diff --git a/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/CHANGELOG.md b/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/CHANGELOG.md index cd0dcc3d4d66..c9ca0a9976da 100644 --- a/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/CHANGELOG.md +++ b/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/CHANGELOG.md @@ -10,6 +10,8 @@ ### Other Changes +Migrated to TypeSpec-based code generation. + ## 1.1.1 (2024-12-24) ### Features Added diff --git a/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/api/Azure.ResourceManager.DevTestLabs.net10.0.cs b/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/api/Azure.ResourceManager.DevTestLabs.net10.0.cs index d598d5b1b1b4..3fa28f3e72e7 100644 --- a/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/api/Azure.ResourceManager.DevTestLabs.net10.0.cs +++ b/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/api/Azure.ResourceManager.DevTestLabs.net10.0.cs @@ -32,7 +32,10 @@ public DevTestLabArmTemplateData(Azure.Core.AzureLocation location) { } public bool? IsEnabled { get { throw null; } } public System.Collections.Generic.IReadOnlyList ParametersValueFilesInfo { get { throw null; } } public string Publisher { get { throw null; } } + protected virtual Azure.ResourceManager.Models.ResourceData JsonModelCreateCore(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } protected override void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + protected virtual Azure.ResourceManager.Models.ResourceData PersistableModelCreateCore(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + protected virtual System.BinaryData PersistableModelWriteCore(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } Azure.ResourceManager.DevTestLabs.DevTestLabArmTemplateData System.ClientModel.Primitives.IJsonModel.Create(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } void System.ClientModel.Primitives.IJsonModel.Write(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } Azure.ResourceManager.DevTestLabs.DevTestLabArmTemplateData System.ClientModel.Primitives.IPersistableModel.Create(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } @@ -80,7 +83,10 @@ public DevTestLabArtifactData(Azure.Core.AzureLocation location) { } public string Publisher { get { throw null; } } public string TargetOSType { get { throw null; } } public string Title { get { throw null; } } + protected virtual Azure.ResourceManager.Models.ResourceData JsonModelCreateCore(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } protected override void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + protected virtual Azure.ResourceManager.Models.ResourceData PersistableModelCreateCore(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + protected virtual System.BinaryData PersistableModelWriteCore(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } Azure.ResourceManager.DevTestLabs.DevTestLabArtifactData System.ClientModel.Primitives.IJsonModel.Create(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } void System.ClientModel.Primitives.IJsonModel.Write(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } Azure.ResourceManager.DevTestLabs.DevTestLabArtifactData System.ClientModel.Primitives.IPersistableModel.Create(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } @@ -135,7 +141,10 @@ public DevTestLabArtifactSourceData(Azure.Core.AzureLocation location) { } public Azure.ResourceManager.DevTestLabs.Models.DevTestLabEnableStatus? Status { get { throw null; } set { } } public System.Guid? UniqueIdentifier { get { throw null; } } public System.Uri Uri { get { throw null; } set { } } + protected virtual Azure.ResourceManager.Models.ResourceData JsonModelCreateCore(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } protected override void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + protected virtual Azure.ResourceManager.Models.ResourceData PersistableModelCreateCore(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + protected virtual System.BinaryData PersistableModelWriteCore(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } Azure.ResourceManager.DevTestLabs.DevTestLabArtifactSourceData System.ClientModel.Primitives.IJsonModel.Create(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } void System.ClientModel.Primitives.IJsonModel.Write(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } Azure.ResourceManager.DevTestLabs.DevTestLabArtifactSourceData System.ClientModel.Primitives.IPersistableModel.Create(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } @@ -215,7 +224,10 @@ public DevTestLabCostData(Azure.Core.AzureLocation location) { } public System.DateTimeOffset? StartOn { get { throw null; } set { } } public Azure.ResourceManager.DevTestLabs.Models.DevTestLabTargetCost TargetCost { get { throw null; } set { } } public System.Guid? UniqueIdentifier { get { throw null; } } + protected virtual Azure.ResourceManager.Models.ResourceData JsonModelCreateCore(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } protected override void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + protected virtual Azure.ResourceManager.Models.ResourceData PersistableModelCreateCore(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + protected virtual System.BinaryData PersistableModelWriteCore(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } Azure.ResourceManager.DevTestLabs.DevTestLabCostData System.ClientModel.Primitives.IJsonModel.Create(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } void System.ClientModel.Primitives.IJsonModel.Write(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } Azure.ResourceManager.DevTestLabs.DevTestLabCostData System.ClientModel.Primitives.IPersistableModel.Create(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } @@ -277,7 +289,10 @@ public DevTestLabCustomImageData(Azure.Core.AzureLocation location) { } public System.Guid? UniqueIdentifier { get { throw null; } } public Azure.ResourceManager.DevTestLabs.Models.DevTestLabCustomImageVhd Vhd { get { throw null; } set { } } public Azure.ResourceManager.DevTestLabs.Models.DevTestLabCustomImageVm Vm { get { throw null; } set { } } + protected virtual Azure.ResourceManager.Models.ResourceData JsonModelCreateCore(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } protected override void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + protected virtual Azure.ResourceManager.Models.ResourceData PersistableModelCreateCore(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + protected virtual System.BinaryData PersistableModelWriteCore(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } Azure.ResourceManager.DevTestLabs.DevTestLabCustomImageData System.ClientModel.Primitives.IJsonModel.Create(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } void System.ClientModel.Primitives.IJsonModel.Write(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } Azure.ResourceManager.DevTestLabs.DevTestLabCustomImageData System.ClientModel.Primitives.IPersistableModel.Create(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } @@ -332,7 +347,10 @@ public DevTestLabData(Azure.Core.AzureLocation location) { } public System.Guid? UniqueIdentifier { get { throw null; } } public string VaultName { get { throw null; } } public string VmCreationResourceGroup { get { throw null; } } + protected virtual Azure.ResourceManager.Models.ResourceData JsonModelCreateCore(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } protected override void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + protected virtual Azure.ResourceManager.Models.ResourceData PersistableModelCreateCore(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + protected virtual System.BinaryData PersistableModelWriteCore(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } Azure.ResourceManager.DevTestLabs.DevTestLabData System.ClientModel.Primitives.IJsonModel.Create(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } void System.ClientModel.Primitives.IJsonModel.Write(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } Azure.ResourceManager.DevTestLabs.DevTestLabData System.ClientModel.Primitives.IPersistableModel.Create(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } @@ -370,7 +388,10 @@ public DevTestLabDiskData(Azure.Core.AzureLocation location) { } public string ProvisioningState { get { throw null; } } public string StorageAccountId { get { throw null; } set { } } public System.Guid? UniqueIdentifier { get { throw null; } } + protected virtual Azure.ResourceManager.Models.ResourceData JsonModelCreateCore(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } protected override void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + protected virtual Azure.ResourceManager.Models.ResourceData PersistableModelCreateCore(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + protected virtual System.BinaryData PersistableModelWriteCore(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } Azure.ResourceManager.DevTestLabs.DevTestLabDiskData System.ClientModel.Primitives.IJsonModel.Create(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } void System.ClientModel.Primitives.IJsonModel.Write(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } Azure.ResourceManager.DevTestLabs.DevTestLabDiskData System.ClientModel.Primitives.IPersistableModel.Create(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } @@ -432,7 +453,10 @@ public DevTestLabEnvironmentData(Azure.Core.AzureLocation location) { } public string ProvisioningState { get { throw null; } } public string ResourceGroupId { get { throw null; } } public System.Guid? UniqueIdentifier { get { throw null; } } + protected virtual Azure.ResourceManager.Models.ResourceData JsonModelCreateCore(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } protected override void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + protected virtual Azure.ResourceManager.Models.ResourceData PersistableModelCreateCore(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + protected virtual System.BinaryData PersistableModelWriteCore(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } Azure.ResourceManager.DevTestLabs.DevTestLabEnvironmentData System.ClientModel.Primitives.IJsonModel.Create(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } void System.ClientModel.Primitives.IJsonModel.Write(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } Azure.ResourceManager.DevTestLabs.DevTestLabEnvironmentData System.ClientModel.Primitives.IPersistableModel.Create(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } @@ -492,7 +516,10 @@ public DevTestLabFormulaData(Azure.Core.AzureLocation location) { } public string OSType { get { throw null; } set { } } public string ProvisioningState { get { throw null; } } public System.Guid? UniqueIdentifier { get { throw null; } } + protected virtual Azure.ResourceManager.Models.ResourceData JsonModelCreateCore(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } protected override void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + protected virtual Azure.ResourceManager.Models.ResourceData PersistableModelCreateCore(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + protected virtual System.BinaryData PersistableModelWriteCore(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } Azure.ResourceManager.DevTestLabs.DevTestLabFormulaData System.ClientModel.Primitives.IJsonModel.Create(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } void System.ClientModel.Primitives.IJsonModel.Write(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } Azure.ResourceManager.DevTestLabs.DevTestLabFormulaData System.ClientModel.Primitives.IPersistableModel.Create(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } @@ -598,7 +625,10 @@ public DevTestLabNotificationChannelData(Azure.Core.AzureLocation location) { } public string ProvisioningState { get { throw null; } } public System.Guid? UniqueIdentifier { get { throw null; } } public System.Uri WebHookUri { get { throw null; } set { } } + protected virtual Azure.ResourceManager.Models.ResourceData JsonModelCreateCore(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } protected override void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + protected virtual Azure.ResourceManager.Models.ResourceData PersistableModelCreateCore(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + protected virtual System.BinaryData PersistableModelWriteCore(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } Azure.ResourceManager.DevTestLabs.DevTestLabNotificationChannelData System.ClientModel.Primitives.IJsonModel.Create(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } void System.ClientModel.Primitives.IJsonModel.Write(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } Azure.ResourceManager.DevTestLabs.DevTestLabNotificationChannelData System.ClientModel.Primitives.IPersistableModel.Create(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } @@ -661,7 +691,10 @@ public DevTestLabPolicyData(Azure.Core.AzureLocation location) { } public Azure.ResourceManager.DevTestLabs.Models.DevTestLabPolicyStatus? Status { get { throw null; } set { } } public string Threshold { get { throw null; } set { } } public System.Guid? UniqueIdentifier { get { throw null; } } + protected virtual Azure.ResourceManager.Models.ResourceData JsonModelCreateCore(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } protected override void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + protected virtual Azure.ResourceManager.Models.ResourceData PersistableModelCreateCore(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + protected virtual System.BinaryData PersistableModelWriteCore(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } Azure.ResourceManager.DevTestLabs.DevTestLabPolicyData System.ClientModel.Primitives.IJsonModel.Create(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } void System.ClientModel.Primitives.IJsonModel.Write(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } Azure.ResourceManager.DevTestLabs.DevTestLabPolicyData System.ClientModel.Primitives.IPersistableModel.Create(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } @@ -743,6 +776,8 @@ protected DevTestLabResource() { } public virtual Azure.Response GetDevTestLabUser(string name, string expand = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } public virtual System.Threading.Tasks.Task> GetDevTestLabUserAsync(string name, string expand = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } public virtual Azure.ResourceManager.DevTestLabs.DevTestLabUserCollection GetDevTestLabUsers() { throw null; } + public virtual Azure.Pageable GetDevTestLabVhds(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.AsyncPageable GetDevTestLabVhdsAsync(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } public virtual Azure.Response GetDevTestLabVirtualNetwork(string name, string expand = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } public virtual System.Threading.Tasks.Task> GetDevTestLabVirtualNetworkAsync(string name, string expand = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } public virtual Azure.ResourceManager.DevTestLabs.DevTestLabVirtualNetworkCollection GetDevTestLabVirtualNetworks() { throw null; } @@ -751,7 +786,9 @@ protected DevTestLabResource() { } public virtual Azure.ResourceManager.DevTestLabs.DevTestLabVmCollection GetDevTestLabVms() { throw null; } public virtual Azure.Pageable GetGalleryImages(string expand = null, string filter = null, int? top = default(int?), string orderby = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } public virtual Azure.AsyncPageable GetGalleryImagesAsync(string expand = null, string filter = null, int? top = default(int?), string orderby = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + [System.ObsoleteAttribute("This operation is not supported. Please use the method GetDevTestLabVhds instead.", false)] public virtual Azure.Pageable GetVhds(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + [System.ObsoleteAttribute("This operation is not supported. Please use the method GetDevTestLabVhdsAsync instead.", false)] public virtual Azure.AsyncPageable GetVhdsAsync(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } public virtual Azure.ResourceManager.ArmOperation ImportVm(Azure.WaitUntil waitUntil, Azure.ResourceManager.DevTestLabs.Models.DevTestLabImportVmContent content, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } public virtual System.Threading.Tasks.Task ImportVmAsync(Azure.WaitUntil waitUntil, Azure.ResourceManager.DevTestLabs.Models.DevTestLabImportVmContent content, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } @@ -800,7 +837,10 @@ public DevTestLabScheduleData(Azure.Core.AzureLocation location) { } public string TimeZoneId { get { throw null; } set { } } public System.Guid? UniqueIdentifier { get { throw null; } } public Azure.ResourceManager.DevTestLabs.Models.DevTestLabWeekDetails WeeklyRecurrence { get { throw null; } set { } } + protected virtual Azure.ResourceManager.Models.ResourceData JsonModelCreateCore(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } protected override void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + protected virtual Azure.ResourceManager.Models.ResourceData PersistableModelCreateCore(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + protected virtual System.BinaryData PersistableModelWriteCore(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } Azure.ResourceManager.DevTestLabs.DevTestLabScheduleData System.ClientModel.Primitives.IJsonModel.Create(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } void System.ClientModel.Primitives.IJsonModel.Write(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } Azure.ResourceManager.DevTestLabs.DevTestLabScheduleData System.ClientModel.Primitives.IPersistableModel.Create(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } @@ -821,6 +861,8 @@ protected DevTestLabScheduleResource() { } public virtual Azure.ResourceManager.ArmOperation Execute(Azure.WaitUntil waitUntil, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } public virtual System.Threading.Tasks.Task ExecuteAsync(Azure.WaitUntil waitUntil, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } public virtual Azure.Response Get(string expand = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Pageable GetApplicable(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.AsyncPageable GetApplicableAsync(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } public virtual System.Threading.Tasks.Task> GetAsync(string expand = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } public virtual Azure.Response RemoveTag(string key, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } public virtual System.Threading.Tasks.Task> RemoveTagAsync(string key, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } @@ -857,7 +899,10 @@ public DevTestLabSecretData(Azure.Core.AzureLocation location) { } public string ProvisioningState { get { throw null; } } public System.Guid? UniqueIdentifier { get { throw null; } } public string Value { get { throw null; } set { } } + protected virtual Azure.ResourceManager.Models.ResourceData JsonModelCreateCore(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } protected override void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + protected virtual Azure.ResourceManager.Models.ResourceData PersistableModelCreateCore(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + protected virtual System.BinaryData PersistableModelWriteCore(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } Azure.ResourceManager.DevTestLabs.DevTestLabSecretData System.ClientModel.Primitives.IJsonModel.Create(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } void System.ClientModel.Primitives.IJsonModel.Write(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } Azure.ResourceManager.DevTestLabs.DevTestLabSecretData System.ClientModel.Primitives.IPersistableModel.Create(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } @@ -914,7 +959,10 @@ public DevTestLabServiceFabricData(Azure.Core.AzureLocation location) { } public string ExternalServiceFabricId { get { throw null; } set { } } public string ProvisioningState { get { throw null; } } public System.Guid? UniqueIdentifier { get { throw null; } } + protected virtual Azure.ResourceManager.Models.ResourceData JsonModelCreateCore(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } protected override void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + protected virtual Azure.ResourceManager.Models.ResourceData PersistableModelCreateCore(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + protected virtual System.BinaryData PersistableModelWriteCore(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } Azure.ResourceManager.DevTestLabs.DevTestLabServiceFabricData System.ClientModel.Primitives.IJsonModel.Create(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } void System.ClientModel.Primitives.IJsonModel.Write(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } Azure.ResourceManager.DevTestLabs.DevTestLabServiceFabricData System.ClientModel.Primitives.IPersistableModel.Create(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } @@ -1015,7 +1063,10 @@ public partial class DevTestLabServiceRunnerData : Azure.ResourceManager.Models. { public DevTestLabServiceRunnerData(Azure.Core.AzureLocation location) { } public Azure.ResourceManager.DevTestLabs.Models.DevTestLabManagedIdentity Identity { get { throw null; } set { } } + protected virtual Azure.ResourceManager.Models.ResourceData JsonModelCreateCore(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } protected override void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + protected virtual Azure.ResourceManager.Models.ResourceData PersistableModelCreateCore(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + protected virtual System.BinaryData PersistableModelWriteCore(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } Azure.ResourceManager.DevTestLabs.DevTestLabServiceRunnerData System.ClientModel.Primitives.IJsonModel.Create(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } void System.ClientModel.Primitives.IJsonModel.Write(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } Azure.ResourceManager.DevTestLabs.DevTestLabServiceRunnerData System.ClientModel.Primitives.IPersistableModel.Create(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } @@ -1106,7 +1157,10 @@ public DevTestLabUserData(Azure.Core.AzureLocation location) { } public string ProvisioningState { get { throw null; } } public Azure.ResourceManager.DevTestLabs.Models.DevTestLabUserSecretStore SecretStore { get { throw null; } set { } } public System.Guid? UniqueIdentifier { get { throw null; } } + protected virtual Azure.ResourceManager.Models.ResourceData JsonModelCreateCore(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } protected override void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + protected virtual Azure.ResourceManager.Models.ResourceData PersistableModelCreateCore(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + protected virtual System.BinaryData PersistableModelWriteCore(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } Azure.ResourceManager.DevTestLabs.DevTestLabUserData System.ClientModel.Primitives.IJsonModel.Create(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } void System.ClientModel.Primitives.IJsonModel.Write(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } Azure.ResourceManager.DevTestLabs.DevTestLabUserData System.ClientModel.Primitives.IPersistableModel.Create(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } @@ -1178,7 +1232,10 @@ public DevTestLabVirtualNetworkData(Azure.Core.AzureLocation location) { } public string ProvisioningState { get { throw null; } } public System.Collections.Generic.IList SubnetOverrides { get { throw null; } } public System.Guid? UniqueIdentifier { get { throw null; } } + protected virtual Azure.ResourceManager.Models.ResourceData JsonModelCreateCore(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } protected override void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + protected virtual Azure.ResourceManager.Models.ResourceData PersistableModelCreateCore(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + protected virtual System.BinaryData PersistableModelWriteCore(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } Azure.ResourceManager.DevTestLabs.DevTestLabVirtualNetworkData System.ClientModel.Primitives.IJsonModel.Create(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } void System.ClientModel.Primitives.IJsonModel.Write(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } Azure.ResourceManager.DevTestLabs.DevTestLabVirtualNetworkData System.ClientModel.Primitives.IPersistableModel.Create(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } @@ -1265,7 +1322,10 @@ public DevTestLabVmData(Azure.Core.AzureLocation location) { } public System.Guid? UniqueIdentifier { get { throw null; } } public string UserName { get { throw null; } set { } } public Azure.ResourceManager.DevTestLabs.Models.DevTestLabVmCreationSource? VmCreationSource { get { throw null; } } + protected virtual Azure.ResourceManager.Models.ResourceData JsonModelCreateCore(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } protected override void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + protected virtual Azure.ResourceManager.Models.ResourceData PersistableModelCreateCore(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + protected virtual System.BinaryData PersistableModelWriteCore(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } Azure.ResourceManager.DevTestLabs.DevTestLabVmData System.ClientModel.Primitives.IJsonModel.Create(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } void System.ClientModel.Primitives.IJsonModel.Write(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } Azure.ResourceManager.DevTestLabs.DevTestLabVmData System.ClientModel.Primitives.IPersistableModel.Create(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } @@ -1430,33 +1490,57 @@ public static partial class ArmDevTestLabsModelFactory public static Azure.ResourceManager.DevTestLabs.Models.DevTestLabArmTemplateInfo DevTestLabArmTemplateInfo(System.BinaryData template = null, System.BinaryData parameters = null) { throw null; } public static Azure.ResourceManager.DevTestLabs.DevTestLabArtifactData DevTestLabArtifactData(Azure.Core.ResourceIdentifier id = null, string name = null, Azure.Core.ResourceType resourceType = default(Azure.Core.ResourceType), Azure.ResourceManager.Models.SystemData systemData = null, System.Collections.Generic.IDictionary tags = null, Azure.Core.AzureLocation location = default(Azure.Core.AzureLocation), string title = null, string description = null, string publisher = null, string filePath = null, string icon = null, string targetOSType = null, System.BinaryData parameters = null, System.DateTimeOffset? createdOn = default(System.DateTimeOffset?)) { throw null; } public static Azure.ResourceManager.DevTestLabs.Models.DevTestLabArtifactDeploymentStatus DevTestLabArtifactDeploymentStatus(string deploymentStatus = null, int? artifactsApplied = default(int?), int? totalArtifacts = default(int?)) { throw null; } + public static Azure.ResourceManager.DevTestLabs.Models.DevTestLabArtifactGenerateArmTemplateContent DevTestLabArtifactGenerateArmTemplateContent(string vmName = null, System.Collections.Generic.IEnumerable parameters = null, Azure.Core.AzureLocation? location = default(Azure.Core.AzureLocation?), Azure.ResourceManager.DevTestLabs.Models.DevTestLabFileUploadOption? fileUploadOptions = default(Azure.ResourceManager.DevTestLabs.Models.DevTestLabFileUploadOption?)) { throw null; } + public static Azure.ResourceManager.DevTestLabs.Models.DevTestLabArtifactInstallInfo DevTestLabArtifactInstallInfo(string artifactId = null, string artifactTitle = null, System.Collections.Generic.IEnumerable parameters = null, string status = null, string deploymentStatusMessage = null, string vmExtensionStatusMessage = null, System.DateTimeOffset? installOn = default(System.DateTimeOffset?)) { throw null; } public static Azure.ResourceManager.DevTestLabs.DevTestLabArtifactSourceData DevTestLabArtifactSourceData(Azure.Core.ResourceIdentifier id = null, string name = null, Azure.Core.ResourceType resourceType = default(Azure.Core.ResourceType), Azure.ResourceManager.Models.SystemData systemData = null, System.Collections.Generic.IDictionary tags = null, Azure.Core.AzureLocation location = default(Azure.Core.AzureLocation), string displayName = null, System.Uri uri = null, Azure.ResourceManager.DevTestLabs.Models.DevTestLabSourceControlType? sourceType = default(Azure.ResourceManager.DevTestLabs.Models.DevTestLabSourceControlType?), string folderPath = null, string armTemplateFolderPath = null, string branchRef = null, string securityToken = null, Azure.ResourceManager.DevTestLabs.Models.DevTestLabEnableStatus? status = default(Azure.ResourceManager.DevTestLabs.Models.DevTestLabEnableStatus?), System.DateTimeOffset? createdOn = default(System.DateTimeOffset?), string provisioningState = null, System.Guid? uniqueIdentifier = default(System.Guid?)) { throw null; } + public static Azure.ResourceManager.DevTestLabs.Models.DevTestLabArtifactSourcePatch DevTestLabArtifactSourcePatch(System.Collections.Generic.IDictionary tags = null) { throw null; } public static Azure.ResourceManager.DevTestLabs.DevTestLabCostData DevTestLabCostData(Azure.Core.ResourceIdentifier id = null, string name = null, Azure.Core.ResourceType resourceType = default(Azure.Core.ResourceType), Azure.ResourceManager.Models.SystemData systemData = null, System.Collections.Generic.IDictionary tags = null, Azure.Core.AzureLocation location = default(Azure.Core.AzureLocation), Azure.ResourceManager.DevTestLabs.Models.DevTestLabTargetCost targetCost = null, double? estimatedLabCost = default(double?), System.Collections.Generic.IEnumerable labCostDetails = null, System.Collections.Generic.IEnumerable resourceCosts = null, string currencyCode = null, System.DateTimeOffset? startOn = default(System.DateTimeOffset?), System.DateTimeOffset? endOn = default(System.DateTimeOffset?), System.DateTimeOffset? createdOn = default(System.DateTimeOffset?), string provisioningState = null, System.Guid? uniqueIdentifier = default(System.Guid?)) { throw null; } public static Azure.ResourceManager.DevTestLabs.Models.DevTestLabCostDetails DevTestLabCostDetails(System.DateTimeOffset? on = default(System.DateTimeOffset?), double? cost = default(double?), Azure.ResourceManager.DevTestLabs.Models.DevTestLabCostType? costType = default(Azure.ResourceManager.DevTestLabs.Models.DevTestLabCostType?)) { throw null; } public static Azure.ResourceManager.DevTestLabs.DevTestLabCustomImageData DevTestLabCustomImageData(Azure.Core.ResourceIdentifier id = null, string name = null, Azure.Core.ResourceType resourceType = default(Azure.Core.ResourceType), Azure.ResourceManager.Models.SystemData systemData = null, System.Collections.Generic.IDictionary tags = null, Azure.Core.AzureLocation location = default(Azure.Core.AzureLocation), Azure.ResourceManager.DevTestLabs.Models.DevTestLabCustomImageVm vm = null, Azure.ResourceManager.DevTestLabs.Models.DevTestLabCustomImageVhd vhd = null, string description = null, string author = null, System.DateTimeOffset? createdOn = default(System.DateTimeOffset?), string managedImageId = null, string managedSnapshotId = null, System.Collections.Generic.IEnumerable dataDiskStorageInfo = null, Azure.ResourceManager.DevTestLabs.Models.DevTestLabCustomImagePlan customImagePlan = null, bool? isPlanAuthorized = default(bool?), string provisioningState = null, System.Guid? uniqueIdentifier = default(System.Guid?)) { throw null; } + public static Azure.ResourceManager.DevTestLabs.Models.DevTestLabCustomImagePatch DevTestLabCustomImagePatch(System.Collections.Generic.IDictionary tags = null) { throw null; } public static Azure.ResourceManager.DevTestLabs.DevTestLabData DevTestLabData(Azure.Core.ResourceIdentifier id = null, string name = null, Azure.Core.ResourceType resourceType = default(Azure.Core.ResourceType), Azure.ResourceManager.Models.SystemData systemData = null, System.Collections.Generic.IDictionary tags = null, Azure.Core.AzureLocation location = default(Azure.Core.AzureLocation), string defaultStorageAccount = null, string defaultPremiumStorageAccount = null, string artifactsStorageAccount = null, string premiumDataDiskStorageAccount = null, string vaultName = null, Azure.ResourceManager.DevTestLabs.Models.DevTestLabStorageType? labStorageType = default(Azure.ResourceManager.DevTestLabs.Models.DevTestLabStorageType?), System.Collections.Generic.IEnumerable mandatoryArtifactsResourceIdsLinux = null, System.Collections.Generic.IEnumerable mandatoryArtifactsResourceIdsWindows = null, System.DateTimeOffset? createdOn = default(System.DateTimeOffset?), Azure.ResourceManager.DevTestLabs.Models.DevTestLabPremiumDataDisk? premiumDataDisks = default(Azure.ResourceManager.DevTestLabs.Models.DevTestLabPremiumDataDisk?), Azure.ResourceManager.DevTestLabs.Models.DevTestLabEnvironmentPermission? environmentPermission = default(Azure.ResourceManager.DevTestLabs.Models.DevTestLabEnvironmentPermission?), Azure.ResourceManager.DevTestLabs.Models.DevTestLabAnnouncement announcement = null, Azure.ResourceManager.DevTestLabs.Models.DevTestLabSupport support = null, string vmCreationResourceGroup = null, string publicIPId = null, string loadBalancerId = null, string networkSecurityGroupId = null, System.Collections.Generic.IDictionary extendedProperties = null, string provisioningState = null, System.Guid? uniqueIdentifier = default(System.Guid?)) { throw null; } public static Azure.ResourceManager.DevTestLabs.DevTestLabDiskData DevTestLabDiskData(Azure.Core.ResourceIdentifier id = null, string name = null, Azure.Core.ResourceType resourceType = default(Azure.Core.ResourceType), Azure.ResourceManager.Models.SystemData systemData = null, System.Collections.Generic.IDictionary tags = null, Azure.Core.AzureLocation location = default(Azure.Core.AzureLocation), Azure.ResourceManager.DevTestLabs.Models.DevTestLabStorageType? diskType = default(Azure.ResourceManager.DevTestLabs.Models.DevTestLabStorageType?), int? diskSizeGiB = default(int?), Azure.Core.ResourceIdentifier leasedByLabVmId = null, string diskBlobName = null, System.Uri diskUri = null, string storageAccountId = null, System.DateTimeOffset? createdOn = default(System.DateTimeOffset?), string hostCaching = null, Azure.Core.ResourceIdentifier managedDiskId = null, string provisioningState = null, System.Guid? uniqueIdentifier = default(System.Guid?)) { throw null; } + public static Azure.ResourceManager.DevTestLabs.Models.DevTestLabDiskPatch DevTestLabDiskPatch(System.Collections.Generic.IDictionary tags = null) { throw null; } public static Azure.ResourceManager.DevTestLabs.DevTestLabEnvironmentData DevTestLabEnvironmentData(Azure.Core.ResourceIdentifier id = null, string name = null, Azure.Core.ResourceType resourceType = default(Azure.Core.ResourceType), Azure.ResourceManager.Models.SystemData systemData = null, System.Collections.Generic.IDictionary tags = null, Azure.Core.AzureLocation location = default(Azure.Core.AzureLocation), Azure.ResourceManager.DevTestLabs.Models.DevTestLabEnvironmentDeployment deploymentProperties = null, string armTemplateDisplayName = null, string resourceGroupId = null, string createdByUser = null, string provisioningState = null, System.Guid? uniqueIdentifier = default(System.Guid?)) { throw null; } + public static Azure.ResourceManager.DevTestLabs.Models.DevTestLabEnvironmentDeployment DevTestLabEnvironmentDeployment(Azure.Core.ResourceIdentifier armTemplateId = null, System.Collections.Generic.IEnumerable parameters = null) { throw null; } + public static Azure.ResourceManager.DevTestLabs.Models.DevTestLabEnvironmentPatch DevTestLabEnvironmentPatch(System.Collections.Generic.IDictionary tags = null) { throw null; } + public static Azure.ResourceManager.DevTestLabs.Models.DevTestLabEvaluatePoliciesContent DevTestLabEvaluatePoliciesContent(System.Collections.Generic.IEnumerable policies = null) { throw null; } public static Azure.ResourceManager.DevTestLabs.Models.DevTestLabEvaluatePoliciesResult DevTestLabEvaluatePoliciesResult(System.Collections.Generic.IEnumerable results = null) { throw null; } public static Azure.ResourceManager.DevTestLabs.Models.DevTestLabExternalSubnet DevTestLabExternalSubnet(Azure.Core.ResourceIdentifier id = null, string name = null) { throw null; } public static Azure.ResourceManager.DevTestLabs.DevTestLabFormulaData DevTestLabFormulaData(Azure.Core.ResourceIdentifier id = null, string name = null, Azure.Core.ResourceType resourceType = default(Azure.Core.ResourceType), Azure.ResourceManager.Models.SystemData systemData = null, System.Collections.Generic.IDictionary tags = null, Azure.Core.AzureLocation location = default(Azure.Core.AzureLocation), string description = null, string author = null, string osType = null, System.DateTimeOffset? createdOn = default(System.DateTimeOffset?), Azure.ResourceManager.DevTestLabs.Models.DevTestLabVmCreationContent formulaContent = null, string labVmId = null, string provisioningState = null, System.Guid? uniqueIdentifier = default(System.Guid?)) { throw null; } + public static Azure.ResourceManager.DevTestLabs.Models.DevTestLabFormulaPatch DevTestLabFormulaPatch(System.Collections.Generic.IDictionary tags = null) { throw null; } public static Azure.ResourceManager.DevTestLabs.Models.DevTestLabGalleryImage DevTestLabGalleryImage(Azure.Core.ResourceIdentifier id = null, string name = null, Azure.Core.ResourceType resourceType = default(Azure.Core.ResourceType), Azure.ResourceManager.Models.SystemData systemData = null, System.Collections.Generic.IDictionary tags = null, Azure.Core.AzureLocation location = default(Azure.Core.AzureLocation), string author = null, System.DateTimeOffset? createdOn = default(System.DateTimeOffset?), string description = null, Azure.ResourceManager.DevTestLabs.Models.DevTestLabGalleryImageReference imageReference = null, string icon = null, bool? isEnabled = default(bool?), string planId = null, bool? isPlanAuthorized = default(bool?)) { throw null; } public static Azure.ResourceManager.DevTestLabs.Models.DevTestLabGenerateUploadUriResult DevTestLabGenerateUploadUriResult(System.Uri uploadUri = null) { throw null; } public static Azure.ResourceManager.DevTestLabs.DevTestLabNotificationChannelData DevTestLabNotificationChannelData(Azure.Core.ResourceIdentifier id = null, string name = null, Azure.Core.ResourceType resourceType = default(Azure.Core.ResourceType), Azure.ResourceManager.Models.SystemData systemData = null, System.Collections.Generic.IDictionary tags = null, Azure.Core.AzureLocation location = default(Azure.Core.AzureLocation), System.Uri webHookUri = null, string emailRecipient = null, string notificationLocale = null, string description = null, System.Collections.Generic.IEnumerable events = null, System.DateTimeOffset? createdOn = default(System.DateTimeOffset?), string provisioningState = null, System.Guid? uniqueIdentifier = default(System.Guid?)) { throw null; } + public static Azure.ResourceManager.DevTestLabs.Models.DevTestLabNotificationChannelPatch DevTestLabNotificationChannelPatch(System.Collections.Generic.IDictionary tags = null) { throw null; } public static Azure.ResourceManager.DevTestLabs.Models.DevTestLabParametersValueFileInfo DevTestLabParametersValueFileInfo(string fileName = null, System.BinaryData parametersValueInfo = null) { throw null; } + public static Azure.ResourceManager.DevTestLabs.Models.DevTestLabPatch DevTestLabPatch(System.Collections.Generic.IDictionary tags = null) { throw null; } public static Azure.ResourceManager.DevTestLabs.DevTestLabPolicyData DevTestLabPolicyData(Azure.Core.ResourceIdentifier id = null, string name = null, Azure.Core.ResourceType resourceType = default(Azure.Core.ResourceType), Azure.ResourceManager.Models.SystemData systemData = null, System.Collections.Generic.IDictionary tags = null, Azure.Core.AzureLocation location = default(Azure.Core.AzureLocation), string description = null, Azure.ResourceManager.DevTestLabs.Models.DevTestLabPolicyStatus? status = default(Azure.ResourceManager.DevTestLabs.Models.DevTestLabPolicyStatus?), Azure.ResourceManager.DevTestLabs.Models.DevTestLabPolicyFactName? factName = default(Azure.ResourceManager.DevTestLabs.Models.DevTestLabPolicyFactName?), string factData = null, string threshold = null, Azure.ResourceManager.DevTestLabs.Models.DevTestLabPolicyEvaluatorType? evaluatorType = default(Azure.ResourceManager.DevTestLabs.Models.DevTestLabPolicyEvaluatorType?), System.DateTimeOffset? createdOn = default(System.DateTimeOffset?), string provisioningState = null, System.Guid? uniqueIdentifier = default(System.Guid?)) { throw null; } + public static Azure.ResourceManager.DevTestLabs.Models.DevTestLabPolicyPatch DevTestLabPolicyPatch(System.Collections.Generic.IDictionary tags = null) { throw null; } public static Azure.ResourceManager.DevTestLabs.Models.DevTestLabPolicySetResult DevTestLabPolicySetResult(bool? hasError = default(bool?), System.Collections.Generic.IEnumerable policyViolations = null) { throw null; } public static Azure.ResourceManager.DevTestLabs.Models.DevTestLabPolicyViolation DevTestLabPolicyViolation(string code = null, string message = null) { throw null; } public static Azure.ResourceManager.DevTestLabs.Models.DevTestLabRdpConnection DevTestLabRdpConnection(string contents = null) { throw null; } public static Azure.ResourceManager.DevTestLabs.Models.DevTestLabResourceCost DevTestLabResourceCost(string resourceName = null, string resourceUniqueId = null, double? resourceCost = default(double?), string resourceType = null, string resourceOwner = null, string resourcePricingTier = null, string resourceStatus = null, string resourceId = null, string externalResourceId = null) { throw null; } + public static Azure.ResourceManager.DevTestLabs.Models.DevTestLabResourcePatch DevTestLabResourcePatch(System.Collections.Generic.IDictionary tags = null) { throw null; } public static Azure.ResourceManager.DevTestLabs.Models.DevTestLabScheduleCreationParameter DevTestLabScheduleCreationParameter(string name = null, Azure.Core.AzureLocation? location = default(Azure.Core.AzureLocation?), System.Collections.Generic.IDictionary tags = null, Azure.ResourceManager.DevTestLabs.Models.DevTestLabEnableStatus? status = default(Azure.ResourceManager.DevTestLabs.Models.DevTestLabEnableStatus?), string taskType = null, Azure.ResourceManager.DevTestLabs.Models.DevTestLabWeekDetails weeklyRecurrence = null, string dailyRecurrenceTime = null, int? hourlyRecurrenceMinute = default(int?), string timeZoneId = null, Azure.ResourceManager.DevTestLabs.Models.DevTestLabNotificationSettings notificationSettings = null, Azure.Core.ResourceIdentifier targetResourceId = null) { throw null; } public static Azure.ResourceManager.DevTestLabs.DevTestLabScheduleData DevTestLabScheduleData(Azure.Core.ResourceIdentifier id = null, string name = null, Azure.Core.ResourceType resourceType = default(Azure.Core.ResourceType), Azure.ResourceManager.Models.SystemData systemData = null, System.Collections.Generic.IDictionary tags = null, Azure.Core.AzureLocation location = default(Azure.Core.AzureLocation), Azure.ResourceManager.DevTestLabs.Models.DevTestLabEnableStatus? status = default(Azure.ResourceManager.DevTestLabs.Models.DevTestLabEnableStatus?), string taskType = null, Azure.ResourceManager.DevTestLabs.Models.DevTestLabWeekDetails weeklyRecurrence = null, string dailyRecurrenceTime = null, int? hourlyRecurrenceMinute = default(int?), string timeZoneId = null, Azure.ResourceManager.DevTestLabs.Models.DevTestLabNotificationSettings notificationSettings = null, System.DateTimeOffset? createdOn = default(System.DateTimeOffset?), string targetResourceId = null, string provisioningState = null, System.Guid? uniqueIdentifier = default(System.Guid?)) { throw null; } + public static Azure.ResourceManager.DevTestLabs.Models.DevTestLabSchedulePatch DevTestLabSchedulePatch(System.Collections.Generic.IDictionary tags = null) { throw null; } public static Azure.ResourceManager.DevTestLabs.DevTestLabSecretData DevTestLabSecretData(Azure.Core.ResourceIdentifier id = null, string name = null, Azure.Core.ResourceType resourceType = default(Azure.Core.ResourceType), Azure.ResourceManager.Models.SystemData systemData = null, System.Collections.Generic.IDictionary tags = null, Azure.Core.AzureLocation location = default(Azure.Core.AzureLocation), string value = null, string provisioningState = null, System.Guid? uniqueIdentifier = default(System.Guid?)) { throw null; } + public static Azure.ResourceManager.DevTestLabs.Models.DevTestLabSecretPatch DevTestLabSecretPatch(System.Collections.Generic.IDictionary tags = null) { throw null; } public static Azure.ResourceManager.DevTestLabs.DevTestLabServiceFabricData DevTestLabServiceFabricData(Azure.Core.ResourceIdentifier id = null, string name = null, Azure.Core.ResourceType resourceType = default(Azure.Core.ResourceType), Azure.ResourceManager.Models.SystemData systemData = null, System.Collections.Generic.IDictionary tags = null, Azure.Core.AzureLocation location = default(Azure.Core.AzureLocation), string externalServiceFabricId = null, string environmentId = null, Azure.ResourceManager.DevTestLabs.Models.DevTestLabApplicableSchedule applicableSchedule = null, string provisioningState = null, System.Guid? uniqueIdentifier = default(System.Guid?)) { throw null; } + public static Azure.ResourceManager.DevTestLabs.Models.DevTestLabServiceFabricPatch DevTestLabServiceFabricPatch(System.Collections.Generic.IDictionary tags = null) { throw null; } public static Azure.ResourceManager.DevTestLabs.DevTestLabServiceRunnerData DevTestLabServiceRunnerData(Azure.Core.ResourceIdentifier id = null, string name = null, Azure.Core.ResourceType resourceType = default(Azure.Core.ResourceType), Azure.ResourceManager.Models.SystemData systemData = null, System.Collections.Generic.IDictionary tags = null, Azure.Core.AzureLocation location = default(Azure.Core.AzureLocation), Azure.ResourceManager.DevTestLabs.Models.DevTestLabManagedIdentity identity = null) { throw null; } + public static Azure.ResourceManager.DevTestLabs.Models.DevTestLabTargetCost DevTestLabTargetCost(Azure.ResourceManager.DevTestLabs.Models.DevTestLabTargetCostStatus? status = default(Azure.ResourceManager.DevTestLabs.Models.DevTestLabTargetCostStatus?), int? target = default(int?), System.Collections.Generic.IEnumerable costThresholds = null, System.DateTimeOffset? cycleStartOn = default(System.DateTimeOffset?), System.DateTimeOffset? cycleEndOn = default(System.DateTimeOffset?), Azure.ResourceManager.DevTestLabs.Models.DevTestLabReportingCycleType? cycleType = default(Azure.ResourceManager.DevTestLabs.Models.DevTestLabReportingCycleType?)) { throw null; } public static Azure.ResourceManager.DevTestLabs.DevTestLabUserData DevTestLabUserData(Azure.Core.ResourceIdentifier id = null, string name = null, Azure.Core.ResourceType resourceType = default(Azure.Core.ResourceType), Azure.ResourceManager.Models.SystemData systemData = null, System.Collections.Generic.IDictionary tags = null, Azure.Core.AzureLocation location = default(Azure.Core.AzureLocation), Azure.ResourceManager.DevTestLabs.Models.DevTestLabUserIdentity identity = null, Azure.ResourceManager.DevTestLabs.Models.DevTestLabUserSecretStore secretStore = null, System.DateTimeOffset? createdOn = default(System.DateTimeOffset?), string provisioningState = null, System.Guid? uniqueIdentifier = default(System.Guid?)) { throw null; } + public static Azure.ResourceManager.DevTestLabs.Models.DevTestLabUserPatch DevTestLabUserPatch(System.Collections.Generic.IDictionary tags = null) { throw null; } + public static Azure.ResourceManager.DevTestLabs.Models.DevTestLabVhd DevTestLabVhd(System.Uri id = null) { throw null; } public static Azure.ResourceManager.DevTestLabs.DevTestLabVirtualNetworkData DevTestLabVirtualNetworkData(Azure.Core.ResourceIdentifier id = null, string name = null, Azure.Core.ResourceType resourceType = default(Azure.Core.ResourceType), Azure.ResourceManager.Models.SystemData systemData = null, System.Collections.Generic.IDictionary tags = null, Azure.Core.AzureLocation location = default(Azure.Core.AzureLocation), System.Collections.Generic.IEnumerable allowedSubnets = null, string description = null, string externalProviderResourceId = null, System.Collections.Generic.IEnumerable externalSubnets = null, System.Collections.Generic.IEnumerable subnetOverrides = null, System.DateTimeOffset? createdOn = default(System.DateTimeOffset?), string provisioningState = null, System.Guid? uniqueIdentifier = default(System.Guid?)) { throw null; } + public static Azure.ResourceManager.DevTestLabs.Models.DevTestLabVirtualNetworkPatch DevTestLabVirtualNetworkPatch(System.Collections.Generic.IDictionary tags = null) { throw null; } + public static Azure.ResourceManager.DevTestLabs.Models.DevTestLabVmApplyArtifactsContent DevTestLabVmApplyArtifactsContent(System.Collections.Generic.IEnumerable artifacts = null) { throw null; } + public static Azure.ResourceManager.DevTestLabs.Models.DevTestLabVmCreationContent DevTestLabVmCreationContent(string notes = null, string ownerObjectId = null, string ownerUserPrincipalName = null, System.DateTimeOffset? createdOn = default(System.DateTimeOffset?), string customImageId = null, string size = null, string userName = null, string password = null, string sshKey = null, bool? isAuthenticationWithSshKey = default(bool?), string labSubnetName = null, Azure.Core.ResourceIdentifier labVirtualNetworkId = null, bool? disallowPublicIPAddress = default(bool?), System.Collections.Generic.IEnumerable artifacts = null, Azure.ResourceManager.DevTestLabs.Models.DevTestLabGalleryImageReference galleryImageReference = null, string planId = null, Azure.ResourceManager.DevTestLabs.Models.DevTestLabNetworkInterface networkInterface = null, System.DateTimeOffset? expireOn = default(System.DateTimeOffset?), bool? allowClaim = default(bool?), string storageType = null, string environmentId = null, System.Collections.Generic.IEnumerable dataDiskParameters = null, System.Collections.Generic.IEnumerable scheduleParameters = null, int? bulkCreationParametersInstanceCount = default(int?), string name = null, Azure.Core.AzureLocation? location = default(Azure.Core.AzureLocation?), System.Collections.Generic.IDictionary tags = null) { throw null; } public static Azure.ResourceManager.DevTestLabs.DevTestLabVmData DevTestLabVmData(Azure.Core.ResourceIdentifier id = null, string name = null, Azure.Core.ResourceType resourceType = default(Azure.Core.ResourceType), Azure.ResourceManager.Models.SystemData systemData = null, System.Collections.Generic.IDictionary tags = null, Azure.Core.AzureLocation location = default(Azure.Core.AzureLocation), string notes = null, string ownerObjectId = null, string ownerUserPrincipalName = null, string createdByUserId = null, string createdByUser = null, System.DateTimeOffset? createdOn = default(System.DateTimeOffset?), Azure.Core.ResourceIdentifier computeId = null, string customImageId = null, string osType = null, string size = null, string userName = null, string password = null, string sshKey = null, bool? isAuthenticationWithSshKey = default(bool?), string fqdn = null, string labSubnetName = null, Azure.Core.ResourceIdentifier labVirtualNetworkId = null, bool? disallowPublicIPAddress = default(bool?), System.Collections.Generic.IEnumerable artifacts = null, Azure.ResourceManager.DevTestLabs.Models.DevTestLabArtifactDeploymentStatus artifactDeploymentStatus = null, Azure.ResourceManager.DevTestLabs.Models.DevTestLabGalleryImageReference galleryImageReference = null, string planId = null, Azure.ResourceManager.DevTestLabs.Models.ComputeVmProperties computeVm = null, Azure.ResourceManager.DevTestLabs.Models.DevTestLabNetworkInterface networkInterface = null, Azure.ResourceManager.DevTestLabs.Models.DevTestLabApplicableSchedule applicableSchedule = null, System.DateTimeOffset? expireOn = default(System.DateTimeOffset?), bool? allowClaim = default(bool?), string storageType = null, Azure.ResourceManager.DevTestLabs.Models.DevTestLabVmCreationSource? vmCreationSource = default(Azure.ResourceManager.DevTestLabs.Models.DevTestLabVmCreationSource?), Azure.Core.ResourceIdentifier environmentId = null, System.Collections.Generic.IEnumerable dataDiskParameters = null, System.Collections.Generic.IEnumerable scheduleParameters = null, string lastKnownPowerState = null, string provisioningState = null, System.Guid? uniqueIdentifier = default(System.Guid?)) { throw null; } + public static Azure.ResourceManager.DevTestLabs.Models.DevTestLabVmPatch DevTestLabVmPatch(System.Collections.Generic.IDictionary tags = null) { throw null; } + public static Azure.ResourceManager.DevTestLabs.Models.DevTestLabWeekDetails DevTestLabWeekDetails(System.Collections.Generic.IEnumerable weekdays = null, string time = null) { throw null; } } public partial class AttachNewDataDiskDetails : System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel { @@ -1464,7 +1548,10 @@ public AttachNewDataDiskDetails() { } public string DiskName { get { throw null; } set { } } public int? DiskSizeGiB { get { throw null; } set { } } public Azure.ResourceManager.DevTestLabs.Models.DevTestLabStorageType? DiskType { get { throw null; } set { } } + protected virtual Azure.ResourceManager.DevTestLabs.Models.AttachNewDataDiskDetails JsonModelCreateCore(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } protected virtual void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + protected virtual Azure.ResourceManager.DevTestLabs.Models.AttachNewDataDiskDetails PersistableModelCreateCore(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + protected virtual System.BinaryData PersistableModelWriteCore(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } Azure.ResourceManager.DevTestLabs.Models.AttachNewDataDiskDetails System.ClientModel.Primitives.IJsonModel.Create(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } void System.ClientModel.Primitives.IJsonModel.Write(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } Azure.ResourceManager.DevTestLabs.Models.AttachNewDataDiskDetails System.ClientModel.Primitives.IPersistableModel.Create(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } @@ -1478,7 +1565,10 @@ internal ComputeDataDisk() { } public System.Uri DiskUri { get { throw null; } } public string ManagedDiskId { get { throw null; } } public string Name { get { throw null; } } + protected virtual Azure.ResourceManager.DevTestLabs.Models.ComputeDataDisk JsonModelCreateCore(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } protected virtual void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + protected virtual Azure.ResourceManager.DevTestLabs.Models.ComputeDataDisk PersistableModelCreateCore(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + protected virtual System.BinaryData PersistableModelWriteCore(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } Azure.ResourceManager.DevTestLabs.Models.ComputeDataDisk System.ClientModel.Primitives.IJsonModel.Create(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } void System.ClientModel.Primitives.IJsonModel.Write(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } Azure.ResourceManager.DevTestLabs.Models.ComputeDataDisk System.ClientModel.Primitives.IPersistableModel.Create(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } @@ -1491,7 +1581,10 @@ internal ComputeVmInstanceViewStatus() { } public string Code { get { throw null; } } public string DisplayStatus { get { throw null; } } public string Message { get { throw null; } } + protected virtual Azure.ResourceManager.DevTestLabs.Models.ComputeVmInstanceViewStatus JsonModelCreateCore(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } protected virtual void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + protected virtual Azure.ResourceManager.DevTestLabs.Models.ComputeVmInstanceViewStatus PersistableModelCreateCore(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + protected virtual System.BinaryData PersistableModelWriteCore(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } Azure.ResourceManager.DevTestLabs.Models.ComputeVmInstanceViewStatus System.ClientModel.Primitives.IJsonModel.Create(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } void System.ClientModel.Primitives.IJsonModel.Write(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } Azure.ResourceManager.DevTestLabs.Models.ComputeVmInstanceViewStatus System.ClientModel.Primitives.IPersistableModel.Create(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } @@ -1508,7 +1601,10 @@ internal ComputeVmProperties() { } public string OSType { get { throw null; } } public System.Collections.Generic.IReadOnlyList Statuses { get { throw null; } } public string VmSize { get { throw null; } } + protected virtual Azure.ResourceManager.DevTestLabs.Models.ComputeVmProperties JsonModelCreateCore(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } protected virtual void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + protected virtual Azure.ResourceManager.DevTestLabs.Models.ComputeVmProperties PersistableModelCreateCore(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + protected virtual System.BinaryData PersistableModelWriteCore(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } Azure.ResourceManager.DevTestLabs.Models.ComputeVmProperties System.ClientModel.Primitives.IJsonModel.Create(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } void System.ClientModel.Primitives.IJsonModel.Write(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } Azure.ResourceManager.DevTestLabs.Models.ComputeVmProperties System.ClientModel.Primitives.IPersistableModel.Create(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } @@ -1525,7 +1621,10 @@ public DevTestLabAnnouncement() { } public string ProvisioningState { get { throw null; } } public string Title { get { throw null; } set { } } public System.Guid? UniqueIdentifier { get { throw null; } } + protected virtual Azure.ResourceManager.DevTestLabs.Models.DevTestLabAnnouncement JsonModelCreateCore(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } protected virtual void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + protected virtual Azure.ResourceManager.DevTestLabs.Models.DevTestLabAnnouncement PersistableModelCreateCore(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + protected virtual System.BinaryData PersistableModelWriteCore(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } Azure.ResourceManager.DevTestLabs.Models.DevTestLabAnnouncement System.ClientModel.Primitives.IJsonModel.Create(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } void System.ClientModel.Primitives.IJsonModel.Write(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } Azure.ResourceManager.DevTestLabs.Models.DevTestLabAnnouncement System.ClientModel.Primitives.IPersistableModel.Create(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } @@ -1537,7 +1636,10 @@ public partial class DevTestLabApplicableSchedule : Azure.ResourceManager.Models public DevTestLabApplicableSchedule(Azure.Core.AzureLocation location) { } public Azure.ResourceManager.DevTestLabs.DevTestLabScheduleData LabVmsShutdown { get { throw null; } set { } } public Azure.ResourceManager.DevTestLabs.DevTestLabScheduleData LabVmsStartup { get { throw null; } set { } } + protected virtual Azure.ResourceManager.Models.ResourceData JsonModelCreateCore(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } protected override void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + protected virtual Azure.ResourceManager.Models.ResourceData PersistableModelCreateCore(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + protected virtual System.BinaryData PersistableModelWriteCore(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } Azure.ResourceManager.DevTestLabs.Models.DevTestLabApplicableSchedule System.ClientModel.Primitives.IJsonModel.Create(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } void System.ClientModel.Primitives.IJsonModel.Write(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } Azure.ResourceManager.DevTestLabs.Models.DevTestLabApplicableSchedule System.ClientModel.Primitives.IPersistableModel.Create(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } @@ -1549,7 +1651,10 @@ public partial class DevTestLabArmTemplateInfo : System.ClientModel.Primitives.I internal DevTestLabArmTemplateInfo() { } public System.BinaryData Parameters { get { throw null; } } public System.BinaryData Template { get { throw null; } } + protected virtual Azure.ResourceManager.DevTestLabs.Models.DevTestLabArmTemplateInfo JsonModelCreateCore(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } protected virtual void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + protected virtual Azure.ResourceManager.DevTestLabs.Models.DevTestLabArmTemplateInfo PersistableModelCreateCore(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + protected virtual System.BinaryData PersistableModelWriteCore(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } Azure.ResourceManager.DevTestLabs.Models.DevTestLabArmTemplateInfo System.ClientModel.Primitives.IJsonModel.Create(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } void System.ClientModel.Primitives.IJsonModel.Write(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } Azure.ResourceManager.DevTestLabs.Models.DevTestLabArmTemplateInfo System.ClientModel.Primitives.IPersistableModel.Create(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } @@ -1561,7 +1666,10 @@ public partial class DevTestLabArmTemplateParameter : System.ClientModel.Primiti public DevTestLabArmTemplateParameter() { } public string Name { get { throw null; } set { } } public string Value { get { throw null; } set { } } + protected virtual Azure.ResourceManager.DevTestLabs.Models.DevTestLabArmTemplateParameter JsonModelCreateCore(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } protected virtual void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + protected virtual Azure.ResourceManager.DevTestLabs.Models.DevTestLabArmTemplateParameter PersistableModelCreateCore(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + protected virtual System.BinaryData PersistableModelWriteCore(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } Azure.ResourceManager.DevTestLabs.Models.DevTestLabArmTemplateParameter System.ClientModel.Primitives.IJsonModel.Create(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } void System.ClientModel.Primitives.IJsonModel.Write(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } Azure.ResourceManager.DevTestLabs.Models.DevTestLabArmTemplateParameter System.ClientModel.Primitives.IPersistableModel.Create(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } @@ -1574,7 +1682,10 @@ internal DevTestLabArtifactDeploymentStatus() { } public int? ArtifactsApplied { get { throw null; } } public string DeploymentStatus { get { throw null; } } public int? TotalArtifacts { get { throw null; } } + protected virtual Azure.ResourceManager.DevTestLabs.Models.DevTestLabArtifactDeploymentStatus JsonModelCreateCore(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } protected virtual void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + protected virtual Azure.ResourceManager.DevTestLabs.Models.DevTestLabArtifactDeploymentStatus PersistableModelCreateCore(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + protected virtual System.BinaryData PersistableModelWriteCore(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } Azure.ResourceManager.DevTestLabs.Models.DevTestLabArtifactDeploymentStatus System.ClientModel.Primitives.IJsonModel.Create(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } void System.ClientModel.Primitives.IJsonModel.Write(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } Azure.ResourceManager.DevTestLabs.Models.DevTestLabArtifactDeploymentStatus System.ClientModel.Primitives.IPersistableModel.Create(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } @@ -1588,7 +1699,10 @@ public DevTestLabArtifactGenerateArmTemplateContent() { } public Azure.Core.AzureLocation? Location { get { throw null; } set { } } public System.Collections.Generic.IList Parameters { get { throw null; } } public string VmName { get { throw null; } set { } } + protected virtual Azure.ResourceManager.DevTestLabs.Models.DevTestLabArtifactGenerateArmTemplateContent JsonModelCreateCore(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } protected virtual void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + protected virtual Azure.ResourceManager.DevTestLabs.Models.DevTestLabArtifactGenerateArmTemplateContent PersistableModelCreateCore(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + protected virtual System.BinaryData PersistableModelWriteCore(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } Azure.ResourceManager.DevTestLabs.Models.DevTestLabArtifactGenerateArmTemplateContent System.ClientModel.Primitives.IJsonModel.Create(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } void System.ClientModel.Primitives.IJsonModel.Write(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } Azure.ResourceManager.DevTestLabs.Models.DevTestLabArtifactGenerateArmTemplateContent System.ClientModel.Primitives.IPersistableModel.Create(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } @@ -1605,7 +1719,10 @@ public DevTestLabArtifactInstallInfo() { } public System.Collections.Generic.IList Parameters { get { throw null; } } public string Status { get { throw null; } set { } } public string VmExtensionStatusMessage { get { throw null; } set { } } + protected virtual Azure.ResourceManager.DevTestLabs.Models.DevTestLabArtifactInstallInfo JsonModelCreateCore(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } protected virtual void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + protected virtual Azure.ResourceManager.DevTestLabs.Models.DevTestLabArtifactInstallInfo PersistableModelCreateCore(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + protected virtual System.BinaryData PersistableModelWriteCore(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } Azure.ResourceManager.DevTestLabs.Models.DevTestLabArtifactInstallInfo System.ClientModel.Primitives.IJsonModel.Create(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } void System.ClientModel.Primitives.IJsonModel.Write(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } Azure.ResourceManager.DevTestLabs.Models.DevTestLabArtifactInstallInfo System.ClientModel.Primitives.IPersistableModel.Create(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } @@ -1617,7 +1734,10 @@ public partial class DevTestLabArtifactParameter : System.ClientModel.Primitives public DevTestLabArtifactParameter() { } public string Name { get { throw null; } set { } } public string Value { get { throw null; } set { } } + protected virtual Azure.ResourceManager.DevTestLabs.Models.DevTestLabArtifactParameter JsonModelCreateCore(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } protected virtual void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + protected virtual Azure.ResourceManager.DevTestLabs.Models.DevTestLabArtifactParameter PersistableModelCreateCore(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + protected virtual System.BinaryData PersistableModelWriteCore(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } Azure.ResourceManager.DevTestLabs.Models.DevTestLabArtifactParameter System.ClientModel.Primitives.IJsonModel.Create(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } void System.ClientModel.Primitives.IJsonModel.Write(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } Azure.ResourceManager.DevTestLabs.Models.DevTestLabArtifactParameter System.ClientModel.Primitives.IPersistableModel.Create(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } @@ -1627,7 +1747,10 @@ protected virtual void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer public partial class DevTestLabArtifactSourcePatch : Azure.ResourceManager.DevTestLabs.Models.DevTestLabResourcePatch, System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel { public DevTestLabArtifactSourcePatch() { } + protected override Azure.ResourceManager.DevTestLabs.Models.DevTestLabResourcePatch JsonModelCreateCore(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } protected override void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + protected override Azure.ResourceManager.DevTestLabs.Models.DevTestLabResourcePatch PersistableModelCreateCore(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + protected override System.BinaryData PersistableModelWriteCore(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } Azure.ResourceManager.DevTestLabs.Models.DevTestLabArtifactSourcePatch System.ClientModel.Primitives.IJsonModel.Create(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } void System.ClientModel.Primitives.IJsonModel.Write(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } Azure.ResourceManager.DevTestLabs.Models.DevTestLabArtifactSourcePatch System.ClientModel.Primitives.IPersistableModel.Create(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } @@ -1640,7 +1763,10 @@ internal DevTestLabCostDetails() { } public double? Cost { get { throw null; } } public Azure.ResourceManager.DevTestLabs.Models.DevTestLabCostType? CostType { get { throw null; } } public System.DateTimeOffset? On { get { throw null; } } + protected virtual Azure.ResourceManager.DevTestLabs.Models.DevTestLabCostDetails JsonModelCreateCore(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } protected virtual void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + protected virtual Azure.ResourceManager.DevTestLabs.Models.DevTestLabCostDetails PersistableModelCreateCore(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + protected virtual System.BinaryData PersistableModelWriteCore(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } Azure.ResourceManager.DevTestLabs.Models.DevTestLabCostDetails System.ClientModel.Primitives.IJsonModel.Create(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } void System.ClientModel.Primitives.IJsonModel.Write(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } Azure.ResourceManager.DevTestLabs.Models.DevTestLabCostDetails System.ClientModel.Primitives.IPersistableModel.Create(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } @@ -1655,7 +1781,10 @@ public DevTestLabCostThreshold() { } public Azure.ResourceManager.DevTestLabs.Models.DevTestLabCostThresholdStatus? SendNotificationWhenExceeded { get { throw null; } set { } } public string ThresholdId { get { throw null; } set { } } public double? ThresholdValue { get { throw null; } set { } } + protected virtual Azure.ResourceManager.DevTestLabs.Models.DevTestLabCostThreshold JsonModelCreateCore(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } protected virtual void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + protected virtual Azure.ResourceManager.DevTestLabs.Models.DevTestLabCostThreshold PersistableModelCreateCore(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + protected virtual System.BinaryData PersistableModelWriteCore(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } Azure.ResourceManager.DevTestLabs.Models.DevTestLabCostThreshold System.ClientModel.Primitives.IJsonModel.Create(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } void System.ClientModel.Primitives.IJsonModel.Write(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } Azure.ResourceManager.DevTestLabs.Models.DevTestLabCostThreshold System.ClientModel.Primitives.IPersistableModel.Create(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } @@ -1675,6 +1804,7 @@ protected virtual void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer public override int GetHashCode() { throw null; } public static bool operator ==(Azure.ResourceManager.DevTestLabs.Models.DevTestLabCostThresholdStatus left, Azure.ResourceManager.DevTestLabs.Models.DevTestLabCostThresholdStatus right) { throw null; } public static implicit operator Azure.ResourceManager.DevTestLabs.Models.DevTestLabCostThresholdStatus (string value) { throw null; } + public static implicit operator Azure.ResourceManager.DevTestLabs.Models.DevTestLabCostThresholdStatus? (string value) { throw null; } public static bool operator !=(Azure.ResourceManager.DevTestLabs.Models.DevTestLabCostThresholdStatus left, Azure.ResourceManager.DevTestLabs.Models.DevTestLabCostThresholdStatus right) { throw null; } public override string ToString() { throw null; } } @@ -1692,6 +1822,7 @@ protected virtual void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer public override int GetHashCode() { throw null; } public static bool operator ==(Azure.ResourceManager.DevTestLabs.Models.DevTestLabCostType left, Azure.ResourceManager.DevTestLabs.Models.DevTestLabCostType right) { throw null; } public static implicit operator Azure.ResourceManager.DevTestLabs.Models.DevTestLabCostType (string value) { throw null; } + public static implicit operator Azure.ResourceManager.DevTestLabs.Models.DevTestLabCostType? (string value) { throw null; } public static bool operator !=(Azure.ResourceManager.DevTestLabs.Models.DevTestLabCostType left, Azure.ResourceManager.DevTestLabs.Models.DevTestLabCostType right) { throw null; } public override string ToString() { throw null; } } @@ -1709,13 +1840,17 @@ protected virtual void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer public override int GetHashCode() { throw null; } public static bool operator ==(Azure.ResourceManager.DevTestLabs.Models.DevTestLabCustomImageOSType left, Azure.ResourceManager.DevTestLabs.Models.DevTestLabCustomImageOSType right) { throw null; } public static implicit operator Azure.ResourceManager.DevTestLabs.Models.DevTestLabCustomImageOSType (string value) { throw null; } + public static implicit operator Azure.ResourceManager.DevTestLabs.Models.DevTestLabCustomImageOSType? (string value) { throw null; } public static bool operator !=(Azure.ResourceManager.DevTestLabs.Models.DevTestLabCustomImageOSType left, Azure.ResourceManager.DevTestLabs.Models.DevTestLabCustomImageOSType right) { throw null; } public override string ToString() { throw null; } } public partial class DevTestLabCustomImagePatch : Azure.ResourceManager.DevTestLabs.Models.DevTestLabResourcePatch, System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel { public DevTestLabCustomImagePatch() { } + protected override Azure.ResourceManager.DevTestLabs.Models.DevTestLabResourcePatch JsonModelCreateCore(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } protected override void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + protected override Azure.ResourceManager.DevTestLabs.Models.DevTestLabResourcePatch PersistableModelCreateCore(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + protected override System.BinaryData PersistableModelWriteCore(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } Azure.ResourceManager.DevTestLabs.Models.DevTestLabCustomImagePatch System.ClientModel.Primitives.IJsonModel.Create(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } void System.ClientModel.Primitives.IJsonModel.Write(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } Azure.ResourceManager.DevTestLabs.Models.DevTestLabCustomImagePatch System.ClientModel.Primitives.IPersistableModel.Create(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } @@ -1728,7 +1863,10 @@ public DevTestLabCustomImagePlan() { } public string Id { get { throw null; } set { } } public string Offer { get { throw null; } set { } } public string Publisher { get { throw null; } set { } } + protected virtual Azure.ResourceManager.DevTestLabs.Models.DevTestLabCustomImagePlan JsonModelCreateCore(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } protected virtual void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + protected virtual Azure.ResourceManager.DevTestLabs.Models.DevTestLabCustomImagePlan PersistableModelCreateCore(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + protected virtual System.BinaryData PersistableModelWriteCore(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } Azure.ResourceManager.DevTestLabs.Models.DevTestLabCustomImagePlan System.ClientModel.Primitives.IJsonModel.Create(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } void System.ClientModel.Primitives.IJsonModel.Write(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } Azure.ResourceManager.DevTestLabs.Models.DevTestLabCustomImagePlan System.ClientModel.Primitives.IPersistableModel.Create(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } @@ -1741,7 +1879,10 @@ public DevTestLabCustomImageVhd(Azure.ResourceManager.DevTestLabs.Models.DevTest public string ImageName { get { throw null; } set { } } public bool? IsSysPrepEnabled { get { throw null; } set { } } public Azure.ResourceManager.DevTestLabs.Models.DevTestLabCustomImageOSType OSType { get { throw null; } set { } } + protected virtual Azure.ResourceManager.DevTestLabs.Models.DevTestLabCustomImageVhd JsonModelCreateCore(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } protected virtual void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + protected virtual Azure.ResourceManager.DevTestLabs.Models.DevTestLabCustomImageVhd PersistableModelCreateCore(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + protected virtual System.BinaryData PersistableModelWriteCore(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } Azure.ResourceManager.DevTestLabs.Models.DevTestLabCustomImageVhd System.ClientModel.Primitives.IJsonModel.Create(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } void System.ClientModel.Primitives.IJsonModel.Write(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } Azure.ResourceManager.DevTestLabs.Models.DevTestLabCustomImageVhd System.ClientModel.Primitives.IPersistableModel.Create(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } @@ -1754,7 +1895,10 @@ public DevTestLabCustomImageVm() { } public Azure.ResourceManager.DevTestLabs.Models.DevTestLabLinuxOSState? LinuxOSState { get { throw null; } set { } } public string SourceVmId { get { throw null; } set { } } public Azure.ResourceManager.DevTestLabs.Models.WindowsOSState? WindowsOSState { get { throw null; } set { } } + protected virtual Azure.ResourceManager.DevTestLabs.Models.DevTestLabCustomImageVm JsonModelCreateCore(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } protected virtual void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + protected virtual Azure.ResourceManager.DevTestLabs.Models.DevTestLabCustomImageVm PersistableModelCreateCore(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + protected virtual System.BinaryData PersistableModelWriteCore(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } Azure.ResourceManager.DevTestLabs.Models.DevTestLabCustomImageVm System.ClientModel.Primitives.IJsonModel.Create(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } void System.ClientModel.Primitives.IJsonModel.Write(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } Azure.ResourceManager.DevTestLabs.Models.DevTestLabCustomImageVm System.ClientModel.Primitives.IPersistableModel.Create(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } @@ -1767,7 +1911,10 @@ public DevTestLabDataDiskProperties() { } public Azure.ResourceManager.DevTestLabs.Models.AttachNewDataDiskDetails AttachNewDataDiskOptions { get { throw null; } set { } } public Azure.Core.ResourceIdentifier ExistingLabDiskId { get { throw null; } set { } } public Azure.ResourceManager.DevTestLabs.Models.DevTestLabHostCachingOption? HostCaching { get { throw null; } set { } } + protected virtual Azure.ResourceManager.DevTestLabs.Models.DevTestLabDataDiskProperties JsonModelCreateCore(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } protected virtual void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + protected virtual Azure.ResourceManager.DevTestLabs.Models.DevTestLabDataDiskProperties PersistableModelCreateCore(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + protected virtual System.BinaryData PersistableModelWriteCore(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } Azure.ResourceManager.DevTestLabs.Models.DevTestLabDataDiskProperties System.ClientModel.Primitives.IJsonModel.Create(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } void System.ClientModel.Primitives.IJsonModel.Write(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } Azure.ResourceManager.DevTestLabs.Models.DevTestLabDataDiskProperties System.ClientModel.Primitives.IPersistableModel.Create(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } @@ -1779,7 +1926,10 @@ public partial class DevTestLabDataDiskStorageTypeInfo : System.ClientModel.Prim public DevTestLabDataDiskStorageTypeInfo() { } public string Lun { get { throw null; } set { } } public Azure.ResourceManager.DevTestLabs.Models.DevTestLabStorageType? StorageType { get { throw null; } set { } } + protected virtual Azure.ResourceManager.DevTestLabs.Models.DevTestLabDataDiskStorageTypeInfo JsonModelCreateCore(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } protected virtual void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + protected virtual Azure.ResourceManager.DevTestLabs.Models.DevTestLabDataDiskStorageTypeInfo PersistableModelCreateCore(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + protected virtual System.BinaryData PersistableModelWriteCore(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } Azure.ResourceManager.DevTestLabs.Models.DevTestLabDataDiskStorageTypeInfo System.ClientModel.Primitives.IJsonModel.Create(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } void System.ClientModel.Primitives.IJsonModel.Write(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } Azure.ResourceManager.DevTestLabs.Models.DevTestLabDataDiskStorageTypeInfo System.ClientModel.Primitives.IPersistableModel.Create(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } @@ -1790,7 +1940,10 @@ public partial class DevTestLabDiskAttachContent : System.ClientModel.Primitives { public DevTestLabDiskAttachContent() { } public Azure.Core.ResourceIdentifier LeasedByLabVmId { get { throw null; } set { } } + protected virtual Azure.ResourceManager.DevTestLabs.Models.DevTestLabDiskAttachContent JsonModelCreateCore(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } protected virtual void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + protected virtual Azure.ResourceManager.DevTestLabs.Models.DevTestLabDiskAttachContent PersistableModelCreateCore(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + protected virtual System.BinaryData PersistableModelWriteCore(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } Azure.ResourceManager.DevTestLabs.Models.DevTestLabDiskAttachContent System.ClientModel.Primitives.IJsonModel.Create(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } void System.ClientModel.Primitives.IJsonModel.Write(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } Azure.ResourceManager.DevTestLabs.Models.DevTestLabDiskAttachContent System.ClientModel.Primitives.IPersistableModel.Create(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } @@ -1801,7 +1954,10 @@ public partial class DevTestLabDiskDetachContent : System.ClientModel.Primitives { public DevTestLabDiskDetachContent() { } public Azure.Core.ResourceIdentifier LeasedByLabVmId { get { throw null; } set { } } + protected virtual Azure.ResourceManager.DevTestLabs.Models.DevTestLabDiskDetachContent JsonModelCreateCore(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } protected virtual void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + protected virtual Azure.ResourceManager.DevTestLabs.Models.DevTestLabDiskDetachContent PersistableModelCreateCore(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + protected virtual System.BinaryData PersistableModelWriteCore(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } Azure.ResourceManager.DevTestLabs.Models.DevTestLabDiskDetachContent System.ClientModel.Primitives.IJsonModel.Create(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } void System.ClientModel.Primitives.IJsonModel.Write(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } Azure.ResourceManager.DevTestLabs.Models.DevTestLabDiskDetachContent System.ClientModel.Primitives.IPersistableModel.Create(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } @@ -1811,7 +1967,10 @@ protected virtual void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer public partial class DevTestLabDiskPatch : Azure.ResourceManager.DevTestLabs.Models.DevTestLabResourcePatch, System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel { public DevTestLabDiskPatch() { } + protected override Azure.ResourceManager.DevTestLabs.Models.DevTestLabResourcePatch JsonModelCreateCore(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } protected override void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + protected override Azure.ResourceManager.DevTestLabs.Models.DevTestLabResourcePatch PersistableModelCreateCore(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + protected override System.BinaryData PersistableModelWriteCore(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } Azure.ResourceManager.DevTestLabs.Models.DevTestLabDiskPatch System.ClientModel.Primitives.IJsonModel.Create(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } void System.ClientModel.Primitives.IJsonModel.Write(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } Azure.ResourceManager.DevTestLabs.Models.DevTestLabDiskPatch System.ClientModel.Primitives.IPersistableModel.Create(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } @@ -1831,6 +1990,7 @@ protected override void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter write public override int GetHashCode() { throw null; } public static bool operator ==(Azure.ResourceManager.DevTestLabs.Models.DevTestLabEnableStatus left, Azure.ResourceManager.DevTestLabs.Models.DevTestLabEnableStatus right) { throw null; } public static implicit operator Azure.ResourceManager.DevTestLabs.Models.DevTestLabEnableStatus (string value) { throw null; } + public static implicit operator Azure.ResourceManager.DevTestLabs.Models.DevTestLabEnableStatus? (string value) { throw null; } public static bool operator !=(Azure.ResourceManager.DevTestLabs.Models.DevTestLabEnableStatus left, Azure.ResourceManager.DevTestLabs.Models.DevTestLabEnableStatus right) { throw null; } public override string ToString() { throw null; } } @@ -1839,7 +1999,10 @@ public partial class DevTestLabEnvironmentDeployment : System.ClientModel.Primit public DevTestLabEnvironmentDeployment() { } public Azure.Core.ResourceIdentifier ArmTemplateId { get { throw null; } set { } } public System.Collections.Generic.IList Parameters { get { throw null; } } + protected virtual Azure.ResourceManager.DevTestLabs.Models.DevTestLabEnvironmentDeployment JsonModelCreateCore(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } protected virtual void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + protected virtual Azure.ResourceManager.DevTestLabs.Models.DevTestLabEnvironmentDeployment PersistableModelCreateCore(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + protected virtual System.BinaryData PersistableModelWriteCore(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } Azure.ResourceManager.DevTestLabs.Models.DevTestLabEnvironmentDeployment System.ClientModel.Primitives.IJsonModel.Create(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } void System.ClientModel.Primitives.IJsonModel.Write(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } Azure.ResourceManager.DevTestLabs.Models.DevTestLabEnvironmentDeployment System.ClientModel.Primitives.IPersistableModel.Create(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } @@ -1849,7 +2012,10 @@ protected virtual void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer public partial class DevTestLabEnvironmentPatch : Azure.ResourceManager.DevTestLabs.Models.DevTestLabResourcePatch, System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel { public DevTestLabEnvironmentPatch() { } + protected override Azure.ResourceManager.DevTestLabs.Models.DevTestLabResourcePatch JsonModelCreateCore(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } protected override void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + protected override Azure.ResourceManager.DevTestLabs.Models.DevTestLabResourcePatch PersistableModelCreateCore(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + protected override System.BinaryData PersistableModelWriteCore(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } Azure.ResourceManager.DevTestLabs.Models.DevTestLabEnvironmentPatch System.ClientModel.Primitives.IJsonModel.Create(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } void System.ClientModel.Primitives.IJsonModel.Write(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } Azure.ResourceManager.DevTestLabs.Models.DevTestLabEnvironmentPatch System.ClientModel.Primitives.IPersistableModel.Create(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } @@ -1869,6 +2035,7 @@ protected override void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter write public override int GetHashCode() { throw null; } public static bool operator ==(Azure.ResourceManager.DevTestLabs.Models.DevTestLabEnvironmentPermission left, Azure.ResourceManager.DevTestLabs.Models.DevTestLabEnvironmentPermission right) { throw null; } public static implicit operator Azure.ResourceManager.DevTestLabs.Models.DevTestLabEnvironmentPermission (string value) { throw null; } + public static implicit operator Azure.ResourceManager.DevTestLabs.Models.DevTestLabEnvironmentPermission? (string value) { throw null; } public static bool operator !=(Azure.ResourceManager.DevTestLabs.Models.DevTestLabEnvironmentPermission left, Azure.ResourceManager.DevTestLabs.Models.DevTestLabEnvironmentPermission right) { throw null; } public override string ToString() { throw null; } } @@ -1876,7 +2043,10 @@ public partial class DevTestLabEvaluatePoliciesContent : System.ClientModel.Prim { public DevTestLabEvaluatePoliciesContent() { } public System.Collections.Generic.IList Policies { get { throw null; } } + protected virtual Azure.ResourceManager.DevTestLabs.Models.DevTestLabEvaluatePoliciesContent JsonModelCreateCore(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } protected virtual void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + protected virtual Azure.ResourceManager.DevTestLabs.Models.DevTestLabEvaluatePoliciesContent PersistableModelCreateCore(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + protected virtual System.BinaryData PersistableModelWriteCore(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } Azure.ResourceManager.DevTestLabs.Models.DevTestLabEvaluatePoliciesContent System.ClientModel.Primitives.IJsonModel.Create(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } void System.ClientModel.Primitives.IJsonModel.Write(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } Azure.ResourceManager.DevTestLabs.Models.DevTestLabEvaluatePoliciesContent System.ClientModel.Primitives.IPersistableModel.Create(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } @@ -1887,7 +2057,10 @@ public partial class DevTestLabEvaluatePoliciesResult : System.ClientModel.Primi { internal DevTestLabEvaluatePoliciesResult() { } public System.Collections.Generic.IReadOnlyList Results { get { throw null; } } + protected virtual Azure.ResourceManager.DevTestLabs.Models.DevTestLabEvaluatePoliciesResult JsonModelCreateCore(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } protected virtual void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + protected virtual Azure.ResourceManager.DevTestLabs.Models.DevTestLabEvaluatePoliciesResult PersistableModelCreateCore(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + protected virtual System.BinaryData PersistableModelWriteCore(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } Azure.ResourceManager.DevTestLabs.Models.DevTestLabEvaluatePoliciesResult System.ClientModel.Primitives.IJsonModel.Create(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } void System.ClientModel.Primitives.IJsonModel.Write(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } Azure.ResourceManager.DevTestLabs.Models.DevTestLabEvaluatePoliciesResult System.ClientModel.Primitives.IPersistableModel.Create(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } @@ -1901,7 +2074,10 @@ public DevTestLabEvaluatePolicy() { } public string FactName { get { throw null; } set { } } public string UserObjectId { get { throw null; } set { } } public string ValueOffset { get { throw null; } set { } } + protected virtual Azure.ResourceManager.DevTestLabs.Models.DevTestLabEvaluatePolicy JsonModelCreateCore(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } protected virtual void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + protected virtual Azure.ResourceManager.DevTestLabs.Models.DevTestLabEvaluatePolicy PersistableModelCreateCore(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + protected virtual System.BinaryData PersistableModelWriteCore(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } Azure.ResourceManager.DevTestLabs.Models.DevTestLabEvaluatePolicy System.ClientModel.Primitives.IJsonModel.Create(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } void System.ClientModel.Primitives.IJsonModel.Write(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } Azure.ResourceManager.DevTestLabs.Models.DevTestLabEvaluatePolicy System.ClientModel.Primitives.IPersistableModel.Create(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } @@ -1913,7 +2089,10 @@ public partial class DevTestLabExportResourceUsageContent : System.ClientModel.P public DevTestLabExportResourceUsageContent() { } public System.Uri BlobStorageAbsoluteSasUri { get { throw null; } set { } } public System.DateTimeOffset? UsageStartOn { get { throw null; } set { } } + protected virtual Azure.ResourceManager.DevTestLabs.Models.DevTestLabExportResourceUsageContent JsonModelCreateCore(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } protected virtual void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + protected virtual Azure.ResourceManager.DevTestLabs.Models.DevTestLabExportResourceUsageContent PersistableModelCreateCore(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + protected virtual System.BinaryData PersistableModelWriteCore(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } Azure.ResourceManager.DevTestLabs.Models.DevTestLabExportResourceUsageContent System.ClientModel.Primitives.IJsonModel.Create(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } void System.ClientModel.Primitives.IJsonModel.Write(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } Azure.ResourceManager.DevTestLabs.Models.DevTestLabExportResourceUsageContent System.ClientModel.Primitives.IPersistableModel.Create(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } @@ -1925,7 +2104,10 @@ public partial class DevTestLabExternalSubnet : System.ClientModel.Primitives.IJ internal DevTestLabExternalSubnet() { } public Azure.Core.ResourceIdentifier Id { get { throw null; } } public string Name { get { throw null; } } + protected virtual Azure.ResourceManager.DevTestLabs.Models.DevTestLabExternalSubnet JsonModelCreateCore(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } protected virtual void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + protected virtual Azure.ResourceManager.DevTestLabs.Models.DevTestLabExternalSubnet PersistableModelCreateCore(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + protected virtual System.BinaryData PersistableModelWriteCore(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } Azure.ResourceManager.DevTestLabs.Models.DevTestLabExternalSubnet System.ClientModel.Primitives.IJsonModel.Create(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } void System.ClientModel.Primitives.IJsonModel.Write(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } Azure.ResourceManager.DevTestLabs.Models.DevTestLabExternalSubnet System.ClientModel.Primitives.IPersistableModel.Create(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } @@ -1945,13 +2127,17 @@ protected virtual void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer public override int GetHashCode() { throw null; } public static bool operator ==(Azure.ResourceManager.DevTestLabs.Models.DevTestLabFileUploadOption left, Azure.ResourceManager.DevTestLabs.Models.DevTestLabFileUploadOption right) { throw null; } public static implicit operator Azure.ResourceManager.DevTestLabs.Models.DevTestLabFileUploadOption (string value) { throw null; } + public static implicit operator Azure.ResourceManager.DevTestLabs.Models.DevTestLabFileUploadOption? (string value) { throw null; } public static bool operator !=(Azure.ResourceManager.DevTestLabs.Models.DevTestLabFileUploadOption left, Azure.ResourceManager.DevTestLabs.Models.DevTestLabFileUploadOption right) { throw null; } public override string ToString() { throw null; } } public partial class DevTestLabFormulaPatch : Azure.ResourceManager.DevTestLabs.Models.DevTestLabResourcePatch, System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel { public DevTestLabFormulaPatch() { } + protected override Azure.ResourceManager.DevTestLabs.Models.DevTestLabResourcePatch JsonModelCreateCore(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } protected override void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + protected override Azure.ResourceManager.DevTestLabs.Models.DevTestLabResourcePatch PersistableModelCreateCore(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + protected override System.BinaryData PersistableModelWriteCore(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } Azure.ResourceManager.DevTestLabs.Models.DevTestLabFormulaPatch System.ClientModel.Primitives.IJsonModel.Create(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } void System.ClientModel.Primitives.IJsonModel.Write(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } Azure.ResourceManager.DevTestLabs.Models.DevTestLabFormulaPatch System.ClientModel.Primitives.IPersistableModel.Create(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } @@ -1969,7 +2155,10 @@ public DevTestLabGalleryImage(Azure.Core.AzureLocation location) { } public bool? IsEnabled { get { throw null; } set { } } public bool? IsPlanAuthorized { get { throw null; } set { } } public string PlanId { get { throw null; } set { } } + protected virtual Azure.ResourceManager.Models.ResourceData JsonModelCreateCore(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } protected override void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + protected virtual Azure.ResourceManager.Models.ResourceData PersistableModelCreateCore(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + protected virtual System.BinaryData PersistableModelWriteCore(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } Azure.ResourceManager.DevTestLabs.Models.DevTestLabGalleryImage System.ClientModel.Primitives.IJsonModel.Create(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } void System.ClientModel.Primitives.IJsonModel.Write(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } Azure.ResourceManager.DevTestLabs.Models.DevTestLabGalleryImage System.ClientModel.Primitives.IPersistableModel.Create(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } @@ -1984,7 +2173,10 @@ public DevTestLabGalleryImageReference() { } public string Publisher { get { throw null; } set { } } public string Sku { get { throw null; } set { } } public string Version { get { throw null; } set { } } + protected virtual Azure.ResourceManager.DevTestLabs.Models.DevTestLabGalleryImageReference JsonModelCreateCore(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } protected virtual void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + protected virtual Azure.ResourceManager.DevTestLabs.Models.DevTestLabGalleryImageReference PersistableModelCreateCore(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + protected virtual System.BinaryData PersistableModelWriteCore(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } Azure.ResourceManager.DevTestLabs.Models.DevTestLabGalleryImageReference System.ClientModel.Primitives.IJsonModel.Create(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } void System.ClientModel.Primitives.IJsonModel.Write(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } Azure.ResourceManager.DevTestLabs.Models.DevTestLabGalleryImageReference System.ClientModel.Primitives.IPersistableModel.Create(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } @@ -1995,7 +2187,10 @@ public partial class DevTestLabGenerateUploadUriContent : System.ClientModel.Pri { public DevTestLabGenerateUploadUriContent() { } public string BlobName { get { throw null; } set { } } + protected virtual Azure.ResourceManager.DevTestLabs.Models.DevTestLabGenerateUploadUriContent JsonModelCreateCore(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } protected virtual void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + protected virtual Azure.ResourceManager.DevTestLabs.Models.DevTestLabGenerateUploadUriContent PersistableModelCreateCore(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + protected virtual System.BinaryData PersistableModelWriteCore(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } Azure.ResourceManager.DevTestLabs.Models.DevTestLabGenerateUploadUriContent System.ClientModel.Primitives.IJsonModel.Create(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } void System.ClientModel.Primitives.IJsonModel.Write(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } Azure.ResourceManager.DevTestLabs.Models.DevTestLabGenerateUploadUriContent System.ClientModel.Primitives.IPersistableModel.Create(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } @@ -2006,7 +2201,10 @@ public partial class DevTestLabGenerateUploadUriResult : System.ClientModel.Prim { internal DevTestLabGenerateUploadUriResult() { } public System.Uri UploadUri { get { throw null; } } + protected virtual Azure.ResourceManager.DevTestLabs.Models.DevTestLabGenerateUploadUriResult JsonModelCreateCore(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } protected virtual void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + protected virtual Azure.ResourceManager.DevTestLabs.Models.DevTestLabGenerateUploadUriResult PersistableModelCreateCore(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + protected virtual System.BinaryData PersistableModelWriteCore(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } Azure.ResourceManager.DevTestLabs.Models.DevTestLabGenerateUploadUriResult System.ClientModel.Primitives.IJsonModel.Create(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } void System.ClientModel.Primitives.IJsonModel.Write(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } Azure.ResourceManager.DevTestLabs.Models.DevTestLabGenerateUploadUriResult System.ClientModel.Primitives.IPersistableModel.Create(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } @@ -2018,7 +2216,10 @@ public partial class DevTestLabGlobalScheduleRetargetContent : System.ClientMode public DevTestLabGlobalScheduleRetargetContent() { } public Azure.Core.ResourceIdentifier CurrentResourceId { get { throw null; } set { } } public Azure.Core.ResourceIdentifier TargetResourceId { get { throw null; } set { } } + protected virtual Azure.ResourceManager.DevTestLabs.Models.DevTestLabGlobalScheduleRetargetContent JsonModelCreateCore(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } protected virtual void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + protected virtual Azure.ResourceManager.DevTestLabs.Models.DevTestLabGlobalScheduleRetargetContent PersistableModelCreateCore(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + protected virtual System.BinaryData PersistableModelWriteCore(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } Azure.ResourceManager.DevTestLabs.Models.DevTestLabGlobalScheduleRetargetContent System.ClientModel.Primitives.IJsonModel.Create(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } void System.ClientModel.Primitives.IJsonModel.Write(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } Azure.ResourceManager.DevTestLabs.Models.DevTestLabGlobalScheduleRetargetContent System.ClientModel.Primitives.IPersistableModel.Create(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } @@ -2039,6 +2240,7 @@ protected virtual void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer public override int GetHashCode() { throw null; } public static bool operator ==(Azure.ResourceManager.DevTestLabs.Models.DevTestLabHostCachingOption left, Azure.ResourceManager.DevTestLabs.Models.DevTestLabHostCachingOption right) { throw null; } public static implicit operator Azure.ResourceManager.DevTestLabs.Models.DevTestLabHostCachingOption (string value) { throw null; } + public static implicit operator Azure.ResourceManager.DevTestLabs.Models.DevTestLabHostCachingOption? (string value) { throw null; } public static bool operator !=(Azure.ResourceManager.DevTestLabs.Models.DevTestLabHostCachingOption left, Azure.ResourceManager.DevTestLabs.Models.DevTestLabHostCachingOption right) { throw null; } public override string ToString() { throw null; } } @@ -2047,7 +2249,10 @@ public partial class DevTestLabImportVmContent : System.ClientModel.Primitives.I public DevTestLabImportVmContent() { } public string DestinationVmName { get { throw null; } set { } } public Azure.Core.ResourceIdentifier SourceVmResourceId { get { throw null; } set { } } + protected virtual Azure.ResourceManager.DevTestLabs.Models.DevTestLabImportVmContent JsonModelCreateCore(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } protected virtual void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + protected virtual Azure.ResourceManager.DevTestLabs.Models.DevTestLabImportVmContent PersistableModelCreateCore(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + protected virtual System.BinaryData PersistableModelWriteCore(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } Azure.ResourceManager.DevTestLabs.Models.DevTestLabImportVmContent System.ClientModel.Primitives.IJsonModel.Create(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } void System.ClientModel.Primitives.IJsonModel.Write(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } Azure.ResourceManager.DevTestLabs.Models.DevTestLabImportVmContent System.ClientModel.Primitives.IPersistableModel.Create(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } @@ -2060,7 +2265,10 @@ public DevTestLabInboundNatRule() { } public int? BackendPort { get { throw null; } set { } } public int? FrontendPort { get { throw null; } set { } } public Azure.ResourceManager.DevTestLabs.Models.DevTestLabTransportProtocol? TransportProtocol { get { throw null; } set { } } + protected virtual Azure.ResourceManager.DevTestLabs.Models.DevTestLabInboundNatRule JsonModelCreateCore(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } protected virtual void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + protected virtual Azure.ResourceManager.DevTestLabs.Models.DevTestLabInboundNatRule PersistableModelCreateCore(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + protected virtual System.BinaryData PersistableModelWriteCore(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } Azure.ResourceManager.DevTestLabs.Models.DevTestLabInboundNatRule System.ClientModel.Primitives.IJsonModel.Create(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } void System.ClientModel.Primitives.IJsonModel.Write(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } Azure.ResourceManager.DevTestLabs.Models.DevTestLabInboundNatRule System.ClientModel.Primitives.IPersistableModel.Create(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } @@ -2081,6 +2289,7 @@ protected virtual void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer public override int GetHashCode() { throw null; } public static bool operator ==(Azure.ResourceManager.DevTestLabs.Models.DevTestLabLinuxOSState left, Azure.ResourceManager.DevTestLabs.Models.DevTestLabLinuxOSState right) { throw null; } public static implicit operator Azure.ResourceManager.DevTestLabs.Models.DevTestLabLinuxOSState (string value) { throw null; } + public static implicit operator Azure.ResourceManager.DevTestLabs.Models.DevTestLabLinuxOSState? (string value) { throw null; } public static bool operator !=(Azure.ResourceManager.DevTestLabs.Models.DevTestLabLinuxOSState left, Azure.ResourceManager.DevTestLabs.Models.DevTestLabLinuxOSState right) { throw null; } public override string ToString() { throw null; } } @@ -2091,6 +2300,10 @@ public DevTestLabManagedIdentity() { } public Azure.ResourceManager.Models.ManagedServiceIdentityType ManagedIdentityType { get { throw null; } set { } } public System.Guid? PrincipalId { get { throw null; } set { } } public System.Guid? TenantId { get { throw null; } set { } } + protected virtual Azure.ResourceManager.DevTestLabs.Models.DevTestLabManagedIdentity JsonModelCreateCore(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + protected virtual void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + protected virtual Azure.ResourceManager.DevTestLabs.Models.DevTestLabManagedIdentity PersistableModelCreateCore(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + protected virtual System.BinaryData PersistableModelWriteCore(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } Azure.ResourceManager.DevTestLabs.Models.DevTestLabManagedIdentity System.ClientModel.Primitives.IJsonModel.Create(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } void System.ClientModel.Primitives.IJsonModel.Write(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } Azure.ResourceManager.DevTestLabs.Models.DevTestLabManagedIdentity System.ClientModel.Primitives.IPersistableModel.Create(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } @@ -2109,7 +2322,10 @@ public DevTestLabNetworkInterface() { } public string SshAuthority { get { throw null; } set { } } public Azure.Core.ResourceIdentifier SubnetId { get { throw null; } set { } } public Azure.Core.ResourceIdentifier VirtualNetworkId { get { throw null; } set { } } + protected virtual Azure.ResourceManager.DevTestLabs.Models.DevTestLabNetworkInterface JsonModelCreateCore(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } protected virtual void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + protected virtual Azure.ResourceManager.DevTestLabs.Models.DevTestLabNetworkInterface PersistableModelCreateCore(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + protected virtual System.BinaryData PersistableModelWriteCore(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } Azure.ResourceManager.DevTestLabs.Models.DevTestLabNetworkInterface System.ClientModel.Primitives.IJsonModel.Create(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } void System.ClientModel.Primitives.IJsonModel.Write(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } Azure.ResourceManager.DevTestLabs.Models.DevTestLabNetworkInterface System.ClientModel.Primitives.IPersistableModel.Create(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } @@ -2120,7 +2336,10 @@ public partial class DevTestLabNotificationChannelEvent : System.ClientModel.Pri { public DevTestLabNotificationChannelEvent() { } public Azure.ResourceManager.DevTestLabs.Models.DevTestLabNotificationChannelEventType? EventName { get { throw null; } set { } } + protected virtual Azure.ResourceManager.DevTestLabs.Models.DevTestLabNotificationChannelEvent JsonModelCreateCore(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } protected virtual void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + protected virtual Azure.ResourceManager.DevTestLabs.Models.DevTestLabNotificationChannelEvent PersistableModelCreateCore(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + protected virtual System.BinaryData PersistableModelWriteCore(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } Azure.ResourceManager.DevTestLabs.Models.DevTestLabNotificationChannelEvent System.ClientModel.Primitives.IJsonModel.Create(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } void System.ClientModel.Primitives.IJsonModel.Write(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } Azure.ResourceManager.DevTestLabs.Models.DevTestLabNotificationChannelEvent System.ClientModel.Primitives.IPersistableModel.Create(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } @@ -2140,6 +2359,7 @@ protected virtual void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer public override int GetHashCode() { throw null; } public static bool operator ==(Azure.ResourceManager.DevTestLabs.Models.DevTestLabNotificationChannelEventType left, Azure.ResourceManager.DevTestLabs.Models.DevTestLabNotificationChannelEventType right) { throw null; } public static implicit operator Azure.ResourceManager.DevTestLabs.Models.DevTestLabNotificationChannelEventType (string value) { throw null; } + public static implicit operator Azure.ResourceManager.DevTestLabs.Models.DevTestLabNotificationChannelEventType? (string value) { throw null; } public static bool operator !=(Azure.ResourceManager.DevTestLabs.Models.DevTestLabNotificationChannelEventType left, Azure.ResourceManager.DevTestLabs.Models.DevTestLabNotificationChannelEventType right) { throw null; } public override string ToString() { throw null; } } @@ -2148,7 +2368,10 @@ public partial class DevTestLabNotificationChannelNotifyContent : System.ClientM public DevTestLabNotificationChannelNotifyContent() { } public Azure.ResourceManager.DevTestLabs.Models.DevTestLabNotificationChannelEventType? EventName { get { throw null; } set { } } public string JsonPayload { get { throw null; } set { } } + protected virtual Azure.ResourceManager.DevTestLabs.Models.DevTestLabNotificationChannelNotifyContent JsonModelCreateCore(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } protected virtual void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + protected virtual Azure.ResourceManager.DevTestLabs.Models.DevTestLabNotificationChannelNotifyContent PersistableModelCreateCore(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + protected virtual System.BinaryData PersistableModelWriteCore(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } Azure.ResourceManager.DevTestLabs.Models.DevTestLabNotificationChannelNotifyContent System.ClientModel.Primitives.IJsonModel.Create(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } void System.ClientModel.Primitives.IJsonModel.Write(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } Azure.ResourceManager.DevTestLabs.Models.DevTestLabNotificationChannelNotifyContent System.ClientModel.Primitives.IPersistableModel.Create(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } @@ -2158,7 +2381,10 @@ protected virtual void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer public partial class DevTestLabNotificationChannelPatch : Azure.ResourceManager.DevTestLabs.Models.DevTestLabResourcePatch, System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel { public DevTestLabNotificationChannelPatch() { } + protected override Azure.ResourceManager.DevTestLabs.Models.DevTestLabResourcePatch JsonModelCreateCore(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } protected override void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + protected override Azure.ResourceManager.DevTestLabs.Models.DevTestLabResourcePatch PersistableModelCreateCore(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + protected override System.BinaryData PersistableModelWriteCore(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } Azure.ResourceManager.DevTestLabs.Models.DevTestLabNotificationChannelPatch System.ClientModel.Primitives.IJsonModel.Create(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } void System.ClientModel.Primitives.IJsonModel.Write(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } Azure.ResourceManager.DevTestLabs.Models.DevTestLabNotificationChannelPatch System.ClientModel.Primitives.IPersistableModel.Create(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } @@ -2173,7 +2399,10 @@ public DevTestLabNotificationSettings() { } public Azure.ResourceManager.DevTestLabs.Models.DevTestLabEnableStatus? Status { get { throw null; } set { } } public int? TimeInMinutes { get { throw null; } set { } } public System.Uri WebhookUri { get { throw null; } set { } } + protected virtual Azure.ResourceManager.DevTestLabs.Models.DevTestLabNotificationSettings JsonModelCreateCore(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } protected virtual void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + protected virtual Azure.ResourceManager.DevTestLabs.Models.DevTestLabNotificationSettings PersistableModelCreateCore(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + protected virtual System.BinaryData PersistableModelWriteCore(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } Azure.ResourceManager.DevTestLabs.Models.DevTestLabNotificationSettings System.ClientModel.Primitives.IJsonModel.Create(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } void System.ClientModel.Primitives.IJsonModel.Write(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } Azure.ResourceManager.DevTestLabs.Models.DevTestLabNotificationSettings System.ClientModel.Primitives.IPersistableModel.Create(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } @@ -2185,7 +2414,10 @@ public partial class DevTestLabParameter : System.ClientModel.Primitives.IJsonMo public DevTestLabParameter() { } public string Name { get { throw null; } set { } } public string Value { get { throw null; } set { } } + protected virtual Azure.ResourceManager.DevTestLabs.Models.DevTestLabParameter JsonModelCreateCore(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } protected virtual void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + protected virtual Azure.ResourceManager.DevTestLabs.Models.DevTestLabParameter PersistableModelCreateCore(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + protected virtual System.BinaryData PersistableModelWriteCore(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } Azure.ResourceManager.DevTestLabs.Models.DevTestLabParameter System.ClientModel.Primitives.IJsonModel.Create(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } void System.ClientModel.Primitives.IJsonModel.Write(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } Azure.ResourceManager.DevTestLabs.Models.DevTestLabParameter System.ClientModel.Primitives.IPersistableModel.Create(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } @@ -2197,7 +2429,10 @@ public partial class DevTestLabParametersValueFileInfo : System.ClientModel.Prim internal DevTestLabParametersValueFileInfo() { } public string FileName { get { throw null; } } public System.BinaryData ParametersValueInfo { get { throw null; } } + protected virtual Azure.ResourceManager.DevTestLabs.Models.DevTestLabParametersValueFileInfo JsonModelCreateCore(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } protected virtual void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + protected virtual Azure.ResourceManager.DevTestLabs.Models.DevTestLabParametersValueFileInfo PersistableModelCreateCore(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + protected virtual System.BinaryData PersistableModelWriteCore(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } Azure.ResourceManager.DevTestLabs.Models.DevTestLabParametersValueFileInfo System.ClientModel.Primitives.IJsonModel.Create(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } void System.ClientModel.Primitives.IJsonModel.Write(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } Azure.ResourceManager.DevTestLabs.Models.DevTestLabParametersValueFileInfo System.ClientModel.Primitives.IPersistableModel.Create(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } @@ -2207,7 +2442,10 @@ protected virtual void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer public partial class DevTestLabPatch : Azure.ResourceManager.DevTestLabs.Models.DevTestLabResourcePatch, System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel { public DevTestLabPatch() { } + protected override Azure.ResourceManager.DevTestLabs.Models.DevTestLabResourcePatch JsonModelCreateCore(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } protected override void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + protected override Azure.ResourceManager.DevTestLabs.Models.DevTestLabResourcePatch PersistableModelCreateCore(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + protected override System.BinaryData PersistableModelWriteCore(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } Azure.ResourceManager.DevTestLabs.Models.DevTestLabPatch System.ClientModel.Primitives.IJsonModel.Create(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } void System.ClientModel.Primitives.IJsonModel.Write(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } Azure.ResourceManager.DevTestLabs.Models.DevTestLabPatch System.ClientModel.Primitives.IPersistableModel.Create(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } @@ -2227,6 +2465,7 @@ protected override void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter write public override int GetHashCode() { throw null; } public static bool operator ==(Azure.ResourceManager.DevTestLabs.Models.DevTestLabPolicyEvaluatorType left, Azure.ResourceManager.DevTestLabs.Models.DevTestLabPolicyEvaluatorType right) { throw null; } public static implicit operator Azure.ResourceManager.DevTestLabs.Models.DevTestLabPolicyEvaluatorType (string value) { throw null; } + public static implicit operator Azure.ResourceManager.DevTestLabs.Models.DevTestLabPolicyEvaluatorType? (string value) { throw null; } public static bool operator !=(Azure.ResourceManager.DevTestLabs.Models.DevTestLabPolicyEvaluatorType left, Azure.ResourceManager.DevTestLabs.Models.DevTestLabPolicyEvaluatorType right) { throw null; } public override string ToString() { throw null; } } @@ -2251,13 +2490,17 @@ protected override void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter write public override int GetHashCode() { throw null; } public static bool operator ==(Azure.ResourceManager.DevTestLabs.Models.DevTestLabPolicyFactName left, Azure.ResourceManager.DevTestLabs.Models.DevTestLabPolicyFactName right) { throw null; } public static implicit operator Azure.ResourceManager.DevTestLabs.Models.DevTestLabPolicyFactName (string value) { throw null; } + public static implicit operator Azure.ResourceManager.DevTestLabs.Models.DevTestLabPolicyFactName? (string value) { throw null; } public static bool operator !=(Azure.ResourceManager.DevTestLabs.Models.DevTestLabPolicyFactName left, Azure.ResourceManager.DevTestLabs.Models.DevTestLabPolicyFactName right) { throw null; } public override string ToString() { throw null; } } public partial class DevTestLabPolicyPatch : Azure.ResourceManager.DevTestLabs.Models.DevTestLabResourcePatch, System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel { public DevTestLabPolicyPatch() { } + protected override Azure.ResourceManager.DevTestLabs.Models.DevTestLabResourcePatch JsonModelCreateCore(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } protected override void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + protected override Azure.ResourceManager.DevTestLabs.Models.DevTestLabResourcePatch PersistableModelCreateCore(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + protected override System.BinaryData PersistableModelWriteCore(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } Azure.ResourceManager.DevTestLabs.Models.DevTestLabPolicyPatch System.ClientModel.Primitives.IJsonModel.Create(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } void System.ClientModel.Primitives.IJsonModel.Write(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } Azure.ResourceManager.DevTestLabs.Models.DevTestLabPolicyPatch System.ClientModel.Primitives.IPersistableModel.Create(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } @@ -2269,7 +2512,10 @@ public partial class DevTestLabPolicySetResult : System.ClientModel.Primitives.I internal DevTestLabPolicySetResult() { } public bool? HasError { get { throw null; } } public System.Collections.Generic.IReadOnlyList PolicyViolations { get { throw null; } } + protected virtual Azure.ResourceManager.DevTestLabs.Models.DevTestLabPolicySetResult JsonModelCreateCore(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } protected virtual void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + protected virtual Azure.ResourceManager.DevTestLabs.Models.DevTestLabPolicySetResult PersistableModelCreateCore(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + protected virtual System.BinaryData PersistableModelWriteCore(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } Azure.ResourceManager.DevTestLabs.Models.DevTestLabPolicySetResult System.ClientModel.Primitives.IJsonModel.Create(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } void System.ClientModel.Primitives.IJsonModel.Write(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } Azure.ResourceManager.DevTestLabs.Models.DevTestLabPolicySetResult System.ClientModel.Primitives.IPersistableModel.Create(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } @@ -2289,6 +2535,7 @@ protected virtual void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer public override int GetHashCode() { throw null; } public static bool operator ==(Azure.ResourceManager.DevTestLabs.Models.DevTestLabPolicyStatus left, Azure.ResourceManager.DevTestLabs.Models.DevTestLabPolicyStatus right) { throw null; } public static implicit operator Azure.ResourceManager.DevTestLabs.Models.DevTestLabPolicyStatus (string value) { throw null; } + public static implicit operator Azure.ResourceManager.DevTestLabs.Models.DevTestLabPolicyStatus? (string value) { throw null; } public static bool operator !=(Azure.ResourceManager.DevTestLabs.Models.DevTestLabPolicyStatus left, Azure.ResourceManager.DevTestLabs.Models.DevTestLabPolicyStatus right) { throw null; } public override string ToString() { throw null; } } @@ -2297,7 +2544,10 @@ public partial class DevTestLabPolicyViolation : System.ClientModel.Primitives.I internal DevTestLabPolicyViolation() { } public string Code { get { throw null; } } public string Message { get { throw null; } } + protected virtual Azure.ResourceManager.DevTestLabs.Models.DevTestLabPolicyViolation JsonModelCreateCore(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } protected virtual void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + protected virtual Azure.ResourceManager.DevTestLabs.Models.DevTestLabPolicyViolation PersistableModelCreateCore(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + protected virtual System.BinaryData PersistableModelWriteCore(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } Azure.ResourceManager.DevTestLabs.Models.DevTestLabPolicyViolation System.ClientModel.Primitives.IJsonModel.Create(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } void System.ClientModel.Primitives.IJsonModel.Write(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } Azure.ResourceManager.DevTestLabs.Models.DevTestLabPolicyViolation System.ClientModel.Primitives.IPersistableModel.Create(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } @@ -2309,7 +2559,10 @@ public partial class DevTestLabPort : System.ClientModel.Primitives.IJsonModel.Create(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } void System.ClientModel.Primitives.IJsonModel.Write(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } Azure.ResourceManager.DevTestLabs.Models.DevTestLabPort System.ClientModel.Primitives.IPersistableModel.Create(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } @@ -2329,6 +2582,7 @@ protected virtual void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer public override int GetHashCode() { throw null; } public static bool operator ==(Azure.ResourceManager.DevTestLabs.Models.DevTestLabPremiumDataDisk left, Azure.ResourceManager.DevTestLabs.Models.DevTestLabPremiumDataDisk right) { throw null; } public static implicit operator Azure.ResourceManager.DevTestLabs.Models.DevTestLabPremiumDataDisk (string value) { throw null; } + public static implicit operator Azure.ResourceManager.DevTestLabs.Models.DevTestLabPremiumDataDisk? (string value) { throw null; } public static bool operator !=(Azure.ResourceManager.DevTestLabs.Models.DevTestLabPremiumDataDisk left, Azure.ResourceManager.DevTestLabs.Models.DevTestLabPremiumDataDisk right) { throw null; } public override string ToString() { throw null; } } @@ -2336,7 +2590,10 @@ public partial class DevTestLabRdpConnection : System.ClientModel.Primitives.IJs { internal DevTestLabRdpConnection() { } public string Contents { get { throw null; } } + protected virtual Azure.ResourceManager.DevTestLabs.Models.DevTestLabRdpConnection JsonModelCreateCore(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } protected virtual void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + protected virtual Azure.ResourceManager.DevTestLabs.Models.DevTestLabRdpConnection PersistableModelCreateCore(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + protected virtual System.BinaryData PersistableModelWriteCore(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } Azure.ResourceManager.DevTestLabs.Models.DevTestLabRdpConnection System.ClientModel.Primitives.IJsonModel.Create(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } void System.ClientModel.Primitives.IJsonModel.Write(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } Azure.ResourceManager.DevTestLabs.Models.DevTestLabRdpConnection System.ClientModel.Primitives.IPersistableModel.Create(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } @@ -2356,6 +2613,7 @@ protected virtual void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer public override int GetHashCode() { throw null; } public static bool operator ==(Azure.ResourceManager.DevTestLabs.Models.DevTestLabReportingCycleType left, Azure.ResourceManager.DevTestLabs.Models.DevTestLabReportingCycleType right) { throw null; } public static implicit operator Azure.ResourceManager.DevTestLabs.Models.DevTestLabReportingCycleType (string value) { throw null; } + public static implicit operator Azure.ResourceManager.DevTestLabs.Models.DevTestLabReportingCycleType? (string value) { throw null; } public static bool operator !=(Azure.ResourceManager.DevTestLabs.Models.DevTestLabReportingCycleType left, Azure.ResourceManager.DevTestLabs.Models.DevTestLabReportingCycleType right) { throw null; } public override string ToString() { throw null; } } @@ -2371,7 +2629,10 @@ internal DevTestLabResourceCost() { } public string ResourceStatus { get { throw null; } } public string ResourceType { get { throw null; } } public string ResourceUniqueId { get { throw null; } } + protected virtual Azure.ResourceManager.DevTestLabs.Models.DevTestLabResourceCost JsonModelCreateCore(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } protected virtual void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + protected virtual Azure.ResourceManager.DevTestLabs.Models.DevTestLabResourceCost PersistableModelCreateCore(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + protected virtual System.BinaryData PersistableModelWriteCore(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } Azure.ResourceManager.DevTestLabs.Models.DevTestLabResourceCost System.ClientModel.Primitives.IJsonModel.Create(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } void System.ClientModel.Primitives.IJsonModel.Write(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } Azure.ResourceManager.DevTestLabs.Models.DevTestLabResourceCost System.ClientModel.Primitives.IPersistableModel.Create(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } @@ -2382,7 +2643,10 @@ public partial class DevTestLabResourcePatch : System.ClientModel.Primitives.IJs { public DevTestLabResourcePatch() { } public System.Collections.Generic.IDictionary Tags { get { throw null; } } + protected virtual Azure.ResourceManager.DevTestLabs.Models.DevTestLabResourcePatch JsonModelCreateCore(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } protected virtual void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + protected virtual Azure.ResourceManager.DevTestLabs.Models.DevTestLabResourcePatch PersistableModelCreateCore(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + protected virtual System.BinaryData PersistableModelWriteCore(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } Azure.ResourceManager.DevTestLabs.Models.DevTestLabResourcePatch System.ClientModel.Primitives.IJsonModel.Create(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } void System.ClientModel.Primitives.IJsonModel.Write(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } Azure.ResourceManager.DevTestLabs.Models.DevTestLabResourcePatch System.ClientModel.Primitives.IPersistableModel.Create(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } @@ -2403,7 +2667,10 @@ public DevTestLabScheduleCreationParameter() { } public string TaskType { get { throw null; } set { } } public string TimeZoneId { get { throw null; } set { } } public Azure.ResourceManager.DevTestLabs.Models.DevTestLabWeekDetails WeeklyRecurrence { get { throw null; } set { } } + protected virtual Azure.ResourceManager.DevTestLabs.Models.DevTestLabScheduleCreationParameter JsonModelCreateCore(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } protected virtual void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + protected virtual Azure.ResourceManager.DevTestLabs.Models.DevTestLabScheduleCreationParameter PersistableModelCreateCore(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + protected virtual System.BinaryData PersistableModelWriteCore(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } Azure.ResourceManager.DevTestLabs.Models.DevTestLabScheduleCreationParameter System.ClientModel.Primitives.IJsonModel.Create(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } void System.ClientModel.Primitives.IJsonModel.Write(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } Azure.ResourceManager.DevTestLabs.Models.DevTestLabScheduleCreationParameter System.ClientModel.Primitives.IPersistableModel.Create(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } @@ -2413,7 +2680,10 @@ protected virtual void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer public partial class DevTestLabSchedulePatch : Azure.ResourceManager.DevTestLabs.Models.DevTestLabResourcePatch, System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel { public DevTestLabSchedulePatch() { } + protected override Azure.ResourceManager.DevTestLabs.Models.DevTestLabResourcePatch JsonModelCreateCore(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } protected override void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + protected override Azure.ResourceManager.DevTestLabs.Models.DevTestLabResourcePatch PersistableModelCreateCore(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + protected override System.BinaryData PersistableModelWriteCore(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } Azure.ResourceManager.DevTestLabs.Models.DevTestLabSchedulePatch System.ClientModel.Primitives.IJsonModel.Create(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } void System.ClientModel.Primitives.IJsonModel.Write(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } Azure.ResourceManager.DevTestLabs.Models.DevTestLabSchedulePatch System.ClientModel.Primitives.IPersistableModel.Create(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } @@ -2423,7 +2693,10 @@ protected override void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter write public partial class DevTestLabSecretPatch : Azure.ResourceManager.DevTestLabs.Models.DevTestLabResourcePatch, System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel { public DevTestLabSecretPatch() { } + protected override Azure.ResourceManager.DevTestLabs.Models.DevTestLabResourcePatch JsonModelCreateCore(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } protected override void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + protected override Azure.ResourceManager.DevTestLabs.Models.DevTestLabResourcePatch PersistableModelCreateCore(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + protected override System.BinaryData PersistableModelWriteCore(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } Azure.ResourceManager.DevTestLabs.Models.DevTestLabSecretPatch System.ClientModel.Primitives.IJsonModel.Create(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } void System.ClientModel.Primitives.IJsonModel.Write(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } Azure.ResourceManager.DevTestLabs.Models.DevTestLabSecretPatch System.ClientModel.Primitives.IPersistableModel.Create(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } @@ -2433,7 +2706,10 @@ protected override void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter write public partial class DevTestLabServiceFabricPatch : Azure.ResourceManager.DevTestLabs.Models.DevTestLabResourcePatch, System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel { public DevTestLabServiceFabricPatch() { } + protected override Azure.ResourceManager.DevTestLabs.Models.DevTestLabResourcePatch JsonModelCreateCore(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } protected override void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + protected override Azure.ResourceManager.DevTestLabs.Models.DevTestLabResourcePatch PersistableModelCreateCore(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + protected override System.BinaryData PersistableModelWriteCore(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } Azure.ResourceManager.DevTestLabs.Models.DevTestLabServiceFabricPatch System.ClientModel.Primitives.IJsonModel.Create(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } void System.ClientModel.Primitives.IJsonModel.Write(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } Azure.ResourceManager.DevTestLabs.Models.DevTestLabServiceFabricPatch System.ClientModel.Primitives.IPersistableModel.Create(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } @@ -2454,6 +2730,7 @@ protected override void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter write public override int GetHashCode() { throw null; } public static bool operator ==(Azure.ResourceManager.DevTestLabs.Models.DevTestLabSourceControlType left, Azure.ResourceManager.DevTestLabs.Models.DevTestLabSourceControlType right) { throw null; } public static implicit operator Azure.ResourceManager.DevTestLabs.Models.DevTestLabSourceControlType (string value) { throw null; } + public static implicit operator Azure.ResourceManager.DevTestLabs.Models.DevTestLabSourceControlType? (string value) { throw null; } public static bool operator !=(Azure.ResourceManager.DevTestLabs.Models.DevTestLabSourceControlType left, Azure.ResourceManager.DevTestLabs.Models.DevTestLabSourceControlType right) { throw null; } public override string ToString() { throw null; } } @@ -2471,6 +2748,7 @@ protected override void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter write public override int GetHashCode() { throw null; } public static bool operator ==(Azure.ResourceManager.DevTestLabs.Models.DevTestLabStorageType left, Azure.ResourceManager.DevTestLabs.Models.DevTestLabStorageType right) { throw null; } public static implicit operator Azure.ResourceManager.DevTestLabs.Models.DevTestLabStorageType (string value) { throw null; } + public static implicit operator Azure.ResourceManager.DevTestLabs.Models.DevTestLabStorageType? (string value) { throw null; } public static bool operator !=(Azure.ResourceManager.DevTestLabs.Models.DevTestLabStorageType left, Azure.ResourceManager.DevTestLabs.Models.DevTestLabStorageType right) { throw null; } public override string ToString() { throw null; } } @@ -2480,7 +2758,10 @@ public DevTestLabSubnet() { } public Azure.ResourceManager.DevTestLabs.Models.DevTestLabUsagePermissionType? AllowPublicIP { get { throw null; } set { } } public string LabSubnetName { get { throw null; } set { } } public Azure.Core.ResourceIdentifier ResourceId { get { throw null; } set { } } + protected virtual Azure.ResourceManager.DevTestLabs.Models.DevTestLabSubnet JsonModelCreateCore(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } protected virtual void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + protected virtual Azure.ResourceManager.DevTestLabs.Models.DevTestLabSubnet PersistableModelCreateCore(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + protected virtual System.BinaryData PersistableModelWriteCore(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } Azure.ResourceManager.DevTestLabs.Models.DevTestLabSubnet System.ClientModel.Primitives.IJsonModel.Create(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } void System.ClientModel.Primitives.IJsonModel.Write(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } Azure.ResourceManager.DevTestLabs.Models.DevTestLabSubnet System.ClientModel.Primitives.IPersistableModel.Create(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } @@ -2496,7 +2777,10 @@ public DevTestLabSubnetOverride() { } public Azure.ResourceManager.DevTestLabs.Models.DevTestLabUsagePermissionType? UseInVmCreationPermission { get { throw null; } set { } } public Azure.ResourceManager.DevTestLabs.Models.DevTestLabUsagePermissionType? UsePublicIPAddressPermission { get { throw null; } set { } } public string VirtualNetworkPoolName { get { throw null; } set { } } + protected virtual Azure.ResourceManager.DevTestLabs.Models.DevTestLabSubnetOverride JsonModelCreateCore(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } protected virtual void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + protected virtual Azure.ResourceManager.DevTestLabs.Models.DevTestLabSubnetOverride PersistableModelCreateCore(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + protected virtual System.BinaryData PersistableModelWriteCore(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } Azure.ResourceManager.DevTestLabs.Models.DevTestLabSubnetOverride System.ClientModel.Primitives.IJsonModel.Create(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } void System.ClientModel.Primitives.IJsonModel.Write(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } Azure.ResourceManager.DevTestLabs.Models.DevTestLabSubnetOverride System.ClientModel.Primitives.IPersistableModel.Create(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } @@ -2508,7 +2792,10 @@ public partial class DevTestLabSupport : System.ClientModel.Primitives.IJsonMode public DevTestLabSupport() { } public Azure.ResourceManager.DevTestLabs.Models.DevTestLabEnableStatus? Enabled { get { throw null; } set { } } public string Markdown { get { throw null; } set { } } + protected virtual Azure.ResourceManager.DevTestLabs.Models.DevTestLabSupport JsonModelCreateCore(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } protected virtual void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + protected virtual Azure.ResourceManager.DevTestLabs.Models.DevTestLabSupport PersistableModelCreateCore(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + protected virtual System.BinaryData PersistableModelWriteCore(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } Azure.ResourceManager.DevTestLabs.Models.DevTestLabSupport System.ClientModel.Primitives.IJsonModel.Create(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } void System.ClientModel.Primitives.IJsonModel.Write(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } Azure.ResourceManager.DevTestLabs.Models.DevTestLabSupport System.ClientModel.Primitives.IPersistableModel.Create(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } @@ -2524,7 +2811,10 @@ public DevTestLabTargetCost() { } public Azure.ResourceManager.DevTestLabs.Models.DevTestLabReportingCycleType? CycleType { get { throw null; } set { } } public Azure.ResourceManager.DevTestLabs.Models.DevTestLabTargetCostStatus? Status { get { throw null; } set { } } public int? Target { get { throw null; } set { } } + protected virtual Azure.ResourceManager.DevTestLabs.Models.DevTestLabTargetCost JsonModelCreateCore(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } protected virtual void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + protected virtual Azure.ResourceManager.DevTestLabs.Models.DevTestLabTargetCost PersistableModelCreateCore(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + protected virtual System.BinaryData PersistableModelWriteCore(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } Azure.ResourceManager.DevTestLabs.Models.DevTestLabTargetCost System.ClientModel.Primitives.IJsonModel.Create(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } void System.ClientModel.Primitives.IJsonModel.Write(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } Azure.ResourceManager.DevTestLabs.Models.DevTestLabTargetCost System.ClientModel.Primitives.IPersistableModel.Create(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } @@ -2544,6 +2834,7 @@ protected virtual void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer public override int GetHashCode() { throw null; } public static bool operator ==(Azure.ResourceManager.DevTestLabs.Models.DevTestLabTargetCostStatus left, Azure.ResourceManager.DevTestLabs.Models.DevTestLabTargetCostStatus right) { throw null; } public static implicit operator Azure.ResourceManager.DevTestLabs.Models.DevTestLabTargetCostStatus (string value) { throw null; } + public static implicit operator Azure.ResourceManager.DevTestLabs.Models.DevTestLabTargetCostStatus? (string value) { throw null; } public static bool operator !=(Azure.ResourceManager.DevTestLabs.Models.DevTestLabTargetCostStatus left, Azure.ResourceManager.DevTestLabs.Models.DevTestLabTargetCostStatus right) { throw null; } public override string ToString() { throw null; } } @@ -2560,6 +2851,7 @@ protected virtual void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer public override int GetHashCode() { throw null; } public static bool operator ==(Azure.ResourceManager.DevTestLabs.Models.DevTestLabTransportProtocol left, Azure.ResourceManager.DevTestLabs.Models.DevTestLabTransportProtocol right) { throw null; } public static implicit operator Azure.ResourceManager.DevTestLabs.Models.DevTestLabTransportProtocol (string value) { throw null; } + public static implicit operator Azure.ResourceManager.DevTestLabs.Models.DevTestLabTransportProtocol? (string value) { throw null; } public static bool operator !=(Azure.ResourceManager.DevTestLabs.Models.DevTestLabTransportProtocol left, Azure.ResourceManager.DevTestLabs.Models.DevTestLabTransportProtocol right) { throw null; } public override string ToString() { throw null; } } @@ -2577,6 +2869,7 @@ protected virtual void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer public override int GetHashCode() { throw null; } public static bool operator ==(Azure.ResourceManager.DevTestLabs.Models.DevTestLabUsagePermissionType left, Azure.ResourceManager.DevTestLabs.Models.DevTestLabUsagePermissionType right) { throw null; } public static implicit operator Azure.ResourceManager.DevTestLabs.Models.DevTestLabUsagePermissionType (string value) { throw null; } + public static implicit operator Azure.ResourceManager.DevTestLabs.Models.DevTestLabUsagePermissionType? (string value) { throw null; } public static bool operator !=(Azure.ResourceManager.DevTestLabs.Models.DevTestLabUsagePermissionType left, Azure.ResourceManager.DevTestLabs.Models.DevTestLabUsagePermissionType right) { throw null; } public override string ToString() { throw null; } } @@ -2588,7 +2881,10 @@ public DevTestLabUserIdentity() { } public string PrincipalId { get { throw null; } set { } } public string PrincipalName { get { throw null; } set { } } public System.Guid? TenantId { get { throw null; } set { } } + protected virtual Azure.ResourceManager.DevTestLabs.Models.DevTestLabUserIdentity JsonModelCreateCore(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } protected virtual void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + protected virtual Azure.ResourceManager.DevTestLabs.Models.DevTestLabUserIdentity PersistableModelCreateCore(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + protected virtual System.BinaryData PersistableModelWriteCore(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } Azure.ResourceManager.DevTestLabs.Models.DevTestLabUserIdentity System.ClientModel.Primitives.IJsonModel.Create(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } void System.ClientModel.Primitives.IJsonModel.Write(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } Azure.ResourceManager.DevTestLabs.Models.DevTestLabUserIdentity System.ClientModel.Primitives.IPersistableModel.Create(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } @@ -2598,7 +2894,10 @@ protected virtual void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer public partial class DevTestLabUserPatch : Azure.ResourceManager.DevTestLabs.Models.DevTestLabResourcePatch, System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel { public DevTestLabUserPatch() { } + protected override Azure.ResourceManager.DevTestLabs.Models.DevTestLabResourcePatch JsonModelCreateCore(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } protected override void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + protected override Azure.ResourceManager.DevTestLabs.Models.DevTestLabResourcePatch PersistableModelCreateCore(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + protected override System.BinaryData PersistableModelWriteCore(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } Azure.ResourceManager.DevTestLabs.Models.DevTestLabUserPatch System.ClientModel.Primitives.IJsonModel.Create(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } void System.ClientModel.Primitives.IJsonModel.Write(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } Azure.ResourceManager.DevTestLabs.Models.DevTestLabUserPatch System.ClientModel.Primitives.IPersistableModel.Create(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } @@ -2610,17 +2909,37 @@ public partial class DevTestLabUserSecretStore : System.ClientModel.Primitives.I public DevTestLabUserSecretStore() { } public Azure.Core.ResourceIdentifier KeyVaultId { get { throw null; } set { } } public System.Uri KeyVaultUri { get { throw null; } set { } } + protected virtual Azure.ResourceManager.DevTestLabs.Models.DevTestLabUserSecretStore JsonModelCreateCore(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } protected virtual void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + protected virtual Azure.ResourceManager.DevTestLabs.Models.DevTestLabUserSecretStore PersistableModelCreateCore(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + protected virtual System.BinaryData PersistableModelWriteCore(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } Azure.ResourceManager.DevTestLabs.Models.DevTestLabUserSecretStore System.ClientModel.Primitives.IJsonModel.Create(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } void System.ClientModel.Primitives.IJsonModel.Write(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } Azure.ResourceManager.DevTestLabs.Models.DevTestLabUserSecretStore System.ClientModel.Primitives.IPersistableModel.Create(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } string System.ClientModel.Primitives.IPersistableModel.GetFormatFromOptions(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } System.BinaryData System.ClientModel.Primitives.IPersistableModel.Write(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } } + public partial class DevTestLabVhd : System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel + { + internal DevTestLabVhd() { } + public System.Uri Id { get { throw null; } } + protected virtual Azure.ResourceManager.DevTestLabs.Models.DevTestLabVhd JsonModelCreateCore(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + protected virtual void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + protected virtual Azure.ResourceManager.DevTestLabs.Models.DevTestLabVhd PersistableModelCreateCore(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + protected virtual System.BinaryData PersistableModelWriteCore(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + Azure.ResourceManager.DevTestLabs.Models.DevTestLabVhd System.ClientModel.Primitives.IJsonModel.Create(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + void System.ClientModel.Primitives.IJsonModel.Write(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.ResourceManager.DevTestLabs.Models.DevTestLabVhd System.ClientModel.Primitives.IPersistableModel.Create(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + string System.ClientModel.Primitives.IPersistableModel.GetFormatFromOptions(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + System.BinaryData System.ClientModel.Primitives.IPersistableModel.Write(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + } public partial class DevTestLabVirtualNetworkPatch : Azure.ResourceManager.DevTestLabs.Models.DevTestLabResourcePatch, System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel { public DevTestLabVirtualNetworkPatch() { } + protected override Azure.ResourceManager.DevTestLabs.Models.DevTestLabResourcePatch JsonModelCreateCore(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } protected override void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + protected override Azure.ResourceManager.DevTestLabs.Models.DevTestLabResourcePatch PersistableModelCreateCore(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + protected override System.BinaryData PersistableModelWriteCore(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } Azure.ResourceManager.DevTestLabs.Models.DevTestLabVirtualNetworkPatch System.ClientModel.Primitives.IJsonModel.Create(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } void System.ClientModel.Primitives.IJsonModel.Write(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } Azure.ResourceManager.DevTestLabs.Models.DevTestLabVirtualNetworkPatch System.ClientModel.Primitives.IPersistableModel.Create(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } @@ -2631,7 +2950,10 @@ public partial class DevTestLabVmApplyArtifactsContent : System.ClientModel.Prim { public DevTestLabVmApplyArtifactsContent() { } public System.Collections.Generic.IList Artifacts { get { throw null; } } + protected virtual Azure.ResourceManager.DevTestLabs.Models.DevTestLabVmApplyArtifactsContent JsonModelCreateCore(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } protected virtual void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + protected virtual Azure.ResourceManager.DevTestLabs.Models.DevTestLabVmApplyArtifactsContent PersistableModelCreateCore(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + protected virtual System.BinaryData PersistableModelWriteCore(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } Azure.ResourceManager.DevTestLabs.Models.DevTestLabVmApplyArtifactsContent System.ClientModel.Primitives.IJsonModel.Create(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } void System.ClientModel.Primitives.IJsonModel.Write(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } Azure.ResourceManager.DevTestLabs.Models.DevTestLabVmApplyArtifactsContent System.ClientModel.Primitives.IPersistableModel.Create(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } @@ -2668,7 +2990,10 @@ public DevTestLabVmCreationContent() { } public string StorageType { get { throw null; } set { } } public System.Collections.Generic.IDictionary Tags { get { throw null; } } public string UserName { get { throw null; } set { } } + protected virtual Azure.ResourceManager.DevTestLabs.Models.DevTestLabVmCreationContent JsonModelCreateCore(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } protected virtual void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + protected virtual Azure.ResourceManager.DevTestLabs.Models.DevTestLabVmCreationContent PersistableModelCreateCore(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + protected virtual System.BinaryData PersistableModelWriteCore(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } Azure.ResourceManager.DevTestLabs.Models.DevTestLabVmCreationContent System.ClientModel.Primitives.IJsonModel.Create(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } void System.ClientModel.Primitives.IJsonModel.Write(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } Azure.ResourceManager.DevTestLabs.Models.DevTestLabVmCreationContent System.ClientModel.Primitives.IPersistableModel.Create(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } @@ -2689,6 +3014,7 @@ protected virtual void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer public override int GetHashCode() { throw null; } public static bool operator ==(Azure.ResourceManager.DevTestLabs.Models.DevTestLabVmCreationSource left, Azure.ResourceManager.DevTestLabs.Models.DevTestLabVmCreationSource right) { throw null; } public static implicit operator Azure.ResourceManager.DevTestLabs.Models.DevTestLabVmCreationSource (string value) { throw null; } + public static implicit operator Azure.ResourceManager.DevTestLabs.Models.DevTestLabVmCreationSource? (string value) { throw null; } public static bool operator !=(Azure.ResourceManager.DevTestLabs.Models.DevTestLabVmCreationSource left, Azure.ResourceManager.DevTestLabs.Models.DevTestLabVmCreationSource right) { throw null; } public override string ToString() { throw null; } } @@ -2696,7 +3022,10 @@ public partial class DevTestLabVmDetachDataDiskContent : System.ClientModel.Prim { public DevTestLabVmDetachDataDiskContent() { } public Azure.Core.ResourceIdentifier ExistingLabDiskId { get { throw null; } set { } } + protected virtual Azure.ResourceManager.DevTestLabs.Models.DevTestLabVmDetachDataDiskContent JsonModelCreateCore(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } protected virtual void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + protected virtual Azure.ResourceManager.DevTestLabs.Models.DevTestLabVmDetachDataDiskContent PersistableModelCreateCore(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + protected virtual System.BinaryData PersistableModelWriteCore(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } Azure.ResourceManager.DevTestLabs.Models.DevTestLabVmDetachDataDiskContent System.ClientModel.Primitives.IJsonModel.Create(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } void System.ClientModel.Primitives.IJsonModel.Write(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } Azure.ResourceManager.DevTestLabs.Models.DevTestLabVmDetachDataDiskContent System.ClientModel.Primitives.IPersistableModel.Create(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } @@ -2706,7 +3035,10 @@ protected virtual void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer public partial class DevTestLabVmPatch : Azure.ResourceManager.DevTestLabs.Models.DevTestLabResourcePatch, System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel { public DevTestLabVmPatch() { } + protected override Azure.ResourceManager.DevTestLabs.Models.DevTestLabResourcePatch JsonModelCreateCore(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } protected override void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + protected override Azure.ResourceManager.DevTestLabs.Models.DevTestLabResourcePatch PersistableModelCreateCore(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + protected override System.BinaryData PersistableModelWriteCore(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } Azure.ResourceManager.DevTestLabs.Models.DevTestLabVmPatch System.ClientModel.Primitives.IJsonModel.Create(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } void System.ClientModel.Primitives.IJsonModel.Write(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } Azure.ResourceManager.DevTestLabs.Models.DevTestLabVmPatch System.ClientModel.Primitives.IPersistableModel.Create(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } @@ -2717,7 +3049,10 @@ public partial class DevTestLabVmResizeContent : System.ClientModel.Primitives.I { public DevTestLabVmResizeContent() { } public string Size { get { throw null; } set { } } + protected virtual Azure.ResourceManager.DevTestLabs.Models.DevTestLabVmResizeContent JsonModelCreateCore(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } protected virtual void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + protected virtual Azure.ResourceManager.DevTestLabs.Models.DevTestLabVmResizeContent PersistableModelCreateCore(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + protected virtual System.BinaryData PersistableModelWriteCore(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } Azure.ResourceManager.DevTestLabs.Models.DevTestLabVmResizeContent System.ClientModel.Primitives.IJsonModel.Create(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } void System.ClientModel.Primitives.IJsonModel.Write(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } Azure.ResourceManager.DevTestLabs.Models.DevTestLabVmResizeContent System.ClientModel.Primitives.IPersistableModel.Create(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } @@ -2729,7 +3064,10 @@ public partial class DevTestLabWeekDetails : System.ClientModel.Primitives.IJson public DevTestLabWeekDetails() { } public string Time { get { throw null; } set { } } public System.Collections.Generic.IList Weekdays { get { throw null; } } + protected virtual Azure.ResourceManager.DevTestLabs.Models.DevTestLabWeekDetails JsonModelCreateCore(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } protected virtual void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + protected virtual Azure.ResourceManager.DevTestLabs.Models.DevTestLabWeekDetails PersistableModelCreateCore(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + protected virtual System.BinaryData PersistableModelWriteCore(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } Azure.ResourceManager.DevTestLabs.Models.DevTestLabWeekDetails System.ClientModel.Primitives.IJsonModel.Create(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } void System.ClientModel.Primitives.IJsonModel.Write(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } Azure.ResourceManager.DevTestLabs.Models.DevTestLabWeekDetails System.ClientModel.Primitives.IPersistableModel.Create(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } @@ -2750,6 +3088,7 @@ protected virtual void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer public override int GetHashCode() { throw null; } public static bool operator ==(Azure.ResourceManager.DevTestLabs.Models.WindowsOSState left, Azure.ResourceManager.DevTestLabs.Models.WindowsOSState right) { throw null; } public static implicit operator Azure.ResourceManager.DevTestLabs.Models.WindowsOSState (string value) { throw null; } + public static implicit operator Azure.ResourceManager.DevTestLabs.Models.WindowsOSState? (string value) { throw null; } public static bool operator !=(Azure.ResourceManager.DevTestLabs.Models.WindowsOSState left, Azure.ResourceManager.DevTestLabs.Models.WindowsOSState right) { throw null; } public override string ToString() { throw null; } } diff --git a/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/api/Azure.ResourceManager.DevTestLabs.net8.0.cs b/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/api/Azure.ResourceManager.DevTestLabs.net8.0.cs index d598d5b1b1b4..3fa28f3e72e7 100644 --- a/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/api/Azure.ResourceManager.DevTestLabs.net8.0.cs +++ b/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/api/Azure.ResourceManager.DevTestLabs.net8.0.cs @@ -32,7 +32,10 @@ public DevTestLabArmTemplateData(Azure.Core.AzureLocation location) { } public bool? IsEnabled { get { throw null; } } public System.Collections.Generic.IReadOnlyList ParametersValueFilesInfo { get { throw null; } } public string Publisher { get { throw null; } } + protected virtual Azure.ResourceManager.Models.ResourceData JsonModelCreateCore(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } protected override void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + protected virtual Azure.ResourceManager.Models.ResourceData PersistableModelCreateCore(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + protected virtual System.BinaryData PersistableModelWriteCore(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } Azure.ResourceManager.DevTestLabs.DevTestLabArmTemplateData System.ClientModel.Primitives.IJsonModel.Create(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } void System.ClientModel.Primitives.IJsonModel.Write(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } Azure.ResourceManager.DevTestLabs.DevTestLabArmTemplateData System.ClientModel.Primitives.IPersistableModel.Create(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } @@ -80,7 +83,10 @@ public DevTestLabArtifactData(Azure.Core.AzureLocation location) { } public string Publisher { get { throw null; } } public string TargetOSType { get { throw null; } } public string Title { get { throw null; } } + protected virtual Azure.ResourceManager.Models.ResourceData JsonModelCreateCore(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } protected override void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + protected virtual Azure.ResourceManager.Models.ResourceData PersistableModelCreateCore(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + protected virtual System.BinaryData PersistableModelWriteCore(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } Azure.ResourceManager.DevTestLabs.DevTestLabArtifactData System.ClientModel.Primitives.IJsonModel.Create(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } void System.ClientModel.Primitives.IJsonModel.Write(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } Azure.ResourceManager.DevTestLabs.DevTestLabArtifactData System.ClientModel.Primitives.IPersistableModel.Create(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } @@ -135,7 +141,10 @@ public DevTestLabArtifactSourceData(Azure.Core.AzureLocation location) { } public Azure.ResourceManager.DevTestLabs.Models.DevTestLabEnableStatus? Status { get { throw null; } set { } } public System.Guid? UniqueIdentifier { get { throw null; } } public System.Uri Uri { get { throw null; } set { } } + protected virtual Azure.ResourceManager.Models.ResourceData JsonModelCreateCore(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } protected override void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + protected virtual Azure.ResourceManager.Models.ResourceData PersistableModelCreateCore(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + protected virtual System.BinaryData PersistableModelWriteCore(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } Azure.ResourceManager.DevTestLabs.DevTestLabArtifactSourceData System.ClientModel.Primitives.IJsonModel.Create(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } void System.ClientModel.Primitives.IJsonModel.Write(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } Azure.ResourceManager.DevTestLabs.DevTestLabArtifactSourceData System.ClientModel.Primitives.IPersistableModel.Create(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } @@ -215,7 +224,10 @@ public DevTestLabCostData(Azure.Core.AzureLocation location) { } public System.DateTimeOffset? StartOn { get { throw null; } set { } } public Azure.ResourceManager.DevTestLabs.Models.DevTestLabTargetCost TargetCost { get { throw null; } set { } } public System.Guid? UniqueIdentifier { get { throw null; } } + protected virtual Azure.ResourceManager.Models.ResourceData JsonModelCreateCore(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } protected override void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + protected virtual Azure.ResourceManager.Models.ResourceData PersistableModelCreateCore(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + protected virtual System.BinaryData PersistableModelWriteCore(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } Azure.ResourceManager.DevTestLabs.DevTestLabCostData System.ClientModel.Primitives.IJsonModel.Create(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } void System.ClientModel.Primitives.IJsonModel.Write(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } Azure.ResourceManager.DevTestLabs.DevTestLabCostData System.ClientModel.Primitives.IPersistableModel.Create(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } @@ -277,7 +289,10 @@ public DevTestLabCustomImageData(Azure.Core.AzureLocation location) { } public System.Guid? UniqueIdentifier { get { throw null; } } public Azure.ResourceManager.DevTestLabs.Models.DevTestLabCustomImageVhd Vhd { get { throw null; } set { } } public Azure.ResourceManager.DevTestLabs.Models.DevTestLabCustomImageVm Vm { get { throw null; } set { } } + protected virtual Azure.ResourceManager.Models.ResourceData JsonModelCreateCore(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } protected override void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + protected virtual Azure.ResourceManager.Models.ResourceData PersistableModelCreateCore(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + protected virtual System.BinaryData PersistableModelWriteCore(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } Azure.ResourceManager.DevTestLabs.DevTestLabCustomImageData System.ClientModel.Primitives.IJsonModel.Create(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } void System.ClientModel.Primitives.IJsonModel.Write(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } Azure.ResourceManager.DevTestLabs.DevTestLabCustomImageData System.ClientModel.Primitives.IPersistableModel.Create(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } @@ -332,7 +347,10 @@ public DevTestLabData(Azure.Core.AzureLocation location) { } public System.Guid? UniqueIdentifier { get { throw null; } } public string VaultName { get { throw null; } } public string VmCreationResourceGroup { get { throw null; } } + protected virtual Azure.ResourceManager.Models.ResourceData JsonModelCreateCore(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } protected override void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + protected virtual Azure.ResourceManager.Models.ResourceData PersistableModelCreateCore(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + protected virtual System.BinaryData PersistableModelWriteCore(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } Azure.ResourceManager.DevTestLabs.DevTestLabData System.ClientModel.Primitives.IJsonModel.Create(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } void System.ClientModel.Primitives.IJsonModel.Write(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } Azure.ResourceManager.DevTestLabs.DevTestLabData System.ClientModel.Primitives.IPersistableModel.Create(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } @@ -370,7 +388,10 @@ public DevTestLabDiskData(Azure.Core.AzureLocation location) { } public string ProvisioningState { get { throw null; } } public string StorageAccountId { get { throw null; } set { } } public System.Guid? UniqueIdentifier { get { throw null; } } + protected virtual Azure.ResourceManager.Models.ResourceData JsonModelCreateCore(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } protected override void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + protected virtual Azure.ResourceManager.Models.ResourceData PersistableModelCreateCore(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + protected virtual System.BinaryData PersistableModelWriteCore(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } Azure.ResourceManager.DevTestLabs.DevTestLabDiskData System.ClientModel.Primitives.IJsonModel.Create(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } void System.ClientModel.Primitives.IJsonModel.Write(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } Azure.ResourceManager.DevTestLabs.DevTestLabDiskData System.ClientModel.Primitives.IPersistableModel.Create(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } @@ -432,7 +453,10 @@ public DevTestLabEnvironmentData(Azure.Core.AzureLocation location) { } public string ProvisioningState { get { throw null; } } public string ResourceGroupId { get { throw null; } } public System.Guid? UniqueIdentifier { get { throw null; } } + protected virtual Azure.ResourceManager.Models.ResourceData JsonModelCreateCore(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } protected override void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + protected virtual Azure.ResourceManager.Models.ResourceData PersistableModelCreateCore(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + protected virtual System.BinaryData PersistableModelWriteCore(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } Azure.ResourceManager.DevTestLabs.DevTestLabEnvironmentData System.ClientModel.Primitives.IJsonModel.Create(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } void System.ClientModel.Primitives.IJsonModel.Write(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } Azure.ResourceManager.DevTestLabs.DevTestLabEnvironmentData System.ClientModel.Primitives.IPersistableModel.Create(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } @@ -492,7 +516,10 @@ public DevTestLabFormulaData(Azure.Core.AzureLocation location) { } public string OSType { get { throw null; } set { } } public string ProvisioningState { get { throw null; } } public System.Guid? UniqueIdentifier { get { throw null; } } + protected virtual Azure.ResourceManager.Models.ResourceData JsonModelCreateCore(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } protected override void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + protected virtual Azure.ResourceManager.Models.ResourceData PersistableModelCreateCore(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + protected virtual System.BinaryData PersistableModelWriteCore(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } Azure.ResourceManager.DevTestLabs.DevTestLabFormulaData System.ClientModel.Primitives.IJsonModel.Create(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } void System.ClientModel.Primitives.IJsonModel.Write(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } Azure.ResourceManager.DevTestLabs.DevTestLabFormulaData System.ClientModel.Primitives.IPersistableModel.Create(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } @@ -598,7 +625,10 @@ public DevTestLabNotificationChannelData(Azure.Core.AzureLocation location) { } public string ProvisioningState { get { throw null; } } public System.Guid? UniqueIdentifier { get { throw null; } } public System.Uri WebHookUri { get { throw null; } set { } } + protected virtual Azure.ResourceManager.Models.ResourceData JsonModelCreateCore(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } protected override void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + protected virtual Azure.ResourceManager.Models.ResourceData PersistableModelCreateCore(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + protected virtual System.BinaryData PersistableModelWriteCore(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } Azure.ResourceManager.DevTestLabs.DevTestLabNotificationChannelData System.ClientModel.Primitives.IJsonModel.Create(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } void System.ClientModel.Primitives.IJsonModel.Write(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } Azure.ResourceManager.DevTestLabs.DevTestLabNotificationChannelData System.ClientModel.Primitives.IPersistableModel.Create(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } @@ -661,7 +691,10 @@ public DevTestLabPolicyData(Azure.Core.AzureLocation location) { } public Azure.ResourceManager.DevTestLabs.Models.DevTestLabPolicyStatus? Status { get { throw null; } set { } } public string Threshold { get { throw null; } set { } } public System.Guid? UniqueIdentifier { get { throw null; } } + protected virtual Azure.ResourceManager.Models.ResourceData JsonModelCreateCore(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } protected override void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + protected virtual Azure.ResourceManager.Models.ResourceData PersistableModelCreateCore(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + protected virtual System.BinaryData PersistableModelWriteCore(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } Azure.ResourceManager.DevTestLabs.DevTestLabPolicyData System.ClientModel.Primitives.IJsonModel.Create(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } void System.ClientModel.Primitives.IJsonModel.Write(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } Azure.ResourceManager.DevTestLabs.DevTestLabPolicyData System.ClientModel.Primitives.IPersistableModel.Create(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } @@ -743,6 +776,8 @@ protected DevTestLabResource() { } public virtual Azure.Response GetDevTestLabUser(string name, string expand = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } public virtual System.Threading.Tasks.Task> GetDevTestLabUserAsync(string name, string expand = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } public virtual Azure.ResourceManager.DevTestLabs.DevTestLabUserCollection GetDevTestLabUsers() { throw null; } + public virtual Azure.Pageable GetDevTestLabVhds(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.AsyncPageable GetDevTestLabVhdsAsync(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } public virtual Azure.Response GetDevTestLabVirtualNetwork(string name, string expand = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } public virtual System.Threading.Tasks.Task> GetDevTestLabVirtualNetworkAsync(string name, string expand = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } public virtual Azure.ResourceManager.DevTestLabs.DevTestLabVirtualNetworkCollection GetDevTestLabVirtualNetworks() { throw null; } @@ -751,7 +786,9 @@ protected DevTestLabResource() { } public virtual Azure.ResourceManager.DevTestLabs.DevTestLabVmCollection GetDevTestLabVms() { throw null; } public virtual Azure.Pageable GetGalleryImages(string expand = null, string filter = null, int? top = default(int?), string orderby = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } public virtual Azure.AsyncPageable GetGalleryImagesAsync(string expand = null, string filter = null, int? top = default(int?), string orderby = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + [System.ObsoleteAttribute("This operation is not supported. Please use the method GetDevTestLabVhds instead.", false)] public virtual Azure.Pageable GetVhds(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + [System.ObsoleteAttribute("This operation is not supported. Please use the method GetDevTestLabVhdsAsync instead.", false)] public virtual Azure.AsyncPageable GetVhdsAsync(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } public virtual Azure.ResourceManager.ArmOperation ImportVm(Azure.WaitUntil waitUntil, Azure.ResourceManager.DevTestLabs.Models.DevTestLabImportVmContent content, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } public virtual System.Threading.Tasks.Task ImportVmAsync(Azure.WaitUntil waitUntil, Azure.ResourceManager.DevTestLabs.Models.DevTestLabImportVmContent content, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } @@ -800,7 +837,10 @@ public DevTestLabScheduleData(Azure.Core.AzureLocation location) { } public string TimeZoneId { get { throw null; } set { } } public System.Guid? UniqueIdentifier { get { throw null; } } public Azure.ResourceManager.DevTestLabs.Models.DevTestLabWeekDetails WeeklyRecurrence { get { throw null; } set { } } + protected virtual Azure.ResourceManager.Models.ResourceData JsonModelCreateCore(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } protected override void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + protected virtual Azure.ResourceManager.Models.ResourceData PersistableModelCreateCore(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + protected virtual System.BinaryData PersistableModelWriteCore(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } Azure.ResourceManager.DevTestLabs.DevTestLabScheduleData System.ClientModel.Primitives.IJsonModel.Create(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } void System.ClientModel.Primitives.IJsonModel.Write(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } Azure.ResourceManager.DevTestLabs.DevTestLabScheduleData System.ClientModel.Primitives.IPersistableModel.Create(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } @@ -821,6 +861,8 @@ protected DevTestLabScheduleResource() { } public virtual Azure.ResourceManager.ArmOperation Execute(Azure.WaitUntil waitUntil, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } public virtual System.Threading.Tasks.Task ExecuteAsync(Azure.WaitUntil waitUntil, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } public virtual Azure.Response Get(string expand = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Pageable GetApplicable(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.AsyncPageable GetApplicableAsync(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } public virtual System.Threading.Tasks.Task> GetAsync(string expand = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } public virtual Azure.Response RemoveTag(string key, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } public virtual System.Threading.Tasks.Task> RemoveTagAsync(string key, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } @@ -857,7 +899,10 @@ public DevTestLabSecretData(Azure.Core.AzureLocation location) { } public string ProvisioningState { get { throw null; } } public System.Guid? UniqueIdentifier { get { throw null; } } public string Value { get { throw null; } set { } } + protected virtual Azure.ResourceManager.Models.ResourceData JsonModelCreateCore(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } protected override void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + protected virtual Azure.ResourceManager.Models.ResourceData PersistableModelCreateCore(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + protected virtual System.BinaryData PersistableModelWriteCore(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } Azure.ResourceManager.DevTestLabs.DevTestLabSecretData System.ClientModel.Primitives.IJsonModel.Create(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } void System.ClientModel.Primitives.IJsonModel.Write(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } Azure.ResourceManager.DevTestLabs.DevTestLabSecretData System.ClientModel.Primitives.IPersistableModel.Create(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } @@ -914,7 +959,10 @@ public DevTestLabServiceFabricData(Azure.Core.AzureLocation location) { } public string ExternalServiceFabricId { get { throw null; } set { } } public string ProvisioningState { get { throw null; } } public System.Guid? UniqueIdentifier { get { throw null; } } + protected virtual Azure.ResourceManager.Models.ResourceData JsonModelCreateCore(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } protected override void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + protected virtual Azure.ResourceManager.Models.ResourceData PersistableModelCreateCore(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + protected virtual System.BinaryData PersistableModelWriteCore(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } Azure.ResourceManager.DevTestLabs.DevTestLabServiceFabricData System.ClientModel.Primitives.IJsonModel.Create(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } void System.ClientModel.Primitives.IJsonModel.Write(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } Azure.ResourceManager.DevTestLabs.DevTestLabServiceFabricData System.ClientModel.Primitives.IPersistableModel.Create(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } @@ -1015,7 +1063,10 @@ public partial class DevTestLabServiceRunnerData : Azure.ResourceManager.Models. { public DevTestLabServiceRunnerData(Azure.Core.AzureLocation location) { } public Azure.ResourceManager.DevTestLabs.Models.DevTestLabManagedIdentity Identity { get { throw null; } set { } } + protected virtual Azure.ResourceManager.Models.ResourceData JsonModelCreateCore(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } protected override void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + protected virtual Azure.ResourceManager.Models.ResourceData PersistableModelCreateCore(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + protected virtual System.BinaryData PersistableModelWriteCore(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } Azure.ResourceManager.DevTestLabs.DevTestLabServiceRunnerData System.ClientModel.Primitives.IJsonModel.Create(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } void System.ClientModel.Primitives.IJsonModel.Write(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } Azure.ResourceManager.DevTestLabs.DevTestLabServiceRunnerData System.ClientModel.Primitives.IPersistableModel.Create(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } @@ -1106,7 +1157,10 @@ public DevTestLabUserData(Azure.Core.AzureLocation location) { } public string ProvisioningState { get { throw null; } } public Azure.ResourceManager.DevTestLabs.Models.DevTestLabUserSecretStore SecretStore { get { throw null; } set { } } public System.Guid? UniqueIdentifier { get { throw null; } } + protected virtual Azure.ResourceManager.Models.ResourceData JsonModelCreateCore(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } protected override void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + protected virtual Azure.ResourceManager.Models.ResourceData PersistableModelCreateCore(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + protected virtual System.BinaryData PersistableModelWriteCore(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } Azure.ResourceManager.DevTestLabs.DevTestLabUserData System.ClientModel.Primitives.IJsonModel.Create(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } void System.ClientModel.Primitives.IJsonModel.Write(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } Azure.ResourceManager.DevTestLabs.DevTestLabUserData System.ClientModel.Primitives.IPersistableModel.Create(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } @@ -1178,7 +1232,10 @@ public DevTestLabVirtualNetworkData(Azure.Core.AzureLocation location) { } public string ProvisioningState { get { throw null; } } public System.Collections.Generic.IList SubnetOverrides { get { throw null; } } public System.Guid? UniqueIdentifier { get { throw null; } } + protected virtual Azure.ResourceManager.Models.ResourceData JsonModelCreateCore(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } protected override void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + protected virtual Azure.ResourceManager.Models.ResourceData PersistableModelCreateCore(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + protected virtual System.BinaryData PersistableModelWriteCore(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } Azure.ResourceManager.DevTestLabs.DevTestLabVirtualNetworkData System.ClientModel.Primitives.IJsonModel.Create(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } void System.ClientModel.Primitives.IJsonModel.Write(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } Azure.ResourceManager.DevTestLabs.DevTestLabVirtualNetworkData System.ClientModel.Primitives.IPersistableModel.Create(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } @@ -1265,7 +1322,10 @@ public DevTestLabVmData(Azure.Core.AzureLocation location) { } public System.Guid? UniqueIdentifier { get { throw null; } } public string UserName { get { throw null; } set { } } public Azure.ResourceManager.DevTestLabs.Models.DevTestLabVmCreationSource? VmCreationSource { get { throw null; } } + protected virtual Azure.ResourceManager.Models.ResourceData JsonModelCreateCore(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } protected override void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + protected virtual Azure.ResourceManager.Models.ResourceData PersistableModelCreateCore(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + protected virtual System.BinaryData PersistableModelWriteCore(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } Azure.ResourceManager.DevTestLabs.DevTestLabVmData System.ClientModel.Primitives.IJsonModel.Create(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } void System.ClientModel.Primitives.IJsonModel.Write(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } Azure.ResourceManager.DevTestLabs.DevTestLabVmData System.ClientModel.Primitives.IPersistableModel.Create(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } @@ -1430,33 +1490,57 @@ public static partial class ArmDevTestLabsModelFactory public static Azure.ResourceManager.DevTestLabs.Models.DevTestLabArmTemplateInfo DevTestLabArmTemplateInfo(System.BinaryData template = null, System.BinaryData parameters = null) { throw null; } public static Azure.ResourceManager.DevTestLabs.DevTestLabArtifactData DevTestLabArtifactData(Azure.Core.ResourceIdentifier id = null, string name = null, Azure.Core.ResourceType resourceType = default(Azure.Core.ResourceType), Azure.ResourceManager.Models.SystemData systemData = null, System.Collections.Generic.IDictionary tags = null, Azure.Core.AzureLocation location = default(Azure.Core.AzureLocation), string title = null, string description = null, string publisher = null, string filePath = null, string icon = null, string targetOSType = null, System.BinaryData parameters = null, System.DateTimeOffset? createdOn = default(System.DateTimeOffset?)) { throw null; } public static Azure.ResourceManager.DevTestLabs.Models.DevTestLabArtifactDeploymentStatus DevTestLabArtifactDeploymentStatus(string deploymentStatus = null, int? artifactsApplied = default(int?), int? totalArtifacts = default(int?)) { throw null; } + public static Azure.ResourceManager.DevTestLabs.Models.DevTestLabArtifactGenerateArmTemplateContent DevTestLabArtifactGenerateArmTemplateContent(string vmName = null, System.Collections.Generic.IEnumerable parameters = null, Azure.Core.AzureLocation? location = default(Azure.Core.AzureLocation?), Azure.ResourceManager.DevTestLabs.Models.DevTestLabFileUploadOption? fileUploadOptions = default(Azure.ResourceManager.DevTestLabs.Models.DevTestLabFileUploadOption?)) { throw null; } + public static Azure.ResourceManager.DevTestLabs.Models.DevTestLabArtifactInstallInfo DevTestLabArtifactInstallInfo(string artifactId = null, string artifactTitle = null, System.Collections.Generic.IEnumerable parameters = null, string status = null, string deploymentStatusMessage = null, string vmExtensionStatusMessage = null, System.DateTimeOffset? installOn = default(System.DateTimeOffset?)) { throw null; } public static Azure.ResourceManager.DevTestLabs.DevTestLabArtifactSourceData DevTestLabArtifactSourceData(Azure.Core.ResourceIdentifier id = null, string name = null, Azure.Core.ResourceType resourceType = default(Azure.Core.ResourceType), Azure.ResourceManager.Models.SystemData systemData = null, System.Collections.Generic.IDictionary tags = null, Azure.Core.AzureLocation location = default(Azure.Core.AzureLocation), string displayName = null, System.Uri uri = null, Azure.ResourceManager.DevTestLabs.Models.DevTestLabSourceControlType? sourceType = default(Azure.ResourceManager.DevTestLabs.Models.DevTestLabSourceControlType?), string folderPath = null, string armTemplateFolderPath = null, string branchRef = null, string securityToken = null, Azure.ResourceManager.DevTestLabs.Models.DevTestLabEnableStatus? status = default(Azure.ResourceManager.DevTestLabs.Models.DevTestLabEnableStatus?), System.DateTimeOffset? createdOn = default(System.DateTimeOffset?), string provisioningState = null, System.Guid? uniqueIdentifier = default(System.Guid?)) { throw null; } + public static Azure.ResourceManager.DevTestLabs.Models.DevTestLabArtifactSourcePatch DevTestLabArtifactSourcePatch(System.Collections.Generic.IDictionary tags = null) { throw null; } public static Azure.ResourceManager.DevTestLabs.DevTestLabCostData DevTestLabCostData(Azure.Core.ResourceIdentifier id = null, string name = null, Azure.Core.ResourceType resourceType = default(Azure.Core.ResourceType), Azure.ResourceManager.Models.SystemData systemData = null, System.Collections.Generic.IDictionary tags = null, Azure.Core.AzureLocation location = default(Azure.Core.AzureLocation), Azure.ResourceManager.DevTestLabs.Models.DevTestLabTargetCost targetCost = null, double? estimatedLabCost = default(double?), System.Collections.Generic.IEnumerable labCostDetails = null, System.Collections.Generic.IEnumerable resourceCosts = null, string currencyCode = null, System.DateTimeOffset? startOn = default(System.DateTimeOffset?), System.DateTimeOffset? endOn = default(System.DateTimeOffset?), System.DateTimeOffset? createdOn = default(System.DateTimeOffset?), string provisioningState = null, System.Guid? uniqueIdentifier = default(System.Guid?)) { throw null; } public static Azure.ResourceManager.DevTestLabs.Models.DevTestLabCostDetails DevTestLabCostDetails(System.DateTimeOffset? on = default(System.DateTimeOffset?), double? cost = default(double?), Azure.ResourceManager.DevTestLabs.Models.DevTestLabCostType? costType = default(Azure.ResourceManager.DevTestLabs.Models.DevTestLabCostType?)) { throw null; } public static Azure.ResourceManager.DevTestLabs.DevTestLabCustomImageData DevTestLabCustomImageData(Azure.Core.ResourceIdentifier id = null, string name = null, Azure.Core.ResourceType resourceType = default(Azure.Core.ResourceType), Azure.ResourceManager.Models.SystemData systemData = null, System.Collections.Generic.IDictionary tags = null, Azure.Core.AzureLocation location = default(Azure.Core.AzureLocation), Azure.ResourceManager.DevTestLabs.Models.DevTestLabCustomImageVm vm = null, Azure.ResourceManager.DevTestLabs.Models.DevTestLabCustomImageVhd vhd = null, string description = null, string author = null, System.DateTimeOffset? createdOn = default(System.DateTimeOffset?), string managedImageId = null, string managedSnapshotId = null, System.Collections.Generic.IEnumerable dataDiskStorageInfo = null, Azure.ResourceManager.DevTestLabs.Models.DevTestLabCustomImagePlan customImagePlan = null, bool? isPlanAuthorized = default(bool?), string provisioningState = null, System.Guid? uniqueIdentifier = default(System.Guid?)) { throw null; } + public static Azure.ResourceManager.DevTestLabs.Models.DevTestLabCustomImagePatch DevTestLabCustomImagePatch(System.Collections.Generic.IDictionary tags = null) { throw null; } public static Azure.ResourceManager.DevTestLabs.DevTestLabData DevTestLabData(Azure.Core.ResourceIdentifier id = null, string name = null, Azure.Core.ResourceType resourceType = default(Azure.Core.ResourceType), Azure.ResourceManager.Models.SystemData systemData = null, System.Collections.Generic.IDictionary tags = null, Azure.Core.AzureLocation location = default(Azure.Core.AzureLocation), string defaultStorageAccount = null, string defaultPremiumStorageAccount = null, string artifactsStorageAccount = null, string premiumDataDiskStorageAccount = null, string vaultName = null, Azure.ResourceManager.DevTestLabs.Models.DevTestLabStorageType? labStorageType = default(Azure.ResourceManager.DevTestLabs.Models.DevTestLabStorageType?), System.Collections.Generic.IEnumerable mandatoryArtifactsResourceIdsLinux = null, System.Collections.Generic.IEnumerable mandatoryArtifactsResourceIdsWindows = null, System.DateTimeOffset? createdOn = default(System.DateTimeOffset?), Azure.ResourceManager.DevTestLabs.Models.DevTestLabPremiumDataDisk? premiumDataDisks = default(Azure.ResourceManager.DevTestLabs.Models.DevTestLabPremiumDataDisk?), Azure.ResourceManager.DevTestLabs.Models.DevTestLabEnvironmentPermission? environmentPermission = default(Azure.ResourceManager.DevTestLabs.Models.DevTestLabEnvironmentPermission?), Azure.ResourceManager.DevTestLabs.Models.DevTestLabAnnouncement announcement = null, Azure.ResourceManager.DevTestLabs.Models.DevTestLabSupport support = null, string vmCreationResourceGroup = null, string publicIPId = null, string loadBalancerId = null, string networkSecurityGroupId = null, System.Collections.Generic.IDictionary extendedProperties = null, string provisioningState = null, System.Guid? uniqueIdentifier = default(System.Guid?)) { throw null; } public static Azure.ResourceManager.DevTestLabs.DevTestLabDiskData DevTestLabDiskData(Azure.Core.ResourceIdentifier id = null, string name = null, Azure.Core.ResourceType resourceType = default(Azure.Core.ResourceType), Azure.ResourceManager.Models.SystemData systemData = null, System.Collections.Generic.IDictionary tags = null, Azure.Core.AzureLocation location = default(Azure.Core.AzureLocation), Azure.ResourceManager.DevTestLabs.Models.DevTestLabStorageType? diskType = default(Azure.ResourceManager.DevTestLabs.Models.DevTestLabStorageType?), int? diskSizeGiB = default(int?), Azure.Core.ResourceIdentifier leasedByLabVmId = null, string diskBlobName = null, System.Uri diskUri = null, string storageAccountId = null, System.DateTimeOffset? createdOn = default(System.DateTimeOffset?), string hostCaching = null, Azure.Core.ResourceIdentifier managedDiskId = null, string provisioningState = null, System.Guid? uniqueIdentifier = default(System.Guid?)) { throw null; } + public static Azure.ResourceManager.DevTestLabs.Models.DevTestLabDiskPatch DevTestLabDiskPatch(System.Collections.Generic.IDictionary tags = null) { throw null; } public static Azure.ResourceManager.DevTestLabs.DevTestLabEnvironmentData DevTestLabEnvironmentData(Azure.Core.ResourceIdentifier id = null, string name = null, Azure.Core.ResourceType resourceType = default(Azure.Core.ResourceType), Azure.ResourceManager.Models.SystemData systemData = null, System.Collections.Generic.IDictionary tags = null, Azure.Core.AzureLocation location = default(Azure.Core.AzureLocation), Azure.ResourceManager.DevTestLabs.Models.DevTestLabEnvironmentDeployment deploymentProperties = null, string armTemplateDisplayName = null, string resourceGroupId = null, string createdByUser = null, string provisioningState = null, System.Guid? uniqueIdentifier = default(System.Guid?)) { throw null; } + public static Azure.ResourceManager.DevTestLabs.Models.DevTestLabEnvironmentDeployment DevTestLabEnvironmentDeployment(Azure.Core.ResourceIdentifier armTemplateId = null, System.Collections.Generic.IEnumerable parameters = null) { throw null; } + public static Azure.ResourceManager.DevTestLabs.Models.DevTestLabEnvironmentPatch DevTestLabEnvironmentPatch(System.Collections.Generic.IDictionary tags = null) { throw null; } + public static Azure.ResourceManager.DevTestLabs.Models.DevTestLabEvaluatePoliciesContent DevTestLabEvaluatePoliciesContent(System.Collections.Generic.IEnumerable policies = null) { throw null; } public static Azure.ResourceManager.DevTestLabs.Models.DevTestLabEvaluatePoliciesResult DevTestLabEvaluatePoliciesResult(System.Collections.Generic.IEnumerable results = null) { throw null; } public static Azure.ResourceManager.DevTestLabs.Models.DevTestLabExternalSubnet DevTestLabExternalSubnet(Azure.Core.ResourceIdentifier id = null, string name = null) { throw null; } public static Azure.ResourceManager.DevTestLabs.DevTestLabFormulaData DevTestLabFormulaData(Azure.Core.ResourceIdentifier id = null, string name = null, Azure.Core.ResourceType resourceType = default(Azure.Core.ResourceType), Azure.ResourceManager.Models.SystemData systemData = null, System.Collections.Generic.IDictionary tags = null, Azure.Core.AzureLocation location = default(Azure.Core.AzureLocation), string description = null, string author = null, string osType = null, System.DateTimeOffset? createdOn = default(System.DateTimeOffset?), Azure.ResourceManager.DevTestLabs.Models.DevTestLabVmCreationContent formulaContent = null, string labVmId = null, string provisioningState = null, System.Guid? uniqueIdentifier = default(System.Guid?)) { throw null; } + public static Azure.ResourceManager.DevTestLabs.Models.DevTestLabFormulaPatch DevTestLabFormulaPatch(System.Collections.Generic.IDictionary tags = null) { throw null; } public static Azure.ResourceManager.DevTestLabs.Models.DevTestLabGalleryImage DevTestLabGalleryImage(Azure.Core.ResourceIdentifier id = null, string name = null, Azure.Core.ResourceType resourceType = default(Azure.Core.ResourceType), Azure.ResourceManager.Models.SystemData systemData = null, System.Collections.Generic.IDictionary tags = null, Azure.Core.AzureLocation location = default(Azure.Core.AzureLocation), string author = null, System.DateTimeOffset? createdOn = default(System.DateTimeOffset?), string description = null, Azure.ResourceManager.DevTestLabs.Models.DevTestLabGalleryImageReference imageReference = null, string icon = null, bool? isEnabled = default(bool?), string planId = null, bool? isPlanAuthorized = default(bool?)) { throw null; } public static Azure.ResourceManager.DevTestLabs.Models.DevTestLabGenerateUploadUriResult DevTestLabGenerateUploadUriResult(System.Uri uploadUri = null) { throw null; } public static Azure.ResourceManager.DevTestLabs.DevTestLabNotificationChannelData DevTestLabNotificationChannelData(Azure.Core.ResourceIdentifier id = null, string name = null, Azure.Core.ResourceType resourceType = default(Azure.Core.ResourceType), Azure.ResourceManager.Models.SystemData systemData = null, System.Collections.Generic.IDictionary tags = null, Azure.Core.AzureLocation location = default(Azure.Core.AzureLocation), System.Uri webHookUri = null, string emailRecipient = null, string notificationLocale = null, string description = null, System.Collections.Generic.IEnumerable events = null, System.DateTimeOffset? createdOn = default(System.DateTimeOffset?), string provisioningState = null, System.Guid? uniqueIdentifier = default(System.Guid?)) { throw null; } + public static Azure.ResourceManager.DevTestLabs.Models.DevTestLabNotificationChannelPatch DevTestLabNotificationChannelPatch(System.Collections.Generic.IDictionary tags = null) { throw null; } public static Azure.ResourceManager.DevTestLabs.Models.DevTestLabParametersValueFileInfo DevTestLabParametersValueFileInfo(string fileName = null, System.BinaryData parametersValueInfo = null) { throw null; } + public static Azure.ResourceManager.DevTestLabs.Models.DevTestLabPatch DevTestLabPatch(System.Collections.Generic.IDictionary tags = null) { throw null; } public static Azure.ResourceManager.DevTestLabs.DevTestLabPolicyData DevTestLabPolicyData(Azure.Core.ResourceIdentifier id = null, string name = null, Azure.Core.ResourceType resourceType = default(Azure.Core.ResourceType), Azure.ResourceManager.Models.SystemData systemData = null, System.Collections.Generic.IDictionary tags = null, Azure.Core.AzureLocation location = default(Azure.Core.AzureLocation), string description = null, Azure.ResourceManager.DevTestLabs.Models.DevTestLabPolicyStatus? status = default(Azure.ResourceManager.DevTestLabs.Models.DevTestLabPolicyStatus?), Azure.ResourceManager.DevTestLabs.Models.DevTestLabPolicyFactName? factName = default(Azure.ResourceManager.DevTestLabs.Models.DevTestLabPolicyFactName?), string factData = null, string threshold = null, Azure.ResourceManager.DevTestLabs.Models.DevTestLabPolicyEvaluatorType? evaluatorType = default(Azure.ResourceManager.DevTestLabs.Models.DevTestLabPolicyEvaluatorType?), System.DateTimeOffset? createdOn = default(System.DateTimeOffset?), string provisioningState = null, System.Guid? uniqueIdentifier = default(System.Guid?)) { throw null; } + public static Azure.ResourceManager.DevTestLabs.Models.DevTestLabPolicyPatch DevTestLabPolicyPatch(System.Collections.Generic.IDictionary tags = null) { throw null; } public static Azure.ResourceManager.DevTestLabs.Models.DevTestLabPolicySetResult DevTestLabPolicySetResult(bool? hasError = default(bool?), System.Collections.Generic.IEnumerable policyViolations = null) { throw null; } public static Azure.ResourceManager.DevTestLabs.Models.DevTestLabPolicyViolation DevTestLabPolicyViolation(string code = null, string message = null) { throw null; } public static Azure.ResourceManager.DevTestLabs.Models.DevTestLabRdpConnection DevTestLabRdpConnection(string contents = null) { throw null; } public static Azure.ResourceManager.DevTestLabs.Models.DevTestLabResourceCost DevTestLabResourceCost(string resourceName = null, string resourceUniqueId = null, double? resourceCost = default(double?), string resourceType = null, string resourceOwner = null, string resourcePricingTier = null, string resourceStatus = null, string resourceId = null, string externalResourceId = null) { throw null; } + public static Azure.ResourceManager.DevTestLabs.Models.DevTestLabResourcePatch DevTestLabResourcePatch(System.Collections.Generic.IDictionary tags = null) { throw null; } public static Azure.ResourceManager.DevTestLabs.Models.DevTestLabScheduleCreationParameter DevTestLabScheduleCreationParameter(string name = null, Azure.Core.AzureLocation? location = default(Azure.Core.AzureLocation?), System.Collections.Generic.IDictionary tags = null, Azure.ResourceManager.DevTestLabs.Models.DevTestLabEnableStatus? status = default(Azure.ResourceManager.DevTestLabs.Models.DevTestLabEnableStatus?), string taskType = null, Azure.ResourceManager.DevTestLabs.Models.DevTestLabWeekDetails weeklyRecurrence = null, string dailyRecurrenceTime = null, int? hourlyRecurrenceMinute = default(int?), string timeZoneId = null, Azure.ResourceManager.DevTestLabs.Models.DevTestLabNotificationSettings notificationSettings = null, Azure.Core.ResourceIdentifier targetResourceId = null) { throw null; } public static Azure.ResourceManager.DevTestLabs.DevTestLabScheduleData DevTestLabScheduleData(Azure.Core.ResourceIdentifier id = null, string name = null, Azure.Core.ResourceType resourceType = default(Azure.Core.ResourceType), Azure.ResourceManager.Models.SystemData systemData = null, System.Collections.Generic.IDictionary tags = null, Azure.Core.AzureLocation location = default(Azure.Core.AzureLocation), Azure.ResourceManager.DevTestLabs.Models.DevTestLabEnableStatus? status = default(Azure.ResourceManager.DevTestLabs.Models.DevTestLabEnableStatus?), string taskType = null, Azure.ResourceManager.DevTestLabs.Models.DevTestLabWeekDetails weeklyRecurrence = null, string dailyRecurrenceTime = null, int? hourlyRecurrenceMinute = default(int?), string timeZoneId = null, Azure.ResourceManager.DevTestLabs.Models.DevTestLabNotificationSettings notificationSettings = null, System.DateTimeOffset? createdOn = default(System.DateTimeOffset?), string targetResourceId = null, string provisioningState = null, System.Guid? uniqueIdentifier = default(System.Guid?)) { throw null; } + public static Azure.ResourceManager.DevTestLabs.Models.DevTestLabSchedulePatch DevTestLabSchedulePatch(System.Collections.Generic.IDictionary tags = null) { throw null; } public static Azure.ResourceManager.DevTestLabs.DevTestLabSecretData DevTestLabSecretData(Azure.Core.ResourceIdentifier id = null, string name = null, Azure.Core.ResourceType resourceType = default(Azure.Core.ResourceType), Azure.ResourceManager.Models.SystemData systemData = null, System.Collections.Generic.IDictionary tags = null, Azure.Core.AzureLocation location = default(Azure.Core.AzureLocation), string value = null, string provisioningState = null, System.Guid? uniqueIdentifier = default(System.Guid?)) { throw null; } + public static Azure.ResourceManager.DevTestLabs.Models.DevTestLabSecretPatch DevTestLabSecretPatch(System.Collections.Generic.IDictionary tags = null) { throw null; } public static Azure.ResourceManager.DevTestLabs.DevTestLabServiceFabricData DevTestLabServiceFabricData(Azure.Core.ResourceIdentifier id = null, string name = null, Azure.Core.ResourceType resourceType = default(Azure.Core.ResourceType), Azure.ResourceManager.Models.SystemData systemData = null, System.Collections.Generic.IDictionary tags = null, Azure.Core.AzureLocation location = default(Azure.Core.AzureLocation), string externalServiceFabricId = null, string environmentId = null, Azure.ResourceManager.DevTestLabs.Models.DevTestLabApplicableSchedule applicableSchedule = null, string provisioningState = null, System.Guid? uniqueIdentifier = default(System.Guid?)) { throw null; } + public static Azure.ResourceManager.DevTestLabs.Models.DevTestLabServiceFabricPatch DevTestLabServiceFabricPatch(System.Collections.Generic.IDictionary tags = null) { throw null; } public static Azure.ResourceManager.DevTestLabs.DevTestLabServiceRunnerData DevTestLabServiceRunnerData(Azure.Core.ResourceIdentifier id = null, string name = null, Azure.Core.ResourceType resourceType = default(Azure.Core.ResourceType), Azure.ResourceManager.Models.SystemData systemData = null, System.Collections.Generic.IDictionary tags = null, Azure.Core.AzureLocation location = default(Azure.Core.AzureLocation), Azure.ResourceManager.DevTestLabs.Models.DevTestLabManagedIdentity identity = null) { throw null; } + public static Azure.ResourceManager.DevTestLabs.Models.DevTestLabTargetCost DevTestLabTargetCost(Azure.ResourceManager.DevTestLabs.Models.DevTestLabTargetCostStatus? status = default(Azure.ResourceManager.DevTestLabs.Models.DevTestLabTargetCostStatus?), int? target = default(int?), System.Collections.Generic.IEnumerable costThresholds = null, System.DateTimeOffset? cycleStartOn = default(System.DateTimeOffset?), System.DateTimeOffset? cycleEndOn = default(System.DateTimeOffset?), Azure.ResourceManager.DevTestLabs.Models.DevTestLabReportingCycleType? cycleType = default(Azure.ResourceManager.DevTestLabs.Models.DevTestLabReportingCycleType?)) { throw null; } public static Azure.ResourceManager.DevTestLabs.DevTestLabUserData DevTestLabUserData(Azure.Core.ResourceIdentifier id = null, string name = null, Azure.Core.ResourceType resourceType = default(Azure.Core.ResourceType), Azure.ResourceManager.Models.SystemData systemData = null, System.Collections.Generic.IDictionary tags = null, Azure.Core.AzureLocation location = default(Azure.Core.AzureLocation), Azure.ResourceManager.DevTestLabs.Models.DevTestLabUserIdentity identity = null, Azure.ResourceManager.DevTestLabs.Models.DevTestLabUserSecretStore secretStore = null, System.DateTimeOffset? createdOn = default(System.DateTimeOffset?), string provisioningState = null, System.Guid? uniqueIdentifier = default(System.Guid?)) { throw null; } + public static Azure.ResourceManager.DevTestLabs.Models.DevTestLabUserPatch DevTestLabUserPatch(System.Collections.Generic.IDictionary tags = null) { throw null; } + public static Azure.ResourceManager.DevTestLabs.Models.DevTestLabVhd DevTestLabVhd(System.Uri id = null) { throw null; } public static Azure.ResourceManager.DevTestLabs.DevTestLabVirtualNetworkData DevTestLabVirtualNetworkData(Azure.Core.ResourceIdentifier id = null, string name = null, Azure.Core.ResourceType resourceType = default(Azure.Core.ResourceType), Azure.ResourceManager.Models.SystemData systemData = null, System.Collections.Generic.IDictionary tags = null, Azure.Core.AzureLocation location = default(Azure.Core.AzureLocation), System.Collections.Generic.IEnumerable allowedSubnets = null, string description = null, string externalProviderResourceId = null, System.Collections.Generic.IEnumerable externalSubnets = null, System.Collections.Generic.IEnumerable subnetOverrides = null, System.DateTimeOffset? createdOn = default(System.DateTimeOffset?), string provisioningState = null, System.Guid? uniqueIdentifier = default(System.Guid?)) { throw null; } + public static Azure.ResourceManager.DevTestLabs.Models.DevTestLabVirtualNetworkPatch DevTestLabVirtualNetworkPatch(System.Collections.Generic.IDictionary tags = null) { throw null; } + public static Azure.ResourceManager.DevTestLabs.Models.DevTestLabVmApplyArtifactsContent DevTestLabVmApplyArtifactsContent(System.Collections.Generic.IEnumerable artifacts = null) { throw null; } + public static Azure.ResourceManager.DevTestLabs.Models.DevTestLabVmCreationContent DevTestLabVmCreationContent(string notes = null, string ownerObjectId = null, string ownerUserPrincipalName = null, System.DateTimeOffset? createdOn = default(System.DateTimeOffset?), string customImageId = null, string size = null, string userName = null, string password = null, string sshKey = null, bool? isAuthenticationWithSshKey = default(bool?), string labSubnetName = null, Azure.Core.ResourceIdentifier labVirtualNetworkId = null, bool? disallowPublicIPAddress = default(bool?), System.Collections.Generic.IEnumerable artifacts = null, Azure.ResourceManager.DevTestLabs.Models.DevTestLabGalleryImageReference galleryImageReference = null, string planId = null, Azure.ResourceManager.DevTestLabs.Models.DevTestLabNetworkInterface networkInterface = null, System.DateTimeOffset? expireOn = default(System.DateTimeOffset?), bool? allowClaim = default(bool?), string storageType = null, string environmentId = null, System.Collections.Generic.IEnumerable dataDiskParameters = null, System.Collections.Generic.IEnumerable scheduleParameters = null, int? bulkCreationParametersInstanceCount = default(int?), string name = null, Azure.Core.AzureLocation? location = default(Azure.Core.AzureLocation?), System.Collections.Generic.IDictionary tags = null) { throw null; } public static Azure.ResourceManager.DevTestLabs.DevTestLabVmData DevTestLabVmData(Azure.Core.ResourceIdentifier id = null, string name = null, Azure.Core.ResourceType resourceType = default(Azure.Core.ResourceType), Azure.ResourceManager.Models.SystemData systemData = null, System.Collections.Generic.IDictionary tags = null, Azure.Core.AzureLocation location = default(Azure.Core.AzureLocation), string notes = null, string ownerObjectId = null, string ownerUserPrincipalName = null, string createdByUserId = null, string createdByUser = null, System.DateTimeOffset? createdOn = default(System.DateTimeOffset?), Azure.Core.ResourceIdentifier computeId = null, string customImageId = null, string osType = null, string size = null, string userName = null, string password = null, string sshKey = null, bool? isAuthenticationWithSshKey = default(bool?), string fqdn = null, string labSubnetName = null, Azure.Core.ResourceIdentifier labVirtualNetworkId = null, bool? disallowPublicIPAddress = default(bool?), System.Collections.Generic.IEnumerable artifacts = null, Azure.ResourceManager.DevTestLabs.Models.DevTestLabArtifactDeploymentStatus artifactDeploymentStatus = null, Azure.ResourceManager.DevTestLabs.Models.DevTestLabGalleryImageReference galleryImageReference = null, string planId = null, Azure.ResourceManager.DevTestLabs.Models.ComputeVmProperties computeVm = null, Azure.ResourceManager.DevTestLabs.Models.DevTestLabNetworkInterface networkInterface = null, Azure.ResourceManager.DevTestLabs.Models.DevTestLabApplicableSchedule applicableSchedule = null, System.DateTimeOffset? expireOn = default(System.DateTimeOffset?), bool? allowClaim = default(bool?), string storageType = null, Azure.ResourceManager.DevTestLabs.Models.DevTestLabVmCreationSource? vmCreationSource = default(Azure.ResourceManager.DevTestLabs.Models.DevTestLabVmCreationSource?), Azure.Core.ResourceIdentifier environmentId = null, System.Collections.Generic.IEnumerable dataDiskParameters = null, System.Collections.Generic.IEnumerable scheduleParameters = null, string lastKnownPowerState = null, string provisioningState = null, System.Guid? uniqueIdentifier = default(System.Guid?)) { throw null; } + public static Azure.ResourceManager.DevTestLabs.Models.DevTestLabVmPatch DevTestLabVmPatch(System.Collections.Generic.IDictionary tags = null) { throw null; } + public static Azure.ResourceManager.DevTestLabs.Models.DevTestLabWeekDetails DevTestLabWeekDetails(System.Collections.Generic.IEnumerable weekdays = null, string time = null) { throw null; } } public partial class AttachNewDataDiskDetails : System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel { @@ -1464,7 +1548,10 @@ public AttachNewDataDiskDetails() { } public string DiskName { get { throw null; } set { } } public int? DiskSizeGiB { get { throw null; } set { } } public Azure.ResourceManager.DevTestLabs.Models.DevTestLabStorageType? DiskType { get { throw null; } set { } } + protected virtual Azure.ResourceManager.DevTestLabs.Models.AttachNewDataDiskDetails JsonModelCreateCore(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } protected virtual void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + protected virtual Azure.ResourceManager.DevTestLabs.Models.AttachNewDataDiskDetails PersistableModelCreateCore(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + protected virtual System.BinaryData PersistableModelWriteCore(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } Azure.ResourceManager.DevTestLabs.Models.AttachNewDataDiskDetails System.ClientModel.Primitives.IJsonModel.Create(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } void System.ClientModel.Primitives.IJsonModel.Write(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } Azure.ResourceManager.DevTestLabs.Models.AttachNewDataDiskDetails System.ClientModel.Primitives.IPersistableModel.Create(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } @@ -1478,7 +1565,10 @@ internal ComputeDataDisk() { } public System.Uri DiskUri { get { throw null; } } public string ManagedDiskId { get { throw null; } } public string Name { get { throw null; } } + protected virtual Azure.ResourceManager.DevTestLabs.Models.ComputeDataDisk JsonModelCreateCore(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } protected virtual void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + protected virtual Azure.ResourceManager.DevTestLabs.Models.ComputeDataDisk PersistableModelCreateCore(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + protected virtual System.BinaryData PersistableModelWriteCore(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } Azure.ResourceManager.DevTestLabs.Models.ComputeDataDisk System.ClientModel.Primitives.IJsonModel.Create(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } void System.ClientModel.Primitives.IJsonModel.Write(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } Azure.ResourceManager.DevTestLabs.Models.ComputeDataDisk System.ClientModel.Primitives.IPersistableModel.Create(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } @@ -1491,7 +1581,10 @@ internal ComputeVmInstanceViewStatus() { } public string Code { get { throw null; } } public string DisplayStatus { get { throw null; } } public string Message { get { throw null; } } + protected virtual Azure.ResourceManager.DevTestLabs.Models.ComputeVmInstanceViewStatus JsonModelCreateCore(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } protected virtual void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + protected virtual Azure.ResourceManager.DevTestLabs.Models.ComputeVmInstanceViewStatus PersistableModelCreateCore(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + protected virtual System.BinaryData PersistableModelWriteCore(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } Azure.ResourceManager.DevTestLabs.Models.ComputeVmInstanceViewStatus System.ClientModel.Primitives.IJsonModel.Create(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } void System.ClientModel.Primitives.IJsonModel.Write(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } Azure.ResourceManager.DevTestLabs.Models.ComputeVmInstanceViewStatus System.ClientModel.Primitives.IPersistableModel.Create(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } @@ -1508,7 +1601,10 @@ internal ComputeVmProperties() { } public string OSType { get { throw null; } } public System.Collections.Generic.IReadOnlyList Statuses { get { throw null; } } public string VmSize { get { throw null; } } + protected virtual Azure.ResourceManager.DevTestLabs.Models.ComputeVmProperties JsonModelCreateCore(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } protected virtual void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + protected virtual Azure.ResourceManager.DevTestLabs.Models.ComputeVmProperties PersistableModelCreateCore(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + protected virtual System.BinaryData PersistableModelWriteCore(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } Azure.ResourceManager.DevTestLabs.Models.ComputeVmProperties System.ClientModel.Primitives.IJsonModel.Create(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } void System.ClientModel.Primitives.IJsonModel.Write(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } Azure.ResourceManager.DevTestLabs.Models.ComputeVmProperties System.ClientModel.Primitives.IPersistableModel.Create(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } @@ -1525,7 +1621,10 @@ public DevTestLabAnnouncement() { } public string ProvisioningState { get { throw null; } } public string Title { get { throw null; } set { } } public System.Guid? UniqueIdentifier { get { throw null; } } + protected virtual Azure.ResourceManager.DevTestLabs.Models.DevTestLabAnnouncement JsonModelCreateCore(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } protected virtual void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + protected virtual Azure.ResourceManager.DevTestLabs.Models.DevTestLabAnnouncement PersistableModelCreateCore(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + protected virtual System.BinaryData PersistableModelWriteCore(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } Azure.ResourceManager.DevTestLabs.Models.DevTestLabAnnouncement System.ClientModel.Primitives.IJsonModel.Create(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } void System.ClientModel.Primitives.IJsonModel.Write(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } Azure.ResourceManager.DevTestLabs.Models.DevTestLabAnnouncement System.ClientModel.Primitives.IPersistableModel.Create(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } @@ -1537,7 +1636,10 @@ public partial class DevTestLabApplicableSchedule : Azure.ResourceManager.Models public DevTestLabApplicableSchedule(Azure.Core.AzureLocation location) { } public Azure.ResourceManager.DevTestLabs.DevTestLabScheduleData LabVmsShutdown { get { throw null; } set { } } public Azure.ResourceManager.DevTestLabs.DevTestLabScheduleData LabVmsStartup { get { throw null; } set { } } + protected virtual Azure.ResourceManager.Models.ResourceData JsonModelCreateCore(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } protected override void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + protected virtual Azure.ResourceManager.Models.ResourceData PersistableModelCreateCore(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + protected virtual System.BinaryData PersistableModelWriteCore(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } Azure.ResourceManager.DevTestLabs.Models.DevTestLabApplicableSchedule System.ClientModel.Primitives.IJsonModel.Create(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } void System.ClientModel.Primitives.IJsonModel.Write(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } Azure.ResourceManager.DevTestLabs.Models.DevTestLabApplicableSchedule System.ClientModel.Primitives.IPersistableModel.Create(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } @@ -1549,7 +1651,10 @@ public partial class DevTestLabArmTemplateInfo : System.ClientModel.Primitives.I internal DevTestLabArmTemplateInfo() { } public System.BinaryData Parameters { get { throw null; } } public System.BinaryData Template { get { throw null; } } + protected virtual Azure.ResourceManager.DevTestLabs.Models.DevTestLabArmTemplateInfo JsonModelCreateCore(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } protected virtual void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + protected virtual Azure.ResourceManager.DevTestLabs.Models.DevTestLabArmTemplateInfo PersistableModelCreateCore(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + protected virtual System.BinaryData PersistableModelWriteCore(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } Azure.ResourceManager.DevTestLabs.Models.DevTestLabArmTemplateInfo System.ClientModel.Primitives.IJsonModel.Create(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } void System.ClientModel.Primitives.IJsonModel.Write(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } Azure.ResourceManager.DevTestLabs.Models.DevTestLabArmTemplateInfo System.ClientModel.Primitives.IPersistableModel.Create(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } @@ -1561,7 +1666,10 @@ public partial class DevTestLabArmTemplateParameter : System.ClientModel.Primiti public DevTestLabArmTemplateParameter() { } public string Name { get { throw null; } set { } } public string Value { get { throw null; } set { } } + protected virtual Azure.ResourceManager.DevTestLabs.Models.DevTestLabArmTemplateParameter JsonModelCreateCore(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } protected virtual void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + protected virtual Azure.ResourceManager.DevTestLabs.Models.DevTestLabArmTemplateParameter PersistableModelCreateCore(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + protected virtual System.BinaryData PersistableModelWriteCore(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } Azure.ResourceManager.DevTestLabs.Models.DevTestLabArmTemplateParameter System.ClientModel.Primitives.IJsonModel.Create(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } void System.ClientModel.Primitives.IJsonModel.Write(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } Azure.ResourceManager.DevTestLabs.Models.DevTestLabArmTemplateParameter System.ClientModel.Primitives.IPersistableModel.Create(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } @@ -1574,7 +1682,10 @@ internal DevTestLabArtifactDeploymentStatus() { } public int? ArtifactsApplied { get { throw null; } } public string DeploymentStatus { get { throw null; } } public int? TotalArtifacts { get { throw null; } } + protected virtual Azure.ResourceManager.DevTestLabs.Models.DevTestLabArtifactDeploymentStatus JsonModelCreateCore(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } protected virtual void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + protected virtual Azure.ResourceManager.DevTestLabs.Models.DevTestLabArtifactDeploymentStatus PersistableModelCreateCore(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + protected virtual System.BinaryData PersistableModelWriteCore(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } Azure.ResourceManager.DevTestLabs.Models.DevTestLabArtifactDeploymentStatus System.ClientModel.Primitives.IJsonModel.Create(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } void System.ClientModel.Primitives.IJsonModel.Write(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } Azure.ResourceManager.DevTestLabs.Models.DevTestLabArtifactDeploymentStatus System.ClientModel.Primitives.IPersistableModel.Create(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } @@ -1588,7 +1699,10 @@ public DevTestLabArtifactGenerateArmTemplateContent() { } public Azure.Core.AzureLocation? Location { get { throw null; } set { } } public System.Collections.Generic.IList Parameters { get { throw null; } } public string VmName { get { throw null; } set { } } + protected virtual Azure.ResourceManager.DevTestLabs.Models.DevTestLabArtifactGenerateArmTemplateContent JsonModelCreateCore(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } protected virtual void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + protected virtual Azure.ResourceManager.DevTestLabs.Models.DevTestLabArtifactGenerateArmTemplateContent PersistableModelCreateCore(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + protected virtual System.BinaryData PersistableModelWriteCore(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } Azure.ResourceManager.DevTestLabs.Models.DevTestLabArtifactGenerateArmTemplateContent System.ClientModel.Primitives.IJsonModel.Create(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } void System.ClientModel.Primitives.IJsonModel.Write(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } Azure.ResourceManager.DevTestLabs.Models.DevTestLabArtifactGenerateArmTemplateContent System.ClientModel.Primitives.IPersistableModel.Create(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } @@ -1605,7 +1719,10 @@ public DevTestLabArtifactInstallInfo() { } public System.Collections.Generic.IList Parameters { get { throw null; } } public string Status { get { throw null; } set { } } public string VmExtensionStatusMessage { get { throw null; } set { } } + protected virtual Azure.ResourceManager.DevTestLabs.Models.DevTestLabArtifactInstallInfo JsonModelCreateCore(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } protected virtual void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + protected virtual Azure.ResourceManager.DevTestLabs.Models.DevTestLabArtifactInstallInfo PersistableModelCreateCore(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + protected virtual System.BinaryData PersistableModelWriteCore(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } Azure.ResourceManager.DevTestLabs.Models.DevTestLabArtifactInstallInfo System.ClientModel.Primitives.IJsonModel.Create(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } void System.ClientModel.Primitives.IJsonModel.Write(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } Azure.ResourceManager.DevTestLabs.Models.DevTestLabArtifactInstallInfo System.ClientModel.Primitives.IPersistableModel.Create(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } @@ -1617,7 +1734,10 @@ public partial class DevTestLabArtifactParameter : System.ClientModel.Primitives public DevTestLabArtifactParameter() { } public string Name { get { throw null; } set { } } public string Value { get { throw null; } set { } } + protected virtual Azure.ResourceManager.DevTestLabs.Models.DevTestLabArtifactParameter JsonModelCreateCore(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } protected virtual void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + protected virtual Azure.ResourceManager.DevTestLabs.Models.DevTestLabArtifactParameter PersistableModelCreateCore(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + protected virtual System.BinaryData PersistableModelWriteCore(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } Azure.ResourceManager.DevTestLabs.Models.DevTestLabArtifactParameter System.ClientModel.Primitives.IJsonModel.Create(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } void System.ClientModel.Primitives.IJsonModel.Write(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } Azure.ResourceManager.DevTestLabs.Models.DevTestLabArtifactParameter System.ClientModel.Primitives.IPersistableModel.Create(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } @@ -1627,7 +1747,10 @@ protected virtual void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer public partial class DevTestLabArtifactSourcePatch : Azure.ResourceManager.DevTestLabs.Models.DevTestLabResourcePatch, System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel { public DevTestLabArtifactSourcePatch() { } + protected override Azure.ResourceManager.DevTestLabs.Models.DevTestLabResourcePatch JsonModelCreateCore(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } protected override void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + protected override Azure.ResourceManager.DevTestLabs.Models.DevTestLabResourcePatch PersistableModelCreateCore(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + protected override System.BinaryData PersistableModelWriteCore(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } Azure.ResourceManager.DevTestLabs.Models.DevTestLabArtifactSourcePatch System.ClientModel.Primitives.IJsonModel.Create(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } void System.ClientModel.Primitives.IJsonModel.Write(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } Azure.ResourceManager.DevTestLabs.Models.DevTestLabArtifactSourcePatch System.ClientModel.Primitives.IPersistableModel.Create(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } @@ -1640,7 +1763,10 @@ internal DevTestLabCostDetails() { } public double? Cost { get { throw null; } } public Azure.ResourceManager.DevTestLabs.Models.DevTestLabCostType? CostType { get { throw null; } } public System.DateTimeOffset? On { get { throw null; } } + protected virtual Azure.ResourceManager.DevTestLabs.Models.DevTestLabCostDetails JsonModelCreateCore(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } protected virtual void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + protected virtual Azure.ResourceManager.DevTestLabs.Models.DevTestLabCostDetails PersistableModelCreateCore(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + protected virtual System.BinaryData PersistableModelWriteCore(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } Azure.ResourceManager.DevTestLabs.Models.DevTestLabCostDetails System.ClientModel.Primitives.IJsonModel.Create(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } void System.ClientModel.Primitives.IJsonModel.Write(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } Azure.ResourceManager.DevTestLabs.Models.DevTestLabCostDetails System.ClientModel.Primitives.IPersistableModel.Create(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } @@ -1655,7 +1781,10 @@ public DevTestLabCostThreshold() { } public Azure.ResourceManager.DevTestLabs.Models.DevTestLabCostThresholdStatus? SendNotificationWhenExceeded { get { throw null; } set { } } public string ThresholdId { get { throw null; } set { } } public double? ThresholdValue { get { throw null; } set { } } + protected virtual Azure.ResourceManager.DevTestLabs.Models.DevTestLabCostThreshold JsonModelCreateCore(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } protected virtual void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + protected virtual Azure.ResourceManager.DevTestLabs.Models.DevTestLabCostThreshold PersistableModelCreateCore(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + protected virtual System.BinaryData PersistableModelWriteCore(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } Azure.ResourceManager.DevTestLabs.Models.DevTestLabCostThreshold System.ClientModel.Primitives.IJsonModel.Create(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } void System.ClientModel.Primitives.IJsonModel.Write(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } Azure.ResourceManager.DevTestLabs.Models.DevTestLabCostThreshold System.ClientModel.Primitives.IPersistableModel.Create(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } @@ -1675,6 +1804,7 @@ protected virtual void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer public override int GetHashCode() { throw null; } public static bool operator ==(Azure.ResourceManager.DevTestLabs.Models.DevTestLabCostThresholdStatus left, Azure.ResourceManager.DevTestLabs.Models.DevTestLabCostThresholdStatus right) { throw null; } public static implicit operator Azure.ResourceManager.DevTestLabs.Models.DevTestLabCostThresholdStatus (string value) { throw null; } + public static implicit operator Azure.ResourceManager.DevTestLabs.Models.DevTestLabCostThresholdStatus? (string value) { throw null; } public static bool operator !=(Azure.ResourceManager.DevTestLabs.Models.DevTestLabCostThresholdStatus left, Azure.ResourceManager.DevTestLabs.Models.DevTestLabCostThresholdStatus right) { throw null; } public override string ToString() { throw null; } } @@ -1692,6 +1822,7 @@ protected virtual void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer public override int GetHashCode() { throw null; } public static bool operator ==(Azure.ResourceManager.DevTestLabs.Models.DevTestLabCostType left, Azure.ResourceManager.DevTestLabs.Models.DevTestLabCostType right) { throw null; } public static implicit operator Azure.ResourceManager.DevTestLabs.Models.DevTestLabCostType (string value) { throw null; } + public static implicit operator Azure.ResourceManager.DevTestLabs.Models.DevTestLabCostType? (string value) { throw null; } public static bool operator !=(Azure.ResourceManager.DevTestLabs.Models.DevTestLabCostType left, Azure.ResourceManager.DevTestLabs.Models.DevTestLabCostType right) { throw null; } public override string ToString() { throw null; } } @@ -1709,13 +1840,17 @@ protected virtual void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer public override int GetHashCode() { throw null; } public static bool operator ==(Azure.ResourceManager.DevTestLabs.Models.DevTestLabCustomImageOSType left, Azure.ResourceManager.DevTestLabs.Models.DevTestLabCustomImageOSType right) { throw null; } public static implicit operator Azure.ResourceManager.DevTestLabs.Models.DevTestLabCustomImageOSType (string value) { throw null; } + public static implicit operator Azure.ResourceManager.DevTestLabs.Models.DevTestLabCustomImageOSType? (string value) { throw null; } public static bool operator !=(Azure.ResourceManager.DevTestLabs.Models.DevTestLabCustomImageOSType left, Azure.ResourceManager.DevTestLabs.Models.DevTestLabCustomImageOSType right) { throw null; } public override string ToString() { throw null; } } public partial class DevTestLabCustomImagePatch : Azure.ResourceManager.DevTestLabs.Models.DevTestLabResourcePatch, System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel { public DevTestLabCustomImagePatch() { } + protected override Azure.ResourceManager.DevTestLabs.Models.DevTestLabResourcePatch JsonModelCreateCore(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } protected override void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + protected override Azure.ResourceManager.DevTestLabs.Models.DevTestLabResourcePatch PersistableModelCreateCore(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + protected override System.BinaryData PersistableModelWriteCore(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } Azure.ResourceManager.DevTestLabs.Models.DevTestLabCustomImagePatch System.ClientModel.Primitives.IJsonModel.Create(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } void System.ClientModel.Primitives.IJsonModel.Write(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } Azure.ResourceManager.DevTestLabs.Models.DevTestLabCustomImagePatch System.ClientModel.Primitives.IPersistableModel.Create(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } @@ -1728,7 +1863,10 @@ public DevTestLabCustomImagePlan() { } public string Id { get { throw null; } set { } } public string Offer { get { throw null; } set { } } public string Publisher { get { throw null; } set { } } + protected virtual Azure.ResourceManager.DevTestLabs.Models.DevTestLabCustomImagePlan JsonModelCreateCore(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } protected virtual void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + protected virtual Azure.ResourceManager.DevTestLabs.Models.DevTestLabCustomImagePlan PersistableModelCreateCore(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + protected virtual System.BinaryData PersistableModelWriteCore(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } Azure.ResourceManager.DevTestLabs.Models.DevTestLabCustomImagePlan System.ClientModel.Primitives.IJsonModel.Create(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } void System.ClientModel.Primitives.IJsonModel.Write(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } Azure.ResourceManager.DevTestLabs.Models.DevTestLabCustomImagePlan System.ClientModel.Primitives.IPersistableModel.Create(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } @@ -1741,7 +1879,10 @@ public DevTestLabCustomImageVhd(Azure.ResourceManager.DevTestLabs.Models.DevTest public string ImageName { get { throw null; } set { } } public bool? IsSysPrepEnabled { get { throw null; } set { } } public Azure.ResourceManager.DevTestLabs.Models.DevTestLabCustomImageOSType OSType { get { throw null; } set { } } + protected virtual Azure.ResourceManager.DevTestLabs.Models.DevTestLabCustomImageVhd JsonModelCreateCore(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } protected virtual void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + protected virtual Azure.ResourceManager.DevTestLabs.Models.DevTestLabCustomImageVhd PersistableModelCreateCore(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + protected virtual System.BinaryData PersistableModelWriteCore(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } Azure.ResourceManager.DevTestLabs.Models.DevTestLabCustomImageVhd System.ClientModel.Primitives.IJsonModel.Create(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } void System.ClientModel.Primitives.IJsonModel.Write(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } Azure.ResourceManager.DevTestLabs.Models.DevTestLabCustomImageVhd System.ClientModel.Primitives.IPersistableModel.Create(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } @@ -1754,7 +1895,10 @@ public DevTestLabCustomImageVm() { } public Azure.ResourceManager.DevTestLabs.Models.DevTestLabLinuxOSState? LinuxOSState { get { throw null; } set { } } public string SourceVmId { get { throw null; } set { } } public Azure.ResourceManager.DevTestLabs.Models.WindowsOSState? WindowsOSState { get { throw null; } set { } } + protected virtual Azure.ResourceManager.DevTestLabs.Models.DevTestLabCustomImageVm JsonModelCreateCore(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } protected virtual void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + protected virtual Azure.ResourceManager.DevTestLabs.Models.DevTestLabCustomImageVm PersistableModelCreateCore(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + protected virtual System.BinaryData PersistableModelWriteCore(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } Azure.ResourceManager.DevTestLabs.Models.DevTestLabCustomImageVm System.ClientModel.Primitives.IJsonModel.Create(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } void System.ClientModel.Primitives.IJsonModel.Write(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } Azure.ResourceManager.DevTestLabs.Models.DevTestLabCustomImageVm System.ClientModel.Primitives.IPersistableModel.Create(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } @@ -1767,7 +1911,10 @@ public DevTestLabDataDiskProperties() { } public Azure.ResourceManager.DevTestLabs.Models.AttachNewDataDiskDetails AttachNewDataDiskOptions { get { throw null; } set { } } public Azure.Core.ResourceIdentifier ExistingLabDiskId { get { throw null; } set { } } public Azure.ResourceManager.DevTestLabs.Models.DevTestLabHostCachingOption? HostCaching { get { throw null; } set { } } + protected virtual Azure.ResourceManager.DevTestLabs.Models.DevTestLabDataDiskProperties JsonModelCreateCore(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } protected virtual void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + protected virtual Azure.ResourceManager.DevTestLabs.Models.DevTestLabDataDiskProperties PersistableModelCreateCore(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + protected virtual System.BinaryData PersistableModelWriteCore(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } Azure.ResourceManager.DevTestLabs.Models.DevTestLabDataDiskProperties System.ClientModel.Primitives.IJsonModel.Create(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } void System.ClientModel.Primitives.IJsonModel.Write(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } Azure.ResourceManager.DevTestLabs.Models.DevTestLabDataDiskProperties System.ClientModel.Primitives.IPersistableModel.Create(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } @@ -1779,7 +1926,10 @@ public partial class DevTestLabDataDiskStorageTypeInfo : System.ClientModel.Prim public DevTestLabDataDiskStorageTypeInfo() { } public string Lun { get { throw null; } set { } } public Azure.ResourceManager.DevTestLabs.Models.DevTestLabStorageType? StorageType { get { throw null; } set { } } + protected virtual Azure.ResourceManager.DevTestLabs.Models.DevTestLabDataDiskStorageTypeInfo JsonModelCreateCore(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } protected virtual void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + protected virtual Azure.ResourceManager.DevTestLabs.Models.DevTestLabDataDiskStorageTypeInfo PersistableModelCreateCore(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + protected virtual System.BinaryData PersistableModelWriteCore(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } Azure.ResourceManager.DevTestLabs.Models.DevTestLabDataDiskStorageTypeInfo System.ClientModel.Primitives.IJsonModel.Create(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } void System.ClientModel.Primitives.IJsonModel.Write(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } Azure.ResourceManager.DevTestLabs.Models.DevTestLabDataDiskStorageTypeInfo System.ClientModel.Primitives.IPersistableModel.Create(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } @@ -1790,7 +1940,10 @@ public partial class DevTestLabDiskAttachContent : System.ClientModel.Primitives { public DevTestLabDiskAttachContent() { } public Azure.Core.ResourceIdentifier LeasedByLabVmId { get { throw null; } set { } } + protected virtual Azure.ResourceManager.DevTestLabs.Models.DevTestLabDiskAttachContent JsonModelCreateCore(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } protected virtual void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + protected virtual Azure.ResourceManager.DevTestLabs.Models.DevTestLabDiskAttachContent PersistableModelCreateCore(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + protected virtual System.BinaryData PersistableModelWriteCore(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } Azure.ResourceManager.DevTestLabs.Models.DevTestLabDiskAttachContent System.ClientModel.Primitives.IJsonModel.Create(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } void System.ClientModel.Primitives.IJsonModel.Write(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } Azure.ResourceManager.DevTestLabs.Models.DevTestLabDiskAttachContent System.ClientModel.Primitives.IPersistableModel.Create(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } @@ -1801,7 +1954,10 @@ public partial class DevTestLabDiskDetachContent : System.ClientModel.Primitives { public DevTestLabDiskDetachContent() { } public Azure.Core.ResourceIdentifier LeasedByLabVmId { get { throw null; } set { } } + protected virtual Azure.ResourceManager.DevTestLabs.Models.DevTestLabDiskDetachContent JsonModelCreateCore(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } protected virtual void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + protected virtual Azure.ResourceManager.DevTestLabs.Models.DevTestLabDiskDetachContent PersistableModelCreateCore(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + protected virtual System.BinaryData PersistableModelWriteCore(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } Azure.ResourceManager.DevTestLabs.Models.DevTestLabDiskDetachContent System.ClientModel.Primitives.IJsonModel.Create(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } void System.ClientModel.Primitives.IJsonModel.Write(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } Azure.ResourceManager.DevTestLabs.Models.DevTestLabDiskDetachContent System.ClientModel.Primitives.IPersistableModel.Create(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } @@ -1811,7 +1967,10 @@ protected virtual void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer public partial class DevTestLabDiskPatch : Azure.ResourceManager.DevTestLabs.Models.DevTestLabResourcePatch, System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel { public DevTestLabDiskPatch() { } + protected override Azure.ResourceManager.DevTestLabs.Models.DevTestLabResourcePatch JsonModelCreateCore(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } protected override void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + protected override Azure.ResourceManager.DevTestLabs.Models.DevTestLabResourcePatch PersistableModelCreateCore(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + protected override System.BinaryData PersistableModelWriteCore(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } Azure.ResourceManager.DevTestLabs.Models.DevTestLabDiskPatch System.ClientModel.Primitives.IJsonModel.Create(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } void System.ClientModel.Primitives.IJsonModel.Write(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } Azure.ResourceManager.DevTestLabs.Models.DevTestLabDiskPatch System.ClientModel.Primitives.IPersistableModel.Create(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } @@ -1831,6 +1990,7 @@ protected override void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter write public override int GetHashCode() { throw null; } public static bool operator ==(Azure.ResourceManager.DevTestLabs.Models.DevTestLabEnableStatus left, Azure.ResourceManager.DevTestLabs.Models.DevTestLabEnableStatus right) { throw null; } public static implicit operator Azure.ResourceManager.DevTestLabs.Models.DevTestLabEnableStatus (string value) { throw null; } + public static implicit operator Azure.ResourceManager.DevTestLabs.Models.DevTestLabEnableStatus? (string value) { throw null; } public static bool operator !=(Azure.ResourceManager.DevTestLabs.Models.DevTestLabEnableStatus left, Azure.ResourceManager.DevTestLabs.Models.DevTestLabEnableStatus right) { throw null; } public override string ToString() { throw null; } } @@ -1839,7 +1999,10 @@ public partial class DevTestLabEnvironmentDeployment : System.ClientModel.Primit public DevTestLabEnvironmentDeployment() { } public Azure.Core.ResourceIdentifier ArmTemplateId { get { throw null; } set { } } public System.Collections.Generic.IList Parameters { get { throw null; } } + protected virtual Azure.ResourceManager.DevTestLabs.Models.DevTestLabEnvironmentDeployment JsonModelCreateCore(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } protected virtual void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + protected virtual Azure.ResourceManager.DevTestLabs.Models.DevTestLabEnvironmentDeployment PersistableModelCreateCore(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + protected virtual System.BinaryData PersistableModelWriteCore(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } Azure.ResourceManager.DevTestLabs.Models.DevTestLabEnvironmentDeployment System.ClientModel.Primitives.IJsonModel.Create(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } void System.ClientModel.Primitives.IJsonModel.Write(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } Azure.ResourceManager.DevTestLabs.Models.DevTestLabEnvironmentDeployment System.ClientModel.Primitives.IPersistableModel.Create(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } @@ -1849,7 +2012,10 @@ protected virtual void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer public partial class DevTestLabEnvironmentPatch : Azure.ResourceManager.DevTestLabs.Models.DevTestLabResourcePatch, System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel { public DevTestLabEnvironmentPatch() { } + protected override Azure.ResourceManager.DevTestLabs.Models.DevTestLabResourcePatch JsonModelCreateCore(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } protected override void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + protected override Azure.ResourceManager.DevTestLabs.Models.DevTestLabResourcePatch PersistableModelCreateCore(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + protected override System.BinaryData PersistableModelWriteCore(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } Azure.ResourceManager.DevTestLabs.Models.DevTestLabEnvironmentPatch System.ClientModel.Primitives.IJsonModel.Create(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } void System.ClientModel.Primitives.IJsonModel.Write(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } Azure.ResourceManager.DevTestLabs.Models.DevTestLabEnvironmentPatch System.ClientModel.Primitives.IPersistableModel.Create(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } @@ -1869,6 +2035,7 @@ protected override void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter write public override int GetHashCode() { throw null; } public static bool operator ==(Azure.ResourceManager.DevTestLabs.Models.DevTestLabEnvironmentPermission left, Azure.ResourceManager.DevTestLabs.Models.DevTestLabEnvironmentPermission right) { throw null; } public static implicit operator Azure.ResourceManager.DevTestLabs.Models.DevTestLabEnvironmentPermission (string value) { throw null; } + public static implicit operator Azure.ResourceManager.DevTestLabs.Models.DevTestLabEnvironmentPermission? (string value) { throw null; } public static bool operator !=(Azure.ResourceManager.DevTestLabs.Models.DevTestLabEnvironmentPermission left, Azure.ResourceManager.DevTestLabs.Models.DevTestLabEnvironmentPermission right) { throw null; } public override string ToString() { throw null; } } @@ -1876,7 +2043,10 @@ public partial class DevTestLabEvaluatePoliciesContent : System.ClientModel.Prim { public DevTestLabEvaluatePoliciesContent() { } public System.Collections.Generic.IList Policies { get { throw null; } } + protected virtual Azure.ResourceManager.DevTestLabs.Models.DevTestLabEvaluatePoliciesContent JsonModelCreateCore(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } protected virtual void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + protected virtual Azure.ResourceManager.DevTestLabs.Models.DevTestLabEvaluatePoliciesContent PersistableModelCreateCore(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + protected virtual System.BinaryData PersistableModelWriteCore(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } Azure.ResourceManager.DevTestLabs.Models.DevTestLabEvaluatePoliciesContent System.ClientModel.Primitives.IJsonModel.Create(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } void System.ClientModel.Primitives.IJsonModel.Write(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } Azure.ResourceManager.DevTestLabs.Models.DevTestLabEvaluatePoliciesContent System.ClientModel.Primitives.IPersistableModel.Create(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } @@ -1887,7 +2057,10 @@ public partial class DevTestLabEvaluatePoliciesResult : System.ClientModel.Primi { internal DevTestLabEvaluatePoliciesResult() { } public System.Collections.Generic.IReadOnlyList Results { get { throw null; } } + protected virtual Azure.ResourceManager.DevTestLabs.Models.DevTestLabEvaluatePoliciesResult JsonModelCreateCore(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } protected virtual void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + protected virtual Azure.ResourceManager.DevTestLabs.Models.DevTestLabEvaluatePoliciesResult PersistableModelCreateCore(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + protected virtual System.BinaryData PersistableModelWriteCore(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } Azure.ResourceManager.DevTestLabs.Models.DevTestLabEvaluatePoliciesResult System.ClientModel.Primitives.IJsonModel.Create(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } void System.ClientModel.Primitives.IJsonModel.Write(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } Azure.ResourceManager.DevTestLabs.Models.DevTestLabEvaluatePoliciesResult System.ClientModel.Primitives.IPersistableModel.Create(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } @@ -1901,7 +2074,10 @@ public DevTestLabEvaluatePolicy() { } public string FactName { get { throw null; } set { } } public string UserObjectId { get { throw null; } set { } } public string ValueOffset { get { throw null; } set { } } + protected virtual Azure.ResourceManager.DevTestLabs.Models.DevTestLabEvaluatePolicy JsonModelCreateCore(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } protected virtual void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + protected virtual Azure.ResourceManager.DevTestLabs.Models.DevTestLabEvaluatePolicy PersistableModelCreateCore(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + protected virtual System.BinaryData PersistableModelWriteCore(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } Azure.ResourceManager.DevTestLabs.Models.DevTestLabEvaluatePolicy System.ClientModel.Primitives.IJsonModel.Create(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } void System.ClientModel.Primitives.IJsonModel.Write(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } Azure.ResourceManager.DevTestLabs.Models.DevTestLabEvaluatePolicy System.ClientModel.Primitives.IPersistableModel.Create(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } @@ -1913,7 +2089,10 @@ public partial class DevTestLabExportResourceUsageContent : System.ClientModel.P public DevTestLabExportResourceUsageContent() { } public System.Uri BlobStorageAbsoluteSasUri { get { throw null; } set { } } public System.DateTimeOffset? UsageStartOn { get { throw null; } set { } } + protected virtual Azure.ResourceManager.DevTestLabs.Models.DevTestLabExportResourceUsageContent JsonModelCreateCore(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } protected virtual void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + protected virtual Azure.ResourceManager.DevTestLabs.Models.DevTestLabExportResourceUsageContent PersistableModelCreateCore(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + protected virtual System.BinaryData PersistableModelWriteCore(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } Azure.ResourceManager.DevTestLabs.Models.DevTestLabExportResourceUsageContent System.ClientModel.Primitives.IJsonModel.Create(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } void System.ClientModel.Primitives.IJsonModel.Write(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } Azure.ResourceManager.DevTestLabs.Models.DevTestLabExportResourceUsageContent System.ClientModel.Primitives.IPersistableModel.Create(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } @@ -1925,7 +2104,10 @@ public partial class DevTestLabExternalSubnet : System.ClientModel.Primitives.IJ internal DevTestLabExternalSubnet() { } public Azure.Core.ResourceIdentifier Id { get { throw null; } } public string Name { get { throw null; } } + protected virtual Azure.ResourceManager.DevTestLabs.Models.DevTestLabExternalSubnet JsonModelCreateCore(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } protected virtual void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + protected virtual Azure.ResourceManager.DevTestLabs.Models.DevTestLabExternalSubnet PersistableModelCreateCore(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + protected virtual System.BinaryData PersistableModelWriteCore(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } Azure.ResourceManager.DevTestLabs.Models.DevTestLabExternalSubnet System.ClientModel.Primitives.IJsonModel.Create(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } void System.ClientModel.Primitives.IJsonModel.Write(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } Azure.ResourceManager.DevTestLabs.Models.DevTestLabExternalSubnet System.ClientModel.Primitives.IPersistableModel.Create(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } @@ -1945,13 +2127,17 @@ protected virtual void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer public override int GetHashCode() { throw null; } public static bool operator ==(Azure.ResourceManager.DevTestLabs.Models.DevTestLabFileUploadOption left, Azure.ResourceManager.DevTestLabs.Models.DevTestLabFileUploadOption right) { throw null; } public static implicit operator Azure.ResourceManager.DevTestLabs.Models.DevTestLabFileUploadOption (string value) { throw null; } + public static implicit operator Azure.ResourceManager.DevTestLabs.Models.DevTestLabFileUploadOption? (string value) { throw null; } public static bool operator !=(Azure.ResourceManager.DevTestLabs.Models.DevTestLabFileUploadOption left, Azure.ResourceManager.DevTestLabs.Models.DevTestLabFileUploadOption right) { throw null; } public override string ToString() { throw null; } } public partial class DevTestLabFormulaPatch : Azure.ResourceManager.DevTestLabs.Models.DevTestLabResourcePatch, System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel { public DevTestLabFormulaPatch() { } + protected override Azure.ResourceManager.DevTestLabs.Models.DevTestLabResourcePatch JsonModelCreateCore(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } protected override void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + protected override Azure.ResourceManager.DevTestLabs.Models.DevTestLabResourcePatch PersistableModelCreateCore(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + protected override System.BinaryData PersistableModelWriteCore(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } Azure.ResourceManager.DevTestLabs.Models.DevTestLabFormulaPatch System.ClientModel.Primitives.IJsonModel.Create(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } void System.ClientModel.Primitives.IJsonModel.Write(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } Azure.ResourceManager.DevTestLabs.Models.DevTestLabFormulaPatch System.ClientModel.Primitives.IPersistableModel.Create(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } @@ -1969,7 +2155,10 @@ public DevTestLabGalleryImage(Azure.Core.AzureLocation location) { } public bool? IsEnabled { get { throw null; } set { } } public bool? IsPlanAuthorized { get { throw null; } set { } } public string PlanId { get { throw null; } set { } } + protected virtual Azure.ResourceManager.Models.ResourceData JsonModelCreateCore(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } protected override void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + protected virtual Azure.ResourceManager.Models.ResourceData PersistableModelCreateCore(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + protected virtual System.BinaryData PersistableModelWriteCore(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } Azure.ResourceManager.DevTestLabs.Models.DevTestLabGalleryImage System.ClientModel.Primitives.IJsonModel.Create(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } void System.ClientModel.Primitives.IJsonModel.Write(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } Azure.ResourceManager.DevTestLabs.Models.DevTestLabGalleryImage System.ClientModel.Primitives.IPersistableModel.Create(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } @@ -1984,7 +2173,10 @@ public DevTestLabGalleryImageReference() { } public string Publisher { get { throw null; } set { } } public string Sku { get { throw null; } set { } } public string Version { get { throw null; } set { } } + protected virtual Azure.ResourceManager.DevTestLabs.Models.DevTestLabGalleryImageReference JsonModelCreateCore(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } protected virtual void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + protected virtual Azure.ResourceManager.DevTestLabs.Models.DevTestLabGalleryImageReference PersistableModelCreateCore(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + protected virtual System.BinaryData PersistableModelWriteCore(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } Azure.ResourceManager.DevTestLabs.Models.DevTestLabGalleryImageReference System.ClientModel.Primitives.IJsonModel.Create(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } void System.ClientModel.Primitives.IJsonModel.Write(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } Azure.ResourceManager.DevTestLabs.Models.DevTestLabGalleryImageReference System.ClientModel.Primitives.IPersistableModel.Create(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } @@ -1995,7 +2187,10 @@ public partial class DevTestLabGenerateUploadUriContent : System.ClientModel.Pri { public DevTestLabGenerateUploadUriContent() { } public string BlobName { get { throw null; } set { } } + protected virtual Azure.ResourceManager.DevTestLabs.Models.DevTestLabGenerateUploadUriContent JsonModelCreateCore(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } protected virtual void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + protected virtual Azure.ResourceManager.DevTestLabs.Models.DevTestLabGenerateUploadUriContent PersistableModelCreateCore(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + protected virtual System.BinaryData PersistableModelWriteCore(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } Azure.ResourceManager.DevTestLabs.Models.DevTestLabGenerateUploadUriContent System.ClientModel.Primitives.IJsonModel.Create(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } void System.ClientModel.Primitives.IJsonModel.Write(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } Azure.ResourceManager.DevTestLabs.Models.DevTestLabGenerateUploadUriContent System.ClientModel.Primitives.IPersistableModel.Create(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } @@ -2006,7 +2201,10 @@ public partial class DevTestLabGenerateUploadUriResult : System.ClientModel.Prim { internal DevTestLabGenerateUploadUriResult() { } public System.Uri UploadUri { get { throw null; } } + protected virtual Azure.ResourceManager.DevTestLabs.Models.DevTestLabGenerateUploadUriResult JsonModelCreateCore(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } protected virtual void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + protected virtual Azure.ResourceManager.DevTestLabs.Models.DevTestLabGenerateUploadUriResult PersistableModelCreateCore(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + protected virtual System.BinaryData PersistableModelWriteCore(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } Azure.ResourceManager.DevTestLabs.Models.DevTestLabGenerateUploadUriResult System.ClientModel.Primitives.IJsonModel.Create(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } void System.ClientModel.Primitives.IJsonModel.Write(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } Azure.ResourceManager.DevTestLabs.Models.DevTestLabGenerateUploadUriResult System.ClientModel.Primitives.IPersistableModel.Create(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } @@ -2018,7 +2216,10 @@ public partial class DevTestLabGlobalScheduleRetargetContent : System.ClientMode public DevTestLabGlobalScheduleRetargetContent() { } public Azure.Core.ResourceIdentifier CurrentResourceId { get { throw null; } set { } } public Azure.Core.ResourceIdentifier TargetResourceId { get { throw null; } set { } } + protected virtual Azure.ResourceManager.DevTestLabs.Models.DevTestLabGlobalScheduleRetargetContent JsonModelCreateCore(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } protected virtual void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + protected virtual Azure.ResourceManager.DevTestLabs.Models.DevTestLabGlobalScheduleRetargetContent PersistableModelCreateCore(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + protected virtual System.BinaryData PersistableModelWriteCore(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } Azure.ResourceManager.DevTestLabs.Models.DevTestLabGlobalScheduleRetargetContent System.ClientModel.Primitives.IJsonModel.Create(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } void System.ClientModel.Primitives.IJsonModel.Write(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } Azure.ResourceManager.DevTestLabs.Models.DevTestLabGlobalScheduleRetargetContent System.ClientModel.Primitives.IPersistableModel.Create(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } @@ -2039,6 +2240,7 @@ protected virtual void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer public override int GetHashCode() { throw null; } public static bool operator ==(Azure.ResourceManager.DevTestLabs.Models.DevTestLabHostCachingOption left, Azure.ResourceManager.DevTestLabs.Models.DevTestLabHostCachingOption right) { throw null; } public static implicit operator Azure.ResourceManager.DevTestLabs.Models.DevTestLabHostCachingOption (string value) { throw null; } + public static implicit operator Azure.ResourceManager.DevTestLabs.Models.DevTestLabHostCachingOption? (string value) { throw null; } public static bool operator !=(Azure.ResourceManager.DevTestLabs.Models.DevTestLabHostCachingOption left, Azure.ResourceManager.DevTestLabs.Models.DevTestLabHostCachingOption right) { throw null; } public override string ToString() { throw null; } } @@ -2047,7 +2249,10 @@ public partial class DevTestLabImportVmContent : System.ClientModel.Primitives.I public DevTestLabImportVmContent() { } public string DestinationVmName { get { throw null; } set { } } public Azure.Core.ResourceIdentifier SourceVmResourceId { get { throw null; } set { } } + protected virtual Azure.ResourceManager.DevTestLabs.Models.DevTestLabImportVmContent JsonModelCreateCore(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } protected virtual void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + protected virtual Azure.ResourceManager.DevTestLabs.Models.DevTestLabImportVmContent PersistableModelCreateCore(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + protected virtual System.BinaryData PersistableModelWriteCore(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } Azure.ResourceManager.DevTestLabs.Models.DevTestLabImportVmContent System.ClientModel.Primitives.IJsonModel.Create(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } void System.ClientModel.Primitives.IJsonModel.Write(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } Azure.ResourceManager.DevTestLabs.Models.DevTestLabImportVmContent System.ClientModel.Primitives.IPersistableModel.Create(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } @@ -2060,7 +2265,10 @@ public DevTestLabInboundNatRule() { } public int? BackendPort { get { throw null; } set { } } public int? FrontendPort { get { throw null; } set { } } public Azure.ResourceManager.DevTestLabs.Models.DevTestLabTransportProtocol? TransportProtocol { get { throw null; } set { } } + protected virtual Azure.ResourceManager.DevTestLabs.Models.DevTestLabInboundNatRule JsonModelCreateCore(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } protected virtual void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + protected virtual Azure.ResourceManager.DevTestLabs.Models.DevTestLabInboundNatRule PersistableModelCreateCore(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + protected virtual System.BinaryData PersistableModelWriteCore(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } Azure.ResourceManager.DevTestLabs.Models.DevTestLabInboundNatRule System.ClientModel.Primitives.IJsonModel.Create(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } void System.ClientModel.Primitives.IJsonModel.Write(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } Azure.ResourceManager.DevTestLabs.Models.DevTestLabInboundNatRule System.ClientModel.Primitives.IPersistableModel.Create(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } @@ -2081,6 +2289,7 @@ protected virtual void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer public override int GetHashCode() { throw null; } public static bool operator ==(Azure.ResourceManager.DevTestLabs.Models.DevTestLabLinuxOSState left, Azure.ResourceManager.DevTestLabs.Models.DevTestLabLinuxOSState right) { throw null; } public static implicit operator Azure.ResourceManager.DevTestLabs.Models.DevTestLabLinuxOSState (string value) { throw null; } + public static implicit operator Azure.ResourceManager.DevTestLabs.Models.DevTestLabLinuxOSState? (string value) { throw null; } public static bool operator !=(Azure.ResourceManager.DevTestLabs.Models.DevTestLabLinuxOSState left, Azure.ResourceManager.DevTestLabs.Models.DevTestLabLinuxOSState right) { throw null; } public override string ToString() { throw null; } } @@ -2091,6 +2300,10 @@ public DevTestLabManagedIdentity() { } public Azure.ResourceManager.Models.ManagedServiceIdentityType ManagedIdentityType { get { throw null; } set { } } public System.Guid? PrincipalId { get { throw null; } set { } } public System.Guid? TenantId { get { throw null; } set { } } + protected virtual Azure.ResourceManager.DevTestLabs.Models.DevTestLabManagedIdentity JsonModelCreateCore(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + protected virtual void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + protected virtual Azure.ResourceManager.DevTestLabs.Models.DevTestLabManagedIdentity PersistableModelCreateCore(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + protected virtual System.BinaryData PersistableModelWriteCore(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } Azure.ResourceManager.DevTestLabs.Models.DevTestLabManagedIdentity System.ClientModel.Primitives.IJsonModel.Create(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } void System.ClientModel.Primitives.IJsonModel.Write(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } Azure.ResourceManager.DevTestLabs.Models.DevTestLabManagedIdentity System.ClientModel.Primitives.IPersistableModel.Create(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } @@ -2109,7 +2322,10 @@ public DevTestLabNetworkInterface() { } public string SshAuthority { get { throw null; } set { } } public Azure.Core.ResourceIdentifier SubnetId { get { throw null; } set { } } public Azure.Core.ResourceIdentifier VirtualNetworkId { get { throw null; } set { } } + protected virtual Azure.ResourceManager.DevTestLabs.Models.DevTestLabNetworkInterface JsonModelCreateCore(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } protected virtual void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + protected virtual Azure.ResourceManager.DevTestLabs.Models.DevTestLabNetworkInterface PersistableModelCreateCore(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + protected virtual System.BinaryData PersistableModelWriteCore(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } Azure.ResourceManager.DevTestLabs.Models.DevTestLabNetworkInterface System.ClientModel.Primitives.IJsonModel.Create(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } void System.ClientModel.Primitives.IJsonModel.Write(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } Azure.ResourceManager.DevTestLabs.Models.DevTestLabNetworkInterface System.ClientModel.Primitives.IPersistableModel.Create(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } @@ -2120,7 +2336,10 @@ public partial class DevTestLabNotificationChannelEvent : System.ClientModel.Pri { public DevTestLabNotificationChannelEvent() { } public Azure.ResourceManager.DevTestLabs.Models.DevTestLabNotificationChannelEventType? EventName { get { throw null; } set { } } + protected virtual Azure.ResourceManager.DevTestLabs.Models.DevTestLabNotificationChannelEvent JsonModelCreateCore(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } protected virtual void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + protected virtual Azure.ResourceManager.DevTestLabs.Models.DevTestLabNotificationChannelEvent PersistableModelCreateCore(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + protected virtual System.BinaryData PersistableModelWriteCore(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } Azure.ResourceManager.DevTestLabs.Models.DevTestLabNotificationChannelEvent System.ClientModel.Primitives.IJsonModel.Create(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } void System.ClientModel.Primitives.IJsonModel.Write(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } Azure.ResourceManager.DevTestLabs.Models.DevTestLabNotificationChannelEvent System.ClientModel.Primitives.IPersistableModel.Create(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } @@ -2140,6 +2359,7 @@ protected virtual void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer public override int GetHashCode() { throw null; } public static bool operator ==(Azure.ResourceManager.DevTestLabs.Models.DevTestLabNotificationChannelEventType left, Azure.ResourceManager.DevTestLabs.Models.DevTestLabNotificationChannelEventType right) { throw null; } public static implicit operator Azure.ResourceManager.DevTestLabs.Models.DevTestLabNotificationChannelEventType (string value) { throw null; } + public static implicit operator Azure.ResourceManager.DevTestLabs.Models.DevTestLabNotificationChannelEventType? (string value) { throw null; } public static bool operator !=(Azure.ResourceManager.DevTestLabs.Models.DevTestLabNotificationChannelEventType left, Azure.ResourceManager.DevTestLabs.Models.DevTestLabNotificationChannelEventType right) { throw null; } public override string ToString() { throw null; } } @@ -2148,7 +2368,10 @@ public partial class DevTestLabNotificationChannelNotifyContent : System.ClientM public DevTestLabNotificationChannelNotifyContent() { } public Azure.ResourceManager.DevTestLabs.Models.DevTestLabNotificationChannelEventType? EventName { get { throw null; } set { } } public string JsonPayload { get { throw null; } set { } } + protected virtual Azure.ResourceManager.DevTestLabs.Models.DevTestLabNotificationChannelNotifyContent JsonModelCreateCore(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } protected virtual void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + protected virtual Azure.ResourceManager.DevTestLabs.Models.DevTestLabNotificationChannelNotifyContent PersistableModelCreateCore(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + protected virtual System.BinaryData PersistableModelWriteCore(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } Azure.ResourceManager.DevTestLabs.Models.DevTestLabNotificationChannelNotifyContent System.ClientModel.Primitives.IJsonModel.Create(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } void System.ClientModel.Primitives.IJsonModel.Write(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } Azure.ResourceManager.DevTestLabs.Models.DevTestLabNotificationChannelNotifyContent System.ClientModel.Primitives.IPersistableModel.Create(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } @@ -2158,7 +2381,10 @@ protected virtual void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer public partial class DevTestLabNotificationChannelPatch : Azure.ResourceManager.DevTestLabs.Models.DevTestLabResourcePatch, System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel { public DevTestLabNotificationChannelPatch() { } + protected override Azure.ResourceManager.DevTestLabs.Models.DevTestLabResourcePatch JsonModelCreateCore(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } protected override void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + protected override Azure.ResourceManager.DevTestLabs.Models.DevTestLabResourcePatch PersistableModelCreateCore(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + protected override System.BinaryData PersistableModelWriteCore(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } Azure.ResourceManager.DevTestLabs.Models.DevTestLabNotificationChannelPatch System.ClientModel.Primitives.IJsonModel.Create(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } void System.ClientModel.Primitives.IJsonModel.Write(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } Azure.ResourceManager.DevTestLabs.Models.DevTestLabNotificationChannelPatch System.ClientModel.Primitives.IPersistableModel.Create(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } @@ -2173,7 +2399,10 @@ public DevTestLabNotificationSettings() { } public Azure.ResourceManager.DevTestLabs.Models.DevTestLabEnableStatus? Status { get { throw null; } set { } } public int? TimeInMinutes { get { throw null; } set { } } public System.Uri WebhookUri { get { throw null; } set { } } + protected virtual Azure.ResourceManager.DevTestLabs.Models.DevTestLabNotificationSettings JsonModelCreateCore(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } protected virtual void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + protected virtual Azure.ResourceManager.DevTestLabs.Models.DevTestLabNotificationSettings PersistableModelCreateCore(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + protected virtual System.BinaryData PersistableModelWriteCore(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } Azure.ResourceManager.DevTestLabs.Models.DevTestLabNotificationSettings System.ClientModel.Primitives.IJsonModel.Create(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } void System.ClientModel.Primitives.IJsonModel.Write(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } Azure.ResourceManager.DevTestLabs.Models.DevTestLabNotificationSettings System.ClientModel.Primitives.IPersistableModel.Create(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } @@ -2185,7 +2414,10 @@ public partial class DevTestLabParameter : System.ClientModel.Primitives.IJsonMo public DevTestLabParameter() { } public string Name { get { throw null; } set { } } public string Value { get { throw null; } set { } } + protected virtual Azure.ResourceManager.DevTestLabs.Models.DevTestLabParameter JsonModelCreateCore(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } protected virtual void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + protected virtual Azure.ResourceManager.DevTestLabs.Models.DevTestLabParameter PersistableModelCreateCore(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + protected virtual System.BinaryData PersistableModelWriteCore(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } Azure.ResourceManager.DevTestLabs.Models.DevTestLabParameter System.ClientModel.Primitives.IJsonModel.Create(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } void System.ClientModel.Primitives.IJsonModel.Write(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } Azure.ResourceManager.DevTestLabs.Models.DevTestLabParameter System.ClientModel.Primitives.IPersistableModel.Create(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } @@ -2197,7 +2429,10 @@ public partial class DevTestLabParametersValueFileInfo : System.ClientModel.Prim internal DevTestLabParametersValueFileInfo() { } public string FileName { get { throw null; } } public System.BinaryData ParametersValueInfo { get { throw null; } } + protected virtual Azure.ResourceManager.DevTestLabs.Models.DevTestLabParametersValueFileInfo JsonModelCreateCore(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } protected virtual void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + protected virtual Azure.ResourceManager.DevTestLabs.Models.DevTestLabParametersValueFileInfo PersistableModelCreateCore(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + protected virtual System.BinaryData PersistableModelWriteCore(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } Azure.ResourceManager.DevTestLabs.Models.DevTestLabParametersValueFileInfo System.ClientModel.Primitives.IJsonModel.Create(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } void System.ClientModel.Primitives.IJsonModel.Write(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } Azure.ResourceManager.DevTestLabs.Models.DevTestLabParametersValueFileInfo System.ClientModel.Primitives.IPersistableModel.Create(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } @@ -2207,7 +2442,10 @@ protected virtual void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer public partial class DevTestLabPatch : Azure.ResourceManager.DevTestLabs.Models.DevTestLabResourcePatch, System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel { public DevTestLabPatch() { } + protected override Azure.ResourceManager.DevTestLabs.Models.DevTestLabResourcePatch JsonModelCreateCore(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } protected override void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + protected override Azure.ResourceManager.DevTestLabs.Models.DevTestLabResourcePatch PersistableModelCreateCore(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + protected override System.BinaryData PersistableModelWriteCore(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } Azure.ResourceManager.DevTestLabs.Models.DevTestLabPatch System.ClientModel.Primitives.IJsonModel.Create(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } void System.ClientModel.Primitives.IJsonModel.Write(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } Azure.ResourceManager.DevTestLabs.Models.DevTestLabPatch System.ClientModel.Primitives.IPersistableModel.Create(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } @@ -2227,6 +2465,7 @@ protected override void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter write public override int GetHashCode() { throw null; } public static bool operator ==(Azure.ResourceManager.DevTestLabs.Models.DevTestLabPolicyEvaluatorType left, Azure.ResourceManager.DevTestLabs.Models.DevTestLabPolicyEvaluatorType right) { throw null; } public static implicit operator Azure.ResourceManager.DevTestLabs.Models.DevTestLabPolicyEvaluatorType (string value) { throw null; } + public static implicit operator Azure.ResourceManager.DevTestLabs.Models.DevTestLabPolicyEvaluatorType? (string value) { throw null; } public static bool operator !=(Azure.ResourceManager.DevTestLabs.Models.DevTestLabPolicyEvaluatorType left, Azure.ResourceManager.DevTestLabs.Models.DevTestLabPolicyEvaluatorType right) { throw null; } public override string ToString() { throw null; } } @@ -2251,13 +2490,17 @@ protected override void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter write public override int GetHashCode() { throw null; } public static bool operator ==(Azure.ResourceManager.DevTestLabs.Models.DevTestLabPolicyFactName left, Azure.ResourceManager.DevTestLabs.Models.DevTestLabPolicyFactName right) { throw null; } public static implicit operator Azure.ResourceManager.DevTestLabs.Models.DevTestLabPolicyFactName (string value) { throw null; } + public static implicit operator Azure.ResourceManager.DevTestLabs.Models.DevTestLabPolicyFactName? (string value) { throw null; } public static bool operator !=(Azure.ResourceManager.DevTestLabs.Models.DevTestLabPolicyFactName left, Azure.ResourceManager.DevTestLabs.Models.DevTestLabPolicyFactName right) { throw null; } public override string ToString() { throw null; } } public partial class DevTestLabPolicyPatch : Azure.ResourceManager.DevTestLabs.Models.DevTestLabResourcePatch, System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel { public DevTestLabPolicyPatch() { } + protected override Azure.ResourceManager.DevTestLabs.Models.DevTestLabResourcePatch JsonModelCreateCore(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } protected override void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + protected override Azure.ResourceManager.DevTestLabs.Models.DevTestLabResourcePatch PersistableModelCreateCore(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + protected override System.BinaryData PersistableModelWriteCore(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } Azure.ResourceManager.DevTestLabs.Models.DevTestLabPolicyPatch System.ClientModel.Primitives.IJsonModel.Create(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } void System.ClientModel.Primitives.IJsonModel.Write(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } Azure.ResourceManager.DevTestLabs.Models.DevTestLabPolicyPatch System.ClientModel.Primitives.IPersistableModel.Create(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } @@ -2269,7 +2512,10 @@ public partial class DevTestLabPolicySetResult : System.ClientModel.Primitives.I internal DevTestLabPolicySetResult() { } public bool? HasError { get { throw null; } } public System.Collections.Generic.IReadOnlyList PolicyViolations { get { throw null; } } + protected virtual Azure.ResourceManager.DevTestLabs.Models.DevTestLabPolicySetResult JsonModelCreateCore(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } protected virtual void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + protected virtual Azure.ResourceManager.DevTestLabs.Models.DevTestLabPolicySetResult PersistableModelCreateCore(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + protected virtual System.BinaryData PersistableModelWriteCore(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } Azure.ResourceManager.DevTestLabs.Models.DevTestLabPolicySetResult System.ClientModel.Primitives.IJsonModel.Create(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } void System.ClientModel.Primitives.IJsonModel.Write(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } Azure.ResourceManager.DevTestLabs.Models.DevTestLabPolicySetResult System.ClientModel.Primitives.IPersistableModel.Create(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } @@ -2289,6 +2535,7 @@ protected virtual void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer public override int GetHashCode() { throw null; } public static bool operator ==(Azure.ResourceManager.DevTestLabs.Models.DevTestLabPolicyStatus left, Azure.ResourceManager.DevTestLabs.Models.DevTestLabPolicyStatus right) { throw null; } public static implicit operator Azure.ResourceManager.DevTestLabs.Models.DevTestLabPolicyStatus (string value) { throw null; } + public static implicit operator Azure.ResourceManager.DevTestLabs.Models.DevTestLabPolicyStatus? (string value) { throw null; } public static bool operator !=(Azure.ResourceManager.DevTestLabs.Models.DevTestLabPolicyStatus left, Azure.ResourceManager.DevTestLabs.Models.DevTestLabPolicyStatus right) { throw null; } public override string ToString() { throw null; } } @@ -2297,7 +2544,10 @@ public partial class DevTestLabPolicyViolation : System.ClientModel.Primitives.I internal DevTestLabPolicyViolation() { } public string Code { get { throw null; } } public string Message { get { throw null; } } + protected virtual Azure.ResourceManager.DevTestLabs.Models.DevTestLabPolicyViolation JsonModelCreateCore(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } protected virtual void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + protected virtual Azure.ResourceManager.DevTestLabs.Models.DevTestLabPolicyViolation PersistableModelCreateCore(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + protected virtual System.BinaryData PersistableModelWriteCore(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } Azure.ResourceManager.DevTestLabs.Models.DevTestLabPolicyViolation System.ClientModel.Primitives.IJsonModel.Create(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } void System.ClientModel.Primitives.IJsonModel.Write(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } Azure.ResourceManager.DevTestLabs.Models.DevTestLabPolicyViolation System.ClientModel.Primitives.IPersistableModel.Create(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } @@ -2309,7 +2559,10 @@ public partial class DevTestLabPort : System.ClientModel.Primitives.IJsonModel.Create(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } void System.ClientModel.Primitives.IJsonModel.Write(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } Azure.ResourceManager.DevTestLabs.Models.DevTestLabPort System.ClientModel.Primitives.IPersistableModel.Create(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } @@ -2329,6 +2582,7 @@ protected virtual void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer public override int GetHashCode() { throw null; } public static bool operator ==(Azure.ResourceManager.DevTestLabs.Models.DevTestLabPremiumDataDisk left, Azure.ResourceManager.DevTestLabs.Models.DevTestLabPremiumDataDisk right) { throw null; } public static implicit operator Azure.ResourceManager.DevTestLabs.Models.DevTestLabPremiumDataDisk (string value) { throw null; } + public static implicit operator Azure.ResourceManager.DevTestLabs.Models.DevTestLabPremiumDataDisk? (string value) { throw null; } public static bool operator !=(Azure.ResourceManager.DevTestLabs.Models.DevTestLabPremiumDataDisk left, Azure.ResourceManager.DevTestLabs.Models.DevTestLabPremiumDataDisk right) { throw null; } public override string ToString() { throw null; } } @@ -2336,7 +2590,10 @@ public partial class DevTestLabRdpConnection : System.ClientModel.Primitives.IJs { internal DevTestLabRdpConnection() { } public string Contents { get { throw null; } } + protected virtual Azure.ResourceManager.DevTestLabs.Models.DevTestLabRdpConnection JsonModelCreateCore(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } protected virtual void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + protected virtual Azure.ResourceManager.DevTestLabs.Models.DevTestLabRdpConnection PersistableModelCreateCore(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + protected virtual System.BinaryData PersistableModelWriteCore(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } Azure.ResourceManager.DevTestLabs.Models.DevTestLabRdpConnection System.ClientModel.Primitives.IJsonModel.Create(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } void System.ClientModel.Primitives.IJsonModel.Write(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } Azure.ResourceManager.DevTestLabs.Models.DevTestLabRdpConnection System.ClientModel.Primitives.IPersistableModel.Create(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } @@ -2356,6 +2613,7 @@ protected virtual void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer public override int GetHashCode() { throw null; } public static bool operator ==(Azure.ResourceManager.DevTestLabs.Models.DevTestLabReportingCycleType left, Azure.ResourceManager.DevTestLabs.Models.DevTestLabReportingCycleType right) { throw null; } public static implicit operator Azure.ResourceManager.DevTestLabs.Models.DevTestLabReportingCycleType (string value) { throw null; } + public static implicit operator Azure.ResourceManager.DevTestLabs.Models.DevTestLabReportingCycleType? (string value) { throw null; } public static bool operator !=(Azure.ResourceManager.DevTestLabs.Models.DevTestLabReportingCycleType left, Azure.ResourceManager.DevTestLabs.Models.DevTestLabReportingCycleType right) { throw null; } public override string ToString() { throw null; } } @@ -2371,7 +2629,10 @@ internal DevTestLabResourceCost() { } public string ResourceStatus { get { throw null; } } public string ResourceType { get { throw null; } } public string ResourceUniqueId { get { throw null; } } + protected virtual Azure.ResourceManager.DevTestLabs.Models.DevTestLabResourceCost JsonModelCreateCore(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } protected virtual void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + protected virtual Azure.ResourceManager.DevTestLabs.Models.DevTestLabResourceCost PersistableModelCreateCore(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + protected virtual System.BinaryData PersistableModelWriteCore(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } Azure.ResourceManager.DevTestLabs.Models.DevTestLabResourceCost System.ClientModel.Primitives.IJsonModel.Create(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } void System.ClientModel.Primitives.IJsonModel.Write(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } Azure.ResourceManager.DevTestLabs.Models.DevTestLabResourceCost System.ClientModel.Primitives.IPersistableModel.Create(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } @@ -2382,7 +2643,10 @@ public partial class DevTestLabResourcePatch : System.ClientModel.Primitives.IJs { public DevTestLabResourcePatch() { } public System.Collections.Generic.IDictionary Tags { get { throw null; } } + protected virtual Azure.ResourceManager.DevTestLabs.Models.DevTestLabResourcePatch JsonModelCreateCore(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } protected virtual void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + protected virtual Azure.ResourceManager.DevTestLabs.Models.DevTestLabResourcePatch PersistableModelCreateCore(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + protected virtual System.BinaryData PersistableModelWriteCore(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } Azure.ResourceManager.DevTestLabs.Models.DevTestLabResourcePatch System.ClientModel.Primitives.IJsonModel.Create(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } void System.ClientModel.Primitives.IJsonModel.Write(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } Azure.ResourceManager.DevTestLabs.Models.DevTestLabResourcePatch System.ClientModel.Primitives.IPersistableModel.Create(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } @@ -2403,7 +2667,10 @@ public DevTestLabScheduleCreationParameter() { } public string TaskType { get { throw null; } set { } } public string TimeZoneId { get { throw null; } set { } } public Azure.ResourceManager.DevTestLabs.Models.DevTestLabWeekDetails WeeklyRecurrence { get { throw null; } set { } } + protected virtual Azure.ResourceManager.DevTestLabs.Models.DevTestLabScheduleCreationParameter JsonModelCreateCore(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } protected virtual void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + protected virtual Azure.ResourceManager.DevTestLabs.Models.DevTestLabScheduleCreationParameter PersistableModelCreateCore(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + protected virtual System.BinaryData PersistableModelWriteCore(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } Azure.ResourceManager.DevTestLabs.Models.DevTestLabScheduleCreationParameter System.ClientModel.Primitives.IJsonModel.Create(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } void System.ClientModel.Primitives.IJsonModel.Write(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } Azure.ResourceManager.DevTestLabs.Models.DevTestLabScheduleCreationParameter System.ClientModel.Primitives.IPersistableModel.Create(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } @@ -2413,7 +2680,10 @@ protected virtual void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer public partial class DevTestLabSchedulePatch : Azure.ResourceManager.DevTestLabs.Models.DevTestLabResourcePatch, System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel { public DevTestLabSchedulePatch() { } + protected override Azure.ResourceManager.DevTestLabs.Models.DevTestLabResourcePatch JsonModelCreateCore(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } protected override void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + protected override Azure.ResourceManager.DevTestLabs.Models.DevTestLabResourcePatch PersistableModelCreateCore(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + protected override System.BinaryData PersistableModelWriteCore(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } Azure.ResourceManager.DevTestLabs.Models.DevTestLabSchedulePatch System.ClientModel.Primitives.IJsonModel.Create(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } void System.ClientModel.Primitives.IJsonModel.Write(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } Azure.ResourceManager.DevTestLabs.Models.DevTestLabSchedulePatch System.ClientModel.Primitives.IPersistableModel.Create(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } @@ -2423,7 +2693,10 @@ protected override void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter write public partial class DevTestLabSecretPatch : Azure.ResourceManager.DevTestLabs.Models.DevTestLabResourcePatch, System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel { public DevTestLabSecretPatch() { } + protected override Azure.ResourceManager.DevTestLabs.Models.DevTestLabResourcePatch JsonModelCreateCore(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } protected override void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + protected override Azure.ResourceManager.DevTestLabs.Models.DevTestLabResourcePatch PersistableModelCreateCore(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + protected override System.BinaryData PersistableModelWriteCore(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } Azure.ResourceManager.DevTestLabs.Models.DevTestLabSecretPatch System.ClientModel.Primitives.IJsonModel.Create(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } void System.ClientModel.Primitives.IJsonModel.Write(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } Azure.ResourceManager.DevTestLabs.Models.DevTestLabSecretPatch System.ClientModel.Primitives.IPersistableModel.Create(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } @@ -2433,7 +2706,10 @@ protected override void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter write public partial class DevTestLabServiceFabricPatch : Azure.ResourceManager.DevTestLabs.Models.DevTestLabResourcePatch, System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel { public DevTestLabServiceFabricPatch() { } + protected override Azure.ResourceManager.DevTestLabs.Models.DevTestLabResourcePatch JsonModelCreateCore(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } protected override void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + protected override Azure.ResourceManager.DevTestLabs.Models.DevTestLabResourcePatch PersistableModelCreateCore(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + protected override System.BinaryData PersistableModelWriteCore(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } Azure.ResourceManager.DevTestLabs.Models.DevTestLabServiceFabricPatch System.ClientModel.Primitives.IJsonModel.Create(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } void System.ClientModel.Primitives.IJsonModel.Write(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } Azure.ResourceManager.DevTestLabs.Models.DevTestLabServiceFabricPatch System.ClientModel.Primitives.IPersistableModel.Create(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } @@ -2454,6 +2730,7 @@ protected override void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter write public override int GetHashCode() { throw null; } public static bool operator ==(Azure.ResourceManager.DevTestLabs.Models.DevTestLabSourceControlType left, Azure.ResourceManager.DevTestLabs.Models.DevTestLabSourceControlType right) { throw null; } public static implicit operator Azure.ResourceManager.DevTestLabs.Models.DevTestLabSourceControlType (string value) { throw null; } + public static implicit operator Azure.ResourceManager.DevTestLabs.Models.DevTestLabSourceControlType? (string value) { throw null; } public static bool operator !=(Azure.ResourceManager.DevTestLabs.Models.DevTestLabSourceControlType left, Azure.ResourceManager.DevTestLabs.Models.DevTestLabSourceControlType right) { throw null; } public override string ToString() { throw null; } } @@ -2471,6 +2748,7 @@ protected override void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter write public override int GetHashCode() { throw null; } public static bool operator ==(Azure.ResourceManager.DevTestLabs.Models.DevTestLabStorageType left, Azure.ResourceManager.DevTestLabs.Models.DevTestLabStorageType right) { throw null; } public static implicit operator Azure.ResourceManager.DevTestLabs.Models.DevTestLabStorageType (string value) { throw null; } + public static implicit operator Azure.ResourceManager.DevTestLabs.Models.DevTestLabStorageType? (string value) { throw null; } public static bool operator !=(Azure.ResourceManager.DevTestLabs.Models.DevTestLabStorageType left, Azure.ResourceManager.DevTestLabs.Models.DevTestLabStorageType right) { throw null; } public override string ToString() { throw null; } } @@ -2480,7 +2758,10 @@ public DevTestLabSubnet() { } public Azure.ResourceManager.DevTestLabs.Models.DevTestLabUsagePermissionType? AllowPublicIP { get { throw null; } set { } } public string LabSubnetName { get { throw null; } set { } } public Azure.Core.ResourceIdentifier ResourceId { get { throw null; } set { } } + protected virtual Azure.ResourceManager.DevTestLabs.Models.DevTestLabSubnet JsonModelCreateCore(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } protected virtual void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + protected virtual Azure.ResourceManager.DevTestLabs.Models.DevTestLabSubnet PersistableModelCreateCore(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + protected virtual System.BinaryData PersistableModelWriteCore(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } Azure.ResourceManager.DevTestLabs.Models.DevTestLabSubnet System.ClientModel.Primitives.IJsonModel.Create(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } void System.ClientModel.Primitives.IJsonModel.Write(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } Azure.ResourceManager.DevTestLabs.Models.DevTestLabSubnet System.ClientModel.Primitives.IPersistableModel.Create(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } @@ -2496,7 +2777,10 @@ public DevTestLabSubnetOverride() { } public Azure.ResourceManager.DevTestLabs.Models.DevTestLabUsagePermissionType? UseInVmCreationPermission { get { throw null; } set { } } public Azure.ResourceManager.DevTestLabs.Models.DevTestLabUsagePermissionType? UsePublicIPAddressPermission { get { throw null; } set { } } public string VirtualNetworkPoolName { get { throw null; } set { } } + protected virtual Azure.ResourceManager.DevTestLabs.Models.DevTestLabSubnetOverride JsonModelCreateCore(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } protected virtual void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + protected virtual Azure.ResourceManager.DevTestLabs.Models.DevTestLabSubnetOverride PersistableModelCreateCore(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + protected virtual System.BinaryData PersistableModelWriteCore(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } Azure.ResourceManager.DevTestLabs.Models.DevTestLabSubnetOverride System.ClientModel.Primitives.IJsonModel.Create(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } void System.ClientModel.Primitives.IJsonModel.Write(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } Azure.ResourceManager.DevTestLabs.Models.DevTestLabSubnetOverride System.ClientModel.Primitives.IPersistableModel.Create(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } @@ -2508,7 +2792,10 @@ public partial class DevTestLabSupport : System.ClientModel.Primitives.IJsonMode public DevTestLabSupport() { } public Azure.ResourceManager.DevTestLabs.Models.DevTestLabEnableStatus? Enabled { get { throw null; } set { } } public string Markdown { get { throw null; } set { } } + protected virtual Azure.ResourceManager.DevTestLabs.Models.DevTestLabSupport JsonModelCreateCore(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } protected virtual void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + protected virtual Azure.ResourceManager.DevTestLabs.Models.DevTestLabSupport PersistableModelCreateCore(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + protected virtual System.BinaryData PersistableModelWriteCore(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } Azure.ResourceManager.DevTestLabs.Models.DevTestLabSupport System.ClientModel.Primitives.IJsonModel.Create(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } void System.ClientModel.Primitives.IJsonModel.Write(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } Azure.ResourceManager.DevTestLabs.Models.DevTestLabSupport System.ClientModel.Primitives.IPersistableModel.Create(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } @@ -2524,7 +2811,10 @@ public DevTestLabTargetCost() { } public Azure.ResourceManager.DevTestLabs.Models.DevTestLabReportingCycleType? CycleType { get { throw null; } set { } } public Azure.ResourceManager.DevTestLabs.Models.DevTestLabTargetCostStatus? Status { get { throw null; } set { } } public int? Target { get { throw null; } set { } } + protected virtual Azure.ResourceManager.DevTestLabs.Models.DevTestLabTargetCost JsonModelCreateCore(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } protected virtual void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + protected virtual Azure.ResourceManager.DevTestLabs.Models.DevTestLabTargetCost PersistableModelCreateCore(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + protected virtual System.BinaryData PersistableModelWriteCore(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } Azure.ResourceManager.DevTestLabs.Models.DevTestLabTargetCost System.ClientModel.Primitives.IJsonModel.Create(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } void System.ClientModel.Primitives.IJsonModel.Write(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } Azure.ResourceManager.DevTestLabs.Models.DevTestLabTargetCost System.ClientModel.Primitives.IPersistableModel.Create(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } @@ -2544,6 +2834,7 @@ protected virtual void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer public override int GetHashCode() { throw null; } public static bool operator ==(Azure.ResourceManager.DevTestLabs.Models.DevTestLabTargetCostStatus left, Azure.ResourceManager.DevTestLabs.Models.DevTestLabTargetCostStatus right) { throw null; } public static implicit operator Azure.ResourceManager.DevTestLabs.Models.DevTestLabTargetCostStatus (string value) { throw null; } + public static implicit operator Azure.ResourceManager.DevTestLabs.Models.DevTestLabTargetCostStatus? (string value) { throw null; } public static bool operator !=(Azure.ResourceManager.DevTestLabs.Models.DevTestLabTargetCostStatus left, Azure.ResourceManager.DevTestLabs.Models.DevTestLabTargetCostStatus right) { throw null; } public override string ToString() { throw null; } } @@ -2560,6 +2851,7 @@ protected virtual void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer public override int GetHashCode() { throw null; } public static bool operator ==(Azure.ResourceManager.DevTestLabs.Models.DevTestLabTransportProtocol left, Azure.ResourceManager.DevTestLabs.Models.DevTestLabTransportProtocol right) { throw null; } public static implicit operator Azure.ResourceManager.DevTestLabs.Models.DevTestLabTransportProtocol (string value) { throw null; } + public static implicit operator Azure.ResourceManager.DevTestLabs.Models.DevTestLabTransportProtocol? (string value) { throw null; } public static bool operator !=(Azure.ResourceManager.DevTestLabs.Models.DevTestLabTransportProtocol left, Azure.ResourceManager.DevTestLabs.Models.DevTestLabTransportProtocol right) { throw null; } public override string ToString() { throw null; } } @@ -2577,6 +2869,7 @@ protected virtual void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer public override int GetHashCode() { throw null; } public static bool operator ==(Azure.ResourceManager.DevTestLabs.Models.DevTestLabUsagePermissionType left, Azure.ResourceManager.DevTestLabs.Models.DevTestLabUsagePermissionType right) { throw null; } public static implicit operator Azure.ResourceManager.DevTestLabs.Models.DevTestLabUsagePermissionType (string value) { throw null; } + public static implicit operator Azure.ResourceManager.DevTestLabs.Models.DevTestLabUsagePermissionType? (string value) { throw null; } public static bool operator !=(Azure.ResourceManager.DevTestLabs.Models.DevTestLabUsagePermissionType left, Azure.ResourceManager.DevTestLabs.Models.DevTestLabUsagePermissionType right) { throw null; } public override string ToString() { throw null; } } @@ -2588,7 +2881,10 @@ public DevTestLabUserIdentity() { } public string PrincipalId { get { throw null; } set { } } public string PrincipalName { get { throw null; } set { } } public System.Guid? TenantId { get { throw null; } set { } } + protected virtual Azure.ResourceManager.DevTestLabs.Models.DevTestLabUserIdentity JsonModelCreateCore(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } protected virtual void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + protected virtual Azure.ResourceManager.DevTestLabs.Models.DevTestLabUserIdentity PersistableModelCreateCore(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + protected virtual System.BinaryData PersistableModelWriteCore(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } Azure.ResourceManager.DevTestLabs.Models.DevTestLabUserIdentity System.ClientModel.Primitives.IJsonModel.Create(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } void System.ClientModel.Primitives.IJsonModel.Write(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } Azure.ResourceManager.DevTestLabs.Models.DevTestLabUserIdentity System.ClientModel.Primitives.IPersistableModel.Create(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } @@ -2598,7 +2894,10 @@ protected virtual void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer public partial class DevTestLabUserPatch : Azure.ResourceManager.DevTestLabs.Models.DevTestLabResourcePatch, System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel { public DevTestLabUserPatch() { } + protected override Azure.ResourceManager.DevTestLabs.Models.DevTestLabResourcePatch JsonModelCreateCore(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } protected override void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + protected override Azure.ResourceManager.DevTestLabs.Models.DevTestLabResourcePatch PersistableModelCreateCore(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + protected override System.BinaryData PersistableModelWriteCore(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } Azure.ResourceManager.DevTestLabs.Models.DevTestLabUserPatch System.ClientModel.Primitives.IJsonModel.Create(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } void System.ClientModel.Primitives.IJsonModel.Write(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } Azure.ResourceManager.DevTestLabs.Models.DevTestLabUserPatch System.ClientModel.Primitives.IPersistableModel.Create(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } @@ -2610,17 +2909,37 @@ public partial class DevTestLabUserSecretStore : System.ClientModel.Primitives.I public DevTestLabUserSecretStore() { } public Azure.Core.ResourceIdentifier KeyVaultId { get { throw null; } set { } } public System.Uri KeyVaultUri { get { throw null; } set { } } + protected virtual Azure.ResourceManager.DevTestLabs.Models.DevTestLabUserSecretStore JsonModelCreateCore(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } protected virtual void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + protected virtual Azure.ResourceManager.DevTestLabs.Models.DevTestLabUserSecretStore PersistableModelCreateCore(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + protected virtual System.BinaryData PersistableModelWriteCore(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } Azure.ResourceManager.DevTestLabs.Models.DevTestLabUserSecretStore System.ClientModel.Primitives.IJsonModel.Create(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } void System.ClientModel.Primitives.IJsonModel.Write(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } Azure.ResourceManager.DevTestLabs.Models.DevTestLabUserSecretStore System.ClientModel.Primitives.IPersistableModel.Create(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } string System.ClientModel.Primitives.IPersistableModel.GetFormatFromOptions(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } System.BinaryData System.ClientModel.Primitives.IPersistableModel.Write(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } } + public partial class DevTestLabVhd : System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel + { + internal DevTestLabVhd() { } + public System.Uri Id { get { throw null; } } + protected virtual Azure.ResourceManager.DevTestLabs.Models.DevTestLabVhd JsonModelCreateCore(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + protected virtual void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + protected virtual Azure.ResourceManager.DevTestLabs.Models.DevTestLabVhd PersistableModelCreateCore(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + protected virtual System.BinaryData PersistableModelWriteCore(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + Azure.ResourceManager.DevTestLabs.Models.DevTestLabVhd System.ClientModel.Primitives.IJsonModel.Create(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + void System.ClientModel.Primitives.IJsonModel.Write(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.ResourceManager.DevTestLabs.Models.DevTestLabVhd System.ClientModel.Primitives.IPersistableModel.Create(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + string System.ClientModel.Primitives.IPersistableModel.GetFormatFromOptions(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + System.BinaryData System.ClientModel.Primitives.IPersistableModel.Write(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + } public partial class DevTestLabVirtualNetworkPatch : Azure.ResourceManager.DevTestLabs.Models.DevTestLabResourcePatch, System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel { public DevTestLabVirtualNetworkPatch() { } + protected override Azure.ResourceManager.DevTestLabs.Models.DevTestLabResourcePatch JsonModelCreateCore(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } protected override void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + protected override Azure.ResourceManager.DevTestLabs.Models.DevTestLabResourcePatch PersistableModelCreateCore(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + protected override System.BinaryData PersistableModelWriteCore(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } Azure.ResourceManager.DevTestLabs.Models.DevTestLabVirtualNetworkPatch System.ClientModel.Primitives.IJsonModel.Create(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } void System.ClientModel.Primitives.IJsonModel.Write(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } Azure.ResourceManager.DevTestLabs.Models.DevTestLabVirtualNetworkPatch System.ClientModel.Primitives.IPersistableModel.Create(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } @@ -2631,7 +2950,10 @@ public partial class DevTestLabVmApplyArtifactsContent : System.ClientModel.Prim { public DevTestLabVmApplyArtifactsContent() { } public System.Collections.Generic.IList Artifacts { get { throw null; } } + protected virtual Azure.ResourceManager.DevTestLabs.Models.DevTestLabVmApplyArtifactsContent JsonModelCreateCore(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } protected virtual void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + protected virtual Azure.ResourceManager.DevTestLabs.Models.DevTestLabVmApplyArtifactsContent PersistableModelCreateCore(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + protected virtual System.BinaryData PersistableModelWriteCore(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } Azure.ResourceManager.DevTestLabs.Models.DevTestLabVmApplyArtifactsContent System.ClientModel.Primitives.IJsonModel.Create(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } void System.ClientModel.Primitives.IJsonModel.Write(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } Azure.ResourceManager.DevTestLabs.Models.DevTestLabVmApplyArtifactsContent System.ClientModel.Primitives.IPersistableModel.Create(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } @@ -2668,7 +2990,10 @@ public DevTestLabVmCreationContent() { } public string StorageType { get { throw null; } set { } } public System.Collections.Generic.IDictionary Tags { get { throw null; } } public string UserName { get { throw null; } set { } } + protected virtual Azure.ResourceManager.DevTestLabs.Models.DevTestLabVmCreationContent JsonModelCreateCore(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } protected virtual void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + protected virtual Azure.ResourceManager.DevTestLabs.Models.DevTestLabVmCreationContent PersistableModelCreateCore(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + protected virtual System.BinaryData PersistableModelWriteCore(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } Azure.ResourceManager.DevTestLabs.Models.DevTestLabVmCreationContent System.ClientModel.Primitives.IJsonModel.Create(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } void System.ClientModel.Primitives.IJsonModel.Write(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } Azure.ResourceManager.DevTestLabs.Models.DevTestLabVmCreationContent System.ClientModel.Primitives.IPersistableModel.Create(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } @@ -2689,6 +3014,7 @@ protected virtual void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer public override int GetHashCode() { throw null; } public static bool operator ==(Azure.ResourceManager.DevTestLabs.Models.DevTestLabVmCreationSource left, Azure.ResourceManager.DevTestLabs.Models.DevTestLabVmCreationSource right) { throw null; } public static implicit operator Azure.ResourceManager.DevTestLabs.Models.DevTestLabVmCreationSource (string value) { throw null; } + public static implicit operator Azure.ResourceManager.DevTestLabs.Models.DevTestLabVmCreationSource? (string value) { throw null; } public static bool operator !=(Azure.ResourceManager.DevTestLabs.Models.DevTestLabVmCreationSource left, Azure.ResourceManager.DevTestLabs.Models.DevTestLabVmCreationSource right) { throw null; } public override string ToString() { throw null; } } @@ -2696,7 +3022,10 @@ public partial class DevTestLabVmDetachDataDiskContent : System.ClientModel.Prim { public DevTestLabVmDetachDataDiskContent() { } public Azure.Core.ResourceIdentifier ExistingLabDiskId { get { throw null; } set { } } + protected virtual Azure.ResourceManager.DevTestLabs.Models.DevTestLabVmDetachDataDiskContent JsonModelCreateCore(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } protected virtual void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + protected virtual Azure.ResourceManager.DevTestLabs.Models.DevTestLabVmDetachDataDiskContent PersistableModelCreateCore(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + protected virtual System.BinaryData PersistableModelWriteCore(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } Azure.ResourceManager.DevTestLabs.Models.DevTestLabVmDetachDataDiskContent System.ClientModel.Primitives.IJsonModel.Create(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } void System.ClientModel.Primitives.IJsonModel.Write(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } Azure.ResourceManager.DevTestLabs.Models.DevTestLabVmDetachDataDiskContent System.ClientModel.Primitives.IPersistableModel.Create(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } @@ -2706,7 +3035,10 @@ protected virtual void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer public partial class DevTestLabVmPatch : Azure.ResourceManager.DevTestLabs.Models.DevTestLabResourcePatch, System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel { public DevTestLabVmPatch() { } + protected override Azure.ResourceManager.DevTestLabs.Models.DevTestLabResourcePatch JsonModelCreateCore(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } protected override void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + protected override Azure.ResourceManager.DevTestLabs.Models.DevTestLabResourcePatch PersistableModelCreateCore(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + protected override System.BinaryData PersistableModelWriteCore(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } Azure.ResourceManager.DevTestLabs.Models.DevTestLabVmPatch System.ClientModel.Primitives.IJsonModel.Create(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } void System.ClientModel.Primitives.IJsonModel.Write(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } Azure.ResourceManager.DevTestLabs.Models.DevTestLabVmPatch System.ClientModel.Primitives.IPersistableModel.Create(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } @@ -2717,7 +3049,10 @@ public partial class DevTestLabVmResizeContent : System.ClientModel.Primitives.I { public DevTestLabVmResizeContent() { } public string Size { get { throw null; } set { } } + protected virtual Azure.ResourceManager.DevTestLabs.Models.DevTestLabVmResizeContent JsonModelCreateCore(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } protected virtual void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + protected virtual Azure.ResourceManager.DevTestLabs.Models.DevTestLabVmResizeContent PersistableModelCreateCore(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + protected virtual System.BinaryData PersistableModelWriteCore(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } Azure.ResourceManager.DevTestLabs.Models.DevTestLabVmResizeContent System.ClientModel.Primitives.IJsonModel.Create(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } void System.ClientModel.Primitives.IJsonModel.Write(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } Azure.ResourceManager.DevTestLabs.Models.DevTestLabVmResizeContent System.ClientModel.Primitives.IPersistableModel.Create(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } @@ -2729,7 +3064,10 @@ public partial class DevTestLabWeekDetails : System.ClientModel.Primitives.IJson public DevTestLabWeekDetails() { } public string Time { get { throw null; } set { } } public System.Collections.Generic.IList Weekdays { get { throw null; } } + protected virtual Azure.ResourceManager.DevTestLabs.Models.DevTestLabWeekDetails JsonModelCreateCore(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } protected virtual void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + protected virtual Azure.ResourceManager.DevTestLabs.Models.DevTestLabWeekDetails PersistableModelCreateCore(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + protected virtual System.BinaryData PersistableModelWriteCore(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } Azure.ResourceManager.DevTestLabs.Models.DevTestLabWeekDetails System.ClientModel.Primitives.IJsonModel.Create(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } void System.ClientModel.Primitives.IJsonModel.Write(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } Azure.ResourceManager.DevTestLabs.Models.DevTestLabWeekDetails System.ClientModel.Primitives.IPersistableModel.Create(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } @@ -2750,6 +3088,7 @@ protected virtual void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer public override int GetHashCode() { throw null; } public static bool operator ==(Azure.ResourceManager.DevTestLabs.Models.WindowsOSState left, Azure.ResourceManager.DevTestLabs.Models.WindowsOSState right) { throw null; } public static implicit operator Azure.ResourceManager.DevTestLabs.Models.WindowsOSState (string value) { throw null; } + public static implicit operator Azure.ResourceManager.DevTestLabs.Models.WindowsOSState? (string value) { throw null; } public static bool operator !=(Azure.ResourceManager.DevTestLabs.Models.WindowsOSState left, Azure.ResourceManager.DevTestLabs.Models.WindowsOSState right) { throw null; } public override string ToString() { throw null; } } diff --git a/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/api/Azure.ResourceManager.DevTestLabs.netstandard2.0.cs b/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/api/Azure.ResourceManager.DevTestLabs.netstandard2.0.cs index d598d5b1b1b4..3fa28f3e72e7 100644 --- a/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/api/Azure.ResourceManager.DevTestLabs.netstandard2.0.cs +++ b/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/api/Azure.ResourceManager.DevTestLabs.netstandard2.0.cs @@ -32,7 +32,10 @@ public DevTestLabArmTemplateData(Azure.Core.AzureLocation location) { } public bool? IsEnabled { get { throw null; } } public System.Collections.Generic.IReadOnlyList ParametersValueFilesInfo { get { throw null; } } public string Publisher { get { throw null; } } + protected virtual Azure.ResourceManager.Models.ResourceData JsonModelCreateCore(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } protected override void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + protected virtual Azure.ResourceManager.Models.ResourceData PersistableModelCreateCore(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + protected virtual System.BinaryData PersistableModelWriteCore(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } Azure.ResourceManager.DevTestLabs.DevTestLabArmTemplateData System.ClientModel.Primitives.IJsonModel.Create(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } void System.ClientModel.Primitives.IJsonModel.Write(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } Azure.ResourceManager.DevTestLabs.DevTestLabArmTemplateData System.ClientModel.Primitives.IPersistableModel.Create(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } @@ -80,7 +83,10 @@ public DevTestLabArtifactData(Azure.Core.AzureLocation location) { } public string Publisher { get { throw null; } } public string TargetOSType { get { throw null; } } public string Title { get { throw null; } } + protected virtual Azure.ResourceManager.Models.ResourceData JsonModelCreateCore(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } protected override void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + protected virtual Azure.ResourceManager.Models.ResourceData PersistableModelCreateCore(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + protected virtual System.BinaryData PersistableModelWriteCore(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } Azure.ResourceManager.DevTestLabs.DevTestLabArtifactData System.ClientModel.Primitives.IJsonModel.Create(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } void System.ClientModel.Primitives.IJsonModel.Write(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } Azure.ResourceManager.DevTestLabs.DevTestLabArtifactData System.ClientModel.Primitives.IPersistableModel.Create(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } @@ -135,7 +141,10 @@ public DevTestLabArtifactSourceData(Azure.Core.AzureLocation location) { } public Azure.ResourceManager.DevTestLabs.Models.DevTestLabEnableStatus? Status { get { throw null; } set { } } public System.Guid? UniqueIdentifier { get { throw null; } } public System.Uri Uri { get { throw null; } set { } } + protected virtual Azure.ResourceManager.Models.ResourceData JsonModelCreateCore(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } protected override void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + protected virtual Azure.ResourceManager.Models.ResourceData PersistableModelCreateCore(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + protected virtual System.BinaryData PersistableModelWriteCore(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } Azure.ResourceManager.DevTestLabs.DevTestLabArtifactSourceData System.ClientModel.Primitives.IJsonModel.Create(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } void System.ClientModel.Primitives.IJsonModel.Write(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } Azure.ResourceManager.DevTestLabs.DevTestLabArtifactSourceData System.ClientModel.Primitives.IPersistableModel.Create(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } @@ -215,7 +224,10 @@ public DevTestLabCostData(Azure.Core.AzureLocation location) { } public System.DateTimeOffset? StartOn { get { throw null; } set { } } public Azure.ResourceManager.DevTestLabs.Models.DevTestLabTargetCost TargetCost { get { throw null; } set { } } public System.Guid? UniqueIdentifier { get { throw null; } } + protected virtual Azure.ResourceManager.Models.ResourceData JsonModelCreateCore(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } protected override void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + protected virtual Azure.ResourceManager.Models.ResourceData PersistableModelCreateCore(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + protected virtual System.BinaryData PersistableModelWriteCore(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } Azure.ResourceManager.DevTestLabs.DevTestLabCostData System.ClientModel.Primitives.IJsonModel.Create(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } void System.ClientModel.Primitives.IJsonModel.Write(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } Azure.ResourceManager.DevTestLabs.DevTestLabCostData System.ClientModel.Primitives.IPersistableModel.Create(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } @@ -277,7 +289,10 @@ public DevTestLabCustomImageData(Azure.Core.AzureLocation location) { } public System.Guid? UniqueIdentifier { get { throw null; } } public Azure.ResourceManager.DevTestLabs.Models.DevTestLabCustomImageVhd Vhd { get { throw null; } set { } } public Azure.ResourceManager.DevTestLabs.Models.DevTestLabCustomImageVm Vm { get { throw null; } set { } } + protected virtual Azure.ResourceManager.Models.ResourceData JsonModelCreateCore(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } protected override void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + protected virtual Azure.ResourceManager.Models.ResourceData PersistableModelCreateCore(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + protected virtual System.BinaryData PersistableModelWriteCore(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } Azure.ResourceManager.DevTestLabs.DevTestLabCustomImageData System.ClientModel.Primitives.IJsonModel.Create(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } void System.ClientModel.Primitives.IJsonModel.Write(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } Azure.ResourceManager.DevTestLabs.DevTestLabCustomImageData System.ClientModel.Primitives.IPersistableModel.Create(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } @@ -332,7 +347,10 @@ public DevTestLabData(Azure.Core.AzureLocation location) { } public System.Guid? UniqueIdentifier { get { throw null; } } public string VaultName { get { throw null; } } public string VmCreationResourceGroup { get { throw null; } } + protected virtual Azure.ResourceManager.Models.ResourceData JsonModelCreateCore(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } protected override void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + protected virtual Azure.ResourceManager.Models.ResourceData PersistableModelCreateCore(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + protected virtual System.BinaryData PersistableModelWriteCore(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } Azure.ResourceManager.DevTestLabs.DevTestLabData System.ClientModel.Primitives.IJsonModel.Create(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } void System.ClientModel.Primitives.IJsonModel.Write(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } Azure.ResourceManager.DevTestLabs.DevTestLabData System.ClientModel.Primitives.IPersistableModel.Create(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } @@ -370,7 +388,10 @@ public DevTestLabDiskData(Azure.Core.AzureLocation location) { } public string ProvisioningState { get { throw null; } } public string StorageAccountId { get { throw null; } set { } } public System.Guid? UniqueIdentifier { get { throw null; } } + protected virtual Azure.ResourceManager.Models.ResourceData JsonModelCreateCore(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } protected override void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + protected virtual Azure.ResourceManager.Models.ResourceData PersistableModelCreateCore(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + protected virtual System.BinaryData PersistableModelWriteCore(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } Azure.ResourceManager.DevTestLabs.DevTestLabDiskData System.ClientModel.Primitives.IJsonModel.Create(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } void System.ClientModel.Primitives.IJsonModel.Write(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } Azure.ResourceManager.DevTestLabs.DevTestLabDiskData System.ClientModel.Primitives.IPersistableModel.Create(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } @@ -432,7 +453,10 @@ public DevTestLabEnvironmentData(Azure.Core.AzureLocation location) { } public string ProvisioningState { get { throw null; } } public string ResourceGroupId { get { throw null; } } public System.Guid? UniqueIdentifier { get { throw null; } } + protected virtual Azure.ResourceManager.Models.ResourceData JsonModelCreateCore(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } protected override void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + protected virtual Azure.ResourceManager.Models.ResourceData PersistableModelCreateCore(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + protected virtual System.BinaryData PersistableModelWriteCore(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } Azure.ResourceManager.DevTestLabs.DevTestLabEnvironmentData System.ClientModel.Primitives.IJsonModel.Create(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } void System.ClientModel.Primitives.IJsonModel.Write(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } Azure.ResourceManager.DevTestLabs.DevTestLabEnvironmentData System.ClientModel.Primitives.IPersistableModel.Create(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } @@ -492,7 +516,10 @@ public DevTestLabFormulaData(Azure.Core.AzureLocation location) { } public string OSType { get { throw null; } set { } } public string ProvisioningState { get { throw null; } } public System.Guid? UniqueIdentifier { get { throw null; } } + protected virtual Azure.ResourceManager.Models.ResourceData JsonModelCreateCore(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } protected override void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + protected virtual Azure.ResourceManager.Models.ResourceData PersistableModelCreateCore(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + protected virtual System.BinaryData PersistableModelWriteCore(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } Azure.ResourceManager.DevTestLabs.DevTestLabFormulaData System.ClientModel.Primitives.IJsonModel.Create(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } void System.ClientModel.Primitives.IJsonModel.Write(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } Azure.ResourceManager.DevTestLabs.DevTestLabFormulaData System.ClientModel.Primitives.IPersistableModel.Create(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } @@ -598,7 +625,10 @@ public DevTestLabNotificationChannelData(Azure.Core.AzureLocation location) { } public string ProvisioningState { get { throw null; } } public System.Guid? UniqueIdentifier { get { throw null; } } public System.Uri WebHookUri { get { throw null; } set { } } + protected virtual Azure.ResourceManager.Models.ResourceData JsonModelCreateCore(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } protected override void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + protected virtual Azure.ResourceManager.Models.ResourceData PersistableModelCreateCore(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + protected virtual System.BinaryData PersistableModelWriteCore(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } Azure.ResourceManager.DevTestLabs.DevTestLabNotificationChannelData System.ClientModel.Primitives.IJsonModel.Create(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } void System.ClientModel.Primitives.IJsonModel.Write(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } Azure.ResourceManager.DevTestLabs.DevTestLabNotificationChannelData System.ClientModel.Primitives.IPersistableModel.Create(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } @@ -661,7 +691,10 @@ public DevTestLabPolicyData(Azure.Core.AzureLocation location) { } public Azure.ResourceManager.DevTestLabs.Models.DevTestLabPolicyStatus? Status { get { throw null; } set { } } public string Threshold { get { throw null; } set { } } public System.Guid? UniqueIdentifier { get { throw null; } } + protected virtual Azure.ResourceManager.Models.ResourceData JsonModelCreateCore(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } protected override void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + protected virtual Azure.ResourceManager.Models.ResourceData PersistableModelCreateCore(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + protected virtual System.BinaryData PersistableModelWriteCore(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } Azure.ResourceManager.DevTestLabs.DevTestLabPolicyData System.ClientModel.Primitives.IJsonModel.Create(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } void System.ClientModel.Primitives.IJsonModel.Write(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } Azure.ResourceManager.DevTestLabs.DevTestLabPolicyData System.ClientModel.Primitives.IPersistableModel.Create(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } @@ -743,6 +776,8 @@ protected DevTestLabResource() { } public virtual Azure.Response GetDevTestLabUser(string name, string expand = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } public virtual System.Threading.Tasks.Task> GetDevTestLabUserAsync(string name, string expand = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } public virtual Azure.ResourceManager.DevTestLabs.DevTestLabUserCollection GetDevTestLabUsers() { throw null; } + public virtual Azure.Pageable GetDevTestLabVhds(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.AsyncPageable GetDevTestLabVhdsAsync(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } public virtual Azure.Response GetDevTestLabVirtualNetwork(string name, string expand = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } public virtual System.Threading.Tasks.Task> GetDevTestLabVirtualNetworkAsync(string name, string expand = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } public virtual Azure.ResourceManager.DevTestLabs.DevTestLabVirtualNetworkCollection GetDevTestLabVirtualNetworks() { throw null; } @@ -751,7 +786,9 @@ protected DevTestLabResource() { } public virtual Azure.ResourceManager.DevTestLabs.DevTestLabVmCollection GetDevTestLabVms() { throw null; } public virtual Azure.Pageable GetGalleryImages(string expand = null, string filter = null, int? top = default(int?), string orderby = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } public virtual Azure.AsyncPageable GetGalleryImagesAsync(string expand = null, string filter = null, int? top = default(int?), string orderby = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + [System.ObsoleteAttribute("This operation is not supported. Please use the method GetDevTestLabVhds instead.", false)] public virtual Azure.Pageable GetVhds(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + [System.ObsoleteAttribute("This operation is not supported. Please use the method GetDevTestLabVhdsAsync instead.", false)] public virtual Azure.AsyncPageable GetVhdsAsync(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } public virtual Azure.ResourceManager.ArmOperation ImportVm(Azure.WaitUntil waitUntil, Azure.ResourceManager.DevTestLabs.Models.DevTestLabImportVmContent content, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } public virtual System.Threading.Tasks.Task ImportVmAsync(Azure.WaitUntil waitUntil, Azure.ResourceManager.DevTestLabs.Models.DevTestLabImportVmContent content, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } @@ -800,7 +837,10 @@ public DevTestLabScheduleData(Azure.Core.AzureLocation location) { } public string TimeZoneId { get { throw null; } set { } } public System.Guid? UniqueIdentifier { get { throw null; } } public Azure.ResourceManager.DevTestLabs.Models.DevTestLabWeekDetails WeeklyRecurrence { get { throw null; } set { } } + protected virtual Azure.ResourceManager.Models.ResourceData JsonModelCreateCore(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } protected override void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + protected virtual Azure.ResourceManager.Models.ResourceData PersistableModelCreateCore(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + protected virtual System.BinaryData PersistableModelWriteCore(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } Azure.ResourceManager.DevTestLabs.DevTestLabScheduleData System.ClientModel.Primitives.IJsonModel.Create(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } void System.ClientModel.Primitives.IJsonModel.Write(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } Azure.ResourceManager.DevTestLabs.DevTestLabScheduleData System.ClientModel.Primitives.IPersistableModel.Create(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } @@ -821,6 +861,8 @@ protected DevTestLabScheduleResource() { } public virtual Azure.ResourceManager.ArmOperation Execute(Azure.WaitUntil waitUntil, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } public virtual System.Threading.Tasks.Task ExecuteAsync(Azure.WaitUntil waitUntil, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } public virtual Azure.Response Get(string expand = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Pageable GetApplicable(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.AsyncPageable GetApplicableAsync(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } public virtual System.Threading.Tasks.Task> GetAsync(string expand = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } public virtual Azure.Response RemoveTag(string key, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } public virtual System.Threading.Tasks.Task> RemoveTagAsync(string key, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } @@ -857,7 +899,10 @@ public DevTestLabSecretData(Azure.Core.AzureLocation location) { } public string ProvisioningState { get { throw null; } } public System.Guid? UniqueIdentifier { get { throw null; } } public string Value { get { throw null; } set { } } + protected virtual Azure.ResourceManager.Models.ResourceData JsonModelCreateCore(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } protected override void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + protected virtual Azure.ResourceManager.Models.ResourceData PersistableModelCreateCore(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + protected virtual System.BinaryData PersistableModelWriteCore(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } Azure.ResourceManager.DevTestLabs.DevTestLabSecretData System.ClientModel.Primitives.IJsonModel.Create(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } void System.ClientModel.Primitives.IJsonModel.Write(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } Azure.ResourceManager.DevTestLabs.DevTestLabSecretData System.ClientModel.Primitives.IPersistableModel.Create(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } @@ -914,7 +959,10 @@ public DevTestLabServiceFabricData(Azure.Core.AzureLocation location) { } public string ExternalServiceFabricId { get { throw null; } set { } } public string ProvisioningState { get { throw null; } } public System.Guid? UniqueIdentifier { get { throw null; } } + protected virtual Azure.ResourceManager.Models.ResourceData JsonModelCreateCore(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } protected override void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + protected virtual Azure.ResourceManager.Models.ResourceData PersistableModelCreateCore(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + protected virtual System.BinaryData PersistableModelWriteCore(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } Azure.ResourceManager.DevTestLabs.DevTestLabServiceFabricData System.ClientModel.Primitives.IJsonModel.Create(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } void System.ClientModel.Primitives.IJsonModel.Write(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } Azure.ResourceManager.DevTestLabs.DevTestLabServiceFabricData System.ClientModel.Primitives.IPersistableModel.Create(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } @@ -1015,7 +1063,10 @@ public partial class DevTestLabServiceRunnerData : Azure.ResourceManager.Models. { public DevTestLabServiceRunnerData(Azure.Core.AzureLocation location) { } public Azure.ResourceManager.DevTestLabs.Models.DevTestLabManagedIdentity Identity { get { throw null; } set { } } + protected virtual Azure.ResourceManager.Models.ResourceData JsonModelCreateCore(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } protected override void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + protected virtual Azure.ResourceManager.Models.ResourceData PersistableModelCreateCore(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + protected virtual System.BinaryData PersistableModelWriteCore(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } Azure.ResourceManager.DevTestLabs.DevTestLabServiceRunnerData System.ClientModel.Primitives.IJsonModel.Create(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } void System.ClientModel.Primitives.IJsonModel.Write(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } Azure.ResourceManager.DevTestLabs.DevTestLabServiceRunnerData System.ClientModel.Primitives.IPersistableModel.Create(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } @@ -1106,7 +1157,10 @@ public DevTestLabUserData(Azure.Core.AzureLocation location) { } public string ProvisioningState { get { throw null; } } public Azure.ResourceManager.DevTestLabs.Models.DevTestLabUserSecretStore SecretStore { get { throw null; } set { } } public System.Guid? UniqueIdentifier { get { throw null; } } + protected virtual Azure.ResourceManager.Models.ResourceData JsonModelCreateCore(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } protected override void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + protected virtual Azure.ResourceManager.Models.ResourceData PersistableModelCreateCore(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + protected virtual System.BinaryData PersistableModelWriteCore(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } Azure.ResourceManager.DevTestLabs.DevTestLabUserData System.ClientModel.Primitives.IJsonModel.Create(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } void System.ClientModel.Primitives.IJsonModel.Write(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } Azure.ResourceManager.DevTestLabs.DevTestLabUserData System.ClientModel.Primitives.IPersistableModel.Create(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } @@ -1178,7 +1232,10 @@ public DevTestLabVirtualNetworkData(Azure.Core.AzureLocation location) { } public string ProvisioningState { get { throw null; } } public System.Collections.Generic.IList SubnetOverrides { get { throw null; } } public System.Guid? UniqueIdentifier { get { throw null; } } + protected virtual Azure.ResourceManager.Models.ResourceData JsonModelCreateCore(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } protected override void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + protected virtual Azure.ResourceManager.Models.ResourceData PersistableModelCreateCore(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + protected virtual System.BinaryData PersistableModelWriteCore(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } Azure.ResourceManager.DevTestLabs.DevTestLabVirtualNetworkData System.ClientModel.Primitives.IJsonModel.Create(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } void System.ClientModel.Primitives.IJsonModel.Write(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } Azure.ResourceManager.DevTestLabs.DevTestLabVirtualNetworkData System.ClientModel.Primitives.IPersistableModel.Create(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } @@ -1265,7 +1322,10 @@ public DevTestLabVmData(Azure.Core.AzureLocation location) { } public System.Guid? UniqueIdentifier { get { throw null; } } public string UserName { get { throw null; } set { } } public Azure.ResourceManager.DevTestLabs.Models.DevTestLabVmCreationSource? VmCreationSource { get { throw null; } } + protected virtual Azure.ResourceManager.Models.ResourceData JsonModelCreateCore(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } protected override void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + protected virtual Azure.ResourceManager.Models.ResourceData PersistableModelCreateCore(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + protected virtual System.BinaryData PersistableModelWriteCore(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } Azure.ResourceManager.DevTestLabs.DevTestLabVmData System.ClientModel.Primitives.IJsonModel.Create(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } void System.ClientModel.Primitives.IJsonModel.Write(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } Azure.ResourceManager.DevTestLabs.DevTestLabVmData System.ClientModel.Primitives.IPersistableModel.Create(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } @@ -1430,33 +1490,57 @@ public static partial class ArmDevTestLabsModelFactory public static Azure.ResourceManager.DevTestLabs.Models.DevTestLabArmTemplateInfo DevTestLabArmTemplateInfo(System.BinaryData template = null, System.BinaryData parameters = null) { throw null; } public static Azure.ResourceManager.DevTestLabs.DevTestLabArtifactData DevTestLabArtifactData(Azure.Core.ResourceIdentifier id = null, string name = null, Azure.Core.ResourceType resourceType = default(Azure.Core.ResourceType), Azure.ResourceManager.Models.SystemData systemData = null, System.Collections.Generic.IDictionary tags = null, Azure.Core.AzureLocation location = default(Azure.Core.AzureLocation), string title = null, string description = null, string publisher = null, string filePath = null, string icon = null, string targetOSType = null, System.BinaryData parameters = null, System.DateTimeOffset? createdOn = default(System.DateTimeOffset?)) { throw null; } public static Azure.ResourceManager.DevTestLabs.Models.DevTestLabArtifactDeploymentStatus DevTestLabArtifactDeploymentStatus(string deploymentStatus = null, int? artifactsApplied = default(int?), int? totalArtifacts = default(int?)) { throw null; } + public static Azure.ResourceManager.DevTestLabs.Models.DevTestLabArtifactGenerateArmTemplateContent DevTestLabArtifactGenerateArmTemplateContent(string vmName = null, System.Collections.Generic.IEnumerable parameters = null, Azure.Core.AzureLocation? location = default(Azure.Core.AzureLocation?), Azure.ResourceManager.DevTestLabs.Models.DevTestLabFileUploadOption? fileUploadOptions = default(Azure.ResourceManager.DevTestLabs.Models.DevTestLabFileUploadOption?)) { throw null; } + public static Azure.ResourceManager.DevTestLabs.Models.DevTestLabArtifactInstallInfo DevTestLabArtifactInstallInfo(string artifactId = null, string artifactTitle = null, System.Collections.Generic.IEnumerable parameters = null, string status = null, string deploymentStatusMessage = null, string vmExtensionStatusMessage = null, System.DateTimeOffset? installOn = default(System.DateTimeOffset?)) { throw null; } public static Azure.ResourceManager.DevTestLabs.DevTestLabArtifactSourceData DevTestLabArtifactSourceData(Azure.Core.ResourceIdentifier id = null, string name = null, Azure.Core.ResourceType resourceType = default(Azure.Core.ResourceType), Azure.ResourceManager.Models.SystemData systemData = null, System.Collections.Generic.IDictionary tags = null, Azure.Core.AzureLocation location = default(Azure.Core.AzureLocation), string displayName = null, System.Uri uri = null, Azure.ResourceManager.DevTestLabs.Models.DevTestLabSourceControlType? sourceType = default(Azure.ResourceManager.DevTestLabs.Models.DevTestLabSourceControlType?), string folderPath = null, string armTemplateFolderPath = null, string branchRef = null, string securityToken = null, Azure.ResourceManager.DevTestLabs.Models.DevTestLabEnableStatus? status = default(Azure.ResourceManager.DevTestLabs.Models.DevTestLabEnableStatus?), System.DateTimeOffset? createdOn = default(System.DateTimeOffset?), string provisioningState = null, System.Guid? uniqueIdentifier = default(System.Guid?)) { throw null; } + public static Azure.ResourceManager.DevTestLabs.Models.DevTestLabArtifactSourcePatch DevTestLabArtifactSourcePatch(System.Collections.Generic.IDictionary tags = null) { throw null; } public static Azure.ResourceManager.DevTestLabs.DevTestLabCostData DevTestLabCostData(Azure.Core.ResourceIdentifier id = null, string name = null, Azure.Core.ResourceType resourceType = default(Azure.Core.ResourceType), Azure.ResourceManager.Models.SystemData systemData = null, System.Collections.Generic.IDictionary tags = null, Azure.Core.AzureLocation location = default(Azure.Core.AzureLocation), Azure.ResourceManager.DevTestLabs.Models.DevTestLabTargetCost targetCost = null, double? estimatedLabCost = default(double?), System.Collections.Generic.IEnumerable labCostDetails = null, System.Collections.Generic.IEnumerable resourceCosts = null, string currencyCode = null, System.DateTimeOffset? startOn = default(System.DateTimeOffset?), System.DateTimeOffset? endOn = default(System.DateTimeOffset?), System.DateTimeOffset? createdOn = default(System.DateTimeOffset?), string provisioningState = null, System.Guid? uniqueIdentifier = default(System.Guid?)) { throw null; } public static Azure.ResourceManager.DevTestLabs.Models.DevTestLabCostDetails DevTestLabCostDetails(System.DateTimeOffset? on = default(System.DateTimeOffset?), double? cost = default(double?), Azure.ResourceManager.DevTestLabs.Models.DevTestLabCostType? costType = default(Azure.ResourceManager.DevTestLabs.Models.DevTestLabCostType?)) { throw null; } public static Azure.ResourceManager.DevTestLabs.DevTestLabCustomImageData DevTestLabCustomImageData(Azure.Core.ResourceIdentifier id = null, string name = null, Azure.Core.ResourceType resourceType = default(Azure.Core.ResourceType), Azure.ResourceManager.Models.SystemData systemData = null, System.Collections.Generic.IDictionary tags = null, Azure.Core.AzureLocation location = default(Azure.Core.AzureLocation), Azure.ResourceManager.DevTestLabs.Models.DevTestLabCustomImageVm vm = null, Azure.ResourceManager.DevTestLabs.Models.DevTestLabCustomImageVhd vhd = null, string description = null, string author = null, System.DateTimeOffset? createdOn = default(System.DateTimeOffset?), string managedImageId = null, string managedSnapshotId = null, System.Collections.Generic.IEnumerable dataDiskStorageInfo = null, Azure.ResourceManager.DevTestLabs.Models.DevTestLabCustomImagePlan customImagePlan = null, bool? isPlanAuthorized = default(bool?), string provisioningState = null, System.Guid? uniqueIdentifier = default(System.Guid?)) { throw null; } + public static Azure.ResourceManager.DevTestLabs.Models.DevTestLabCustomImagePatch DevTestLabCustomImagePatch(System.Collections.Generic.IDictionary tags = null) { throw null; } public static Azure.ResourceManager.DevTestLabs.DevTestLabData DevTestLabData(Azure.Core.ResourceIdentifier id = null, string name = null, Azure.Core.ResourceType resourceType = default(Azure.Core.ResourceType), Azure.ResourceManager.Models.SystemData systemData = null, System.Collections.Generic.IDictionary tags = null, Azure.Core.AzureLocation location = default(Azure.Core.AzureLocation), string defaultStorageAccount = null, string defaultPremiumStorageAccount = null, string artifactsStorageAccount = null, string premiumDataDiskStorageAccount = null, string vaultName = null, Azure.ResourceManager.DevTestLabs.Models.DevTestLabStorageType? labStorageType = default(Azure.ResourceManager.DevTestLabs.Models.DevTestLabStorageType?), System.Collections.Generic.IEnumerable mandatoryArtifactsResourceIdsLinux = null, System.Collections.Generic.IEnumerable mandatoryArtifactsResourceIdsWindows = null, System.DateTimeOffset? createdOn = default(System.DateTimeOffset?), Azure.ResourceManager.DevTestLabs.Models.DevTestLabPremiumDataDisk? premiumDataDisks = default(Azure.ResourceManager.DevTestLabs.Models.DevTestLabPremiumDataDisk?), Azure.ResourceManager.DevTestLabs.Models.DevTestLabEnvironmentPermission? environmentPermission = default(Azure.ResourceManager.DevTestLabs.Models.DevTestLabEnvironmentPermission?), Azure.ResourceManager.DevTestLabs.Models.DevTestLabAnnouncement announcement = null, Azure.ResourceManager.DevTestLabs.Models.DevTestLabSupport support = null, string vmCreationResourceGroup = null, string publicIPId = null, string loadBalancerId = null, string networkSecurityGroupId = null, System.Collections.Generic.IDictionary extendedProperties = null, string provisioningState = null, System.Guid? uniqueIdentifier = default(System.Guid?)) { throw null; } public static Azure.ResourceManager.DevTestLabs.DevTestLabDiskData DevTestLabDiskData(Azure.Core.ResourceIdentifier id = null, string name = null, Azure.Core.ResourceType resourceType = default(Azure.Core.ResourceType), Azure.ResourceManager.Models.SystemData systemData = null, System.Collections.Generic.IDictionary tags = null, Azure.Core.AzureLocation location = default(Azure.Core.AzureLocation), Azure.ResourceManager.DevTestLabs.Models.DevTestLabStorageType? diskType = default(Azure.ResourceManager.DevTestLabs.Models.DevTestLabStorageType?), int? diskSizeGiB = default(int?), Azure.Core.ResourceIdentifier leasedByLabVmId = null, string diskBlobName = null, System.Uri diskUri = null, string storageAccountId = null, System.DateTimeOffset? createdOn = default(System.DateTimeOffset?), string hostCaching = null, Azure.Core.ResourceIdentifier managedDiskId = null, string provisioningState = null, System.Guid? uniqueIdentifier = default(System.Guid?)) { throw null; } + public static Azure.ResourceManager.DevTestLabs.Models.DevTestLabDiskPatch DevTestLabDiskPatch(System.Collections.Generic.IDictionary tags = null) { throw null; } public static Azure.ResourceManager.DevTestLabs.DevTestLabEnvironmentData DevTestLabEnvironmentData(Azure.Core.ResourceIdentifier id = null, string name = null, Azure.Core.ResourceType resourceType = default(Azure.Core.ResourceType), Azure.ResourceManager.Models.SystemData systemData = null, System.Collections.Generic.IDictionary tags = null, Azure.Core.AzureLocation location = default(Azure.Core.AzureLocation), Azure.ResourceManager.DevTestLabs.Models.DevTestLabEnvironmentDeployment deploymentProperties = null, string armTemplateDisplayName = null, string resourceGroupId = null, string createdByUser = null, string provisioningState = null, System.Guid? uniqueIdentifier = default(System.Guid?)) { throw null; } + public static Azure.ResourceManager.DevTestLabs.Models.DevTestLabEnvironmentDeployment DevTestLabEnvironmentDeployment(Azure.Core.ResourceIdentifier armTemplateId = null, System.Collections.Generic.IEnumerable parameters = null) { throw null; } + public static Azure.ResourceManager.DevTestLabs.Models.DevTestLabEnvironmentPatch DevTestLabEnvironmentPatch(System.Collections.Generic.IDictionary tags = null) { throw null; } + public static Azure.ResourceManager.DevTestLabs.Models.DevTestLabEvaluatePoliciesContent DevTestLabEvaluatePoliciesContent(System.Collections.Generic.IEnumerable policies = null) { throw null; } public static Azure.ResourceManager.DevTestLabs.Models.DevTestLabEvaluatePoliciesResult DevTestLabEvaluatePoliciesResult(System.Collections.Generic.IEnumerable results = null) { throw null; } public static Azure.ResourceManager.DevTestLabs.Models.DevTestLabExternalSubnet DevTestLabExternalSubnet(Azure.Core.ResourceIdentifier id = null, string name = null) { throw null; } public static Azure.ResourceManager.DevTestLabs.DevTestLabFormulaData DevTestLabFormulaData(Azure.Core.ResourceIdentifier id = null, string name = null, Azure.Core.ResourceType resourceType = default(Azure.Core.ResourceType), Azure.ResourceManager.Models.SystemData systemData = null, System.Collections.Generic.IDictionary tags = null, Azure.Core.AzureLocation location = default(Azure.Core.AzureLocation), string description = null, string author = null, string osType = null, System.DateTimeOffset? createdOn = default(System.DateTimeOffset?), Azure.ResourceManager.DevTestLabs.Models.DevTestLabVmCreationContent formulaContent = null, string labVmId = null, string provisioningState = null, System.Guid? uniqueIdentifier = default(System.Guid?)) { throw null; } + public static Azure.ResourceManager.DevTestLabs.Models.DevTestLabFormulaPatch DevTestLabFormulaPatch(System.Collections.Generic.IDictionary tags = null) { throw null; } public static Azure.ResourceManager.DevTestLabs.Models.DevTestLabGalleryImage DevTestLabGalleryImage(Azure.Core.ResourceIdentifier id = null, string name = null, Azure.Core.ResourceType resourceType = default(Azure.Core.ResourceType), Azure.ResourceManager.Models.SystemData systemData = null, System.Collections.Generic.IDictionary tags = null, Azure.Core.AzureLocation location = default(Azure.Core.AzureLocation), string author = null, System.DateTimeOffset? createdOn = default(System.DateTimeOffset?), string description = null, Azure.ResourceManager.DevTestLabs.Models.DevTestLabGalleryImageReference imageReference = null, string icon = null, bool? isEnabled = default(bool?), string planId = null, bool? isPlanAuthorized = default(bool?)) { throw null; } public static Azure.ResourceManager.DevTestLabs.Models.DevTestLabGenerateUploadUriResult DevTestLabGenerateUploadUriResult(System.Uri uploadUri = null) { throw null; } public static Azure.ResourceManager.DevTestLabs.DevTestLabNotificationChannelData DevTestLabNotificationChannelData(Azure.Core.ResourceIdentifier id = null, string name = null, Azure.Core.ResourceType resourceType = default(Azure.Core.ResourceType), Azure.ResourceManager.Models.SystemData systemData = null, System.Collections.Generic.IDictionary tags = null, Azure.Core.AzureLocation location = default(Azure.Core.AzureLocation), System.Uri webHookUri = null, string emailRecipient = null, string notificationLocale = null, string description = null, System.Collections.Generic.IEnumerable events = null, System.DateTimeOffset? createdOn = default(System.DateTimeOffset?), string provisioningState = null, System.Guid? uniqueIdentifier = default(System.Guid?)) { throw null; } + public static Azure.ResourceManager.DevTestLabs.Models.DevTestLabNotificationChannelPatch DevTestLabNotificationChannelPatch(System.Collections.Generic.IDictionary tags = null) { throw null; } public static Azure.ResourceManager.DevTestLabs.Models.DevTestLabParametersValueFileInfo DevTestLabParametersValueFileInfo(string fileName = null, System.BinaryData parametersValueInfo = null) { throw null; } + public static Azure.ResourceManager.DevTestLabs.Models.DevTestLabPatch DevTestLabPatch(System.Collections.Generic.IDictionary tags = null) { throw null; } public static Azure.ResourceManager.DevTestLabs.DevTestLabPolicyData DevTestLabPolicyData(Azure.Core.ResourceIdentifier id = null, string name = null, Azure.Core.ResourceType resourceType = default(Azure.Core.ResourceType), Azure.ResourceManager.Models.SystemData systemData = null, System.Collections.Generic.IDictionary tags = null, Azure.Core.AzureLocation location = default(Azure.Core.AzureLocation), string description = null, Azure.ResourceManager.DevTestLabs.Models.DevTestLabPolicyStatus? status = default(Azure.ResourceManager.DevTestLabs.Models.DevTestLabPolicyStatus?), Azure.ResourceManager.DevTestLabs.Models.DevTestLabPolicyFactName? factName = default(Azure.ResourceManager.DevTestLabs.Models.DevTestLabPolicyFactName?), string factData = null, string threshold = null, Azure.ResourceManager.DevTestLabs.Models.DevTestLabPolicyEvaluatorType? evaluatorType = default(Azure.ResourceManager.DevTestLabs.Models.DevTestLabPolicyEvaluatorType?), System.DateTimeOffset? createdOn = default(System.DateTimeOffset?), string provisioningState = null, System.Guid? uniqueIdentifier = default(System.Guid?)) { throw null; } + public static Azure.ResourceManager.DevTestLabs.Models.DevTestLabPolicyPatch DevTestLabPolicyPatch(System.Collections.Generic.IDictionary tags = null) { throw null; } public static Azure.ResourceManager.DevTestLabs.Models.DevTestLabPolicySetResult DevTestLabPolicySetResult(bool? hasError = default(bool?), System.Collections.Generic.IEnumerable policyViolations = null) { throw null; } public static Azure.ResourceManager.DevTestLabs.Models.DevTestLabPolicyViolation DevTestLabPolicyViolation(string code = null, string message = null) { throw null; } public static Azure.ResourceManager.DevTestLabs.Models.DevTestLabRdpConnection DevTestLabRdpConnection(string contents = null) { throw null; } public static Azure.ResourceManager.DevTestLabs.Models.DevTestLabResourceCost DevTestLabResourceCost(string resourceName = null, string resourceUniqueId = null, double? resourceCost = default(double?), string resourceType = null, string resourceOwner = null, string resourcePricingTier = null, string resourceStatus = null, string resourceId = null, string externalResourceId = null) { throw null; } + public static Azure.ResourceManager.DevTestLabs.Models.DevTestLabResourcePatch DevTestLabResourcePatch(System.Collections.Generic.IDictionary tags = null) { throw null; } public static Azure.ResourceManager.DevTestLabs.Models.DevTestLabScheduleCreationParameter DevTestLabScheduleCreationParameter(string name = null, Azure.Core.AzureLocation? location = default(Azure.Core.AzureLocation?), System.Collections.Generic.IDictionary tags = null, Azure.ResourceManager.DevTestLabs.Models.DevTestLabEnableStatus? status = default(Azure.ResourceManager.DevTestLabs.Models.DevTestLabEnableStatus?), string taskType = null, Azure.ResourceManager.DevTestLabs.Models.DevTestLabWeekDetails weeklyRecurrence = null, string dailyRecurrenceTime = null, int? hourlyRecurrenceMinute = default(int?), string timeZoneId = null, Azure.ResourceManager.DevTestLabs.Models.DevTestLabNotificationSettings notificationSettings = null, Azure.Core.ResourceIdentifier targetResourceId = null) { throw null; } public static Azure.ResourceManager.DevTestLabs.DevTestLabScheduleData DevTestLabScheduleData(Azure.Core.ResourceIdentifier id = null, string name = null, Azure.Core.ResourceType resourceType = default(Azure.Core.ResourceType), Azure.ResourceManager.Models.SystemData systemData = null, System.Collections.Generic.IDictionary tags = null, Azure.Core.AzureLocation location = default(Azure.Core.AzureLocation), Azure.ResourceManager.DevTestLabs.Models.DevTestLabEnableStatus? status = default(Azure.ResourceManager.DevTestLabs.Models.DevTestLabEnableStatus?), string taskType = null, Azure.ResourceManager.DevTestLabs.Models.DevTestLabWeekDetails weeklyRecurrence = null, string dailyRecurrenceTime = null, int? hourlyRecurrenceMinute = default(int?), string timeZoneId = null, Azure.ResourceManager.DevTestLabs.Models.DevTestLabNotificationSettings notificationSettings = null, System.DateTimeOffset? createdOn = default(System.DateTimeOffset?), string targetResourceId = null, string provisioningState = null, System.Guid? uniqueIdentifier = default(System.Guid?)) { throw null; } + public static Azure.ResourceManager.DevTestLabs.Models.DevTestLabSchedulePatch DevTestLabSchedulePatch(System.Collections.Generic.IDictionary tags = null) { throw null; } public static Azure.ResourceManager.DevTestLabs.DevTestLabSecretData DevTestLabSecretData(Azure.Core.ResourceIdentifier id = null, string name = null, Azure.Core.ResourceType resourceType = default(Azure.Core.ResourceType), Azure.ResourceManager.Models.SystemData systemData = null, System.Collections.Generic.IDictionary tags = null, Azure.Core.AzureLocation location = default(Azure.Core.AzureLocation), string value = null, string provisioningState = null, System.Guid? uniqueIdentifier = default(System.Guid?)) { throw null; } + public static Azure.ResourceManager.DevTestLabs.Models.DevTestLabSecretPatch DevTestLabSecretPatch(System.Collections.Generic.IDictionary tags = null) { throw null; } public static Azure.ResourceManager.DevTestLabs.DevTestLabServiceFabricData DevTestLabServiceFabricData(Azure.Core.ResourceIdentifier id = null, string name = null, Azure.Core.ResourceType resourceType = default(Azure.Core.ResourceType), Azure.ResourceManager.Models.SystemData systemData = null, System.Collections.Generic.IDictionary tags = null, Azure.Core.AzureLocation location = default(Azure.Core.AzureLocation), string externalServiceFabricId = null, string environmentId = null, Azure.ResourceManager.DevTestLabs.Models.DevTestLabApplicableSchedule applicableSchedule = null, string provisioningState = null, System.Guid? uniqueIdentifier = default(System.Guid?)) { throw null; } + public static Azure.ResourceManager.DevTestLabs.Models.DevTestLabServiceFabricPatch DevTestLabServiceFabricPatch(System.Collections.Generic.IDictionary tags = null) { throw null; } public static Azure.ResourceManager.DevTestLabs.DevTestLabServiceRunnerData DevTestLabServiceRunnerData(Azure.Core.ResourceIdentifier id = null, string name = null, Azure.Core.ResourceType resourceType = default(Azure.Core.ResourceType), Azure.ResourceManager.Models.SystemData systemData = null, System.Collections.Generic.IDictionary tags = null, Azure.Core.AzureLocation location = default(Azure.Core.AzureLocation), Azure.ResourceManager.DevTestLabs.Models.DevTestLabManagedIdentity identity = null) { throw null; } + public static Azure.ResourceManager.DevTestLabs.Models.DevTestLabTargetCost DevTestLabTargetCost(Azure.ResourceManager.DevTestLabs.Models.DevTestLabTargetCostStatus? status = default(Azure.ResourceManager.DevTestLabs.Models.DevTestLabTargetCostStatus?), int? target = default(int?), System.Collections.Generic.IEnumerable costThresholds = null, System.DateTimeOffset? cycleStartOn = default(System.DateTimeOffset?), System.DateTimeOffset? cycleEndOn = default(System.DateTimeOffset?), Azure.ResourceManager.DevTestLabs.Models.DevTestLabReportingCycleType? cycleType = default(Azure.ResourceManager.DevTestLabs.Models.DevTestLabReportingCycleType?)) { throw null; } public static Azure.ResourceManager.DevTestLabs.DevTestLabUserData DevTestLabUserData(Azure.Core.ResourceIdentifier id = null, string name = null, Azure.Core.ResourceType resourceType = default(Azure.Core.ResourceType), Azure.ResourceManager.Models.SystemData systemData = null, System.Collections.Generic.IDictionary tags = null, Azure.Core.AzureLocation location = default(Azure.Core.AzureLocation), Azure.ResourceManager.DevTestLabs.Models.DevTestLabUserIdentity identity = null, Azure.ResourceManager.DevTestLabs.Models.DevTestLabUserSecretStore secretStore = null, System.DateTimeOffset? createdOn = default(System.DateTimeOffset?), string provisioningState = null, System.Guid? uniqueIdentifier = default(System.Guid?)) { throw null; } + public static Azure.ResourceManager.DevTestLabs.Models.DevTestLabUserPatch DevTestLabUserPatch(System.Collections.Generic.IDictionary tags = null) { throw null; } + public static Azure.ResourceManager.DevTestLabs.Models.DevTestLabVhd DevTestLabVhd(System.Uri id = null) { throw null; } public static Azure.ResourceManager.DevTestLabs.DevTestLabVirtualNetworkData DevTestLabVirtualNetworkData(Azure.Core.ResourceIdentifier id = null, string name = null, Azure.Core.ResourceType resourceType = default(Azure.Core.ResourceType), Azure.ResourceManager.Models.SystemData systemData = null, System.Collections.Generic.IDictionary tags = null, Azure.Core.AzureLocation location = default(Azure.Core.AzureLocation), System.Collections.Generic.IEnumerable allowedSubnets = null, string description = null, string externalProviderResourceId = null, System.Collections.Generic.IEnumerable externalSubnets = null, System.Collections.Generic.IEnumerable subnetOverrides = null, System.DateTimeOffset? createdOn = default(System.DateTimeOffset?), string provisioningState = null, System.Guid? uniqueIdentifier = default(System.Guid?)) { throw null; } + public static Azure.ResourceManager.DevTestLabs.Models.DevTestLabVirtualNetworkPatch DevTestLabVirtualNetworkPatch(System.Collections.Generic.IDictionary tags = null) { throw null; } + public static Azure.ResourceManager.DevTestLabs.Models.DevTestLabVmApplyArtifactsContent DevTestLabVmApplyArtifactsContent(System.Collections.Generic.IEnumerable artifacts = null) { throw null; } + public static Azure.ResourceManager.DevTestLabs.Models.DevTestLabVmCreationContent DevTestLabVmCreationContent(string notes = null, string ownerObjectId = null, string ownerUserPrincipalName = null, System.DateTimeOffset? createdOn = default(System.DateTimeOffset?), string customImageId = null, string size = null, string userName = null, string password = null, string sshKey = null, bool? isAuthenticationWithSshKey = default(bool?), string labSubnetName = null, Azure.Core.ResourceIdentifier labVirtualNetworkId = null, bool? disallowPublicIPAddress = default(bool?), System.Collections.Generic.IEnumerable artifacts = null, Azure.ResourceManager.DevTestLabs.Models.DevTestLabGalleryImageReference galleryImageReference = null, string planId = null, Azure.ResourceManager.DevTestLabs.Models.DevTestLabNetworkInterface networkInterface = null, System.DateTimeOffset? expireOn = default(System.DateTimeOffset?), bool? allowClaim = default(bool?), string storageType = null, string environmentId = null, System.Collections.Generic.IEnumerable dataDiskParameters = null, System.Collections.Generic.IEnumerable scheduleParameters = null, int? bulkCreationParametersInstanceCount = default(int?), string name = null, Azure.Core.AzureLocation? location = default(Azure.Core.AzureLocation?), System.Collections.Generic.IDictionary tags = null) { throw null; } public static Azure.ResourceManager.DevTestLabs.DevTestLabVmData DevTestLabVmData(Azure.Core.ResourceIdentifier id = null, string name = null, Azure.Core.ResourceType resourceType = default(Azure.Core.ResourceType), Azure.ResourceManager.Models.SystemData systemData = null, System.Collections.Generic.IDictionary tags = null, Azure.Core.AzureLocation location = default(Azure.Core.AzureLocation), string notes = null, string ownerObjectId = null, string ownerUserPrincipalName = null, string createdByUserId = null, string createdByUser = null, System.DateTimeOffset? createdOn = default(System.DateTimeOffset?), Azure.Core.ResourceIdentifier computeId = null, string customImageId = null, string osType = null, string size = null, string userName = null, string password = null, string sshKey = null, bool? isAuthenticationWithSshKey = default(bool?), string fqdn = null, string labSubnetName = null, Azure.Core.ResourceIdentifier labVirtualNetworkId = null, bool? disallowPublicIPAddress = default(bool?), System.Collections.Generic.IEnumerable artifacts = null, Azure.ResourceManager.DevTestLabs.Models.DevTestLabArtifactDeploymentStatus artifactDeploymentStatus = null, Azure.ResourceManager.DevTestLabs.Models.DevTestLabGalleryImageReference galleryImageReference = null, string planId = null, Azure.ResourceManager.DevTestLabs.Models.ComputeVmProperties computeVm = null, Azure.ResourceManager.DevTestLabs.Models.DevTestLabNetworkInterface networkInterface = null, Azure.ResourceManager.DevTestLabs.Models.DevTestLabApplicableSchedule applicableSchedule = null, System.DateTimeOffset? expireOn = default(System.DateTimeOffset?), bool? allowClaim = default(bool?), string storageType = null, Azure.ResourceManager.DevTestLabs.Models.DevTestLabVmCreationSource? vmCreationSource = default(Azure.ResourceManager.DevTestLabs.Models.DevTestLabVmCreationSource?), Azure.Core.ResourceIdentifier environmentId = null, System.Collections.Generic.IEnumerable dataDiskParameters = null, System.Collections.Generic.IEnumerable scheduleParameters = null, string lastKnownPowerState = null, string provisioningState = null, System.Guid? uniqueIdentifier = default(System.Guid?)) { throw null; } + public static Azure.ResourceManager.DevTestLabs.Models.DevTestLabVmPatch DevTestLabVmPatch(System.Collections.Generic.IDictionary tags = null) { throw null; } + public static Azure.ResourceManager.DevTestLabs.Models.DevTestLabWeekDetails DevTestLabWeekDetails(System.Collections.Generic.IEnumerable weekdays = null, string time = null) { throw null; } } public partial class AttachNewDataDiskDetails : System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel { @@ -1464,7 +1548,10 @@ public AttachNewDataDiskDetails() { } public string DiskName { get { throw null; } set { } } public int? DiskSizeGiB { get { throw null; } set { } } public Azure.ResourceManager.DevTestLabs.Models.DevTestLabStorageType? DiskType { get { throw null; } set { } } + protected virtual Azure.ResourceManager.DevTestLabs.Models.AttachNewDataDiskDetails JsonModelCreateCore(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } protected virtual void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + protected virtual Azure.ResourceManager.DevTestLabs.Models.AttachNewDataDiskDetails PersistableModelCreateCore(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + protected virtual System.BinaryData PersistableModelWriteCore(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } Azure.ResourceManager.DevTestLabs.Models.AttachNewDataDiskDetails System.ClientModel.Primitives.IJsonModel.Create(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } void System.ClientModel.Primitives.IJsonModel.Write(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } Azure.ResourceManager.DevTestLabs.Models.AttachNewDataDiskDetails System.ClientModel.Primitives.IPersistableModel.Create(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } @@ -1478,7 +1565,10 @@ internal ComputeDataDisk() { } public System.Uri DiskUri { get { throw null; } } public string ManagedDiskId { get { throw null; } } public string Name { get { throw null; } } + protected virtual Azure.ResourceManager.DevTestLabs.Models.ComputeDataDisk JsonModelCreateCore(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } protected virtual void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + protected virtual Azure.ResourceManager.DevTestLabs.Models.ComputeDataDisk PersistableModelCreateCore(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + protected virtual System.BinaryData PersistableModelWriteCore(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } Azure.ResourceManager.DevTestLabs.Models.ComputeDataDisk System.ClientModel.Primitives.IJsonModel.Create(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } void System.ClientModel.Primitives.IJsonModel.Write(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } Azure.ResourceManager.DevTestLabs.Models.ComputeDataDisk System.ClientModel.Primitives.IPersistableModel.Create(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } @@ -1491,7 +1581,10 @@ internal ComputeVmInstanceViewStatus() { } public string Code { get { throw null; } } public string DisplayStatus { get { throw null; } } public string Message { get { throw null; } } + protected virtual Azure.ResourceManager.DevTestLabs.Models.ComputeVmInstanceViewStatus JsonModelCreateCore(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } protected virtual void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + protected virtual Azure.ResourceManager.DevTestLabs.Models.ComputeVmInstanceViewStatus PersistableModelCreateCore(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + protected virtual System.BinaryData PersistableModelWriteCore(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } Azure.ResourceManager.DevTestLabs.Models.ComputeVmInstanceViewStatus System.ClientModel.Primitives.IJsonModel.Create(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } void System.ClientModel.Primitives.IJsonModel.Write(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } Azure.ResourceManager.DevTestLabs.Models.ComputeVmInstanceViewStatus System.ClientModel.Primitives.IPersistableModel.Create(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } @@ -1508,7 +1601,10 @@ internal ComputeVmProperties() { } public string OSType { get { throw null; } } public System.Collections.Generic.IReadOnlyList Statuses { get { throw null; } } public string VmSize { get { throw null; } } + protected virtual Azure.ResourceManager.DevTestLabs.Models.ComputeVmProperties JsonModelCreateCore(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } protected virtual void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + protected virtual Azure.ResourceManager.DevTestLabs.Models.ComputeVmProperties PersistableModelCreateCore(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + protected virtual System.BinaryData PersistableModelWriteCore(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } Azure.ResourceManager.DevTestLabs.Models.ComputeVmProperties System.ClientModel.Primitives.IJsonModel.Create(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } void System.ClientModel.Primitives.IJsonModel.Write(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } Azure.ResourceManager.DevTestLabs.Models.ComputeVmProperties System.ClientModel.Primitives.IPersistableModel.Create(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } @@ -1525,7 +1621,10 @@ public DevTestLabAnnouncement() { } public string ProvisioningState { get { throw null; } } public string Title { get { throw null; } set { } } public System.Guid? UniqueIdentifier { get { throw null; } } + protected virtual Azure.ResourceManager.DevTestLabs.Models.DevTestLabAnnouncement JsonModelCreateCore(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } protected virtual void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + protected virtual Azure.ResourceManager.DevTestLabs.Models.DevTestLabAnnouncement PersistableModelCreateCore(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + protected virtual System.BinaryData PersistableModelWriteCore(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } Azure.ResourceManager.DevTestLabs.Models.DevTestLabAnnouncement System.ClientModel.Primitives.IJsonModel.Create(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } void System.ClientModel.Primitives.IJsonModel.Write(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } Azure.ResourceManager.DevTestLabs.Models.DevTestLabAnnouncement System.ClientModel.Primitives.IPersistableModel.Create(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } @@ -1537,7 +1636,10 @@ public partial class DevTestLabApplicableSchedule : Azure.ResourceManager.Models public DevTestLabApplicableSchedule(Azure.Core.AzureLocation location) { } public Azure.ResourceManager.DevTestLabs.DevTestLabScheduleData LabVmsShutdown { get { throw null; } set { } } public Azure.ResourceManager.DevTestLabs.DevTestLabScheduleData LabVmsStartup { get { throw null; } set { } } + protected virtual Azure.ResourceManager.Models.ResourceData JsonModelCreateCore(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } protected override void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + protected virtual Azure.ResourceManager.Models.ResourceData PersistableModelCreateCore(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + protected virtual System.BinaryData PersistableModelWriteCore(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } Azure.ResourceManager.DevTestLabs.Models.DevTestLabApplicableSchedule System.ClientModel.Primitives.IJsonModel.Create(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } void System.ClientModel.Primitives.IJsonModel.Write(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } Azure.ResourceManager.DevTestLabs.Models.DevTestLabApplicableSchedule System.ClientModel.Primitives.IPersistableModel.Create(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } @@ -1549,7 +1651,10 @@ public partial class DevTestLabArmTemplateInfo : System.ClientModel.Primitives.I internal DevTestLabArmTemplateInfo() { } public System.BinaryData Parameters { get { throw null; } } public System.BinaryData Template { get { throw null; } } + protected virtual Azure.ResourceManager.DevTestLabs.Models.DevTestLabArmTemplateInfo JsonModelCreateCore(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } protected virtual void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + protected virtual Azure.ResourceManager.DevTestLabs.Models.DevTestLabArmTemplateInfo PersistableModelCreateCore(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + protected virtual System.BinaryData PersistableModelWriteCore(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } Azure.ResourceManager.DevTestLabs.Models.DevTestLabArmTemplateInfo System.ClientModel.Primitives.IJsonModel.Create(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } void System.ClientModel.Primitives.IJsonModel.Write(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } Azure.ResourceManager.DevTestLabs.Models.DevTestLabArmTemplateInfo System.ClientModel.Primitives.IPersistableModel.Create(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } @@ -1561,7 +1666,10 @@ public partial class DevTestLabArmTemplateParameter : System.ClientModel.Primiti public DevTestLabArmTemplateParameter() { } public string Name { get { throw null; } set { } } public string Value { get { throw null; } set { } } + protected virtual Azure.ResourceManager.DevTestLabs.Models.DevTestLabArmTemplateParameter JsonModelCreateCore(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } protected virtual void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + protected virtual Azure.ResourceManager.DevTestLabs.Models.DevTestLabArmTemplateParameter PersistableModelCreateCore(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + protected virtual System.BinaryData PersistableModelWriteCore(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } Azure.ResourceManager.DevTestLabs.Models.DevTestLabArmTemplateParameter System.ClientModel.Primitives.IJsonModel.Create(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } void System.ClientModel.Primitives.IJsonModel.Write(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } Azure.ResourceManager.DevTestLabs.Models.DevTestLabArmTemplateParameter System.ClientModel.Primitives.IPersistableModel.Create(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } @@ -1574,7 +1682,10 @@ internal DevTestLabArtifactDeploymentStatus() { } public int? ArtifactsApplied { get { throw null; } } public string DeploymentStatus { get { throw null; } } public int? TotalArtifacts { get { throw null; } } + protected virtual Azure.ResourceManager.DevTestLabs.Models.DevTestLabArtifactDeploymentStatus JsonModelCreateCore(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } protected virtual void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + protected virtual Azure.ResourceManager.DevTestLabs.Models.DevTestLabArtifactDeploymentStatus PersistableModelCreateCore(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + protected virtual System.BinaryData PersistableModelWriteCore(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } Azure.ResourceManager.DevTestLabs.Models.DevTestLabArtifactDeploymentStatus System.ClientModel.Primitives.IJsonModel.Create(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } void System.ClientModel.Primitives.IJsonModel.Write(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } Azure.ResourceManager.DevTestLabs.Models.DevTestLabArtifactDeploymentStatus System.ClientModel.Primitives.IPersistableModel.Create(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } @@ -1588,7 +1699,10 @@ public DevTestLabArtifactGenerateArmTemplateContent() { } public Azure.Core.AzureLocation? Location { get { throw null; } set { } } public System.Collections.Generic.IList Parameters { get { throw null; } } public string VmName { get { throw null; } set { } } + protected virtual Azure.ResourceManager.DevTestLabs.Models.DevTestLabArtifactGenerateArmTemplateContent JsonModelCreateCore(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } protected virtual void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + protected virtual Azure.ResourceManager.DevTestLabs.Models.DevTestLabArtifactGenerateArmTemplateContent PersistableModelCreateCore(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + protected virtual System.BinaryData PersistableModelWriteCore(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } Azure.ResourceManager.DevTestLabs.Models.DevTestLabArtifactGenerateArmTemplateContent System.ClientModel.Primitives.IJsonModel.Create(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } void System.ClientModel.Primitives.IJsonModel.Write(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } Azure.ResourceManager.DevTestLabs.Models.DevTestLabArtifactGenerateArmTemplateContent System.ClientModel.Primitives.IPersistableModel.Create(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } @@ -1605,7 +1719,10 @@ public DevTestLabArtifactInstallInfo() { } public System.Collections.Generic.IList Parameters { get { throw null; } } public string Status { get { throw null; } set { } } public string VmExtensionStatusMessage { get { throw null; } set { } } + protected virtual Azure.ResourceManager.DevTestLabs.Models.DevTestLabArtifactInstallInfo JsonModelCreateCore(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } protected virtual void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + protected virtual Azure.ResourceManager.DevTestLabs.Models.DevTestLabArtifactInstallInfo PersistableModelCreateCore(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + protected virtual System.BinaryData PersistableModelWriteCore(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } Azure.ResourceManager.DevTestLabs.Models.DevTestLabArtifactInstallInfo System.ClientModel.Primitives.IJsonModel.Create(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } void System.ClientModel.Primitives.IJsonModel.Write(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } Azure.ResourceManager.DevTestLabs.Models.DevTestLabArtifactInstallInfo System.ClientModel.Primitives.IPersistableModel.Create(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } @@ -1617,7 +1734,10 @@ public partial class DevTestLabArtifactParameter : System.ClientModel.Primitives public DevTestLabArtifactParameter() { } public string Name { get { throw null; } set { } } public string Value { get { throw null; } set { } } + protected virtual Azure.ResourceManager.DevTestLabs.Models.DevTestLabArtifactParameter JsonModelCreateCore(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } protected virtual void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + protected virtual Azure.ResourceManager.DevTestLabs.Models.DevTestLabArtifactParameter PersistableModelCreateCore(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + protected virtual System.BinaryData PersistableModelWriteCore(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } Azure.ResourceManager.DevTestLabs.Models.DevTestLabArtifactParameter System.ClientModel.Primitives.IJsonModel.Create(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } void System.ClientModel.Primitives.IJsonModel.Write(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } Azure.ResourceManager.DevTestLabs.Models.DevTestLabArtifactParameter System.ClientModel.Primitives.IPersistableModel.Create(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } @@ -1627,7 +1747,10 @@ protected virtual void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer public partial class DevTestLabArtifactSourcePatch : Azure.ResourceManager.DevTestLabs.Models.DevTestLabResourcePatch, System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel { public DevTestLabArtifactSourcePatch() { } + protected override Azure.ResourceManager.DevTestLabs.Models.DevTestLabResourcePatch JsonModelCreateCore(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } protected override void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + protected override Azure.ResourceManager.DevTestLabs.Models.DevTestLabResourcePatch PersistableModelCreateCore(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + protected override System.BinaryData PersistableModelWriteCore(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } Azure.ResourceManager.DevTestLabs.Models.DevTestLabArtifactSourcePatch System.ClientModel.Primitives.IJsonModel.Create(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } void System.ClientModel.Primitives.IJsonModel.Write(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } Azure.ResourceManager.DevTestLabs.Models.DevTestLabArtifactSourcePatch System.ClientModel.Primitives.IPersistableModel.Create(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } @@ -1640,7 +1763,10 @@ internal DevTestLabCostDetails() { } public double? Cost { get { throw null; } } public Azure.ResourceManager.DevTestLabs.Models.DevTestLabCostType? CostType { get { throw null; } } public System.DateTimeOffset? On { get { throw null; } } + protected virtual Azure.ResourceManager.DevTestLabs.Models.DevTestLabCostDetails JsonModelCreateCore(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } protected virtual void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + protected virtual Azure.ResourceManager.DevTestLabs.Models.DevTestLabCostDetails PersistableModelCreateCore(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + protected virtual System.BinaryData PersistableModelWriteCore(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } Azure.ResourceManager.DevTestLabs.Models.DevTestLabCostDetails System.ClientModel.Primitives.IJsonModel.Create(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } void System.ClientModel.Primitives.IJsonModel.Write(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } Azure.ResourceManager.DevTestLabs.Models.DevTestLabCostDetails System.ClientModel.Primitives.IPersistableModel.Create(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } @@ -1655,7 +1781,10 @@ public DevTestLabCostThreshold() { } public Azure.ResourceManager.DevTestLabs.Models.DevTestLabCostThresholdStatus? SendNotificationWhenExceeded { get { throw null; } set { } } public string ThresholdId { get { throw null; } set { } } public double? ThresholdValue { get { throw null; } set { } } + protected virtual Azure.ResourceManager.DevTestLabs.Models.DevTestLabCostThreshold JsonModelCreateCore(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } protected virtual void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + protected virtual Azure.ResourceManager.DevTestLabs.Models.DevTestLabCostThreshold PersistableModelCreateCore(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + protected virtual System.BinaryData PersistableModelWriteCore(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } Azure.ResourceManager.DevTestLabs.Models.DevTestLabCostThreshold System.ClientModel.Primitives.IJsonModel.Create(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } void System.ClientModel.Primitives.IJsonModel.Write(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } Azure.ResourceManager.DevTestLabs.Models.DevTestLabCostThreshold System.ClientModel.Primitives.IPersistableModel.Create(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } @@ -1675,6 +1804,7 @@ protected virtual void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer public override int GetHashCode() { throw null; } public static bool operator ==(Azure.ResourceManager.DevTestLabs.Models.DevTestLabCostThresholdStatus left, Azure.ResourceManager.DevTestLabs.Models.DevTestLabCostThresholdStatus right) { throw null; } public static implicit operator Azure.ResourceManager.DevTestLabs.Models.DevTestLabCostThresholdStatus (string value) { throw null; } + public static implicit operator Azure.ResourceManager.DevTestLabs.Models.DevTestLabCostThresholdStatus? (string value) { throw null; } public static bool operator !=(Azure.ResourceManager.DevTestLabs.Models.DevTestLabCostThresholdStatus left, Azure.ResourceManager.DevTestLabs.Models.DevTestLabCostThresholdStatus right) { throw null; } public override string ToString() { throw null; } } @@ -1692,6 +1822,7 @@ protected virtual void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer public override int GetHashCode() { throw null; } public static bool operator ==(Azure.ResourceManager.DevTestLabs.Models.DevTestLabCostType left, Azure.ResourceManager.DevTestLabs.Models.DevTestLabCostType right) { throw null; } public static implicit operator Azure.ResourceManager.DevTestLabs.Models.DevTestLabCostType (string value) { throw null; } + public static implicit operator Azure.ResourceManager.DevTestLabs.Models.DevTestLabCostType? (string value) { throw null; } public static bool operator !=(Azure.ResourceManager.DevTestLabs.Models.DevTestLabCostType left, Azure.ResourceManager.DevTestLabs.Models.DevTestLabCostType right) { throw null; } public override string ToString() { throw null; } } @@ -1709,13 +1840,17 @@ protected virtual void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer public override int GetHashCode() { throw null; } public static bool operator ==(Azure.ResourceManager.DevTestLabs.Models.DevTestLabCustomImageOSType left, Azure.ResourceManager.DevTestLabs.Models.DevTestLabCustomImageOSType right) { throw null; } public static implicit operator Azure.ResourceManager.DevTestLabs.Models.DevTestLabCustomImageOSType (string value) { throw null; } + public static implicit operator Azure.ResourceManager.DevTestLabs.Models.DevTestLabCustomImageOSType? (string value) { throw null; } public static bool operator !=(Azure.ResourceManager.DevTestLabs.Models.DevTestLabCustomImageOSType left, Azure.ResourceManager.DevTestLabs.Models.DevTestLabCustomImageOSType right) { throw null; } public override string ToString() { throw null; } } public partial class DevTestLabCustomImagePatch : Azure.ResourceManager.DevTestLabs.Models.DevTestLabResourcePatch, System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel { public DevTestLabCustomImagePatch() { } + protected override Azure.ResourceManager.DevTestLabs.Models.DevTestLabResourcePatch JsonModelCreateCore(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } protected override void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + protected override Azure.ResourceManager.DevTestLabs.Models.DevTestLabResourcePatch PersistableModelCreateCore(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + protected override System.BinaryData PersistableModelWriteCore(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } Azure.ResourceManager.DevTestLabs.Models.DevTestLabCustomImagePatch System.ClientModel.Primitives.IJsonModel.Create(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } void System.ClientModel.Primitives.IJsonModel.Write(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } Azure.ResourceManager.DevTestLabs.Models.DevTestLabCustomImagePatch System.ClientModel.Primitives.IPersistableModel.Create(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } @@ -1728,7 +1863,10 @@ public DevTestLabCustomImagePlan() { } public string Id { get { throw null; } set { } } public string Offer { get { throw null; } set { } } public string Publisher { get { throw null; } set { } } + protected virtual Azure.ResourceManager.DevTestLabs.Models.DevTestLabCustomImagePlan JsonModelCreateCore(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } protected virtual void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + protected virtual Azure.ResourceManager.DevTestLabs.Models.DevTestLabCustomImagePlan PersistableModelCreateCore(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + protected virtual System.BinaryData PersistableModelWriteCore(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } Azure.ResourceManager.DevTestLabs.Models.DevTestLabCustomImagePlan System.ClientModel.Primitives.IJsonModel.Create(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } void System.ClientModel.Primitives.IJsonModel.Write(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } Azure.ResourceManager.DevTestLabs.Models.DevTestLabCustomImagePlan System.ClientModel.Primitives.IPersistableModel.Create(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } @@ -1741,7 +1879,10 @@ public DevTestLabCustomImageVhd(Azure.ResourceManager.DevTestLabs.Models.DevTest public string ImageName { get { throw null; } set { } } public bool? IsSysPrepEnabled { get { throw null; } set { } } public Azure.ResourceManager.DevTestLabs.Models.DevTestLabCustomImageOSType OSType { get { throw null; } set { } } + protected virtual Azure.ResourceManager.DevTestLabs.Models.DevTestLabCustomImageVhd JsonModelCreateCore(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } protected virtual void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + protected virtual Azure.ResourceManager.DevTestLabs.Models.DevTestLabCustomImageVhd PersistableModelCreateCore(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + protected virtual System.BinaryData PersistableModelWriteCore(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } Azure.ResourceManager.DevTestLabs.Models.DevTestLabCustomImageVhd System.ClientModel.Primitives.IJsonModel.Create(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } void System.ClientModel.Primitives.IJsonModel.Write(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } Azure.ResourceManager.DevTestLabs.Models.DevTestLabCustomImageVhd System.ClientModel.Primitives.IPersistableModel.Create(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } @@ -1754,7 +1895,10 @@ public DevTestLabCustomImageVm() { } public Azure.ResourceManager.DevTestLabs.Models.DevTestLabLinuxOSState? LinuxOSState { get { throw null; } set { } } public string SourceVmId { get { throw null; } set { } } public Azure.ResourceManager.DevTestLabs.Models.WindowsOSState? WindowsOSState { get { throw null; } set { } } + protected virtual Azure.ResourceManager.DevTestLabs.Models.DevTestLabCustomImageVm JsonModelCreateCore(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } protected virtual void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + protected virtual Azure.ResourceManager.DevTestLabs.Models.DevTestLabCustomImageVm PersistableModelCreateCore(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + protected virtual System.BinaryData PersistableModelWriteCore(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } Azure.ResourceManager.DevTestLabs.Models.DevTestLabCustomImageVm System.ClientModel.Primitives.IJsonModel.Create(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } void System.ClientModel.Primitives.IJsonModel.Write(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } Azure.ResourceManager.DevTestLabs.Models.DevTestLabCustomImageVm System.ClientModel.Primitives.IPersistableModel.Create(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } @@ -1767,7 +1911,10 @@ public DevTestLabDataDiskProperties() { } public Azure.ResourceManager.DevTestLabs.Models.AttachNewDataDiskDetails AttachNewDataDiskOptions { get { throw null; } set { } } public Azure.Core.ResourceIdentifier ExistingLabDiskId { get { throw null; } set { } } public Azure.ResourceManager.DevTestLabs.Models.DevTestLabHostCachingOption? HostCaching { get { throw null; } set { } } + protected virtual Azure.ResourceManager.DevTestLabs.Models.DevTestLabDataDiskProperties JsonModelCreateCore(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } protected virtual void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + protected virtual Azure.ResourceManager.DevTestLabs.Models.DevTestLabDataDiskProperties PersistableModelCreateCore(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + protected virtual System.BinaryData PersistableModelWriteCore(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } Azure.ResourceManager.DevTestLabs.Models.DevTestLabDataDiskProperties System.ClientModel.Primitives.IJsonModel.Create(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } void System.ClientModel.Primitives.IJsonModel.Write(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } Azure.ResourceManager.DevTestLabs.Models.DevTestLabDataDiskProperties System.ClientModel.Primitives.IPersistableModel.Create(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } @@ -1779,7 +1926,10 @@ public partial class DevTestLabDataDiskStorageTypeInfo : System.ClientModel.Prim public DevTestLabDataDiskStorageTypeInfo() { } public string Lun { get { throw null; } set { } } public Azure.ResourceManager.DevTestLabs.Models.DevTestLabStorageType? StorageType { get { throw null; } set { } } + protected virtual Azure.ResourceManager.DevTestLabs.Models.DevTestLabDataDiskStorageTypeInfo JsonModelCreateCore(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } protected virtual void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + protected virtual Azure.ResourceManager.DevTestLabs.Models.DevTestLabDataDiskStorageTypeInfo PersistableModelCreateCore(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + protected virtual System.BinaryData PersistableModelWriteCore(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } Azure.ResourceManager.DevTestLabs.Models.DevTestLabDataDiskStorageTypeInfo System.ClientModel.Primitives.IJsonModel.Create(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } void System.ClientModel.Primitives.IJsonModel.Write(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } Azure.ResourceManager.DevTestLabs.Models.DevTestLabDataDiskStorageTypeInfo System.ClientModel.Primitives.IPersistableModel.Create(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } @@ -1790,7 +1940,10 @@ public partial class DevTestLabDiskAttachContent : System.ClientModel.Primitives { public DevTestLabDiskAttachContent() { } public Azure.Core.ResourceIdentifier LeasedByLabVmId { get { throw null; } set { } } + protected virtual Azure.ResourceManager.DevTestLabs.Models.DevTestLabDiskAttachContent JsonModelCreateCore(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } protected virtual void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + protected virtual Azure.ResourceManager.DevTestLabs.Models.DevTestLabDiskAttachContent PersistableModelCreateCore(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + protected virtual System.BinaryData PersistableModelWriteCore(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } Azure.ResourceManager.DevTestLabs.Models.DevTestLabDiskAttachContent System.ClientModel.Primitives.IJsonModel.Create(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } void System.ClientModel.Primitives.IJsonModel.Write(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } Azure.ResourceManager.DevTestLabs.Models.DevTestLabDiskAttachContent System.ClientModel.Primitives.IPersistableModel.Create(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } @@ -1801,7 +1954,10 @@ public partial class DevTestLabDiskDetachContent : System.ClientModel.Primitives { public DevTestLabDiskDetachContent() { } public Azure.Core.ResourceIdentifier LeasedByLabVmId { get { throw null; } set { } } + protected virtual Azure.ResourceManager.DevTestLabs.Models.DevTestLabDiskDetachContent JsonModelCreateCore(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } protected virtual void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + protected virtual Azure.ResourceManager.DevTestLabs.Models.DevTestLabDiskDetachContent PersistableModelCreateCore(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + protected virtual System.BinaryData PersistableModelWriteCore(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } Azure.ResourceManager.DevTestLabs.Models.DevTestLabDiskDetachContent System.ClientModel.Primitives.IJsonModel.Create(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } void System.ClientModel.Primitives.IJsonModel.Write(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } Azure.ResourceManager.DevTestLabs.Models.DevTestLabDiskDetachContent System.ClientModel.Primitives.IPersistableModel.Create(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } @@ -1811,7 +1967,10 @@ protected virtual void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer public partial class DevTestLabDiskPatch : Azure.ResourceManager.DevTestLabs.Models.DevTestLabResourcePatch, System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel { public DevTestLabDiskPatch() { } + protected override Azure.ResourceManager.DevTestLabs.Models.DevTestLabResourcePatch JsonModelCreateCore(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } protected override void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + protected override Azure.ResourceManager.DevTestLabs.Models.DevTestLabResourcePatch PersistableModelCreateCore(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + protected override System.BinaryData PersistableModelWriteCore(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } Azure.ResourceManager.DevTestLabs.Models.DevTestLabDiskPatch System.ClientModel.Primitives.IJsonModel.Create(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } void System.ClientModel.Primitives.IJsonModel.Write(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } Azure.ResourceManager.DevTestLabs.Models.DevTestLabDiskPatch System.ClientModel.Primitives.IPersistableModel.Create(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } @@ -1831,6 +1990,7 @@ protected override void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter write public override int GetHashCode() { throw null; } public static bool operator ==(Azure.ResourceManager.DevTestLabs.Models.DevTestLabEnableStatus left, Azure.ResourceManager.DevTestLabs.Models.DevTestLabEnableStatus right) { throw null; } public static implicit operator Azure.ResourceManager.DevTestLabs.Models.DevTestLabEnableStatus (string value) { throw null; } + public static implicit operator Azure.ResourceManager.DevTestLabs.Models.DevTestLabEnableStatus? (string value) { throw null; } public static bool operator !=(Azure.ResourceManager.DevTestLabs.Models.DevTestLabEnableStatus left, Azure.ResourceManager.DevTestLabs.Models.DevTestLabEnableStatus right) { throw null; } public override string ToString() { throw null; } } @@ -1839,7 +1999,10 @@ public partial class DevTestLabEnvironmentDeployment : System.ClientModel.Primit public DevTestLabEnvironmentDeployment() { } public Azure.Core.ResourceIdentifier ArmTemplateId { get { throw null; } set { } } public System.Collections.Generic.IList Parameters { get { throw null; } } + protected virtual Azure.ResourceManager.DevTestLabs.Models.DevTestLabEnvironmentDeployment JsonModelCreateCore(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } protected virtual void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + protected virtual Azure.ResourceManager.DevTestLabs.Models.DevTestLabEnvironmentDeployment PersistableModelCreateCore(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + protected virtual System.BinaryData PersistableModelWriteCore(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } Azure.ResourceManager.DevTestLabs.Models.DevTestLabEnvironmentDeployment System.ClientModel.Primitives.IJsonModel.Create(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } void System.ClientModel.Primitives.IJsonModel.Write(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } Azure.ResourceManager.DevTestLabs.Models.DevTestLabEnvironmentDeployment System.ClientModel.Primitives.IPersistableModel.Create(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } @@ -1849,7 +2012,10 @@ protected virtual void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer public partial class DevTestLabEnvironmentPatch : Azure.ResourceManager.DevTestLabs.Models.DevTestLabResourcePatch, System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel { public DevTestLabEnvironmentPatch() { } + protected override Azure.ResourceManager.DevTestLabs.Models.DevTestLabResourcePatch JsonModelCreateCore(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } protected override void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + protected override Azure.ResourceManager.DevTestLabs.Models.DevTestLabResourcePatch PersistableModelCreateCore(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + protected override System.BinaryData PersistableModelWriteCore(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } Azure.ResourceManager.DevTestLabs.Models.DevTestLabEnvironmentPatch System.ClientModel.Primitives.IJsonModel.Create(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } void System.ClientModel.Primitives.IJsonModel.Write(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } Azure.ResourceManager.DevTestLabs.Models.DevTestLabEnvironmentPatch System.ClientModel.Primitives.IPersistableModel.Create(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } @@ -1869,6 +2035,7 @@ protected override void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter write public override int GetHashCode() { throw null; } public static bool operator ==(Azure.ResourceManager.DevTestLabs.Models.DevTestLabEnvironmentPermission left, Azure.ResourceManager.DevTestLabs.Models.DevTestLabEnvironmentPermission right) { throw null; } public static implicit operator Azure.ResourceManager.DevTestLabs.Models.DevTestLabEnvironmentPermission (string value) { throw null; } + public static implicit operator Azure.ResourceManager.DevTestLabs.Models.DevTestLabEnvironmentPermission? (string value) { throw null; } public static bool operator !=(Azure.ResourceManager.DevTestLabs.Models.DevTestLabEnvironmentPermission left, Azure.ResourceManager.DevTestLabs.Models.DevTestLabEnvironmentPermission right) { throw null; } public override string ToString() { throw null; } } @@ -1876,7 +2043,10 @@ public partial class DevTestLabEvaluatePoliciesContent : System.ClientModel.Prim { public DevTestLabEvaluatePoliciesContent() { } public System.Collections.Generic.IList Policies { get { throw null; } } + protected virtual Azure.ResourceManager.DevTestLabs.Models.DevTestLabEvaluatePoliciesContent JsonModelCreateCore(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } protected virtual void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + protected virtual Azure.ResourceManager.DevTestLabs.Models.DevTestLabEvaluatePoliciesContent PersistableModelCreateCore(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + protected virtual System.BinaryData PersistableModelWriteCore(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } Azure.ResourceManager.DevTestLabs.Models.DevTestLabEvaluatePoliciesContent System.ClientModel.Primitives.IJsonModel.Create(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } void System.ClientModel.Primitives.IJsonModel.Write(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } Azure.ResourceManager.DevTestLabs.Models.DevTestLabEvaluatePoliciesContent System.ClientModel.Primitives.IPersistableModel.Create(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } @@ -1887,7 +2057,10 @@ public partial class DevTestLabEvaluatePoliciesResult : System.ClientModel.Primi { internal DevTestLabEvaluatePoliciesResult() { } public System.Collections.Generic.IReadOnlyList Results { get { throw null; } } + protected virtual Azure.ResourceManager.DevTestLabs.Models.DevTestLabEvaluatePoliciesResult JsonModelCreateCore(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } protected virtual void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + protected virtual Azure.ResourceManager.DevTestLabs.Models.DevTestLabEvaluatePoliciesResult PersistableModelCreateCore(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + protected virtual System.BinaryData PersistableModelWriteCore(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } Azure.ResourceManager.DevTestLabs.Models.DevTestLabEvaluatePoliciesResult System.ClientModel.Primitives.IJsonModel.Create(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } void System.ClientModel.Primitives.IJsonModel.Write(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } Azure.ResourceManager.DevTestLabs.Models.DevTestLabEvaluatePoliciesResult System.ClientModel.Primitives.IPersistableModel.Create(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } @@ -1901,7 +2074,10 @@ public DevTestLabEvaluatePolicy() { } public string FactName { get { throw null; } set { } } public string UserObjectId { get { throw null; } set { } } public string ValueOffset { get { throw null; } set { } } + protected virtual Azure.ResourceManager.DevTestLabs.Models.DevTestLabEvaluatePolicy JsonModelCreateCore(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } protected virtual void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + protected virtual Azure.ResourceManager.DevTestLabs.Models.DevTestLabEvaluatePolicy PersistableModelCreateCore(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + protected virtual System.BinaryData PersistableModelWriteCore(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } Azure.ResourceManager.DevTestLabs.Models.DevTestLabEvaluatePolicy System.ClientModel.Primitives.IJsonModel.Create(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } void System.ClientModel.Primitives.IJsonModel.Write(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } Azure.ResourceManager.DevTestLabs.Models.DevTestLabEvaluatePolicy System.ClientModel.Primitives.IPersistableModel.Create(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } @@ -1913,7 +2089,10 @@ public partial class DevTestLabExportResourceUsageContent : System.ClientModel.P public DevTestLabExportResourceUsageContent() { } public System.Uri BlobStorageAbsoluteSasUri { get { throw null; } set { } } public System.DateTimeOffset? UsageStartOn { get { throw null; } set { } } + protected virtual Azure.ResourceManager.DevTestLabs.Models.DevTestLabExportResourceUsageContent JsonModelCreateCore(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } protected virtual void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + protected virtual Azure.ResourceManager.DevTestLabs.Models.DevTestLabExportResourceUsageContent PersistableModelCreateCore(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + protected virtual System.BinaryData PersistableModelWriteCore(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } Azure.ResourceManager.DevTestLabs.Models.DevTestLabExportResourceUsageContent System.ClientModel.Primitives.IJsonModel.Create(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } void System.ClientModel.Primitives.IJsonModel.Write(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } Azure.ResourceManager.DevTestLabs.Models.DevTestLabExportResourceUsageContent System.ClientModel.Primitives.IPersistableModel.Create(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } @@ -1925,7 +2104,10 @@ public partial class DevTestLabExternalSubnet : System.ClientModel.Primitives.IJ internal DevTestLabExternalSubnet() { } public Azure.Core.ResourceIdentifier Id { get { throw null; } } public string Name { get { throw null; } } + protected virtual Azure.ResourceManager.DevTestLabs.Models.DevTestLabExternalSubnet JsonModelCreateCore(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } protected virtual void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + protected virtual Azure.ResourceManager.DevTestLabs.Models.DevTestLabExternalSubnet PersistableModelCreateCore(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + protected virtual System.BinaryData PersistableModelWriteCore(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } Azure.ResourceManager.DevTestLabs.Models.DevTestLabExternalSubnet System.ClientModel.Primitives.IJsonModel.Create(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } void System.ClientModel.Primitives.IJsonModel.Write(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } Azure.ResourceManager.DevTestLabs.Models.DevTestLabExternalSubnet System.ClientModel.Primitives.IPersistableModel.Create(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } @@ -1945,13 +2127,17 @@ protected virtual void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer public override int GetHashCode() { throw null; } public static bool operator ==(Azure.ResourceManager.DevTestLabs.Models.DevTestLabFileUploadOption left, Azure.ResourceManager.DevTestLabs.Models.DevTestLabFileUploadOption right) { throw null; } public static implicit operator Azure.ResourceManager.DevTestLabs.Models.DevTestLabFileUploadOption (string value) { throw null; } + public static implicit operator Azure.ResourceManager.DevTestLabs.Models.DevTestLabFileUploadOption? (string value) { throw null; } public static bool operator !=(Azure.ResourceManager.DevTestLabs.Models.DevTestLabFileUploadOption left, Azure.ResourceManager.DevTestLabs.Models.DevTestLabFileUploadOption right) { throw null; } public override string ToString() { throw null; } } public partial class DevTestLabFormulaPatch : Azure.ResourceManager.DevTestLabs.Models.DevTestLabResourcePatch, System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel { public DevTestLabFormulaPatch() { } + protected override Azure.ResourceManager.DevTestLabs.Models.DevTestLabResourcePatch JsonModelCreateCore(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } protected override void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + protected override Azure.ResourceManager.DevTestLabs.Models.DevTestLabResourcePatch PersistableModelCreateCore(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + protected override System.BinaryData PersistableModelWriteCore(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } Azure.ResourceManager.DevTestLabs.Models.DevTestLabFormulaPatch System.ClientModel.Primitives.IJsonModel.Create(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } void System.ClientModel.Primitives.IJsonModel.Write(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } Azure.ResourceManager.DevTestLabs.Models.DevTestLabFormulaPatch System.ClientModel.Primitives.IPersistableModel.Create(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } @@ -1969,7 +2155,10 @@ public DevTestLabGalleryImage(Azure.Core.AzureLocation location) { } public bool? IsEnabled { get { throw null; } set { } } public bool? IsPlanAuthorized { get { throw null; } set { } } public string PlanId { get { throw null; } set { } } + protected virtual Azure.ResourceManager.Models.ResourceData JsonModelCreateCore(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } protected override void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + protected virtual Azure.ResourceManager.Models.ResourceData PersistableModelCreateCore(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + protected virtual System.BinaryData PersistableModelWriteCore(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } Azure.ResourceManager.DevTestLabs.Models.DevTestLabGalleryImage System.ClientModel.Primitives.IJsonModel.Create(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } void System.ClientModel.Primitives.IJsonModel.Write(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } Azure.ResourceManager.DevTestLabs.Models.DevTestLabGalleryImage System.ClientModel.Primitives.IPersistableModel.Create(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } @@ -1984,7 +2173,10 @@ public DevTestLabGalleryImageReference() { } public string Publisher { get { throw null; } set { } } public string Sku { get { throw null; } set { } } public string Version { get { throw null; } set { } } + protected virtual Azure.ResourceManager.DevTestLabs.Models.DevTestLabGalleryImageReference JsonModelCreateCore(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } protected virtual void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + protected virtual Azure.ResourceManager.DevTestLabs.Models.DevTestLabGalleryImageReference PersistableModelCreateCore(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + protected virtual System.BinaryData PersistableModelWriteCore(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } Azure.ResourceManager.DevTestLabs.Models.DevTestLabGalleryImageReference System.ClientModel.Primitives.IJsonModel.Create(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } void System.ClientModel.Primitives.IJsonModel.Write(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } Azure.ResourceManager.DevTestLabs.Models.DevTestLabGalleryImageReference System.ClientModel.Primitives.IPersistableModel.Create(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } @@ -1995,7 +2187,10 @@ public partial class DevTestLabGenerateUploadUriContent : System.ClientModel.Pri { public DevTestLabGenerateUploadUriContent() { } public string BlobName { get { throw null; } set { } } + protected virtual Azure.ResourceManager.DevTestLabs.Models.DevTestLabGenerateUploadUriContent JsonModelCreateCore(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } protected virtual void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + protected virtual Azure.ResourceManager.DevTestLabs.Models.DevTestLabGenerateUploadUriContent PersistableModelCreateCore(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + protected virtual System.BinaryData PersistableModelWriteCore(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } Azure.ResourceManager.DevTestLabs.Models.DevTestLabGenerateUploadUriContent System.ClientModel.Primitives.IJsonModel.Create(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } void System.ClientModel.Primitives.IJsonModel.Write(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } Azure.ResourceManager.DevTestLabs.Models.DevTestLabGenerateUploadUriContent System.ClientModel.Primitives.IPersistableModel.Create(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } @@ -2006,7 +2201,10 @@ public partial class DevTestLabGenerateUploadUriResult : System.ClientModel.Prim { internal DevTestLabGenerateUploadUriResult() { } public System.Uri UploadUri { get { throw null; } } + protected virtual Azure.ResourceManager.DevTestLabs.Models.DevTestLabGenerateUploadUriResult JsonModelCreateCore(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } protected virtual void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + protected virtual Azure.ResourceManager.DevTestLabs.Models.DevTestLabGenerateUploadUriResult PersistableModelCreateCore(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + protected virtual System.BinaryData PersistableModelWriteCore(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } Azure.ResourceManager.DevTestLabs.Models.DevTestLabGenerateUploadUriResult System.ClientModel.Primitives.IJsonModel.Create(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } void System.ClientModel.Primitives.IJsonModel.Write(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } Azure.ResourceManager.DevTestLabs.Models.DevTestLabGenerateUploadUriResult System.ClientModel.Primitives.IPersistableModel.Create(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } @@ -2018,7 +2216,10 @@ public partial class DevTestLabGlobalScheduleRetargetContent : System.ClientMode public DevTestLabGlobalScheduleRetargetContent() { } public Azure.Core.ResourceIdentifier CurrentResourceId { get { throw null; } set { } } public Azure.Core.ResourceIdentifier TargetResourceId { get { throw null; } set { } } + protected virtual Azure.ResourceManager.DevTestLabs.Models.DevTestLabGlobalScheduleRetargetContent JsonModelCreateCore(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } protected virtual void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + protected virtual Azure.ResourceManager.DevTestLabs.Models.DevTestLabGlobalScheduleRetargetContent PersistableModelCreateCore(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + protected virtual System.BinaryData PersistableModelWriteCore(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } Azure.ResourceManager.DevTestLabs.Models.DevTestLabGlobalScheduleRetargetContent System.ClientModel.Primitives.IJsonModel.Create(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } void System.ClientModel.Primitives.IJsonModel.Write(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } Azure.ResourceManager.DevTestLabs.Models.DevTestLabGlobalScheduleRetargetContent System.ClientModel.Primitives.IPersistableModel.Create(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } @@ -2039,6 +2240,7 @@ protected virtual void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer public override int GetHashCode() { throw null; } public static bool operator ==(Azure.ResourceManager.DevTestLabs.Models.DevTestLabHostCachingOption left, Azure.ResourceManager.DevTestLabs.Models.DevTestLabHostCachingOption right) { throw null; } public static implicit operator Azure.ResourceManager.DevTestLabs.Models.DevTestLabHostCachingOption (string value) { throw null; } + public static implicit operator Azure.ResourceManager.DevTestLabs.Models.DevTestLabHostCachingOption? (string value) { throw null; } public static bool operator !=(Azure.ResourceManager.DevTestLabs.Models.DevTestLabHostCachingOption left, Azure.ResourceManager.DevTestLabs.Models.DevTestLabHostCachingOption right) { throw null; } public override string ToString() { throw null; } } @@ -2047,7 +2249,10 @@ public partial class DevTestLabImportVmContent : System.ClientModel.Primitives.I public DevTestLabImportVmContent() { } public string DestinationVmName { get { throw null; } set { } } public Azure.Core.ResourceIdentifier SourceVmResourceId { get { throw null; } set { } } + protected virtual Azure.ResourceManager.DevTestLabs.Models.DevTestLabImportVmContent JsonModelCreateCore(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } protected virtual void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + protected virtual Azure.ResourceManager.DevTestLabs.Models.DevTestLabImportVmContent PersistableModelCreateCore(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + protected virtual System.BinaryData PersistableModelWriteCore(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } Azure.ResourceManager.DevTestLabs.Models.DevTestLabImportVmContent System.ClientModel.Primitives.IJsonModel.Create(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } void System.ClientModel.Primitives.IJsonModel.Write(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } Azure.ResourceManager.DevTestLabs.Models.DevTestLabImportVmContent System.ClientModel.Primitives.IPersistableModel.Create(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } @@ -2060,7 +2265,10 @@ public DevTestLabInboundNatRule() { } public int? BackendPort { get { throw null; } set { } } public int? FrontendPort { get { throw null; } set { } } public Azure.ResourceManager.DevTestLabs.Models.DevTestLabTransportProtocol? TransportProtocol { get { throw null; } set { } } + protected virtual Azure.ResourceManager.DevTestLabs.Models.DevTestLabInboundNatRule JsonModelCreateCore(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } protected virtual void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + protected virtual Azure.ResourceManager.DevTestLabs.Models.DevTestLabInboundNatRule PersistableModelCreateCore(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + protected virtual System.BinaryData PersistableModelWriteCore(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } Azure.ResourceManager.DevTestLabs.Models.DevTestLabInboundNatRule System.ClientModel.Primitives.IJsonModel.Create(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } void System.ClientModel.Primitives.IJsonModel.Write(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } Azure.ResourceManager.DevTestLabs.Models.DevTestLabInboundNatRule System.ClientModel.Primitives.IPersistableModel.Create(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } @@ -2081,6 +2289,7 @@ protected virtual void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer public override int GetHashCode() { throw null; } public static bool operator ==(Azure.ResourceManager.DevTestLabs.Models.DevTestLabLinuxOSState left, Azure.ResourceManager.DevTestLabs.Models.DevTestLabLinuxOSState right) { throw null; } public static implicit operator Azure.ResourceManager.DevTestLabs.Models.DevTestLabLinuxOSState (string value) { throw null; } + public static implicit operator Azure.ResourceManager.DevTestLabs.Models.DevTestLabLinuxOSState? (string value) { throw null; } public static bool operator !=(Azure.ResourceManager.DevTestLabs.Models.DevTestLabLinuxOSState left, Azure.ResourceManager.DevTestLabs.Models.DevTestLabLinuxOSState right) { throw null; } public override string ToString() { throw null; } } @@ -2091,6 +2300,10 @@ public DevTestLabManagedIdentity() { } public Azure.ResourceManager.Models.ManagedServiceIdentityType ManagedIdentityType { get { throw null; } set { } } public System.Guid? PrincipalId { get { throw null; } set { } } public System.Guid? TenantId { get { throw null; } set { } } + protected virtual Azure.ResourceManager.DevTestLabs.Models.DevTestLabManagedIdentity JsonModelCreateCore(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + protected virtual void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + protected virtual Azure.ResourceManager.DevTestLabs.Models.DevTestLabManagedIdentity PersistableModelCreateCore(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + protected virtual System.BinaryData PersistableModelWriteCore(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } Azure.ResourceManager.DevTestLabs.Models.DevTestLabManagedIdentity System.ClientModel.Primitives.IJsonModel.Create(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } void System.ClientModel.Primitives.IJsonModel.Write(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } Azure.ResourceManager.DevTestLabs.Models.DevTestLabManagedIdentity System.ClientModel.Primitives.IPersistableModel.Create(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } @@ -2109,7 +2322,10 @@ public DevTestLabNetworkInterface() { } public string SshAuthority { get { throw null; } set { } } public Azure.Core.ResourceIdentifier SubnetId { get { throw null; } set { } } public Azure.Core.ResourceIdentifier VirtualNetworkId { get { throw null; } set { } } + protected virtual Azure.ResourceManager.DevTestLabs.Models.DevTestLabNetworkInterface JsonModelCreateCore(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } protected virtual void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + protected virtual Azure.ResourceManager.DevTestLabs.Models.DevTestLabNetworkInterface PersistableModelCreateCore(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + protected virtual System.BinaryData PersistableModelWriteCore(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } Azure.ResourceManager.DevTestLabs.Models.DevTestLabNetworkInterface System.ClientModel.Primitives.IJsonModel.Create(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } void System.ClientModel.Primitives.IJsonModel.Write(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } Azure.ResourceManager.DevTestLabs.Models.DevTestLabNetworkInterface System.ClientModel.Primitives.IPersistableModel.Create(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } @@ -2120,7 +2336,10 @@ public partial class DevTestLabNotificationChannelEvent : System.ClientModel.Pri { public DevTestLabNotificationChannelEvent() { } public Azure.ResourceManager.DevTestLabs.Models.DevTestLabNotificationChannelEventType? EventName { get { throw null; } set { } } + protected virtual Azure.ResourceManager.DevTestLabs.Models.DevTestLabNotificationChannelEvent JsonModelCreateCore(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } protected virtual void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + protected virtual Azure.ResourceManager.DevTestLabs.Models.DevTestLabNotificationChannelEvent PersistableModelCreateCore(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + protected virtual System.BinaryData PersistableModelWriteCore(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } Azure.ResourceManager.DevTestLabs.Models.DevTestLabNotificationChannelEvent System.ClientModel.Primitives.IJsonModel.Create(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } void System.ClientModel.Primitives.IJsonModel.Write(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } Azure.ResourceManager.DevTestLabs.Models.DevTestLabNotificationChannelEvent System.ClientModel.Primitives.IPersistableModel.Create(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } @@ -2140,6 +2359,7 @@ protected virtual void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer public override int GetHashCode() { throw null; } public static bool operator ==(Azure.ResourceManager.DevTestLabs.Models.DevTestLabNotificationChannelEventType left, Azure.ResourceManager.DevTestLabs.Models.DevTestLabNotificationChannelEventType right) { throw null; } public static implicit operator Azure.ResourceManager.DevTestLabs.Models.DevTestLabNotificationChannelEventType (string value) { throw null; } + public static implicit operator Azure.ResourceManager.DevTestLabs.Models.DevTestLabNotificationChannelEventType? (string value) { throw null; } public static bool operator !=(Azure.ResourceManager.DevTestLabs.Models.DevTestLabNotificationChannelEventType left, Azure.ResourceManager.DevTestLabs.Models.DevTestLabNotificationChannelEventType right) { throw null; } public override string ToString() { throw null; } } @@ -2148,7 +2368,10 @@ public partial class DevTestLabNotificationChannelNotifyContent : System.ClientM public DevTestLabNotificationChannelNotifyContent() { } public Azure.ResourceManager.DevTestLabs.Models.DevTestLabNotificationChannelEventType? EventName { get { throw null; } set { } } public string JsonPayload { get { throw null; } set { } } + protected virtual Azure.ResourceManager.DevTestLabs.Models.DevTestLabNotificationChannelNotifyContent JsonModelCreateCore(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } protected virtual void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + protected virtual Azure.ResourceManager.DevTestLabs.Models.DevTestLabNotificationChannelNotifyContent PersistableModelCreateCore(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + protected virtual System.BinaryData PersistableModelWriteCore(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } Azure.ResourceManager.DevTestLabs.Models.DevTestLabNotificationChannelNotifyContent System.ClientModel.Primitives.IJsonModel.Create(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } void System.ClientModel.Primitives.IJsonModel.Write(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } Azure.ResourceManager.DevTestLabs.Models.DevTestLabNotificationChannelNotifyContent System.ClientModel.Primitives.IPersistableModel.Create(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } @@ -2158,7 +2381,10 @@ protected virtual void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer public partial class DevTestLabNotificationChannelPatch : Azure.ResourceManager.DevTestLabs.Models.DevTestLabResourcePatch, System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel { public DevTestLabNotificationChannelPatch() { } + protected override Azure.ResourceManager.DevTestLabs.Models.DevTestLabResourcePatch JsonModelCreateCore(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } protected override void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + protected override Azure.ResourceManager.DevTestLabs.Models.DevTestLabResourcePatch PersistableModelCreateCore(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + protected override System.BinaryData PersistableModelWriteCore(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } Azure.ResourceManager.DevTestLabs.Models.DevTestLabNotificationChannelPatch System.ClientModel.Primitives.IJsonModel.Create(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } void System.ClientModel.Primitives.IJsonModel.Write(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } Azure.ResourceManager.DevTestLabs.Models.DevTestLabNotificationChannelPatch System.ClientModel.Primitives.IPersistableModel.Create(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } @@ -2173,7 +2399,10 @@ public DevTestLabNotificationSettings() { } public Azure.ResourceManager.DevTestLabs.Models.DevTestLabEnableStatus? Status { get { throw null; } set { } } public int? TimeInMinutes { get { throw null; } set { } } public System.Uri WebhookUri { get { throw null; } set { } } + protected virtual Azure.ResourceManager.DevTestLabs.Models.DevTestLabNotificationSettings JsonModelCreateCore(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } protected virtual void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + protected virtual Azure.ResourceManager.DevTestLabs.Models.DevTestLabNotificationSettings PersistableModelCreateCore(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + protected virtual System.BinaryData PersistableModelWriteCore(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } Azure.ResourceManager.DevTestLabs.Models.DevTestLabNotificationSettings System.ClientModel.Primitives.IJsonModel.Create(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } void System.ClientModel.Primitives.IJsonModel.Write(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } Azure.ResourceManager.DevTestLabs.Models.DevTestLabNotificationSettings System.ClientModel.Primitives.IPersistableModel.Create(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } @@ -2185,7 +2414,10 @@ public partial class DevTestLabParameter : System.ClientModel.Primitives.IJsonMo public DevTestLabParameter() { } public string Name { get { throw null; } set { } } public string Value { get { throw null; } set { } } + protected virtual Azure.ResourceManager.DevTestLabs.Models.DevTestLabParameter JsonModelCreateCore(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } protected virtual void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + protected virtual Azure.ResourceManager.DevTestLabs.Models.DevTestLabParameter PersistableModelCreateCore(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + protected virtual System.BinaryData PersistableModelWriteCore(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } Azure.ResourceManager.DevTestLabs.Models.DevTestLabParameter System.ClientModel.Primitives.IJsonModel.Create(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } void System.ClientModel.Primitives.IJsonModel.Write(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } Azure.ResourceManager.DevTestLabs.Models.DevTestLabParameter System.ClientModel.Primitives.IPersistableModel.Create(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } @@ -2197,7 +2429,10 @@ public partial class DevTestLabParametersValueFileInfo : System.ClientModel.Prim internal DevTestLabParametersValueFileInfo() { } public string FileName { get { throw null; } } public System.BinaryData ParametersValueInfo { get { throw null; } } + protected virtual Azure.ResourceManager.DevTestLabs.Models.DevTestLabParametersValueFileInfo JsonModelCreateCore(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } protected virtual void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + protected virtual Azure.ResourceManager.DevTestLabs.Models.DevTestLabParametersValueFileInfo PersistableModelCreateCore(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + protected virtual System.BinaryData PersistableModelWriteCore(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } Azure.ResourceManager.DevTestLabs.Models.DevTestLabParametersValueFileInfo System.ClientModel.Primitives.IJsonModel.Create(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } void System.ClientModel.Primitives.IJsonModel.Write(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } Azure.ResourceManager.DevTestLabs.Models.DevTestLabParametersValueFileInfo System.ClientModel.Primitives.IPersistableModel.Create(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } @@ -2207,7 +2442,10 @@ protected virtual void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer public partial class DevTestLabPatch : Azure.ResourceManager.DevTestLabs.Models.DevTestLabResourcePatch, System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel { public DevTestLabPatch() { } + protected override Azure.ResourceManager.DevTestLabs.Models.DevTestLabResourcePatch JsonModelCreateCore(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } protected override void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + protected override Azure.ResourceManager.DevTestLabs.Models.DevTestLabResourcePatch PersistableModelCreateCore(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + protected override System.BinaryData PersistableModelWriteCore(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } Azure.ResourceManager.DevTestLabs.Models.DevTestLabPatch System.ClientModel.Primitives.IJsonModel.Create(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } void System.ClientModel.Primitives.IJsonModel.Write(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } Azure.ResourceManager.DevTestLabs.Models.DevTestLabPatch System.ClientModel.Primitives.IPersistableModel.Create(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } @@ -2227,6 +2465,7 @@ protected override void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter write public override int GetHashCode() { throw null; } public static bool operator ==(Azure.ResourceManager.DevTestLabs.Models.DevTestLabPolicyEvaluatorType left, Azure.ResourceManager.DevTestLabs.Models.DevTestLabPolicyEvaluatorType right) { throw null; } public static implicit operator Azure.ResourceManager.DevTestLabs.Models.DevTestLabPolicyEvaluatorType (string value) { throw null; } + public static implicit operator Azure.ResourceManager.DevTestLabs.Models.DevTestLabPolicyEvaluatorType? (string value) { throw null; } public static bool operator !=(Azure.ResourceManager.DevTestLabs.Models.DevTestLabPolicyEvaluatorType left, Azure.ResourceManager.DevTestLabs.Models.DevTestLabPolicyEvaluatorType right) { throw null; } public override string ToString() { throw null; } } @@ -2251,13 +2490,17 @@ protected override void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter write public override int GetHashCode() { throw null; } public static bool operator ==(Azure.ResourceManager.DevTestLabs.Models.DevTestLabPolicyFactName left, Azure.ResourceManager.DevTestLabs.Models.DevTestLabPolicyFactName right) { throw null; } public static implicit operator Azure.ResourceManager.DevTestLabs.Models.DevTestLabPolicyFactName (string value) { throw null; } + public static implicit operator Azure.ResourceManager.DevTestLabs.Models.DevTestLabPolicyFactName? (string value) { throw null; } public static bool operator !=(Azure.ResourceManager.DevTestLabs.Models.DevTestLabPolicyFactName left, Azure.ResourceManager.DevTestLabs.Models.DevTestLabPolicyFactName right) { throw null; } public override string ToString() { throw null; } } public partial class DevTestLabPolicyPatch : Azure.ResourceManager.DevTestLabs.Models.DevTestLabResourcePatch, System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel { public DevTestLabPolicyPatch() { } + protected override Azure.ResourceManager.DevTestLabs.Models.DevTestLabResourcePatch JsonModelCreateCore(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } protected override void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + protected override Azure.ResourceManager.DevTestLabs.Models.DevTestLabResourcePatch PersistableModelCreateCore(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + protected override System.BinaryData PersistableModelWriteCore(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } Azure.ResourceManager.DevTestLabs.Models.DevTestLabPolicyPatch System.ClientModel.Primitives.IJsonModel.Create(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } void System.ClientModel.Primitives.IJsonModel.Write(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } Azure.ResourceManager.DevTestLabs.Models.DevTestLabPolicyPatch System.ClientModel.Primitives.IPersistableModel.Create(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } @@ -2269,7 +2512,10 @@ public partial class DevTestLabPolicySetResult : System.ClientModel.Primitives.I internal DevTestLabPolicySetResult() { } public bool? HasError { get { throw null; } } public System.Collections.Generic.IReadOnlyList PolicyViolations { get { throw null; } } + protected virtual Azure.ResourceManager.DevTestLabs.Models.DevTestLabPolicySetResult JsonModelCreateCore(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } protected virtual void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + protected virtual Azure.ResourceManager.DevTestLabs.Models.DevTestLabPolicySetResult PersistableModelCreateCore(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + protected virtual System.BinaryData PersistableModelWriteCore(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } Azure.ResourceManager.DevTestLabs.Models.DevTestLabPolicySetResult System.ClientModel.Primitives.IJsonModel.Create(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } void System.ClientModel.Primitives.IJsonModel.Write(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } Azure.ResourceManager.DevTestLabs.Models.DevTestLabPolicySetResult System.ClientModel.Primitives.IPersistableModel.Create(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } @@ -2289,6 +2535,7 @@ protected virtual void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer public override int GetHashCode() { throw null; } public static bool operator ==(Azure.ResourceManager.DevTestLabs.Models.DevTestLabPolicyStatus left, Azure.ResourceManager.DevTestLabs.Models.DevTestLabPolicyStatus right) { throw null; } public static implicit operator Azure.ResourceManager.DevTestLabs.Models.DevTestLabPolicyStatus (string value) { throw null; } + public static implicit operator Azure.ResourceManager.DevTestLabs.Models.DevTestLabPolicyStatus? (string value) { throw null; } public static bool operator !=(Azure.ResourceManager.DevTestLabs.Models.DevTestLabPolicyStatus left, Azure.ResourceManager.DevTestLabs.Models.DevTestLabPolicyStatus right) { throw null; } public override string ToString() { throw null; } } @@ -2297,7 +2544,10 @@ public partial class DevTestLabPolicyViolation : System.ClientModel.Primitives.I internal DevTestLabPolicyViolation() { } public string Code { get { throw null; } } public string Message { get { throw null; } } + protected virtual Azure.ResourceManager.DevTestLabs.Models.DevTestLabPolicyViolation JsonModelCreateCore(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } protected virtual void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + protected virtual Azure.ResourceManager.DevTestLabs.Models.DevTestLabPolicyViolation PersistableModelCreateCore(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + protected virtual System.BinaryData PersistableModelWriteCore(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } Azure.ResourceManager.DevTestLabs.Models.DevTestLabPolicyViolation System.ClientModel.Primitives.IJsonModel.Create(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } void System.ClientModel.Primitives.IJsonModel.Write(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } Azure.ResourceManager.DevTestLabs.Models.DevTestLabPolicyViolation System.ClientModel.Primitives.IPersistableModel.Create(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } @@ -2309,7 +2559,10 @@ public partial class DevTestLabPort : System.ClientModel.Primitives.IJsonModel.Create(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } void System.ClientModel.Primitives.IJsonModel.Write(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } Azure.ResourceManager.DevTestLabs.Models.DevTestLabPort System.ClientModel.Primitives.IPersistableModel.Create(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } @@ -2329,6 +2582,7 @@ protected virtual void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer public override int GetHashCode() { throw null; } public static bool operator ==(Azure.ResourceManager.DevTestLabs.Models.DevTestLabPremiumDataDisk left, Azure.ResourceManager.DevTestLabs.Models.DevTestLabPremiumDataDisk right) { throw null; } public static implicit operator Azure.ResourceManager.DevTestLabs.Models.DevTestLabPremiumDataDisk (string value) { throw null; } + public static implicit operator Azure.ResourceManager.DevTestLabs.Models.DevTestLabPremiumDataDisk? (string value) { throw null; } public static bool operator !=(Azure.ResourceManager.DevTestLabs.Models.DevTestLabPremiumDataDisk left, Azure.ResourceManager.DevTestLabs.Models.DevTestLabPremiumDataDisk right) { throw null; } public override string ToString() { throw null; } } @@ -2336,7 +2590,10 @@ public partial class DevTestLabRdpConnection : System.ClientModel.Primitives.IJs { internal DevTestLabRdpConnection() { } public string Contents { get { throw null; } } + protected virtual Azure.ResourceManager.DevTestLabs.Models.DevTestLabRdpConnection JsonModelCreateCore(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } protected virtual void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + protected virtual Azure.ResourceManager.DevTestLabs.Models.DevTestLabRdpConnection PersistableModelCreateCore(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + protected virtual System.BinaryData PersistableModelWriteCore(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } Azure.ResourceManager.DevTestLabs.Models.DevTestLabRdpConnection System.ClientModel.Primitives.IJsonModel.Create(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } void System.ClientModel.Primitives.IJsonModel.Write(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } Azure.ResourceManager.DevTestLabs.Models.DevTestLabRdpConnection System.ClientModel.Primitives.IPersistableModel.Create(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } @@ -2356,6 +2613,7 @@ protected virtual void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer public override int GetHashCode() { throw null; } public static bool operator ==(Azure.ResourceManager.DevTestLabs.Models.DevTestLabReportingCycleType left, Azure.ResourceManager.DevTestLabs.Models.DevTestLabReportingCycleType right) { throw null; } public static implicit operator Azure.ResourceManager.DevTestLabs.Models.DevTestLabReportingCycleType (string value) { throw null; } + public static implicit operator Azure.ResourceManager.DevTestLabs.Models.DevTestLabReportingCycleType? (string value) { throw null; } public static bool operator !=(Azure.ResourceManager.DevTestLabs.Models.DevTestLabReportingCycleType left, Azure.ResourceManager.DevTestLabs.Models.DevTestLabReportingCycleType right) { throw null; } public override string ToString() { throw null; } } @@ -2371,7 +2629,10 @@ internal DevTestLabResourceCost() { } public string ResourceStatus { get { throw null; } } public string ResourceType { get { throw null; } } public string ResourceUniqueId { get { throw null; } } + protected virtual Azure.ResourceManager.DevTestLabs.Models.DevTestLabResourceCost JsonModelCreateCore(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } protected virtual void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + protected virtual Azure.ResourceManager.DevTestLabs.Models.DevTestLabResourceCost PersistableModelCreateCore(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + protected virtual System.BinaryData PersistableModelWriteCore(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } Azure.ResourceManager.DevTestLabs.Models.DevTestLabResourceCost System.ClientModel.Primitives.IJsonModel.Create(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } void System.ClientModel.Primitives.IJsonModel.Write(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } Azure.ResourceManager.DevTestLabs.Models.DevTestLabResourceCost System.ClientModel.Primitives.IPersistableModel.Create(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } @@ -2382,7 +2643,10 @@ public partial class DevTestLabResourcePatch : System.ClientModel.Primitives.IJs { public DevTestLabResourcePatch() { } public System.Collections.Generic.IDictionary Tags { get { throw null; } } + protected virtual Azure.ResourceManager.DevTestLabs.Models.DevTestLabResourcePatch JsonModelCreateCore(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } protected virtual void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + protected virtual Azure.ResourceManager.DevTestLabs.Models.DevTestLabResourcePatch PersistableModelCreateCore(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + protected virtual System.BinaryData PersistableModelWriteCore(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } Azure.ResourceManager.DevTestLabs.Models.DevTestLabResourcePatch System.ClientModel.Primitives.IJsonModel.Create(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } void System.ClientModel.Primitives.IJsonModel.Write(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } Azure.ResourceManager.DevTestLabs.Models.DevTestLabResourcePatch System.ClientModel.Primitives.IPersistableModel.Create(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } @@ -2403,7 +2667,10 @@ public DevTestLabScheduleCreationParameter() { } public string TaskType { get { throw null; } set { } } public string TimeZoneId { get { throw null; } set { } } public Azure.ResourceManager.DevTestLabs.Models.DevTestLabWeekDetails WeeklyRecurrence { get { throw null; } set { } } + protected virtual Azure.ResourceManager.DevTestLabs.Models.DevTestLabScheduleCreationParameter JsonModelCreateCore(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } protected virtual void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + protected virtual Azure.ResourceManager.DevTestLabs.Models.DevTestLabScheduleCreationParameter PersistableModelCreateCore(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + protected virtual System.BinaryData PersistableModelWriteCore(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } Azure.ResourceManager.DevTestLabs.Models.DevTestLabScheduleCreationParameter System.ClientModel.Primitives.IJsonModel.Create(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } void System.ClientModel.Primitives.IJsonModel.Write(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } Azure.ResourceManager.DevTestLabs.Models.DevTestLabScheduleCreationParameter System.ClientModel.Primitives.IPersistableModel.Create(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } @@ -2413,7 +2680,10 @@ protected virtual void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer public partial class DevTestLabSchedulePatch : Azure.ResourceManager.DevTestLabs.Models.DevTestLabResourcePatch, System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel { public DevTestLabSchedulePatch() { } + protected override Azure.ResourceManager.DevTestLabs.Models.DevTestLabResourcePatch JsonModelCreateCore(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } protected override void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + protected override Azure.ResourceManager.DevTestLabs.Models.DevTestLabResourcePatch PersistableModelCreateCore(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + protected override System.BinaryData PersistableModelWriteCore(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } Azure.ResourceManager.DevTestLabs.Models.DevTestLabSchedulePatch System.ClientModel.Primitives.IJsonModel.Create(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } void System.ClientModel.Primitives.IJsonModel.Write(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } Azure.ResourceManager.DevTestLabs.Models.DevTestLabSchedulePatch System.ClientModel.Primitives.IPersistableModel.Create(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } @@ -2423,7 +2693,10 @@ protected override void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter write public partial class DevTestLabSecretPatch : Azure.ResourceManager.DevTestLabs.Models.DevTestLabResourcePatch, System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel { public DevTestLabSecretPatch() { } + protected override Azure.ResourceManager.DevTestLabs.Models.DevTestLabResourcePatch JsonModelCreateCore(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } protected override void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + protected override Azure.ResourceManager.DevTestLabs.Models.DevTestLabResourcePatch PersistableModelCreateCore(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + protected override System.BinaryData PersistableModelWriteCore(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } Azure.ResourceManager.DevTestLabs.Models.DevTestLabSecretPatch System.ClientModel.Primitives.IJsonModel.Create(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } void System.ClientModel.Primitives.IJsonModel.Write(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } Azure.ResourceManager.DevTestLabs.Models.DevTestLabSecretPatch System.ClientModel.Primitives.IPersistableModel.Create(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } @@ -2433,7 +2706,10 @@ protected override void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter write public partial class DevTestLabServiceFabricPatch : Azure.ResourceManager.DevTestLabs.Models.DevTestLabResourcePatch, System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel { public DevTestLabServiceFabricPatch() { } + protected override Azure.ResourceManager.DevTestLabs.Models.DevTestLabResourcePatch JsonModelCreateCore(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } protected override void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + protected override Azure.ResourceManager.DevTestLabs.Models.DevTestLabResourcePatch PersistableModelCreateCore(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + protected override System.BinaryData PersistableModelWriteCore(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } Azure.ResourceManager.DevTestLabs.Models.DevTestLabServiceFabricPatch System.ClientModel.Primitives.IJsonModel.Create(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } void System.ClientModel.Primitives.IJsonModel.Write(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } Azure.ResourceManager.DevTestLabs.Models.DevTestLabServiceFabricPatch System.ClientModel.Primitives.IPersistableModel.Create(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } @@ -2454,6 +2730,7 @@ protected override void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter write public override int GetHashCode() { throw null; } public static bool operator ==(Azure.ResourceManager.DevTestLabs.Models.DevTestLabSourceControlType left, Azure.ResourceManager.DevTestLabs.Models.DevTestLabSourceControlType right) { throw null; } public static implicit operator Azure.ResourceManager.DevTestLabs.Models.DevTestLabSourceControlType (string value) { throw null; } + public static implicit operator Azure.ResourceManager.DevTestLabs.Models.DevTestLabSourceControlType? (string value) { throw null; } public static bool operator !=(Azure.ResourceManager.DevTestLabs.Models.DevTestLabSourceControlType left, Azure.ResourceManager.DevTestLabs.Models.DevTestLabSourceControlType right) { throw null; } public override string ToString() { throw null; } } @@ -2471,6 +2748,7 @@ protected override void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter write public override int GetHashCode() { throw null; } public static bool operator ==(Azure.ResourceManager.DevTestLabs.Models.DevTestLabStorageType left, Azure.ResourceManager.DevTestLabs.Models.DevTestLabStorageType right) { throw null; } public static implicit operator Azure.ResourceManager.DevTestLabs.Models.DevTestLabStorageType (string value) { throw null; } + public static implicit operator Azure.ResourceManager.DevTestLabs.Models.DevTestLabStorageType? (string value) { throw null; } public static bool operator !=(Azure.ResourceManager.DevTestLabs.Models.DevTestLabStorageType left, Azure.ResourceManager.DevTestLabs.Models.DevTestLabStorageType right) { throw null; } public override string ToString() { throw null; } } @@ -2480,7 +2758,10 @@ public DevTestLabSubnet() { } public Azure.ResourceManager.DevTestLabs.Models.DevTestLabUsagePermissionType? AllowPublicIP { get { throw null; } set { } } public string LabSubnetName { get { throw null; } set { } } public Azure.Core.ResourceIdentifier ResourceId { get { throw null; } set { } } + protected virtual Azure.ResourceManager.DevTestLabs.Models.DevTestLabSubnet JsonModelCreateCore(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } protected virtual void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + protected virtual Azure.ResourceManager.DevTestLabs.Models.DevTestLabSubnet PersistableModelCreateCore(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + protected virtual System.BinaryData PersistableModelWriteCore(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } Azure.ResourceManager.DevTestLabs.Models.DevTestLabSubnet System.ClientModel.Primitives.IJsonModel.Create(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } void System.ClientModel.Primitives.IJsonModel.Write(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } Azure.ResourceManager.DevTestLabs.Models.DevTestLabSubnet System.ClientModel.Primitives.IPersistableModel.Create(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } @@ -2496,7 +2777,10 @@ public DevTestLabSubnetOverride() { } public Azure.ResourceManager.DevTestLabs.Models.DevTestLabUsagePermissionType? UseInVmCreationPermission { get { throw null; } set { } } public Azure.ResourceManager.DevTestLabs.Models.DevTestLabUsagePermissionType? UsePublicIPAddressPermission { get { throw null; } set { } } public string VirtualNetworkPoolName { get { throw null; } set { } } + protected virtual Azure.ResourceManager.DevTestLabs.Models.DevTestLabSubnetOverride JsonModelCreateCore(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } protected virtual void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + protected virtual Azure.ResourceManager.DevTestLabs.Models.DevTestLabSubnetOverride PersistableModelCreateCore(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + protected virtual System.BinaryData PersistableModelWriteCore(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } Azure.ResourceManager.DevTestLabs.Models.DevTestLabSubnetOverride System.ClientModel.Primitives.IJsonModel.Create(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } void System.ClientModel.Primitives.IJsonModel.Write(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } Azure.ResourceManager.DevTestLabs.Models.DevTestLabSubnetOverride System.ClientModel.Primitives.IPersistableModel.Create(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } @@ -2508,7 +2792,10 @@ public partial class DevTestLabSupport : System.ClientModel.Primitives.IJsonMode public DevTestLabSupport() { } public Azure.ResourceManager.DevTestLabs.Models.DevTestLabEnableStatus? Enabled { get { throw null; } set { } } public string Markdown { get { throw null; } set { } } + protected virtual Azure.ResourceManager.DevTestLabs.Models.DevTestLabSupport JsonModelCreateCore(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } protected virtual void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + protected virtual Azure.ResourceManager.DevTestLabs.Models.DevTestLabSupport PersistableModelCreateCore(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + protected virtual System.BinaryData PersistableModelWriteCore(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } Azure.ResourceManager.DevTestLabs.Models.DevTestLabSupport System.ClientModel.Primitives.IJsonModel.Create(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } void System.ClientModel.Primitives.IJsonModel.Write(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } Azure.ResourceManager.DevTestLabs.Models.DevTestLabSupport System.ClientModel.Primitives.IPersistableModel.Create(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } @@ -2524,7 +2811,10 @@ public DevTestLabTargetCost() { } public Azure.ResourceManager.DevTestLabs.Models.DevTestLabReportingCycleType? CycleType { get { throw null; } set { } } public Azure.ResourceManager.DevTestLabs.Models.DevTestLabTargetCostStatus? Status { get { throw null; } set { } } public int? Target { get { throw null; } set { } } + protected virtual Azure.ResourceManager.DevTestLabs.Models.DevTestLabTargetCost JsonModelCreateCore(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } protected virtual void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + protected virtual Azure.ResourceManager.DevTestLabs.Models.DevTestLabTargetCost PersistableModelCreateCore(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + protected virtual System.BinaryData PersistableModelWriteCore(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } Azure.ResourceManager.DevTestLabs.Models.DevTestLabTargetCost System.ClientModel.Primitives.IJsonModel.Create(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } void System.ClientModel.Primitives.IJsonModel.Write(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } Azure.ResourceManager.DevTestLabs.Models.DevTestLabTargetCost System.ClientModel.Primitives.IPersistableModel.Create(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } @@ -2544,6 +2834,7 @@ protected virtual void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer public override int GetHashCode() { throw null; } public static bool operator ==(Azure.ResourceManager.DevTestLabs.Models.DevTestLabTargetCostStatus left, Azure.ResourceManager.DevTestLabs.Models.DevTestLabTargetCostStatus right) { throw null; } public static implicit operator Azure.ResourceManager.DevTestLabs.Models.DevTestLabTargetCostStatus (string value) { throw null; } + public static implicit operator Azure.ResourceManager.DevTestLabs.Models.DevTestLabTargetCostStatus? (string value) { throw null; } public static bool operator !=(Azure.ResourceManager.DevTestLabs.Models.DevTestLabTargetCostStatus left, Azure.ResourceManager.DevTestLabs.Models.DevTestLabTargetCostStatus right) { throw null; } public override string ToString() { throw null; } } @@ -2560,6 +2851,7 @@ protected virtual void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer public override int GetHashCode() { throw null; } public static bool operator ==(Azure.ResourceManager.DevTestLabs.Models.DevTestLabTransportProtocol left, Azure.ResourceManager.DevTestLabs.Models.DevTestLabTransportProtocol right) { throw null; } public static implicit operator Azure.ResourceManager.DevTestLabs.Models.DevTestLabTransportProtocol (string value) { throw null; } + public static implicit operator Azure.ResourceManager.DevTestLabs.Models.DevTestLabTransportProtocol? (string value) { throw null; } public static bool operator !=(Azure.ResourceManager.DevTestLabs.Models.DevTestLabTransportProtocol left, Azure.ResourceManager.DevTestLabs.Models.DevTestLabTransportProtocol right) { throw null; } public override string ToString() { throw null; } } @@ -2577,6 +2869,7 @@ protected virtual void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer public override int GetHashCode() { throw null; } public static bool operator ==(Azure.ResourceManager.DevTestLabs.Models.DevTestLabUsagePermissionType left, Azure.ResourceManager.DevTestLabs.Models.DevTestLabUsagePermissionType right) { throw null; } public static implicit operator Azure.ResourceManager.DevTestLabs.Models.DevTestLabUsagePermissionType (string value) { throw null; } + public static implicit operator Azure.ResourceManager.DevTestLabs.Models.DevTestLabUsagePermissionType? (string value) { throw null; } public static bool operator !=(Azure.ResourceManager.DevTestLabs.Models.DevTestLabUsagePermissionType left, Azure.ResourceManager.DevTestLabs.Models.DevTestLabUsagePermissionType right) { throw null; } public override string ToString() { throw null; } } @@ -2588,7 +2881,10 @@ public DevTestLabUserIdentity() { } public string PrincipalId { get { throw null; } set { } } public string PrincipalName { get { throw null; } set { } } public System.Guid? TenantId { get { throw null; } set { } } + protected virtual Azure.ResourceManager.DevTestLabs.Models.DevTestLabUserIdentity JsonModelCreateCore(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } protected virtual void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + protected virtual Azure.ResourceManager.DevTestLabs.Models.DevTestLabUserIdentity PersistableModelCreateCore(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + protected virtual System.BinaryData PersistableModelWriteCore(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } Azure.ResourceManager.DevTestLabs.Models.DevTestLabUserIdentity System.ClientModel.Primitives.IJsonModel.Create(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } void System.ClientModel.Primitives.IJsonModel.Write(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } Azure.ResourceManager.DevTestLabs.Models.DevTestLabUserIdentity System.ClientModel.Primitives.IPersistableModel.Create(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } @@ -2598,7 +2894,10 @@ protected virtual void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer public partial class DevTestLabUserPatch : Azure.ResourceManager.DevTestLabs.Models.DevTestLabResourcePatch, System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel { public DevTestLabUserPatch() { } + protected override Azure.ResourceManager.DevTestLabs.Models.DevTestLabResourcePatch JsonModelCreateCore(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } protected override void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + protected override Azure.ResourceManager.DevTestLabs.Models.DevTestLabResourcePatch PersistableModelCreateCore(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + protected override System.BinaryData PersistableModelWriteCore(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } Azure.ResourceManager.DevTestLabs.Models.DevTestLabUserPatch System.ClientModel.Primitives.IJsonModel.Create(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } void System.ClientModel.Primitives.IJsonModel.Write(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } Azure.ResourceManager.DevTestLabs.Models.DevTestLabUserPatch System.ClientModel.Primitives.IPersistableModel.Create(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } @@ -2610,17 +2909,37 @@ public partial class DevTestLabUserSecretStore : System.ClientModel.Primitives.I public DevTestLabUserSecretStore() { } public Azure.Core.ResourceIdentifier KeyVaultId { get { throw null; } set { } } public System.Uri KeyVaultUri { get { throw null; } set { } } + protected virtual Azure.ResourceManager.DevTestLabs.Models.DevTestLabUserSecretStore JsonModelCreateCore(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } protected virtual void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + protected virtual Azure.ResourceManager.DevTestLabs.Models.DevTestLabUserSecretStore PersistableModelCreateCore(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + protected virtual System.BinaryData PersistableModelWriteCore(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } Azure.ResourceManager.DevTestLabs.Models.DevTestLabUserSecretStore System.ClientModel.Primitives.IJsonModel.Create(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } void System.ClientModel.Primitives.IJsonModel.Write(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } Azure.ResourceManager.DevTestLabs.Models.DevTestLabUserSecretStore System.ClientModel.Primitives.IPersistableModel.Create(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } string System.ClientModel.Primitives.IPersistableModel.GetFormatFromOptions(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } System.BinaryData System.ClientModel.Primitives.IPersistableModel.Write(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } } + public partial class DevTestLabVhd : System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel + { + internal DevTestLabVhd() { } + public System.Uri Id { get { throw null; } } + protected virtual Azure.ResourceManager.DevTestLabs.Models.DevTestLabVhd JsonModelCreateCore(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + protected virtual void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + protected virtual Azure.ResourceManager.DevTestLabs.Models.DevTestLabVhd PersistableModelCreateCore(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + protected virtual System.BinaryData PersistableModelWriteCore(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + Azure.ResourceManager.DevTestLabs.Models.DevTestLabVhd System.ClientModel.Primitives.IJsonModel.Create(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + void System.ClientModel.Primitives.IJsonModel.Write(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.ResourceManager.DevTestLabs.Models.DevTestLabVhd System.ClientModel.Primitives.IPersistableModel.Create(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + string System.ClientModel.Primitives.IPersistableModel.GetFormatFromOptions(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + System.BinaryData System.ClientModel.Primitives.IPersistableModel.Write(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + } public partial class DevTestLabVirtualNetworkPatch : Azure.ResourceManager.DevTestLabs.Models.DevTestLabResourcePatch, System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel { public DevTestLabVirtualNetworkPatch() { } + protected override Azure.ResourceManager.DevTestLabs.Models.DevTestLabResourcePatch JsonModelCreateCore(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } protected override void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + protected override Azure.ResourceManager.DevTestLabs.Models.DevTestLabResourcePatch PersistableModelCreateCore(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + protected override System.BinaryData PersistableModelWriteCore(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } Azure.ResourceManager.DevTestLabs.Models.DevTestLabVirtualNetworkPatch System.ClientModel.Primitives.IJsonModel.Create(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } void System.ClientModel.Primitives.IJsonModel.Write(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } Azure.ResourceManager.DevTestLabs.Models.DevTestLabVirtualNetworkPatch System.ClientModel.Primitives.IPersistableModel.Create(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } @@ -2631,7 +2950,10 @@ public partial class DevTestLabVmApplyArtifactsContent : System.ClientModel.Prim { public DevTestLabVmApplyArtifactsContent() { } public System.Collections.Generic.IList Artifacts { get { throw null; } } + protected virtual Azure.ResourceManager.DevTestLabs.Models.DevTestLabVmApplyArtifactsContent JsonModelCreateCore(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } protected virtual void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + protected virtual Azure.ResourceManager.DevTestLabs.Models.DevTestLabVmApplyArtifactsContent PersistableModelCreateCore(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + protected virtual System.BinaryData PersistableModelWriteCore(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } Azure.ResourceManager.DevTestLabs.Models.DevTestLabVmApplyArtifactsContent System.ClientModel.Primitives.IJsonModel.Create(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } void System.ClientModel.Primitives.IJsonModel.Write(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } Azure.ResourceManager.DevTestLabs.Models.DevTestLabVmApplyArtifactsContent System.ClientModel.Primitives.IPersistableModel.Create(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } @@ -2668,7 +2990,10 @@ public DevTestLabVmCreationContent() { } public string StorageType { get { throw null; } set { } } public System.Collections.Generic.IDictionary Tags { get { throw null; } } public string UserName { get { throw null; } set { } } + protected virtual Azure.ResourceManager.DevTestLabs.Models.DevTestLabVmCreationContent JsonModelCreateCore(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } protected virtual void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + protected virtual Azure.ResourceManager.DevTestLabs.Models.DevTestLabVmCreationContent PersistableModelCreateCore(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + protected virtual System.BinaryData PersistableModelWriteCore(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } Azure.ResourceManager.DevTestLabs.Models.DevTestLabVmCreationContent System.ClientModel.Primitives.IJsonModel.Create(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } void System.ClientModel.Primitives.IJsonModel.Write(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } Azure.ResourceManager.DevTestLabs.Models.DevTestLabVmCreationContent System.ClientModel.Primitives.IPersistableModel.Create(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } @@ -2689,6 +3014,7 @@ protected virtual void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer public override int GetHashCode() { throw null; } public static bool operator ==(Azure.ResourceManager.DevTestLabs.Models.DevTestLabVmCreationSource left, Azure.ResourceManager.DevTestLabs.Models.DevTestLabVmCreationSource right) { throw null; } public static implicit operator Azure.ResourceManager.DevTestLabs.Models.DevTestLabVmCreationSource (string value) { throw null; } + public static implicit operator Azure.ResourceManager.DevTestLabs.Models.DevTestLabVmCreationSource? (string value) { throw null; } public static bool operator !=(Azure.ResourceManager.DevTestLabs.Models.DevTestLabVmCreationSource left, Azure.ResourceManager.DevTestLabs.Models.DevTestLabVmCreationSource right) { throw null; } public override string ToString() { throw null; } } @@ -2696,7 +3022,10 @@ public partial class DevTestLabVmDetachDataDiskContent : System.ClientModel.Prim { public DevTestLabVmDetachDataDiskContent() { } public Azure.Core.ResourceIdentifier ExistingLabDiskId { get { throw null; } set { } } + protected virtual Azure.ResourceManager.DevTestLabs.Models.DevTestLabVmDetachDataDiskContent JsonModelCreateCore(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } protected virtual void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + protected virtual Azure.ResourceManager.DevTestLabs.Models.DevTestLabVmDetachDataDiskContent PersistableModelCreateCore(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + protected virtual System.BinaryData PersistableModelWriteCore(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } Azure.ResourceManager.DevTestLabs.Models.DevTestLabVmDetachDataDiskContent System.ClientModel.Primitives.IJsonModel.Create(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } void System.ClientModel.Primitives.IJsonModel.Write(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } Azure.ResourceManager.DevTestLabs.Models.DevTestLabVmDetachDataDiskContent System.ClientModel.Primitives.IPersistableModel.Create(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } @@ -2706,7 +3035,10 @@ protected virtual void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer public partial class DevTestLabVmPatch : Azure.ResourceManager.DevTestLabs.Models.DevTestLabResourcePatch, System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel { public DevTestLabVmPatch() { } + protected override Azure.ResourceManager.DevTestLabs.Models.DevTestLabResourcePatch JsonModelCreateCore(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } protected override void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + protected override Azure.ResourceManager.DevTestLabs.Models.DevTestLabResourcePatch PersistableModelCreateCore(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + protected override System.BinaryData PersistableModelWriteCore(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } Azure.ResourceManager.DevTestLabs.Models.DevTestLabVmPatch System.ClientModel.Primitives.IJsonModel.Create(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } void System.ClientModel.Primitives.IJsonModel.Write(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } Azure.ResourceManager.DevTestLabs.Models.DevTestLabVmPatch System.ClientModel.Primitives.IPersistableModel.Create(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } @@ -2717,7 +3049,10 @@ public partial class DevTestLabVmResizeContent : System.ClientModel.Primitives.I { public DevTestLabVmResizeContent() { } public string Size { get { throw null; } set { } } + protected virtual Azure.ResourceManager.DevTestLabs.Models.DevTestLabVmResizeContent JsonModelCreateCore(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } protected virtual void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + protected virtual Azure.ResourceManager.DevTestLabs.Models.DevTestLabVmResizeContent PersistableModelCreateCore(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + protected virtual System.BinaryData PersistableModelWriteCore(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } Azure.ResourceManager.DevTestLabs.Models.DevTestLabVmResizeContent System.ClientModel.Primitives.IJsonModel.Create(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } void System.ClientModel.Primitives.IJsonModel.Write(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } Azure.ResourceManager.DevTestLabs.Models.DevTestLabVmResizeContent System.ClientModel.Primitives.IPersistableModel.Create(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } @@ -2729,7 +3064,10 @@ public partial class DevTestLabWeekDetails : System.ClientModel.Primitives.IJson public DevTestLabWeekDetails() { } public string Time { get { throw null; } set { } } public System.Collections.Generic.IList Weekdays { get { throw null; } } + protected virtual Azure.ResourceManager.DevTestLabs.Models.DevTestLabWeekDetails JsonModelCreateCore(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } protected virtual void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + protected virtual Azure.ResourceManager.DevTestLabs.Models.DevTestLabWeekDetails PersistableModelCreateCore(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + protected virtual System.BinaryData PersistableModelWriteCore(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } Azure.ResourceManager.DevTestLabs.Models.DevTestLabWeekDetails System.ClientModel.Primitives.IJsonModel.Create(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } void System.ClientModel.Primitives.IJsonModel.Write(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } Azure.ResourceManager.DevTestLabs.Models.DevTestLabWeekDetails System.ClientModel.Primitives.IPersistableModel.Create(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } @@ -2750,6 +3088,7 @@ protected virtual void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer public override int GetHashCode() { throw null; } public static bool operator ==(Azure.ResourceManager.DevTestLabs.Models.WindowsOSState left, Azure.ResourceManager.DevTestLabs.Models.WindowsOSState right) { throw null; } public static implicit operator Azure.ResourceManager.DevTestLabs.Models.WindowsOSState (string value) { throw null; } + public static implicit operator Azure.ResourceManager.DevTestLabs.Models.WindowsOSState? (string value) { throw null; } public static bool operator !=(Azure.ResourceManager.DevTestLabs.Models.WindowsOSState left, Azure.ResourceManager.DevTestLabs.Models.WindowsOSState right) { throw null; } public override string ToString() { throw null; } } diff --git a/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/assets.json b/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/assets.json index 60a2669b5a2e..67248b0e5c7f 100644 --- a/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/assets.json +++ b/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/assets.json @@ -2,5 +2,5 @@ "AssetsRepo": "Azure/azure-sdk-assets", "AssetsRepoPrefixPath": "net", "TagPrefix": "net/devtestlabs/Azure.ResourceManager.DevTestLabs", - "Tag": "net/devtestlabs/Azure.ResourceManager.DevTestLabs_9654836287" + "Tag": "net/devtestlabs/Azure.ResourceManager.DevTestLabs_b25be363e1" } diff --git a/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/metadata.json b/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/metadata.json new file mode 100644 index 000000000000..d0859addf928 --- /dev/null +++ b/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/metadata.json @@ -0,0 +1,3 @@ +{ + "apiVersion": "2018-09-15" +} \ No newline at end of file diff --git a/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Azure.ResourceManager.DevTestLabs.csproj b/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Azure.ResourceManager.DevTestLabs.csproj index 6075f1d3148d..d34f22007f5d 100644 --- a/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Azure.ResourceManager.DevTestLabs.csproj +++ b/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Azure.ResourceManager.DevTestLabs.csproj @@ -7,6 +7,5 @@ Microsoft Azure Resource Manager client SDK for Azure resource provider Microsoft.DevTestLabs. azure;management;arm;resource manager;devtestlabs true - true diff --git a/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Customization/DevTestLabArmTemplateData.cs b/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Customization/DevTestLabArmTemplateData.cs new file mode 100644 index 000000000000..cb53c56c35b8 --- /dev/null +++ b/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Customization/DevTestLabArmTemplateData.cs @@ -0,0 +1,20 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +#nullable disable + +using Azure.Core; +using Azure.ResourceManager.Models; + +// NOTE: The following customization is intentionally retained for backward compatibility. +namespace Azure.ResourceManager.DevTestLabs +{ + public partial class DevTestLabArmTemplateData : TrackedResourceData + { + /// Initializes a new instance of . + /// The geo-location where the resource lives. + public DevTestLabArmTemplateData(AzureLocation location) : base(location) + { + } + } +} diff --git a/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Customization/DevTestLabArtifactData.cs b/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Customization/DevTestLabArtifactData.cs new file mode 100644 index 000000000000..cfa104f6ab6d --- /dev/null +++ b/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Customization/DevTestLabArtifactData.cs @@ -0,0 +1,25 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; +using Azure.Core; +using Azure.ResourceManager.DevTestLabs.Models; +using Azure.ResourceManager.Models; + +// NOTE: The following customization is intentionally retained for backward compatibility. +namespace Azure.ResourceManager.DevTestLabs +{ + public partial class DevTestLabArtifactData : TrackedResourceData + { + /// Initializes a new instance of . + /// The geo-location where the resource lives. + public DevTestLabArtifactData(AzureLocation location) : base(location) + { + } + } +} diff --git a/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Customization/DevTestLabManagedIdentity.Serialization.cs b/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Customization/DevTestLabManagedIdentity.Serialization.cs deleted file mode 100644 index 4861a99d712a..000000000000 --- a/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Customization/DevTestLabManagedIdentity.Serialization.cs +++ /dev/null @@ -1,169 +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; -using Azure.ResourceManager.Models; - -// This customization is here to override the serialization and deserialization for `ManagedIdentityType` -namespace Azure.ResourceManager.DevTestLabs.Models -{ - public partial class DevTestLabManagedIdentity : IUtf8JsonSerializable, IJsonModel - { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, new ModelReaderWriterOptions("W")); - void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) - { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; - if (format != "J") - { - throw new FormatException($"The model {nameof(DevTestLabManagedIdentity)} does not support '{format}' format."); - } - writer.WriteStartObject(); - if (Optional.IsDefined(ManagedIdentityType)) - { - writer.WritePropertyName("type"u8); - writer.WriteStringValue(ManagedIdentityType.ToString()); - } - if (Optional.IsDefined(PrincipalId)) - { - writer.WritePropertyName("principalId"u8); - writer.WriteStringValue(PrincipalId.Value); - } - if (Optional.IsDefined(TenantId)) - { - writer.WritePropertyName("tenantId"u8); - writer.WriteStringValue(TenantId.Value); - } - if (Optional.IsDefined(ClientSecretUri)) - { - writer.WritePropertyName("clientSecretUrl"u8); - writer.WriteStringValue(ClientSecretUri.AbsoluteUri); - } - if (options.Format != "W" && _serializedAdditionalRawData != null) - { - foreach (var item in _serializedAdditionalRawData) - { - writer.WritePropertyName(item.Key); -#if NET6_0_OR_GREATER - writer.WriteRawValue(item.Value); -#else - using (JsonDocument document = JsonDocument.Parse(item.Value)) - { - JsonSerializer.Serialize(writer, document.RootElement); - } -#endif - } - } - writer.WriteEndObject(); - } - - DevTestLabManagedIdentity 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(DevTestLabManagedIdentity)} does not support '{format}' format."); - } - - using JsonDocument document = JsonDocument.ParseValue(ref reader); - return DeserializeDevTestLabManagedIdentity(document.RootElement, options); - } - - internal static DevTestLabManagedIdentity DeserializeDevTestLabManagedIdentity(JsonElement element, ModelReaderWriterOptions options = null) - { - options ??= new ModelReaderWriterOptions("W"); - - if (element.ValueKind == JsonValueKind.Null) - { - return null; - } - ManagedServiceIdentityType type = default; - Guid? principalId = default; - Guid? tenantId = default; - Uri clientSecretUrl = default; - IDictionary serializedAdditionalRawData = default; - Dictionary additionalPropertiesDictionary = new Dictionary(); - foreach (var property in element.EnumerateObject()) - { - if (property.NameEquals("type"u8)) - { - if (property.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - type = new ManagedServiceIdentityType(property.Value.GetString()); - continue; - } - if (property.NameEquals("principalId"u8)) - { - if (property.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - principalId = property.Value.GetGuid(); - continue; - } - if (property.NameEquals("tenantId"u8)) - { - if (property.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - tenantId = property.Value.GetGuid(); - continue; - } - if (property.NameEquals("clientSecretUrl"u8)) - { - if (property.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - clientSecretUrl = new Uri(property.Value.GetString()); - continue; - } - if (options.Format != "W") - { - additionalPropertiesDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); - } - } - serializedAdditionalRawData = additionalPropertiesDictionary; - return new DevTestLabManagedIdentity(type, principalId, tenantId, clientSecretUrl, 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, AzureResourceManagerDevTestLabsContext.Default); - default: - throw new FormatException($"The model {nameof(DevTestLabManagedIdentity)} does not support '{options.Format}' format."); - } - } - - DevTestLabManagedIdentity IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) - { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; - - switch (format) - { - case "J": - { - using JsonDocument document = JsonDocument.Parse(data); - return DeserializeDevTestLabManagedIdentity(document.RootElement, options); - } - default: - throw new FormatException($"The model {nameof(DevTestLabManagedIdentity)} does not support '{options.Format}' format."); - } - } - - string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; - } -} diff --git a/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Customization/DevTestLabManagedIdentity.cs b/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Customization/DevTestLabManagedIdentity.cs deleted file mode 100644 index 1e86f5009337..000000000000 --- a/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Customization/DevTestLabManagedIdentity.cs +++ /dev/null @@ -1,79 +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; -using Azure.ResourceManager.Models; - -// This customization is here to override the serialization and deserialization for `ManagedIdentityType` -[assembly: CodeGenSuppressType("DevTestLabManagedIdentity")] -namespace Azure.ResourceManager.DevTestLabs.Models -{ - /// Properties of a managed identity. - public partial class DevTestLabManagedIdentity - { - /// - /// 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 DevTestLabManagedIdentity() - { - } - - /// Initializes a new instance of . - /// Managed identity. - /// The principal id of resource identity. - /// The tenant identifier of resource. - /// The client secret URL of the identity. - /// Keeps track of any properties unknown to the library. - internal DevTestLabManagedIdentity(ManagedServiceIdentityType managedIdentityType, Guid? principalId, Guid? tenantId, Uri clientSecretUri, IDictionary serializedAdditionalRawData) - { - ManagedIdentityType = managedIdentityType; - PrincipalId = principalId; - TenantId = tenantId; - ClientSecretUri = clientSecretUri; - _serializedAdditionalRawData = serializedAdditionalRawData; - } - - /// Managed identity. - public Azure.ResourceManager.Models.ManagedServiceIdentityType ManagedIdentityType { get; set; } - /// The principal id of resource identity. - public Guid? PrincipalId { get; set; } - /// The tenant identifier of resource. - public Guid? TenantId { get; set; } - /// The client secret URL of the identity. - public Uri ClientSecretUri { get; set; } - } -} diff --git a/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Customization/DevTestLabResource.cs b/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Customization/DevTestLabResource.cs new file mode 100644 index 000000000000..b42c1e23414c --- /dev/null +++ b/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Customization/DevTestLabResource.cs @@ -0,0 +1,119 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +#nullable disable + +using System; +using System.ComponentModel; +using System.Threading; +using System.Threading.Tasks; +using Azure.Core; +using Azure.ResourceManager.Resources.Models; + +// NOTE: The following customization is intentionally retained for backward compatibility. +namespace Azure.ResourceManager.DevTestLabs +{ + [Microsoft.TypeSpec.Generator.Customizations.CodeGenSuppress("GetDevTestLabPolicies")] + [Microsoft.TypeSpec.Generator.Customizations.CodeGenSuppress("GetDevTestLabPolicyAsync", typeof(string), typeof(string), typeof(CancellationToken))] + [Microsoft.TypeSpec.Generator.Customizations.CodeGenSuppress("GetDevTestLabPolicy", typeof(string), typeof(string), typeof(CancellationToken))] + public partial class DevTestLabResource : ArmResource + { + /// Gets a collection of DevTestLabPolicies in the . + /// The policySetName for the resource. + /// An object representing collection of DevTestLabPolicies and their operations over a DevTestLabPolicyResource. + public virtual DevTestLabPolicyCollection GetDevTestLabPolicies(string policySetName) + { + return this.GetCachedClient(client => new DevTestLabPolicyCollection(client, Id, policySetName)); + } + + /// Get policy. + /// The policySetName for the resource. + /// The name of the Policy. + /// Specify the $expand query. Example: 'properties($select=description)'. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public virtual async Task> GetDevTestLabPolicyAsync(string policySetName, string name, string expand = default, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(name, nameof(name)); + + return await this.GetDevTestLabPolicies(policySetName).GetAsync(name, expand, cancellationToken).ConfigureAwait(false); + } + + /// Get policy. + /// The policySetName for the resource. + /// The name of the Policy. + /// Specify the $expand query. Example: 'properties($select=description)'. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public virtual Response GetDevTestLabPolicy(string policySetName, string name, string expand = default, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(name, nameof(name)); + + return this.GetDevTestLabPolicies(policySetName).Get(name, expand, cancellationToken); + } + + /// + /// List disk images available for custom image creation. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{name}/listVhds + /// + /// + /// Operation Id + /// Labs_ListVhds + /// + /// + /// Default Api Version + /// 2018-09-15 + /// + /// + /// Resource + /// + /// + /// + /// + /// The cancellation token to use. + /// An async collection of that may take multiple service requests to iterate over. + [EditorBrowsable(EditorBrowsableState.Never)] + [Obsolete("This operation is not supported. Please use the method GetDevTestLabVhdsAsync instead.", false)] + public virtual AsyncPageable GetVhdsAsync(CancellationToken cancellationToken = default) + { + throw new NotSupportedException("This operation is not supported. Please use the method GetDevTestLabVhdsAsync instead."); + } + + /// + /// List disk images available for custom image creation. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{name}/listVhds + /// + /// + /// Operation Id + /// Labs_ListVhds + /// + /// + /// Default Api Version + /// 2018-09-15 + /// + /// + /// Resource + /// + /// + /// + /// + /// The cancellation token to use. + /// A collection of that may take multiple service requests to iterate over. + [EditorBrowsable(EditorBrowsableState.Never)] + [Obsolete("This operation is not supported. Please use the method GetDevTestLabVhds instead.", false)] + public virtual Pageable GetVhds(CancellationToken cancellationToken = default) + { + throw new NotSupportedException("This operation is not supported. Please use the method GetDevTestLabVhds instead."); + } + } +} diff --git a/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Customization/DevTestLabScheduleCollection.cs b/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Customization/DevTestLabScheduleCollection.cs new file mode 100644 index 000000000000..7490db87bb7e --- /dev/null +++ b/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Customization/DevTestLabScheduleCollection.cs @@ -0,0 +1,64 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +#nullable disable + +using System.Collections.Generic; +using System.ComponentModel; +using System.Threading; +using System.Threading.Tasks; + +// NOTE: The following customization is intentionally retained for backward compatibility. +namespace Azure.ResourceManager.DevTestLabs +{ + public partial class DevTestLabScheduleCollection : ArmCollection, IEnumerable, IAsyncEnumerable + { + /// + /// Lists all applicable schedules + /// + /// + /// Request Path. + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/schedules/{name}/listApplicable. + /// + /// + /// Operation Id. + /// Schedules_ListApplicable. + /// + /// + /// Resource. + /// . + /// + /// + /// + /// The name of the Schedule. + /// The cancellation token to use. + /// A collection of that may take multiple service requests to iterate over. + [EditorBrowsable(EditorBrowsableState.Never)] + public virtual AsyncPageable GetApplicableAsync(string name, CancellationToken cancellationToken = default) + => GetAsync(name, default, cancellationToken).Result.Value.GetApplicableAsync(cancellationToken); + + /// + /// Lists all applicable schedules + /// + /// + /// Request Path. + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/schedules/{name}/listApplicable. + /// + /// + /// Operation Id. + /// Schedules_ListApplicable. + /// + /// + /// Resource. + /// . + /// + /// + /// + /// The name of the Schedule. + /// The cancellation token to use. + /// A collection of that may take multiple service requests to iterate over. + [EditorBrowsable(EditorBrowsableState.Never)] + public virtual Pageable GetApplicable(string name, CancellationToken cancellationToken = default) + => Get(name, default, cancellationToken).Value.GetApplicable(cancellationToken); + } +} diff --git a/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Customization/DevTestLabScheduleResource.cs b/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Customization/DevTestLabScheduleResource.cs new file mode 100644 index 000000000000..5cf7f187f4d4 --- /dev/null +++ b/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Customization/DevTestLabScheduleResource.cs @@ -0,0 +1,101 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +#nullable disable + +using System; +using System.Collections.Generic; +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.DevTestLabs.Models; +using Azure.ResourceManager.Resources; + +// NOTE: The following customization is intentionally retained for backward compatibility. +namespace Azure.ResourceManager.DevTestLabs +{ + [Microsoft.TypeSpec.Generator.Customizations.CodeGenSuppress("GetApplicableAsync", typeof(CancellationToken))] + [Microsoft.TypeSpec.Generator.Customizations.CodeGenSuppress("GetApplicable", typeof(CancellationToken))] + public partial class DevTestLabScheduleResource : ArmResource + { + /// + /// Lists all applicable schedules + /// + /// + /// Request Path. + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/schedules/{name}/listApplicable. + /// + /// + /// Operation Id. + /// Schedules_ListApplicable. + /// + /// + /// Default Api Version. + /// 2018-09-15. + /// + /// + /// Resource. + /// . + /// + /// + /// + /// The cancellation token to use. + /// A collection of that may take multiple service requests to iterate over. + public virtual AsyncPageable GetApplicableAsync(CancellationToken cancellationToken = default) + { + RequestContext context = new RequestContext + { + CancellationToken = cancellationToken + }; + return new AsyncPageableWrapper(new DevTestLabSchedulesGetApplicableAsyncCollectionResultOfT( + _devTestLabSchedulesRestClient, + Id.SubscriptionId, + Id.ResourceGroupName, + Id.Parent.Name, + Id.Name, + context), data => new DevTestLabScheduleResource(Client, data)); + } + + /// + /// Lists all applicable schedules + /// + /// + /// Request Path. + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/schedules/{name}/listApplicable. + /// + /// + /// Operation Id. + /// Schedules_ListApplicable. + /// + /// + /// Default Api Version. + /// 2018-09-15. + /// + /// + /// Resource. + /// . + /// + /// + /// + /// The cancellation token to use. + /// A collection of that may take multiple service requests to iterate over. + public virtual Pageable GetApplicable(CancellationToken cancellationToken = default) + { + RequestContext context = new RequestContext + { + CancellationToken = cancellationToken + }; + return new PageableWrapper(new DevTestLabSchedulesGetApplicableCollectionResultOfT( + _devTestLabSchedulesRestClient, + Id.SubscriptionId, + Id.ResourceGroupName, + Id.Parent.Name, + Id.Name, + context), data => new DevTestLabScheduleResource(Client, data)); + } + } +} diff --git a/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Customization/DevTestLabVmScheduleResource.cs b/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Customization/DevTestLabVmScheduleResource.cs new file mode 100644 index 000000000000..3410eff13050 --- /dev/null +++ b/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Customization/DevTestLabVmScheduleResource.cs @@ -0,0 +1,25 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +#nullable disable + +using Azure.Core; + +// NOTE: The following customization is intentionally retained for backward compatibility. +namespace Azure.ResourceManager.DevTestLabs +{ + public partial class DevTestLabVmScheduleResource : ArmResource + { + /// Generate the resource identifier for this resource. + /// The subscriptionId. + /// The resourceGroupName. + /// The labName. + /// The virtualMachineName. + /// The name. + public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string labName, string vmName, string name) + { + string resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/virtualmachines/{vmName}/schedules/{name}"; + return new ResourceIdentifier(resourceId); + } + } +} diff --git a/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Customization/Models/DevTestLabManagedIdentity.cs b/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Customization/Models/DevTestLabManagedIdentity.cs new file mode 100644 index 000000000000..d885ea9ad912 --- /dev/null +++ b/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Customization/Models/DevTestLabManagedIdentity.cs @@ -0,0 +1,38 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +#nullable disable + +using System.ClientModel.Primitives; +using System.Runtime.CompilerServices; +using System.Text.Json; + +// NOTE: The following customization is intentionally retained for backward compatibility. +namespace Azure.ResourceManager.DevTestLabs.Models +{ + /// Properties of a managed identity. + [Microsoft.TypeSpec.Generator.Customizations.CodeGenSerialization(nameof(ManagedIdentityType), SerializationValueHook = nameof(SerializeTypeValue), DeserializationValueHook = nameof(DeserializeTypeValue))] + public partial class DevTestLabManagedIdentity + { + /// Managed identity. + public Azure.ResourceManager.Models.ManagedServiceIdentityType ManagedIdentityType { get; set; } + + [MethodImpl(MethodImplOptions.AggressiveInlining)] + private void SerializeTypeValue(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + // this is the logic we would like to have for the value serialization + writer.WriteStringValue(ManagedIdentityType.ToString()); + } + + [MethodImpl(MethodImplOptions.AggressiveInlining)] + private static void DeserializeTypeValue(JsonProperty property, ref Azure.ResourceManager.Models.ManagedServiceIdentityType ManagedIdentityType) + { + // this is the logic we would like to have for the value deserialization + if (property.Value.ValueKind == JsonValueKind.Null) + { + return; + } + ManagedIdentityType = new Azure.ResourceManager.Models.ManagedServiceIdentityType(property.Value.GetString()); + } + } +} diff --git a/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/ArmDevTestLabsModelFactory.cs b/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/ArmDevTestLabsModelFactory.cs index 97edfcd6beee..4fabd34c67f5 100644 --- a/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/ArmDevTestLabsModelFactory.cs +++ b/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/ArmDevTestLabsModelFactory.cs @@ -8,14 +8,524 @@ using System; using System.Collections.Generic; using System.Linq; +using Azure; using Azure.Core; +using Azure.ResourceManager.DevTestLabs; using Azure.ResourceManager.Models; namespace Azure.ResourceManager.DevTestLabs.Models { - /// Model factory for models. + /// A factory class for creating instances of the models for mocking. public static partial class ArmDevTestLabsModelFactory { + + /// Properties of a lab's announcement banner. + /// The plain text title for the lab announcement. + /// The markdown text (if any) that this lab displays in the UI. If left empty/null, nothing will be shown. + /// Is the lab announcement active/enabled at this time?. + /// The time at which the announcement expires (null for never). + /// Has this announcement expired?. + /// The provisioning status of the resource. + /// The unique immutable identifier of a resource (Guid). + /// A new instance for mocking. + public static DevTestLabAnnouncement DevTestLabAnnouncement(string title = default, string markdown = default, DevTestLabEnableStatus? enabled = default, DateTimeOffset? expireOn = default, bool? isExpired = default, string provisioningState = default, Guid? uniqueIdentifier = default) + { + return new DevTestLabAnnouncement( + title, + markdown, + enabled, + expireOn, + isExpired, + provisioningState, + uniqueIdentifier, + additionalBinaryDataProperties: null); + } + + /// A lab. + /// The tags of the resource. + /// A new instance for mocking. + public static DevTestLabPatch DevTestLabPatch(IDictionary tags = default) + { + tags ??= new ChangeTrackingDictionary(); + + return new DevTestLabPatch(tags, additionalBinaryDataProperties: null); + } + + /// Represents an update resource. + /// The tags of the resource. + /// A new instance for mocking. + public static DevTestLabResourcePatch DevTestLabResourcePatch(IDictionary tags = default) + { + tags ??= new ChangeTrackingDictionary(); + + return new DevTestLabResourcePatch(tags, additionalBinaryDataProperties: null); + } + + /// The notes of the virtual machine. + /// The object identifier of the owner of the virtual machine. + /// The user principal name of the virtual machine owner. + /// The creation date of the virtual machine. + /// The custom image identifier of the virtual machine. + /// The size of the virtual machine. + /// The user name of the virtual machine. + /// The password of the virtual machine administrator. + /// The SSH key of the virtual machine administrator. + /// Indicates whether this virtual machine uses an SSH key for authentication. + /// The lab subnet name of the virtual machine. + /// The lab virtual network identifier of the virtual machine. + /// Indicates whether the virtual machine is to be created without a public IP address. + /// The artifacts to be installed on the virtual machine. + /// The Microsoft Azure Marketplace image reference of the virtual machine. + /// The id of the plan associated with the virtual machine image. + /// The network interface properties. + /// The expiration date for VM. + /// Indicates whether another user can take ownership of the virtual machine. + /// Storage type to use for virtual machine (i.e. Standard, Premium). + /// The resource ID of the environment that contains this virtual machine, if any. + /// New or existing data disks to attach to the virtual machine after creation. + /// Virtual Machine schedules to be created. + /// The number of virtual machine instances to create. + /// The name of the virtual machine or environment. + /// The location of the new virtual machine or environment. + /// The tags of the resource. + /// A new instance for mocking. + public static DevTestLabVmCreationContent DevTestLabVmCreationContent(string notes = default, string ownerObjectId = default, string ownerUserPrincipalName = default, DateTimeOffset? createdOn = default, string customImageId = default, string size = default, string userName = default, string password = default, string sshKey = default, bool? isAuthenticationWithSshKey = default, string labSubnetName = default, ResourceIdentifier labVirtualNetworkId = default, bool? disallowPublicIPAddress = default, IEnumerable artifacts = default, DevTestLabGalleryImageReference galleryImageReference = default, string planId = default, DevTestLabNetworkInterface networkInterface = default, DateTimeOffset? expireOn = default, bool? allowClaim = default, string storageType = default, string environmentId = default, IEnumerable dataDiskParameters = default, IEnumerable scheduleParameters = default, int? bulkCreationParametersInstanceCount = default, string name = default, AzureLocation? location = default, IDictionary tags = default) + { + tags ??= new ChangeTrackingDictionary(); + + return new DevTestLabVmCreationContent(notes is null && ownerObjectId is null && ownerUserPrincipalName is null && createdOn is null && customImageId is null && size is null && userName is null && password is null && sshKey is null && isAuthenticationWithSshKey is null && labSubnetName is null && labVirtualNetworkId is null && disallowPublicIPAddress is null && artifacts is null && galleryImageReference is null && planId is null && networkInterface is null && expireOn is null && allowClaim is null && storageType is null && environmentId is null && dataDiskParameters is null && scheduleParameters is null && bulkCreationParametersInstanceCount is null ? default : new LabVirtualMachineCreationParameterProperties( + new BulkCreationParameters(bulkCreationParametersInstanceCount, null), + notes, + ownerObjectId, + ownerUserPrincipalName, + createdOn, + customImageId, + size, + userName, + password, + sshKey, + isAuthenticationWithSshKey, + labSubnetName, + labVirtualNetworkId, + disallowPublicIPAddress, + (artifacts ?? new ChangeTrackingList()).ToList(), + galleryImageReference, + planId, + networkInterface, + expireOn, + allowClaim, + storageType, + environmentId, + (dataDiskParameters ?? new ChangeTrackingList()).ToList(), + (scheduleParameters ?? new ChangeTrackingList()).ToList(), + null), name, location, tags, additionalBinaryDataProperties: null); + } + + /// Properties of an artifact. + /// The artifact's identifier. + /// The artifact's title. + /// The parameters of the artifact. + /// The status of the artifact. + /// The status message from the deployment. + /// The status message from the virtual machine extension. + /// The time that the artifact starts to install on the virtual machine. + /// A new instance for mocking. + public static DevTestLabArtifactInstallInfo DevTestLabArtifactInstallInfo(string artifactId = default, string artifactTitle = default, IEnumerable parameters = default, string status = default, string deploymentStatusMessage = default, string vmExtensionStatusMessage = default, DateTimeOffset? installOn = default) + { + parameters ??= new ChangeTrackingList(); + + return new DevTestLabArtifactInstallInfo( + artifactId, + artifactTitle, + parameters.ToList(), + status, + deploymentStatusMessage, + vmExtensionStatusMessage, + installOn, + additionalBinaryDataProperties: null); + } + + /// Properties of a weekly schedule. + /// The days of the week for which the schedule is set (e.g. Sunday, Monday, Tuesday, etc.). + /// The time of the day the schedule will occur. + /// A new instance for mocking. + public static DevTestLabWeekDetails DevTestLabWeekDetails(IEnumerable weekdays = default, string time = default) + { + weekdays ??= new ChangeTrackingList(); + + return new DevTestLabWeekDetails(weekdays.ToList(), time, additionalBinaryDataProperties: null); + } + + /// Response body for generating an upload URI. + /// The upload URI for the VHD. + /// A new instance for mocking. + public static DevTestLabGenerateUploadUriResult DevTestLabGenerateUploadUriResult(Uri uploadUri = default) + { + return new DevTestLabGenerateUploadUriResult(uploadUri, additionalBinaryDataProperties: null); + } + + /// Properties of a VHD in the lab. + /// The URI to the VHD. + /// A new instance for mocking. + public static DevTestLabVhd DevTestLabVhd(Uri id = default) + { + return new DevTestLabVhd(id, additionalBinaryDataProperties: null); + } + + /// A schedule. + /// The tags of the resource. + /// A new instance for mocking. + public static DevTestLabSchedulePatch DevTestLabSchedulePatch(IDictionary tags = default) + { + tags ??= new ChangeTrackingDictionary(); + + return new DevTestLabSchedulePatch(tags, additionalBinaryDataProperties: null); + } + + /// Properties of an artifact source. + /// The tags of the resource. + /// A new instance for mocking. + public static DevTestLabArtifactSourcePatch DevTestLabArtifactSourcePatch(IDictionary tags = default) + { + tags ??= new ChangeTrackingDictionary(); + + return new DevTestLabArtifactSourcePatch(tags, additionalBinaryDataProperties: null); + } + + /// A file containing a set of parameter values for an ARM template. + /// File name. + /// Contents of the file. + /// A new instance for mocking. + public static DevTestLabParametersValueFileInfo DevTestLabParametersValueFileInfo(string fileName = default, BinaryData parametersValueInfo = default) + { + return new DevTestLabParametersValueFileInfo(fileName, parametersValueInfo, additionalBinaryDataProperties: null); + } + + /// Parameters for generating an ARM template for deploying artifacts. + /// The resource name of the virtual machine. + /// The parameters of the ARM template. + /// The location of the virtual machine. + /// Options for uploading the files for the artifact. UploadFilesAndGenerateSasTokens is the default value. + /// A new instance for mocking. + public static DevTestLabArtifactGenerateArmTemplateContent DevTestLabArtifactGenerateArmTemplateContent(string vmName = default, IEnumerable parameters = default, AzureLocation? location = default, DevTestLabFileUploadOption? fileUploadOptions = default) + { + parameters ??= new ChangeTrackingList(); + + return new DevTestLabArtifactGenerateArmTemplateContent(vmName, parameters.ToList(), location, fileUploadOptions, additionalBinaryDataProperties: null); + } + + /// Information about a generated ARM template. + /// The template's contents. + /// The parameters of the ARM template. + /// A new instance for mocking. + public static DevTestLabArmTemplateInfo DevTestLabArmTemplateInfo(BinaryData template = default, BinaryData parameters = default) + { + return new DevTestLabArmTemplateInfo(template, parameters, additionalBinaryDataProperties: null); + } + + /// Properties of a cost target. + /// Target cost status. + /// Lab target cost. + /// Cost thresholds. + /// Reporting cycle start date. + /// Reporting cycle end date. + /// Reporting cycle type. + /// A new instance for mocking. + public static DevTestLabTargetCost DevTestLabTargetCost(DevTestLabTargetCostStatus? status = default, int? target = default, IEnumerable costThresholds = default, DateTimeOffset? cycleStartOn = default, DateTimeOffset? cycleEndOn = default, DevTestLabReportingCycleType? cycleType = default) + { + costThresholds ??= new ChangeTrackingList(); + + return new DevTestLabTargetCost( + status, + target, + costThresholds.ToList(), + cycleStartOn, + cycleEndOn, + cycleType, + additionalBinaryDataProperties: null); + } + + /// The properties of a lab cost item. + /// The date of the cost item. + /// The cost component of the cost item. + /// The type of the cost. + /// A new instance for mocking. + public static DevTestLabCostDetails DevTestLabCostDetails(DateTimeOffset? @on = default, double? cost = default, DevTestLabCostType? costType = default) + { + return new DevTestLabCostDetails(@on, cost, costType, additionalBinaryDataProperties: null); + } + + /// The properties of a resource cost item. + /// The name of the resource. + /// The unique identifier of the resource. + /// The cost component of the resource cost item. + /// The logical resource type (ex. virtualmachine, storageaccount). + /// The owner of the resource (ex. janedoe@microsoft.com). + /// The category of the resource (ex. Premium_LRS, Standard_DS1). + /// The status of the resource (ex. Active). + /// The ID of the resource. + /// The ID of the external resource. + /// A new instance for mocking. + public static DevTestLabResourceCost DevTestLabResourceCost(string resourceName = default, string resourceUniqueId = default, double? resourceCost = default, string resourceType = default, string resourceOwner = default, string resourcePricingTier = default, string resourceStatus = default, string resourceId = default, string externalResourceId = default) + { + return new DevTestLabResourceCost( + resourceName, + resourceUniqueId, + resourceCost, + resourceType, + resourceOwner, + resourcePricingTier, + resourceStatus, + resourceId, + externalResourceId, + additionalBinaryDataProperties: null); + } + + /// A custom image. + /// The tags of the resource. + /// A new instance for mocking. + public static DevTestLabCustomImagePatch DevTestLabCustomImagePatch(IDictionary tags = default) + { + tags ??= new ChangeTrackingDictionary(); + + return new DevTestLabCustomImagePatch(tags, additionalBinaryDataProperties: null); + } + + /// A formula for creating a VM, specifying an image base and other parameters. + /// The tags of the resource. + /// A new instance for mocking. + public static DevTestLabFormulaPatch DevTestLabFormulaPatch(IDictionary tags = default) + { + tags ??= new ChangeTrackingDictionary(); + + return new DevTestLabFormulaPatch(tags, additionalBinaryDataProperties: null); + } + + /// A notification. + /// The tags of the resource. + /// A new instance for mocking. + public static DevTestLabNotificationChannelPatch DevTestLabNotificationChannelPatch(IDictionary tags = default) + { + tags ??= new ChangeTrackingDictionary(); + + return new DevTestLabNotificationChannelPatch(tags, additionalBinaryDataProperties: null); + } + + /// A Policy. + /// The tags of the resource. + /// A new instance for mocking. + public static DevTestLabPolicyPatch DevTestLabPolicyPatch(IDictionary tags = default) + { + tags ??= new ChangeTrackingDictionary(); + + return new DevTestLabPolicyPatch(tags, additionalBinaryDataProperties: null); + } + + /// Request body for evaluating a policy set. + /// Policies to evaluate. + /// A new instance for mocking. + public static DevTestLabEvaluatePoliciesContent DevTestLabEvaluatePoliciesContent(IEnumerable policies = default) + { + policies ??= new ChangeTrackingList(); + + return new DevTestLabEvaluatePoliciesContent(policies.ToList(), additionalBinaryDataProperties: null); + } + + /// Response body for evaluating a policy set. + /// Results of evaluating a policy set. + /// A new instance for mocking. + public static DevTestLabEvaluatePoliciesResult DevTestLabEvaluatePoliciesResult(IEnumerable results = default) + { + results ??= new ChangeTrackingList(); + + return new DevTestLabEvaluatePoliciesResult(results.ToList(), additionalBinaryDataProperties: null); + } + + /// Result of a policy set evaluation. + /// A value indicating whether this policy set evaluation has discovered violations. + /// The list of policy violations. + /// A new instance for mocking. + public static DevTestLabPolicySetResult DevTestLabPolicySetResult(bool? hasError = default, IEnumerable policyViolations = default) + { + policyViolations ??= new ChangeTrackingList(); + + return new DevTestLabPolicySetResult(hasError, policyViolations.ToList(), additionalBinaryDataProperties: null); + } + + /// Policy violation. + /// The code of the policy violation. + /// The message of the policy violation. + /// A new instance for mocking. + public static DevTestLabPolicyViolation DevTestLabPolicyViolation(string code = default, string message = default) + { + return new DevTestLabPolicyViolation(code, message, additionalBinaryDataProperties: null); + } + + /// Profile of a lab user. + /// The tags of the resource. + /// A new instance for mocking. + public static DevTestLabUserPatch DevTestLabUserPatch(IDictionary tags = default) + { + tags ??= new ChangeTrackingDictionary(); + + return new DevTestLabUserPatch(tags, additionalBinaryDataProperties: null); + } + + /// A Disk. + /// The tags of the resource. + /// A new instance for mocking. + public static DevTestLabDiskPatch DevTestLabDiskPatch(IDictionary tags = default) + { + tags ??= new ChangeTrackingDictionary(); + + return new DevTestLabDiskPatch(tags, additionalBinaryDataProperties: null); + } + + /// Properties of an environment deployment. + /// The Azure Resource Manager template's identifier. + /// The parameters of the Azure Resource Manager template. + /// A new instance for mocking. + public static DevTestLabEnvironmentDeployment DevTestLabEnvironmentDeployment(ResourceIdentifier armTemplateId = default, IEnumerable parameters = default) + { + parameters ??= new ChangeTrackingList(); + + return new DevTestLabEnvironmentDeployment(armTemplateId, parameters.ToList(), additionalBinaryDataProperties: null); + } + + /// An environment, which is essentially an ARM template deployment. + /// The tags of the resource. + /// A new instance for mocking. + public static DevTestLabEnvironmentPatch DevTestLabEnvironmentPatch(IDictionary tags = default) + { + tags ??= new ChangeTrackingDictionary(); + + return new DevTestLabEnvironmentPatch(tags, additionalBinaryDataProperties: null); + } + + /// A secret. + /// The tags of the resource. + /// A new instance for mocking. + public static DevTestLabSecretPatch DevTestLabSecretPatch(IDictionary tags = default) + { + tags ??= new ChangeTrackingDictionary(); + + return new DevTestLabSecretPatch(tags, additionalBinaryDataProperties: null); + } + + /// A Service Fabric. + /// The tags of the resource. + /// A new instance for mocking. + public static DevTestLabServiceFabricPatch DevTestLabServiceFabricPatch(IDictionary tags = default) + { + tags ??= new ChangeTrackingDictionary(); + + return new DevTestLabServiceFabricPatch(tags, additionalBinaryDataProperties: null); + } + + /// Properties of an artifact deployment. + /// The deployment status of the artifact. + /// The total count of the artifacts that were successfully applied. + /// The total count of the artifacts that were tentatively applied. + /// A new instance for mocking. + public static DevTestLabArtifactDeploymentStatus DevTestLabArtifactDeploymentStatus(string deploymentStatus = default, int? artifactsApplied = default, int? totalArtifacts = default) + { + return new DevTestLabArtifactDeploymentStatus(deploymentStatus, artifactsApplied, totalArtifacts, additionalBinaryDataProperties: null); + } + + /// Properties of a virtual machine returned by the Microsoft.Compute API. + /// Gets the statuses of the virtual machine. + /// Gets the OS type of the virtual machine. + /// Gets the size of the virtual machine. + /// Gets the network interface ID of the virtual machine. + /// Gets OS disk blob uri for the virtual machine. + /// Gets data disks blob uri for the virtual machine. + /// Gets all data disks attached to the virtual machine. + /// A new instance for mocking. + public static ComputeVmProperties ComputeVmProperties(IEnumerable statuses = default, string osType = default, string vmSize = default, string networkInterfaceId = default, string osDiskId = default, IEnumerable dataDiskIds = default, IEnumerable dataDisks = default) + { + statuses ??= new ChangeTrackingList(); + dataDiskIds ??= new ChangeTrackingList(); + dataDisks ??= new ChangeTrackingList(); + + return new ComputeVmProperties( + statuses.ToList(), + osType, + vmSize, + networkInterfaceId, + osDiskId, + dataDiskIds.ToList(), + dataDisks.ToList(), + additionalBinaryDataProperties: null); + } + + /// Status information about a virtual machine. + /// Gets the status Code. + /// Gets the short localizable label for the status. + /// Gets the message associated with the status. + /// A new instance for mocking. + public static ComputeVmInstanceViewStatus ComputeVmInstanceViewStatus(string code = default, string displayStatus = default, string message = default) + { + return new ComputeVmInstanceViewStatus(code, displayStatus, message, additionalBinaryDataProperties: null); + } + + /// A data disks attached to a virtual machine. + /// Gets data disk name. + /// When backed by a blob, the URI of underlying blob. + /// When backed by managed disk, this is the ID of the compute disk resource. + /// Gets data disk size in GiB. + /// A new instance for mocking. + public static ComputeDataDisk ComputeDataDisk(string name = default, Uri diskUri = default, string managedDiskId = default, int? diskSizeGiB = default) + { + return new ComputeDataDisk(name, diskUri, managedDiskId, diskSizeGiB, additionalBinaryDataProperties: null); + } + + /// A virtual machine. + /// The tags of the resource. + /// A new instance for mocking. + public static DevTestLabVmPatch DevTestLabVmPatch(IDictionary tags = default) + { + tags ??= new ChangeTrackingDictionary(); + + return new DevTestLabVmPatch(tags, additionalBinaryDataProperties: null); + } + + /// Request body for applying artifacts to a virtual machine. + /// The list of artifacts to apply. + /// A new instance for mocking. + public static DevTestLabVmApplyArtifactsContent DevTestLabVmApplyArtifactsContent(IEnumerable artifacts = default) + { + artifacts ??= new ChangeTrackingList(); + + return new DevTestLabVmApplyArtifactsContent(artifacts.ToList(), additionalBinaryDataProperties: null); + } + + /// Represents a .rdp file. + /// The contents of the .rdp file. + /// A new instance for mocking. + public static DevTestLabRdpConnection DevTestLabRdpConnection(string contents = default) + { + return new DevTestLabRdpConnection(contents, additionalBinaryDataProperties: null); + } + + /// Subnet information as returned by the Microsoft.Network API. + /// Gets or sets the identifier. + /// Gets or sets the name. + /// A new instance for mocking. + public static DevTestLabExternalSubnet DevTestLabExternalSubnet(ResourceIdentifier id = default, string name = default) + { + return new DevTestLabExternalSubnet(id, name, additionalBinaryDataProperties: null); + } + + /// A virtual network. + /// The tags of the resource. + /// A new instance for mocking. + public static DevTestLabVirtualNetworkPatch DevTestLabVirtualNetworkPatch(IDictionary tags = default) + { + tags ??= new ChangeTrackingDictionary(); + + return new DevTestLabVirtualNetworkPatch(tags, additionalBinaryDataProperties: null); + } + /// Initializes a new instance of . /// The id. /// The name. @@ -34,8 +544,8 @@ public static partial class ArmDevTestLabsModelFactory /// The creation date of the lab. /// /// The setting to enable usage of premium data disks. - /// When its value is 'Enabled', creation of standard or premium data disks is allowed. - /// When its value is 'Disabled', only creation of standard data disks is allowed. + /// When its value is 'Enabled', creation of standard or premium data disks is allowed. + /// When its value is 'Disabled', only creation of standard data disks is allowed. /// /// The access rights to be granted to the user when provisioning an environment. /// The properties of any lab announcement associated with this lab. @@ -48,63 +558,22 @@ public static partial class ArmDevTestLabsModelFactory /// The provisioning status of the resource. /// The unique immutable identifier of a resource (Guid). /// A new instance for mocking. - public static DevTestLabData DevTestLabData(ResourceIdentifier id = null, string name = null, ResourceType resourceType = default, SystemData systemData = null, IDictionary tags = null, AzureLocation location = default, string defaultStorageAccount = null, string defaultPremiumStorageAccount = null, string artifactsStorageAccount = null, string premiumDataDiskStorageAccount = null, string vaultName = null, DevTestLabStorageType? labStorageType = null, IEnumerable mandatoryArtifactsResourceIdsLinux = null, IEnumerable mandatoryArtifactsResourceIdsWindows = null, DateTimeOffset? createdOn = null, DevTestLabPremiumDataDisk? premiumDataDisks = null, DevTestLabEnvironmentPermission? environmentPermission = null, DevTestLabAnnouncement announcement = null, DevTestLabSupport support = null, string vmCreationResourceGroup = null, string publicIPId = null, string loadBalancerId = null, string networkSecurityGroupId = null, IDictionary extendedProperties = null, string provisioningState = null, Guid? uniqueIdentifier = null) + public static DevTestLabData DevTestLabData(ResourceIdentifier id = default, string name = default, ResourceType resourceType = default, SystemData systemData = default, IDictionary tags = default, AzureLocation location = default, string defaultStorageAccount = default, string defaultPremiumStorageAccount = default, string artifactsStorageAccount = default, string premiumDataDiskStorageAccount = default, string vaultName = default, DevTestLabStorageType? labStorageType = default, IEnumerable mandatoryArtifactsResourceIdsLinux = default, IEnumerable mandatoryArtifactsResourceIdsWindows = default, DateTimeOffset? createdOn = default, DevTestLabPremiumDataDisk? premiumDataDisks = default, DevTestLabEnvironmentPermission? environmentPermission = default, DevTestLabAnnouncement announcement = default, DevTestLabSupport support = default, string vmCreationResourceGroup = default, string publicIPId = default, string loadBalancerId = default, string networkSecurityGroupId = default, IDictionary extendedProperties = default, string provisioningState = default, Guid? uniqueIdentifier = default) { - tags ??= new Dictionary(); - mandatoryArtifactsResourceIdsLinux ??= new List(); - mandatoryArtifactsResourceIdsWindows ??= new List(); - extendedProperties ??= new Dictionary(); + tags ??= new ChangeTrackingDictionary(); + mandatoryArtifactsResourceIdsLinux ??= new ChangeTrackingList(); + mandatoryArtifactsResourceIdsWindows ??= new ChangeTrackingList(); + extendedProperties ??= new ChangeTrackingDictionary(); return new DevTestLabData( id, name, resourceType, systemData, - tags, + additionalBinaryDataProperties: null, location, - defaultStorageAccount, - defaultPremiumStorageAccount, - artifactsStorageAccount, - premiumDataDiskStorageAccount, - vaultName, - labStorageType, - mandatoryArtifactsResourceIdsLinux?.ToList(), - mandatoryArtifactsResourceIdsWindows?.ToList(), - createdOn, - premiumDataDisks, - environmentPermission, - announcement, - support, - vmCreationResourceGroup, - publicIPId, - loadBalancerId, - networkSecurityGroupId, - extendedProperties, - provisioningState, - uniqueIdentifier, - serializedAdditionalRawData: null); - } - - /// Initializes a new instance of . - /// The plain text title for the lab announcement. - /// The markdown text (if any) that this lab displays in the UI. If left empty/null, nothing will be shown. - /// Is the lab announcement active/enabled at this time?. - /// The time at which the announcement expires (null for never). - /// Has this announcement expired?. - /// The provisioning status of the resource. - /// The unique immutable identifier of a resource (Guid). - /// A new instance for mocking. - public static DevTestLabAnnouncement DevTestLabAnnouncement(string title = null, string markdown = null, DevTestLabEnableStatus? enabled = null, DateTimeOffset? expireOn = null, bool? isExpired = null, string provisioningState = null, Guid? uniqueIdentifier = null) - { - return new DevTestLabAnnouncement( - title, - markdown, - enabled, - expireOn, - isExpired, - provisioningState, - uniqueIdentifier, - serializedAdditionalRawData: null); + default, + tags); } /// Initializes a new instance of . @@ -126,29 +595,19 @@ public static DevTestLabAnnouncement DevTestLabAnnouncement(string title = null, /// The provisioning status of the resource. /// The unique immutable identifier of a resource (Guid). /// A new instance for mocking. - public static DevTestLabScheduleData DevTestLabScheduleData(ResourceIdentifier id = null, string name = null, ResourceType resourceType = default, SystemData systemData = null, IDictionary tags = null, AzureLocation location = default, DevTestLabEnableStatus? status = null, string taskType = null, DevTestLabWeekDetails weeklyRecurrence = null, string dailyRecurrenceTime = null, int? hourlyRecurrenceMinute = null, string timeZoneId = null, DevTestLabNotificationSettings notificationSettings = null, DateTimeOffset? createdOn = null, string targetResourceId = null, string provisioningState = null, Guid? uniqueIdentifier = null) + public static DevTestLabScheduleData DevTestLabScheduleData(ResourceIdentifier id = default, string name = default, ResourceType resourceType = default, SystemData systemData = default, IDictionary tags = default, AzureLocation location = default, DevTestLabEnableStatus? status = default, string taskType = default, DevTestLabWeekDetails weeklyRecurrence = default, string dailyRecurrenceTime = default, int? hourlyRecurrenceMinute = default, string timeZoneId = default, DevTestLabNotificationSettings notificationSettings = default, DateTimeOffset? createdOn = default, string targetResourceId = default, string provisioningState = default, Guid? uniqueIdentifier = default) { - tags ??= new Dictionary(); + tags ??= new ChangeTrackingDictionary(); return new DevTestLabScheduleData( id, name, resourceType, systemData, - tags, + additionalBinaryDataProperties: null, location, - status, - taskType, - weeklyRecurrence, - dailyRecurrenceTime != null ? new DayDetails(dailyRecurrenceTime, serializedAdditionalRawData: null) : null, - hourlyRecurrenceMinute != null ? new HourDetails(hourlyRecurrenceMinute, serializedAdditionalRawData: null) : null, - timeZoneId, - notificationSettings, - createdOn, - targetResourceId, - provisioningState, - uniqueIdentifier, - serializedAdditionalRawData: null); + default, + tags); } /// Initializes a new instance of . @@ -170,29 +629,19 @@ public static DevTestLabScheduleData DevTestLabScheduleData(ResourceIdentifier i /// The provisioning status of the resource. /// The unique immutable identifier of a resource (Guid). /// A new instance for mocking. - public static DevTestLabArtifactSourceData DevTestLabArtifactSourceData(ResourceIdentifier id = null, string name = null, ResourceType resourceType = default, SystemData systemData = null, IDictionary tags = null, AzureLocation location = default, string displayName = null, Uri uri = null, DevTestLabSourceControlType? sourceType = null, string folderPath = null, string armTemplateFolderPath = null, string branchRef = null, string securityToken = null, DevTestLabEnableStatus? status = null, DateTimeOffset? createdOn = null, string provisioningState = null, Guid? uniqueIdentifier = null) + public static DevTestLabArtifactSourceData DevTestLabArtifactSourceData(ResourceIdentifier id = default, string name = default, ResourceType resourceType = default, SystemData systemData = default, IDictionary tags = default, AzureLocation location = default, string displayName = default, Uri uri = default, DevTestLabSourceControlType? sourceType = default, string folderPath = default, string armTemplateFolderPath = default, string branchRef = default, string securityToken = default, DevTestLabEnableStatus? status = default, DateTimeOffset? createdOn = default, string provisioningState = default, Guid? uniqueIdentifier = default) { - tags ??= new Dictionary(); + tags ??= new ChangeTrackingDictionary(); return new DevTestLabArtifactSourceData( id, name, resourceType, systemData, - tags, + additionalBinaryDataProperties: null, location, - displayName, - uri, - sourceType, - folderPath, - armTemplateFolderPath, - branchRef, - securityToken, - status, - createdOn, - provisioningState, - uniqueIdentifier, - serializedAdditionalRawData: null); + default, + tags); } /// Initializes a new instance of . @@ -211,36 +660,20 @@ public static DevTestLabArtifactSourceData DevTestLabArtifactSourceData(Resource /// File name and parameter values information from all azuredeploy.*.parameters.json for the ARM template. /// Whether or not ARM template is enabled for use by lab user. /// A new instance for mocking. - public static DevTestLabArmTemplateData DevTestLabArmTemplateData(ResourceIdentifier id = null, string name = null, ResourceType resourceType = default, SystemData systemData = null, IDictionary tags = null, AzureLocation location = default, string displayName = null, string description = null, string publisher = null, string icon = null, BinaryData contents = null, DateTimeOffset? createdOn = null, IEnumerable parametersValueFilesInfo = null, bool? isEnabled = null) + public static DevTestLabArmTemplateData DevTestLabArmTemplateData(ResourceIdentifier id = default, string name = default, ResourceType resourceType = default, SystemData systemData = default, IDictionary tags = default, AzureLocation location = default, string displayName = default, string description = default, string publisher = default, string icon = default, BinaryData contents = default, DateTimeOffset? createdOn = default, IEnumerable parametersValueFilesInfo = default, bool? isEnabled = default) { - tags ??= new Dictionary(); - parametersValueFilesInfo ??= new List(); + tags ??= new ChangeTrackingDictionary(); + parametersValueFilesInfo ??= new ChangeTrackingList(); return new DevTestLabArmTemplateData( id, name, resourceType, systemData, - tags, + additionalBinaryDataProperties: null, location, - displayName, - description, - publisher, - icon, - contents, - createdOn, - parametersValueFilesInfo?.ToList(), - isEnabled, - serializedAdditionalRawData: null); - } - - /// Initializes a new instance of . - /// File name. - /// Contents of the file. - /// A new instance for mocking. - public static DevTestLabParametersValueFileInfo DevTestLabParametersValueFileInfo(string fileName = null, BinaryData parametersValueInfo = null) - { - return new DevTestLabParametersValueFileInfo(fileName, parametersValueInfo, serializedAdditionalRawData: null); + default, + tags); } /// Initializes a new instance of . @@ -259,35 +692,19 @@ public static DevTestLabParametersValueFileInfo DevTestLabParametersValueFileInf /// The artifact's parameters. /// The artifact's creation date. /// A new instance for mocking. - public static DevTestLabArtifactData DevTestLabArtifactData(ResourceIdentifier id = null, string name = null, ResourceType resourceType = default, SystemData systemData = null, IDictionary tags = null, AzureLocation location = default, string title = null, string description = null, string publisher = null, string filePath = null, string icon = null, string targetOSType = null, BinaryData parameters = null, DateTimeOffset? createdOn = null) + public static DevTestLabArtifactData DevTestLabArtifactData(ResourceIdentifier id = default, string name = default, ResourceType resourceType = default, SystemData systemData = default, IDictionary tags = default, AzureLocation location = default, string title = default, string description = default, string publisher = default, string filePath = default, string icon = default, string targetOSType = default, BinaryData parameters = default, DateTimeOffset? createdOn = default) { - tags ??= new Dictionary(); + tags ??= new ChangeTrackingDictionary(); return new DevTestLabArtifactData( id, name, resourceType, systemData, - tags, + additionalBinaryDataProperties: null, location, - title, - description, - publisher, - filePath, - icon, - targetOSType, - parameters, - createdOn, - serializedAdditionalRawData: null); - } - - /// Initializes a new instance of . - /// The template's contents. - /// The parameters of the ARM template. - /// A new instance for mocking. - public static DevTestLabArmTemplateInfo DevTestLabArmTemplateInfo(BinaryData template = null, BinaryData parameters = null) - { - return new DevTestLabArmTemplateInfo(template, parameters, serializedAdditionalRawData: null); + default, + tags); } /// Initializes a new instance of . @@ -308,66 +725,21 @@ public static DevTestLabArmTemplateInfo DevTestLabArmTemplateInfo(BinaryData tem /// The provisioning status of the resource. /// The unique immutable identifier of a resource (Guid). /// A new instance for mocking. - public static DevTestLabCostData DevTestLabCostData(ResourceIdentifier id = null, string name = null, ResourceType resourceType = default, SystemData systemData = null, IDictionary tags = null, AzureLocation location = default, DevTestLabTargetCost targetCost = null, double? estimatedLabCost = null, IEnumerable labCostDetails = null, IEnumerable resourceCosts = null, string currencyCode = null, DateTimeOffset? startOn = null, DateTimeOffset? endOn = null, DateTimeOffset? createdOn = null, string provisioningState = null, Guid? uniqueIdentifier = null) + public static DevTestLabCostData DevTestLabCostData(ResourceIdentifier id = default, string name = default, ResourceType resourceType = default, SystemData systemData = default, IDictionary tags = default, AzureLocation location = default, DevTestLabTargetCost targetCost = default, double? estimatedLabCost = default, IEnumerable labCostDetails = default, IEnumerable resourceCosts = default, string currencyCode = default, DateTimeOffset? startOn = default, DateTimeOffset? endOn = default, DateTimeOffset? createdOn = default, string provisioningState = default, Guid? uniqueIdentifier = default) { - tags ??= new Dictionary(); - labCostDetails ??= new List(); - resourceCosts ??= new List(); + tags ??= new ChangeTrackingDictionary(); + labCostDetails ??= new ChangeTrackingList(); + resourceCosts ??= new ChangeTrackingList(); return new DevTestLabCostData( id, name, resourceType, systemData, - tags, + additionalBinaryDataProperties: null, location, - targetCost, - estimatedLabCost != null ? new LabCostSummaryProperties(estimatedLabCost, serializedAdditionalRawData: null) : null, - labCostDetails?.ToList(), - resourceCosts?.ToList(), - currencyCode, - startOn, - endOn, - createdOn, - provisioningState, - uniqueIdentifier, - serializedAdditionalRawData: null); - } - - /// Initializes a new instance of . - /// The date of the cost item. - /// The cost component of the cost item. - /// The type of the cost. - /// A new instance for mocking. - public static DevTestLabCostDetails DevTestLabCostDetails(DateTimeOffset? @on = null, double? cost = null, DevTestLabCostType? costType = null) - { - return new DevTestLabCostDetails(@on, cost, costType, serializedAdditionalRawData: null); - } - - /// Initializes a new instance of . - /// The name of the resource. - /// The unique identifier of the resource. - /// The cost component of the resource cost item. - /// The logical resource type (ex. virtualmachine, storageaccount). - /// The owner of the resource (ex. janedoe@microsoft.com). - /// The category of the resource (ex. Premium_LRS, Standard_DS1). - /// The status of the resource (ex. Active). - /// The ID of the resource. - /// The ID of the external resource. - /// A new instance for mocking. - public static DevTestLabResourceCost DevTestLabResourceCost(string resourceName = null, string resourceUniqueId = null, double? resourceCost = null, string resourceType = null, string resourceOwner = null, string resourcePricingTier = null, string resourceStatus = null, string resourceId = null, string externalResourceId = null) - { - return new DevTestLabResourceCost( - resourceName, - resourceUniqueId, - resourceCost, - resourceType, - resourceOwner, - resourcePricingTier, - resourceStatus, - resourceId, - externalResourceId, - serializedAdditionalRawData: null); + default, + tags); } /// Initializes a new instance of . @@ -390,31 +762,20 @@ public static DevTestLabResourceCost DevTestLabResourceCost(string resourceName /// The provisioning status of the resource. /// The unique immutable identifier of a resource (Guid). /// A new instance for mocking. - public static DevTestLabCustomImageData DevTestLabCustomImageData(ResourceIdentifier id = null, string name = null, ResourceType resourceType = default, SystemData systemData = null, IDictionary tags = null, AzureLocation location = default, DevTestLabCustomImageVm vm = null, DevTestLabCustomImageVhd vhd = null, string description = null, string author = null, DateTimeOffset? createdOn = null, string managedImageId = null, string managedSnapshotId = null, IEnumerable dataDiskStorageInfo = null, DevTestLabCustomImagePlan customImagePlan = null, bool? isPlanAuthorized = null, string provisioningState = null, Guid? uniqueIdentifier = null) + public static DevTestLabCustomImageData DevTestLabCustomImageData(ResourceIdentifier id = default, string name = default, ResourceType resourceType = default, SystemData systemData = default, IDictionary tags = default, AzureLocation location = default, DevTestLabCustomImageVm vm = default, DevTestLabCustomImageVhd vhd = default, string description = default, string author = default, DateTimeOffset? createdOn = default, string managedImageId = default, string managedSnapshotId = default, IEnumerable dataDiskStorageInfo = default, DevTestLabCustomImagePlan customImagePlan = default, bool? isPlanAuthorized = default, string provisioningState = default, Guid? uniqueIdentifier = default) { - tags ??= new Dictionary(); - dataDiskStorageInfo ??= new List(); + tags ??= new ChangeTrackingDictionary(); + dataDiskStorageInfo ??= new ChangeTrackingList(); return new DevTestLabCustomImageData( id, name, resourceType, systemData, - tags, + additionalBinaryDataProperties: null, location, - vm, - vhd, - description, - author, - createdOn, - managedImageId, - managedSnapshotId, - dataDiskStorageInfo?.ToList(), - customImagePlan, - isPlanAuthorized, - provisioningState, - uniqueIdentifier, - serializedAdditionalRawData: null); + default, + tags); } /// Initializes a new instance of . @@ -433,26 +794,19 @@ public static DevTestLabCustomImageData DevTestLabCustomImageData(ResourceIdenti /// The provisioning status of the resource. /// The unique immutable identifier of a resource (Guid). /// A new instance for mocking. - public static DevTestLabFormulaData DevTestLabFormulaData(ResourceIdentifier id = null, string name = null, ResourceType resourceType = default, SystemData systemData = null, IDictionary tags = null, AzureLocation location = default, string description = null, string author = null, string osType = null, DateTimeOffset? createdOn = null, DevTestLabVmCreationContent formulaContent = null, string labVmId = null, string provisioningState = null, Guid? uniqueIdentifier = null) + public static DevTestLabFormulaData DevTestLabFormulaData(ResourceIdentifier id = default, string name = default, ResourceType resourceType = default, SystemData systemData = default, IDictionary tags = default, AzureLocation location = default, string description = default, string author = default, string osType = default, DateTimeOffset? createdOn = default, DevTestLabVmCreationContent formulaContent = default, string labVmId = default, string provisioningState = default, Guid? uniqueIdentifier = default) { - tags ??= new Dictionary(); + tags ??= new ChangeTrackingDictionary(); return new DevTestLabFormulaData( id, name, resourceType, systemData, - tags, + additionalBinaryDataProperties: null, location, - description, - author, - osType, - createdOn, - formulaContent, - labVmId != null ? new FormulaPropertiesFromVm(labVmId, serializedAdditionalRawData: null) : null, - provisioningState, - uniqueIdentifier, - serializedAdditionalRawData: null); + default, + tags); } /// Initializes a new instance of . @@ -468,23 +822,11 @@ public static DevTestLabFormulaData DevTestLabFormulaData(ResourceIdentifier id /// Notification settings. /// The resource ID to which the schedule belongs. /// A new instance for mocking. - public static DevTestLabScheduleCreationParameter DevTestLabScheduleCreationParameter(string name = null, AzureLocation? location = null, IDictionary tags = null, DevTestLabEnableStatus? status = null, string taskType = null, DevTestLabWeekDetails weeklyRecurrence = null, string dailyRecurrenceTime = null, int? hourlyRecurrenceMinute = null, string timeZoneId = null, DevTestLabNotificationSettings notificationSettings = null, ResourceIdentifier targetResourceId = null) + public static DevTestLabScheduleCreationParameter DevTestLabScheduleCreationParameter(string name = default, AzureLocation? location = default, IDictionary tags = default, DevTestLabEnableStatus? status = default, string taskType = default, DevTestLabWeekDetails weeklyRecurrence = default, string dailyRecurrenceTime = default, int? hourlyRecurrenceMinute = default, string timeZoneId = default, DevTestLabNotificationSettings notificationSettings = default, ResourceIdentifier targetResourceId = default) { - tags ??= new Dictionary(); + tags ??= new ChangeTrackingDictionary(); - return new DevTestLabScheduleCreationParameter( - name, - location, - tags, - status, - taskType, - weeklyRecurrence, - dailyRecurrenceTime != null ? new DayDetails(dailyRecurrenceTime, serializedAdditionalRawData: null) : null, - hourlyRecurrenceMinute != null ? new HourDetails(hourlyRecurrenceMinute, serializedAdditionalRawData: null) : null, - timeZoneId, - notificationSettings, - targetResourceId, - serializedAdditionalRawData: null); + return new DevTestLabScheduleCreationParameter(default, name, location, tags, additionalBinaryDataProperties: null); } /// Initializes a new instance of . @@ -503,26 +845,19 @@ public static DevTestLabScheduleCreationParameter DevTestLabScheduleCreationPara /// The third party plan that applies to this image. /// Indicates if the plan has been authorized for programmatic deployment. /// A new instance for mocking. - public static DevTestLabGalleryImage DevTestLabGalleryImage(ResourceIdentifier id = null, string name = null, ResourceType resourceType = default, SystemData systemData = null, IDictionary tags = null, AzureLocation location = default, string author = null, DateTimeOffset? createdOn = null, string description = null, DevTestLabGalleryImageReference imageReference = null, string icon = null, bool? isEnabled = null, string planId = null, bool? isPlanAuthorized = null) + public static DevTestLabGalleryImage DevTestLabGalleryImage(ResourceIdentifier id = default, string name = default, ResourceType resourceType = default, SystemData systemData = default, IDictionary tags = default, AzureLocation location = default, string author = default, DateTimeOffset? createdOn = default, string description = default, DevTestLabGalleryImageReference imageReference = default, string icon = default, bool? isEnabled = default, string planId = default, bool? isPlanAuthorized = default) { - tags ??= new Dictionary(); + tags ??= new ChangeTrackingDictionary(); return new DevTestLabGalleryImage( id, name, resourceType, systemData, - tags, + additionalBinaryDataProperties: null, location, - author, - createdOn, - description, - imageReference, - icon, - isEnabled, - planId, - isPlanAuthorized, - serializedAdditionalRawData: null); + default, + tags); } /// Initializes a new instance of . @@ -541,57 +876,20 @@ public static DevTestLabGalleryImage DevTestLabGalleryImage(ResourceIdentifier i /// The provisioning status of the resource. /// The unique immutable identifier of a resource (Guid). /// A new instance for mocking. - public static DevTestLabNotificationChannelData DevTestLabNotificationChannelData(ResourceIdentifier id = null, string name = null, ResourceType resourceType = default, SystemData systemData = null, IDictionary tags = null, AzureLocation location = default, Uri webHookUri = null, string emailRecipient = null, string notificationLocale = null, string description = null, IEnumerable events = null, DateTimeOffset? createdOn = null, string provisioningState = null, Guid? uniqueIdentifier = null) + public static DevTestLabNotificationChannelData DevTestLabNotificationChannelData(ResourceIdentifier id = default, string name = default, ResourceType resourceType = default, SystemData systemData = default, IDictionary tags = default, AzureLocation location = default, Uri webHookUri = default, string emailRecipient = default, string notificationLocale = default, string description = default, IEnumerable events = default, DateTimeOffset? createdOn = default, string provisioningState = default, Guid? uniqueIdentifier = default) { - tags ??= new Dictionary(); - events ??= new List(); + tags ??= new ChangeTrackingDictionary(); + events ??= new ChangeTrackingList(); return new DevTestLabNotificationChannelData( id, name, resourceType, systemData, - tags, + additionalBinaryDataProperties: null, location, - webHookUri, - emailRecipient, - notificationLocale, - description, - events?.ToList(), - createdOn, - provisioningState, - uniqueIdentifier, - serializedAdditionalRawData: null); - } - - /// Initializes a new instance of . - /// Results of evaluating a policy set. - /// A new instance for mocking. - public static DevTestLabEvaluatePoliciesResult DevTestLabEvaluatePoliciesResult(IEnumerable results = null) - { - results ??= new List(); - - return new DevTestLabEvaluatePoliciesResult(results?.ToList(), serializedAdditionalRawData: null); - } - - /// Initializes a new instance of . - /// A value indicating whether this policy set evaluation has discovered violations. - /// The list of policy violations. - /// A new instance for mocking. - public static DevTestLabPolicySetResult DevTestLabPolicySetResult(bool? hasError = null, IEnumerable policyViolations = null) - { - policyViolations ??= new List(); - - return new DevTestLabPolicySetResult(hasError, policyViolations?.ToList(), serializedAdditionalRawData: null); - } - - /// Initializes a new instance of . - /// The code of the policy violation. - /// The message of the policy violation. - /// A new instance for mocking. - public static DevTestLabPolicyViolation DevTestLabPolicyViolation(string code = null, string message = null) - { - return new DevTestLabPolicyViolation(code, message, serializedAdditionalRawData: null); + default, + tags); } /// Initializes a new instance of . @@ -611,27 +909,19 @@ public static DevTestLabPolicyViolation DevTestLabPolicyViolation(string code = /// The provisioning status of the resource. /// The unique immutable identifier of a resource (Guid). /// A new instance for mocking. - public static DevTestLabPolicyData DevTestLabPolicyData(ResourceIdentifier id = null, string name = null, ResourceType resourceType = default, SystemData systemData = null, IDictionary tags = null, AzureLocation location = default, string description = null, DevTestLabPolicyStatus? status = null, DevTestLabPolicyFactName? factName = null, string factData = null, string threshold = null, DevTestLabPolicyEvaluatorType? evaluatorType = null, DateTimeOffset? createdOn = null, string provisioningState = null, Guid? uniqueIdentifier = null) + public static DevTestLabPolicyData DevTestLabPolicyData(ResourceIdentifier id = default, string name = default, ResourceType resourceType = default, SystemData systemData = default, IDictionary tags = default, AzureLocation location = default, string description = default, DevTestLabPolicyStatus? status = default, DevTestLabPolicyFactName? factName = default, string factData = default, string threshold = default, DevTestLabPolicyEvaluatorType? evaluatorType = default, DateTimeOffset? createdOn = default, string provisioningState = default, Guid? uniqueIdentifier = default) { - tags ??= new Dictionary(); + tags ??= new ChangeTrackingDictionary(); return new DevTestLabPolicyData( id, name, resourceType, systemData, - tags, + additionalBinaryDataProperties: null, location, - description, - status, - factName, - factData, - threshold, - evaluatorType, - createdOn, - provisioningState, - uniqueIdentifier, - serializedAdditionalRawData: null); + default, + tags); } /// Initializes a new instance of . @@ -643,19 +933,19 @@ public static DevTestLabPolicyData DevTestLabPolicyData(ResourceIdentifier id = /// The location. /// The identity of the resource. /// A new instance for mocking. - public static DevTestLabServiceRunnerData DevTestLabServiceRunnerData(ResourceIdentifier id = null, string name = null, ResourceType resourceType = default, SystemData systemData = null, IDictionary tags = null, AzureLocation location = default, DevTestLabManagedIdentity identity = null) + public static DevTestLabServiceRunnerData DevTestLabServiceRunnerData(ResourceIdentifier id = default, string name = default, ResourceType resourceType = default, SystemData systemData = default, IDictionary tags = default, AzureLocation location = default, DevTestLabManagedIdentity identity = default) { - tags ??= new Dictionary(); + tags ??= new ChangeTrackingDictionary(); return new DevTestLabServiceRunnerData( id, name, resourceType, systemData, - tags, + additionalBinaryDataProperties: null, location, - identity, - serializedAdditionalRawData: null); + tags, + identity); } /// Initializes a new instance of . @@ -671,23 +961,19 @@ public static DevTestLabServiceRunnerData DevTestLabServiceRunnerData(ResourceId /// The provisioning status of the resource. /// The unique immutable identifier of a resource (Guid). /// A new instance for mocking. - public static DevTestLabUserData DevTestLabUserData(ResourceIdentifier id = null, string name = null, ResourceType resourceType = default, SystemData systemData = null, IDictionary tags = null, AzureLocation location = default, DevTestLabUserIdentity identity = null, DevTestLabUserSecretStore secretStore = null, DateTimeOffset? createdOn = null, string provisioningState = null, Guid? uniqueIdentifier = null) + public static DevTestLabUserData DevTestLabUserData(ResourceIdentifier id = default, string name = default, ResourceType resourceType = default, SystemData systemData = default, IDictionary tags = default, AzureLocation location = default, DevTestLabUserIdentity identity = default, DevTestLabUserSecretStore secretStore = default, DateTimeOffset? createdOn = default, string provisioningState = default, Guid? uniqueIdentifier = default) { - tags ??= new Dictionary(); + tags ??= new ChangeTrackingDictionary(); return new DevTestLabUserData( id, name, resourceType, systemData, - tags, + additionalBinaryDataProperties: null, location, - identity, - secretStore, - createdOn, - provisioningState, - uniqueIdentifier, - serializedAdditionalRawData: null); + default, + tags); } /// Initializes a new instance of . @@ -709,29 +995,19 @@ public static DevTestLabUserData DevTestLabUserData(ResourceIdentifier id = null /// The provisioning status of the resource. /// The unique immutable identifier of a resource (Guid). /// A new instance for mocking. - public static DevTestLabDiskData DevTestLabDiskData(ResourceIdentifier id = null, string name = null, ResourceType resourceType = default, SystemData systemData = null, IDictionary tags = null, AzureLocation location = default, DevTestLabStorageType? diskType = null, int? diskSizeGiB = null, ResourceIdentifier leasedByLabVmId = null, string diskBlobName = null, Uri diskUri = null, string storageAccountId = null, DateTimeOffset? createdOn = null, string hostCaching = null, ResourceIdentifier managedDiskId = null, string provisioningState = null, Guid? uniqueIdentifier = null) + public static DevTestLabDiskData DevTestLabDiskData(ResourceIdentifier id = default, string name = default, ResourceType resourceType = default, SystemData systemData = default, IDictionary tags = default, AzureLocation location = default, DevTestLabStorageType? diskType = default, int? diskSizeGiB = default, ResourceIdentifier leasedByLabVmId = default, string diskBlobName = default, Uri diskUri = default, string storageAccountId = default, DateTimeOffset? createdOn = default, string hostCaching = default, ResourceIdentifier managedDiskId = default, string provisioningState = default, Guid? uniqueIdentifier = default) { - tags ??= new Dictionary(); + tags ??= new ChangeTrackingDictionary(); return new DevTestLabDiskData( id, name, resourceType, systemData, - tags, + additionalBinaryDataProperties: null, location, - diskType, - diskSizeGiB, - leasedByLabVmId, - diskBlobName, - diskUri, - storageAccountId, - createdOn, - hostCaching, - managedDiskId, - provisioningState, - uniqueIdentifier, - serializedAdditionalRawData: null); + default, + tags); } /// Initializes a new instance of . @@ -748,24 +1024,19 @@ public static DevTestLabDiskData DevTestLabDiskData(ResourceIdentifier id = null /// The provisioning status of the resource. /// The unique immutable identifier of a resource (Guid). /// A new instance for mocking. - public static DevTestLabEnvironmentData DevTestLabEnvironmentData(ResourceIdentifier id = null, string name = null, ResourceType resourceType = default, SystemData systemData = null, IDictionary tags = null, AzureLocation location = default, DevTestLabEnvironmentDeployment deploymentProperties = null, string armTemplateDisplayName = null, string resourceGroupId = null, string createdByUser = null, string provisioningState = null, Guid? uniqueIdentifier = null) + public static DevTestLabEnvironmentData DevTestLabEnvironmentData(ResourceIdentifier id = default, string name = default, ResourceType resourceType = default, SystemData systemData = default, IDictionary tags = default, AzureLocation location = default, DevTestLabEnvironmentDeployment deploymentProperties = default, string armTemplateDisplayName = default, string resourceGroupId = default, string createdByUser = default, string provisioningState = default, Guid? uniqueIdentifier = default) { - tags ??= new Dictionary(); + tags ??= new ChangeTrackingDictionary(); return new DevTestLabEnvironmentData( id, name, resourceType, systemData, - tags, + additionalBinaryDataProperties: null, location, - deploymentProperties, - armTemplateDisplayName, - resourceGroupId, - createdByUser, - provisioningState, - uniqueIdentifier, - serializedAdditionalRawData: null); + default, + tags); } /// Initializes a new instance of . @@ -779,21 +1050,19 @@ public static DevTestLabEnvironmentData DevTestLabEnvironmentData(ResourceIdenti /// The provisioning status of the resource. /// The unique immutable identifier of a resource (Guid). /// A new instance for mocking. - public static DevTestLabSecretData DevTestLabSecretData(ResourceIdentifier id = null, string name = null, ResourceType resourceType = default, SystemData systemData = null, IDictionary tags = null, AzureLocation location = default, string value = null, string provisioningState = null, Guid? uniqueIdentifier = null) + public static DevTestLabSecretData DevTestLabSecretData(ResourceIdentifier id = default, string name = default, ResourceType resourceType = default, SystemData systemData = default, IDictionary tags = default, AzureLocation location = default, string value = default, string provisioningState = default, Guid? uniqueIdentifier = default) { - tags ??= new Dictionary(); + tags ??= new ChangeTrackingDictionary(); return new DevTestLabSecretData( id, name, resourceType, systemData, - tags, + additionalBinaryDataProperties: null, location, - value, - provisioningState, - uniqueIdentifier, - serializedAdditionalRawData: null); + default, + tags); } /// Initializes a new instance of . @@ -809,23 +1078,19 @@ public static DevTestLabSecretData DevTestLabSecretData(ResourceIdentifier id = /// The provisioning status of the resource. /// The unique immutable identifier of a resource (Guid). /// A new instance for mocking. - public static DevTestLabServiceFabricData DevTestLabServiceFabricData(ResourceIdentifier id = null, string name = null, ResourceType resourceType = default, SystemData systemData = null, IDictionary tags = null, AzureLocation location = default, string externalServiceFabricId = null, string environmentId = null, DevTestLabApplicableSchedule applicableSchedule = null, string provisioningState = null, Guid? uniqueIdentifier = null) + public static DevTestLabServiceFabricData DevTestLabServiceFabricData(ResourceIdentifier id = default, string name = default, ResourceType resourceType = default, SystemData systemData = default, IDictionary tags = default, AzureLocation location = default, string externalServiceFabricId = default, string environmentId = default, DevTestLabApplicableSchedule applicableSchedule = default, string provisioningState = default, Guid? uniqueIdentifier = default) { - tags ??= new Dictionary(); + tags ??= new ChangeTrackingDictionary(); return new DevTestLabServiceFabricData( id, name, resourceType, systemData, - tags, + additionalBinaryDataProperties: null, location, - externalServiceFabricId, - environmentId, - applicableSchedule, - provisioningState, - uniqueIdentifier, - serializedAdditionalRawData: null); + default, + tags); } /// Initializes a new instance of . @@ -838,20 +1103,19 @@ public static DevTestLabServiceFabricData DevTestLabServiceFabricData(ResourceId /// The auto-shutdown schedule, if one has been set at the lab or lab resource level. /// The auto-startup schedule, if one has been set at the lab or lab resource level. /// A new instance for mocking. - public static DevTestLabApplicableSchedule DevTestLabApplicableSchedule(ResourceIdentifier id = null, string name = null, ResourceType resourceType = default, SystemData systemData = null, IDictionary tags = null, AzureLocation location = default, DevTestLabScheduleData labVmsShutdown = null, DevTestLabScheduleData labVmsStartup = null) + public static DevTestLabApplicableSchedule DevTestLabApplicableSchedule(ResourceIdentifier id = default, string name = default, ResourceType resourceType = default, SystemData systemData = default, IDictionary tags = default, AzureLocation location = default, DevTestLabScheduleData labVmsShutdown = default, DevTestLabScheduleData labVmsStartup = default) { - tags ??= new Dictionary(); + tags ??= new ChangeTrackingDictionary(); return new DevTestLabApplicableSchedule( id, name, resourceType, systemData, - tags, + additionalBinaryDataProperties: null, location, - labVmsShutdown, - labVmsStartup, - serializedAdditionalRawData: null); + tags, + default); } /// Initializes a new instance of . @@ -897,121 +1161,22 @@ public static DevTestLabApplicableSchedule DevTestLabApplicableSchedule(Resource /// The provisioning status of the resource. /// The unique immutable identifier of a resource (Guid). /// A new instance for mocking. - public static DevTestLabVmData DevTestLabVmData(ResourceIdentifier id = null, string name = null, ResourceType resourceType = default, SystemData systemData = null, IDictionary tags = null, AzureLocation location = default, string notes = null, string ownerObjectId = null, string ownerUserPrincipalName = null, string createdByUserId = null, string createdByUser = null, DateTimeOffset? createdOn = null, ResourceIdentifier computeId = null, string customImageId = null, string osType = null, string size = null, string userName = null, string password = null, string sshKey = null, bool? isAuthenticationWithSshKey = null, string fqdn = null, string labSubnetName = null, ResourceIdentifier labVirtualNetworkId = null, bool? disallowPublicIPAddress = null, IEnumerable artifacts = null, DevTestLabArtifactDeploymentStatus artifactDeploymentStatus = null, DevTestLabGalleryImageReference galleryImageReference = null, string planId = null, ComputeVmProperties computeVm = null, DevTestLabNetworkInterface networkInterface = null, DevTestLabApplicableSchedule applicableSchedule = null, DateTimeOffset? expireOn = null, bool? allowClaim = null, string storageType = null, DevTestLabVmCreationSource? vmCreationSource = null, ResourceIdentifier environmentId = null, IEnumerable dataDiskParameters = null, IEnumerable scheduleParameters = null, string lastKnownPowerState = null, string provisioningState = null, Guid? uniqueIdentifier = null) + public static DevTestLabVmData DevTestLabVmData(ResourceIdentifier id = default, string name = default, ResourceType resourceType = default, SystemData systemData = default, IDictionary tags = default, AzureLocation location = default, string notes = default, string ownerObjectId = default, string ownerUserPrincipalName = default, string createdByUserId = default, string createdByUser = default, DateTimeOffset? createdOn = default, ResourceIdentifier computeId = default, string customImageId = default, string osType = default, string size = default, string userName = default, string password = default, string sshKey = default, bool? isAuthenticationWithSshKey = default, string fqdn = default, string labSubnetName = default, ResourceIdentifier labVirtualNetworkId = default, bool? disallowPublicIPAddress = default, IEnumerable artifacts = default, DevTestLabArtifactDeploymentStatus artifactDeploymentStatus = default, DevTestLabGalleryImageReference galleryImageReference = default, string planId = default, ComputeVmProperties computeVm = default, DevTestLabNetworkInterface networkInterface = default, DevTestLabApplicableSchedule applicableSchedule = default, DateTimeOffset? expireOn = default, bool? allowClaim = default, string storageType = default, DevTestLabVmCreationSource? vmCreationSource = default, ResourceIdentifier environmentId = default, IEnumerable dataDiskParameters = default, IEnumerable scheduleParameters = default, string lastKnownPowerState = default, string provisioningState = default, Guid? uniqueIdentifier = default) { - tags ??= new Dictionary(); - artifacts ??= new List(); - dataDiskParameters ??= new List(); - scheduleParameters ??= new List(); + tags ??= new ChangeTrackingDictionary(); + artifacts ??= new ChangeTrackingList(); + dataDiskParameters ??= new ChangeTrackingList(); + scheduleParameters ??= new ChangeTrackingList(); return new DevTestLabVmData( id, name, resourceType, systemData, - tags, + additionalBinaryDataProperties: null, location, - notes, - ownerObjectId, - ownerUserPrincipalName, - createdByUserId, - createdByUser, - createdOn, - computeId, - customImageId, - osType, - size, - userName, - password, - sshKey, - isAuthenticationWithSshKey, - fqdn, - labSubnetName, - labVirtualNetworkId, - disallowPublicIPAddress, - artifacts?.ToList(), - artifactDeploymentStatus, - galleryImageReference, - planId, - computeVm, - networkInterface, - applicableSchedule, - expireOn, - allowClaim, - storageType, - vmCreationSource, - environmentId, - dataDiskParameters?.ToList(), - scheduleParameters?.ToList(), - lastKnownPowerState, - provisioningState, - uniqueIdentifier, - serializedAdditionalRawData: null); - } - - /// Initializes a new instance of . - /// The deployment status of the artifact. - /// The total count of the artifacts that were successfully applied. - /// The total count of the artifacts that were tentatively applied. - /// A new instance for mocking. - public static DevTestLabArtifactDeploymentStatus DevTestLabArtifactDeploymentStatus(string deploymentStatus = null, int? artifactsApplied = null, int? totalArtifacts = null) - { - return new DevTestLabArtifactDeploymentStatus(deploymentStatus, artifactsApplied, totalArtifacts, serializedAdditionalRawData: null); - } - - /// Initializes a new instance of . - /// Gets the statuses of the virtual machine. - /// Gets the OS type of the virtual machine. - /// Gets the size of the virtual machine. - /// Gets the network interface ID of the virtual machine. - /// Gets OS disk blob uri for the virtual machine. - /// Gets data disks blob uri for the virtual machine. - /// Gets all data disks attached to the virtual machine. - /// A new instance for mocking. - public static ComputeVmProperties ComputeVmProperties(IEnumerable statuses = null, string osType = null, string vmSize = null, string networkInterfaceId = null, string osDiskId = null, IEnumerable dataDiskIds = null, IEnumerable dataDisks = null) - { - statuses ??= new List(); - dataDiskIds ??= new List(); - dataDisks ??= new List(); - - return new ComputeVmProperties( - statuses?.ToList(), - osType, - vmSize, - networkInterfaceId, - osDiskId, - dataDiskIds?.ToList(), - dataDisks?.ToList(), - serializedAdditionalRawData: null); - } - - /// Initializes a new instance of . - /// Gets the status Code. - /// Gets the short localizable label for the status. - /// Gets the message associated with the status. - /// A new instance for mocking. - public static ComputeVmInstanceViewStatus ComputeVmInstanceViewStatus(string code = null, string displayStatus = null, string message = null) - { - return new ComputeVmInstanceViewStatus(code, displayStatus, message, serializedAdditionalRawData: null); - } - - /// Initializes a new instance of . - /// Gets data disk name. - /// When backed by a blob, the URI of underlying blob. - /// When backed by managed disk, this is the ID of the compute disk resource. - /// Gets data disk size in GiB. - /// A new instance for mocking. - public static ComputeDataDisk ComputeDataDisk(string name = null, Uri diskUri = null, string managedDiskId = null, int? diskSizeGiB = null) - { - return new ComputeDataDisk(name, diskUri, managedDiskId, diskSizeGiB, serializedAdditionalRawData: null); - } - - /// Initializes a new instance of . - /// The contents of the .rdp file. - /// A new instance for mocking. - public static DevTestLabRdpConnection DevTestLabRdpConnection(string contents = null) - { - return new DevTestLabRdpConnection(contents, serializedAdditionalRawData: null); + default, + tags); } /// Initializes a new instance of . @@ -1030,46 +1195,22 @@ public static DevTestLabRdpConnection DevTestLabRdpConnection(string contents = /// The provisioning status of the resource. /// The unique immutable identifier of a resource (Guid). /// A new instance for mocking. - public static DevTestLabVirtualNetworkData DevTestLabVirtualNetworkData(ResourceIdentifier id = null, string name = null, ResourceType resourceType = default, SystemData systemData = null, IDictionary tags = null, AzureLocation location = default, IEnumerable allowedSubnets = null, string description = null, string externalProviderResourceId = null, IEnumerable externalSubnets = null, IEnumerable subnetOverrides = null, DateTimeOffset? createdOn = null, string provisioningState = null, Guid? uniqueIdentifier = null) + public static DevTestLabVirtualNetworkData DevTestLabVirtualNetworkData(ResourceIdentifier id = default, string name = default, ResourceType resourceType = default, SystemData systemData = default, IDictionary tags = default, AzureLocation location = default, IEnumerable allowedSubnets = default, string description = default, string externalProviderResourceId = default, IEnumerable externalSubnets = default, IEnumerable subnetOverrides = default, DateTimeOffset? createdOn = default, string provisioningState = default, Guid? uniqueIdentifier = default) { - tags ??= new Dictionary(); - allowedSubnets ??= new List(); - externalSubnets ??= new List(); - subnetOverrides ??= new List(); + tags ??= new ChangeTrackingDictionary(); + allowedSubnets ??= new ChangeTrackingList(); + externalSubnets ??= new ChangeTrackingList(); + subnetOverrides ??= new ChangeTrackingList(); return new DevTestLabVirtualNetworkData( id, name, resourceType, systemData, - tags, + additionalBinaryDataProperties: null, location, - allowedSubnets?.ToList(), - description, - externalProviderResourceId, - externalSubnets?.ToList(), - subnetOverrides?.ToList(), - createdOn, - provisioningState, - uniqueIdentifier, - serializedAdditionalRawData: null); - } - - /// Initializes a new instance of . - /// Gets or sets the identifier. - /// Gets or sets the name. - /// A new instance for mocking. - public static DevTestLabExternalSubnet DevTestLabExternalSubnet(ResourceIdentifier id = null, string name = null) - { - return new DevTestLabExternalSubnet(id, name, serializedAdditionalRawData: null); - } - - /// Initializes a new instance of . - /// The upload URI for the VHD. - /// A new instance for mocking. - public static DevTestLabGenerateUploadUriResult DevTestLabGenerateUploadUriResult(Uri uploadUri = null) - { - return new DevTestLabGenerateUploadUriResult(uploadUri, serializedAdditionalRawData: null); + default, + tags); } } } diff --git a/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/CollectionResults/ArmTemplatesGetAllAsyncCollectionResultOfT.cs b/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/CollectionResults/ArmTemplatesGetAllAsyncCollectionResultOfT.cs new file mode 100644 index 000000000000..93f9f2f3bbf2 --- /dev/null +++ b/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/CollectionResults/ArmTemplatesGetAllAsyncCollectionResultOfT.cs @@ -0,0 +1,99 @@ +// 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.DevTestLabs.Models; + +namespace Azure.ResourceManager.DevTestLabs +{ + internal partial class ArmTemplatesGetAllAsyncCollectionResultOfT : AsyncPageable + { + private readonly ArmTemplates _client; + private readonly string _subscriptionId; + private readonly string _resourceGroupName; + private readonly string _labName; + private readonly string _artifactSourceName; + private readonly string _expand; + private readonly string _filter; + private readonly int? _top; + private readonly string _orderby; + private readonly RequestContext _context; + + /// Initializes a new instance of ArmTemplatesGetAllAsyncCollectionResultOfT, which is used to iterate over the pages of a collection. + /// The ArmTemplates 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 name of the lab. + /// The name of the artifact source. + /// Specify the $expand query. Example: 'properties($select=displayName)'. + /// The filter to apply to the operation. Example: '$filter=contains(name,'myName'). + /// The maximum number of resources to return from the operation. Example: '$top=10'. + /// The ordering expression for the results, using OData notation. Example: '$orderby=name desc'. + /// The request options, which can override default behaviors of the client pipeline on a per-call basis. + public ArmTemplatesGetAllAsyncCollectionResultOfT(ArmTemplates client, string subscriptionId, string resourceGroupName, string labName, string artifactSourceName, string expand, string filter, int? top, string @orderby, RequestContext context) : base(context?.CancellationToken ?? default) + { + _client = client; + _subscriptionId = subscriptionId; + _resourceGroupName = resourceGroupName; + _labName = labName; + _artifactSourceName = artifactSourceName; + _expand = expand; + _filter = filter; + _top = top; + _orderby = @orderby; + _context = context; + } + + /// Gets the pages of ArmTemplatesGetAllAsyncCollectionResultOfT as an enumerable collection. + /// A continuation token indicating where to resume paging. + /// The number of items per page. + /// The pages of ArmTemplatesGetAllAsyncCollectionResultOfT 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; + } + ArmTemplateList result = ArmTemplateList.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.CreateNextGetAllRequest(nextLink, _subscriptionId, _resourceGroupName, _labName, _artifactSourceName, _expand, _filter, _top, _orderby, _context) : _client.CreateGetAllRequest(_subscriptionId, _resourceGroupName, _labName, _artifactSourceName, _expand, _filter, _top, _orderby, _context); + using DiagnosticScope scope = _client.ClientDiagnostics.CreateScope("DevTestLabArmTemplateCollection.GetAll"); + scope.Start(); + try + { + return await _client.Pipeline.ProcessMessageAsync(message, _context).ConfigureAwait(false); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + } +} diff --git a/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/CollectionResults/ArmTemplatesGetAllCollectionResultOfT.cs b/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/CollectionResults/ArmTemplatesGetAllCollectionResultOfT.cs new file mode 100644 index 000000000000..ba880c44b816 --- /dev/null +++ b/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/CollectionResults/ArmTemplatesGetAllCollectionResultOfT.cs @@ -0,0 +1,98 @@ +// 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.DevTestLabs.Models; + +namespace Azure.ResourceManager.DevTestLabs +{ + internal partial class ArmTemplatesGetAllCollectionResultOfT : Pageable + { + private readonly ArmTemplates _client; + private readonly string _subscriptionId; + private readonly string _resourceGroupName; + private readonly string _labName; + private readonly string _artifactSourceName; + private readonly string _expand; + private readonly string _filter; + private readonly int? _top; + private readonly string _orderby; + private readonly RequestContext _context; + + /// Initializes a new instance of ArmTemplatesGetAllCollectionResultOfT, which is used to iterate over the pages of a collection. + /// The ArmTemplates 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 name of the lab. + /// The name of the artifact source. + /// Specify the $expand query. Example: 'properties($select=displayName)'. + /// The filter to apply to the operation. Example: '$filter=contains(name,'myName'). + /// The maximum number of resources to return from the operation. Example: '$top=10'. + /// The ordering expression for the results, using OData notation. Example: '$orderby=name desc'. + /// The request options, which can override default behaviors of the client pipeline on a per-call basis. + public ArmTemplatesGetAllCollectionResultOfT(ArmTemplates client, string subscriptionId, string resourceGroupName, string labName, string artifactSourceName, string expand, string filter, int? top, string @orderby, RequestContext context) : base(context?.CancellationToken ?? default) + { + _client = client; + _subscriptionId = subscriptionId; + _resourceGroupName = resourceGroupName; + _labName = labName; + _artifactSourceName = artifactSourceName; + _expand = expand; + _filter = filter; + _top = top; + _orderby = @orderby; + _context = context; + } + + /// Gets the pages of ArmTemplatesGetAllCollectionResultOfT as an enumerable collection. + /// A continuation token indicating where to resume paging. + /// The number of items per page. + /// The pages of ArmTemplatesGetAllCollectionResultOfT 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; + } + ArmTemplateList result = ArmTemplateList.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.CreateNextGetAllRequest(nextLink, _subscriptionId, _resourceGroupName, _labName, _artifactSourceName, _expand, _filter, _top, _orderby, _context) : _client.CreateGetAllRequest(_subscriptionId, _resourceGroupName, _labName, _artifactSourceName, _expand, _filter, _top, _orderby, _context); + using DiagnosticScope scope = _client.ClientDiagnostics.CreateScope("DevTestLabArmTemplateCollection.GetAll"); + scope.Start(); + try + { + return _client.Pipeline.ProcessMessage(message, _context); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + } +} diff --git a/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/CollectionResults/ArtifactSourcesGetAllAsyncCollectionResultOfT.cs b/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/CollectionResults/ArtifactSourcesGetAllAsyncCollectionResultOfT.cs new file mode 100644 index 000000000000..0834d4ffa15d --- /dev/null +++ b/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/CollectionResults/ArtifactSourcesGetAllAsyncCollectionResultOfT.cs @@ -0,0 +1,96 @@ +// 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.DevTestLabs.Models; + +namespace Azure.ResourceManager.DevTestLabs +{ + internal partial class ArtifactSourcesGetAllAsyncCollectionResultOfT : AsyncPageable + { + private readonly ArtifactSources _client; + private readonly string _subscriptionId; + private readonly string _resourceGroupName; + private readonly string _labName; + private readonly string _expand; + private readonly string _filter; + private readonly int? _top; + private readonly string _orderby; + private readonly RequestContext _context; + + /// Initializes a new instance of ArtifactSourcesGetAllAsyncCollectionResultOfT, which is used to iterate over the pages of a collection. + /// The ArtifactSources 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 name of the lab. + /// Specify the $expand query. Example: 'properties($select=displayName)'. + /// The filter to apply to the operation. Example: '$filter=contains(name,'myName'). + /// The maximum number of resources to return from the operation. Example: '$top=10'. + /// The ordering expression for the results, using OData notation. Example: '$orderby=name desc'. + /// The request options, which can override default behaviors of the client pipeline on a per-call basis. + public ArtifactSourcesGetAllAsyncCollectionResultOfT(ArtifactSources client, string subscriptionId, string resourceGroupName, string labName, string expand, string filter, int? top, string @orderby, RequestContext context) : base(context?.CancellationToken ?? default) + { + _client = client; + _subscriptionId = subscriptionId; + _resourceGroupName = resourceGroupName; + _labName = labName; + _expand = expand; + _filter = filter; + _top = top; + _orderby = @orderby; + _context = context; + } + + /// Gets the pages of ArtifactSourcesGetAllAsyncCollectionResultOfT as an enumerable collection. + /// A continuation token indicating where to resume paging. + /// The number of items per page. + /// The pages of ArtifactSourcesGetAllAsyncCollectionResultOfT 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; + } + ArtifactSourceList result = ArtifactSourceList.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.CreateNextGetAllRequest(nextLink, _subscriptionId, _resourceGroupName, _labName, _expand, _filter, _top, _orderby, _context) : _client.CreateGetAllRequest(_subscriptionId, _resourceGroupName, _labName, _expand, _filter, _top, _orderby, _context); + using DiagnosticScope scope = _client.ClientDiagnostics.CreateScope("DevTestLabArtifactSourceCollection.GetAll"); + scope.Start(); + try + { + return await _client.Pipeline.ProcessMessageAsync(message, _context).ConfigureAwait(false); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + } +} diff --git a/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/CollectionResults/ArtifactSourcesGetAllCollectionResultOfT.cs b/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/CollectionResults/ArtifactSourcesGetAllCollectionResultOfT.cs new file mode 100644 index 000000000000..25e2cb58b21d --- /dev/null +++ b/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/CollectionResults/ArtifactSourcesGetAllCollectionResultOfT.cs @@ -0,0 +1,95 @@ +// 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.DevTestLabs.Models; + +namespace Azure.ResourceManager.DevTestLabs +{ + internal partial class ArtifactSourcesGetAllCollectionResultOfT : Pageable + { + private readonly ArtifactSources _client; + private readonly string _subscriptionId; + private readonly string _resourceGroupName; + private readonly string _labName; + private readonly string _expand; + private readonly string _filter; + private readonly int? _top; + private readonly string _orderby; + private readonly RequestContext _context; + + /// Initializes a new instance of ArtifactSourcesGetAllCollectionResultOfT, which is used to iterate over the pages of a collection. + /// The ArtifactSources 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 name of the lab. + /// Specify the $expand query. Example: 'properties($select=displayName)'. + /// The filter to apply to the operation. Example: '$filter=contains(name,'myName'). + /// The maximum number of resources to return from the operation. Example: '$top=10'. + /// The ordering expression for the results, using OData notation. Example: '$orderby=name desc'. + /// The request options, which can override default behaviors of the client pipeline on a per-call basis. + public ArtifactSourcesGetAllCollectionResultOfT(ArtifactSources client, string subscriptionId, string resourceGroupName, string labName, string expand, string filter, int? top, string @orderby, RequestContext context) : base(context?.CancellationToken ?? default) + { + _client = client; + _subscriptionId = subscriptionId; + _resourceGroupName = resourceGroupName; + _labName = labName; + _expand = expand; + _filter = filter; + _top = top; + _orderby = @orderby; + _context = context; + } + + /// Gets the pages of ArtifactSourcesGetAllCollectionResultOfT as an enumerable collection. + /// A continuation token indicating where to resume paging. + /// The number of items per page. + /// The pages of ArtifactSourcesGetAllCollectionResultOfT 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; + } + ArtifactSourceList result = ArtifactSourceList.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.CreateNextGetAllRequest(nextLink, _subscriptionId, _resourceGroupName, _labName, _expand, _filter, _top, _orderby, _context) : _client.CreateGetAllRequest(_subscriptionId, _resourceGroupName, _labName, _expand, _filter, _top, _orderby, _context); + using DiagnosticScope scope = _client.ClientDiagnostics.CreateScope("DevTestLabArtifactSourceCollection.GetAll"); + scope.Start(); + try + { + return _client.Pipeline.ProcessMessage(message, _context); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + } +} diff --git a/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/CollectionResults/ArtifactsGetAllAsyncCollectionResultOfT.cs b/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/CollectionResults/ArtifactsGetAllAsyncCollectionResultOfT.cs new file mode 100644 index 000000000000..1c22ebb4f6ee --- /dev/null +++ b/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/CollectionResults/ArtifactsGetAllAsyncCollectionResultOfT.cs @@ -0,0 +1,99 @@ +// 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.DevTestLabs.Models; + +namespace Azure.ResourceManager.DevTestLabs +{ + internal partial class ArtifactsGetAllAsyncCollectionResultOfT : AsyncPageable + { + private readonly Artifacts _client; + private readonly string _subscriptionId; + private readonly string _resourceGroupName; + private readonly string _labName; + private readonly string _artifactSourceName; + private readonly string _expand; + private readonly string _filter; + private readonly int? _top; + private readonly string _orderby; + private readonly RequestContext _context; + + /// Initializes a new instance of ArtifactsGetAllAsyncCollectionResultOfT, which is used to iterate over the pages of a collection. + /// The Artifacts 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 name of the lab. + /// The name of the artifact source. + /// Specify the $expand query. Example: 'properties($select=title)'. + /// The filter to apply to the operation. Example: '$filter=contains(name,'myName'). + /// The maximum number of resources to return from the operation. Example: '$top=10'. + /// The ordering expression for the results, using OData notation. Example: '$orderby=name desc'. + /// The request options, which can override default behaviors of the client pipeline on a per-call basis. + public ArtifactsGetAllAsyncCollectionResultOfT(Artifacts client, string subscriptionId, string resourceGroupName, string labName, string artifactSourceName, string expand, string filter, int? top, string @orderby, RequestContext context) : base(context?.CancellationToken ?? default) + { + _client = client; + _subscriptionId = subscriptionId; + _resourceGroupName = resourceGroupName; + _labName = labName; + _artifactSourceName = artifactSourceName; + _expand = expand; + _filter = filter; + _top = top; + _orderby = @orderby; + _context = context; + } + + /// Gets the pages of ArtifactsGetAllAsyncCollectionResultOfT as an enumerable collection. + /// A continuation token indicating where to resume paging. + /// The number of items per page. + /// The pages of ArtifactsGetAllAsyncCollectionResultOfT 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; + } + ArtifactList result = ArtifactList.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.CreateNextGetAllRequest(nextLink, _subscriptionId, _resourceGroupName, _labName, _artifactSourceName, _expand, _filter, _top, _orderby, _context) : _client.CreateGetAllRequest(_subscriptionId, _resourceGroupName, _labName, _artifactSourceName, _expand, _filter, _top, _orderby, _context); + using DiagnosticScope scope = _client.ClientDiagnostics.CreateScope("DevTestLabArtifactCollection.GetAll"); + scope.Start(); + try + { + return await _client.Pipeline.ProcessMessageAsync(message, _context).ConfigureAwait(false); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + } +} diff --git a/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/CollectionResults/ArtifactsGetAllCollectionResultOfT.cs b/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/CollectionResults/ArtifactsGetAllCollectionResultOfT.cs new file mode 100644 index 000000000000..7fc7a81275ed --- /dev/null +++ b/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/CollectionResults/ArtifactsGetAllCollectionResultOfT.cs @@ -0,0 +1,98 @@ +// 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.DevTestLabs.Models; + +namespace Azure.ResourceManager.DevTestLabs +{ + internal partial class ArtifactsGetAllCollectionResultOfT : Pageable + { + private readonly Artifacts _client; + private readonly string _subscriptionId; + private readonly string _resourceGroupName; + private readonly string _labName; + private readonly string _artifactSourceName; + private readonly string _expand; + private readonly string _filter; + private readonly int? _top; + private readonly string _orderby; + private readonly RequestContext _context; + + /// Initializes a new instance of ArtifactsGetAllCollectionResultOfT, which is used to iterate over the pages of a collection. + /// The Artifacts 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 name of the lab. + /// The name of the artifact source. + /// Specify the $expand query. Example: 'properties($select=title)'. + /// The filter to apply to the operation. Example: '$filter=contains(name,'myName'). + /// The maximum number of resources to return from the operation. Example: '$top=10'. + /// The ordering expression for the results, using OData notation. Example: '$orderby=name desc'. + /// The request options, which can override default behaviors of the client pipeline on a per-call basis. + public ArtifactsGetAllCollectionResultOfT(Artifacts client, string subscriptionId, string resourceGroupName, string labName, string artifactSourceName, string expand, string filter, int? top, string @orderby, RequestContext context) : base(context?.CancellationToken ?? default) + { + _client = client; + _subscriptionId = subscriptionId; + _resourceGroupName = resourceGroupName; + _labName = labName; + _artifactSourceName = artifactSourceName; + _expand = expand; + _filter = filter; + _top = top; + _orderby = @orderby; + _context = context; + } + + /// Gets the pages of ArtifactsGetAllCollectionResultOfT as an enumerable collection. + /// A continuation token indicating where to resume paging. + /// The number of items per page. + /// The pages of ArtifactsGetAllCollectionResultOfT 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; + } + ArtifactList result = ArtifactList.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.CreateNextGetAllRequest(nextLink, _subscriptionId, _resourceGroupName, _labName, _artifactSourceName, _expand, _filter, _top, _orderby, _context) : _client.CreateGetAllRequest(_subscriptionId, _resourceGroupName, _labName, _artifactSourceName, _expand, _filter, _top, _orderby, _context); + using DiagnosticScope scope = _client.ClientDiagnostics.CreateScope("DevTestLabArtifactCollection.GetAll"); + scope.Start(); + try + { + return _client.Pipeline.ProcessMessage(message, _context); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + } +} diff --git a/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/CollectionResults/CustomImagesGetAllAsyncCollectionResultOfT.cs b/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/CollectionResults/CustomImagesGetAllAsyncCollectionResultOfT.cs new file mode 100644 index 000000000000..4bb1684c026f --- /dev/null +++ b/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/CollectionResults/CustomImagesGetAllAsyncCollectionResultOfT.cs @@ -0,0 +1,96 @@ +// 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.DevTestLabs.Models; + +namespace Azure.ResourceManager.DevTestLabs +{ + internal partial class CustomImagesGetAllAsyncCollectionResultOfT : AsyncPageable + { + private readonly CustomImages _client; + private readonly string _subscriptionId; + private readonly string _resourceGroupName; + private readonly string _labName; + private readonly string _expand; + private readonly string _filter; + private readonly int? _top; + private readonly string _orderby; + private readonly RequestContext _context; + + /// Initializes a new instance of CustomImagesGetAllAsyncCollectionResultOfT, which is used to iterate over the pages of a collection. + /// The CustomImages 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 name of the lab. + /// Specify the $expand query. Example: 'properties($select=vm)'. + /// The filter to apply to the operation. Example: '$filter=contains(name,'myName'). + /// The maximum number of resources to return from the operation. Example: '$top=10'. + /// The ordering expression for the results, using OData notation. Example: '$orderby=name desc'. + /// The request options, which can override default behaviors of the client pipeline on a per-call basis. + public CustomImagesGetAllAsyncCollectionResultOfT(CustomImages client, string subscriptionId, string resourceGroupName, string labName, string expand, string filter, int? top, string @orderby, RequestContext context) : base(context?.CancellationToken ?? default) + { + _client = client; + _subscriptionId = subscriptionId; + _resourceGroupName = resourceGroupName; + _labName = labName; + _expand = expand; + _filter = filter; + _top = top; + _orderby = @orderby; + _context = context; + } + + /// Gets the pages of CustomImagesGetAllAsyncCollectionResultOfT as an enumerable collection. + /// A continuation token indicating where to resume paging. + /// The number of items per page. + /// The pages of CustomImagesGetAllAsyncCollectionResultOfT 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; + } + CustomImageList result = CustomImageList.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.CreateNextGetAllRequest(nextLink, _subscriptionId, _resourceGroupName, _labName, _expand, _filter, _top, _orderby, _context) : _client.CreateGetAllRequest(_subscriptionId, _resourceGroupName, _labName, _expand, _filter, _top, _orderby, _context); + using DiagnosticScope scope = _client.ClientDiagnostics.CreateScope("DevTestLabCustomImageCollection.GetAll"); + scope.Start(); + try + { + return await _client.Pipeline.ProcessMessageAsync(message, _context).ConfigureAwait(false); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + } +} diff --git a/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/CollectionResults/CustomImagesGetAllCollectionResultOfT.cs b/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/CollectionResults/CustomImagesGetAllCollectionResultOfT.cs new file mode 100644 index 000000000000..8aba903d0ba6 --- /dev/null +++ b/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/CollectionResults/CustomImagesGetAllCollectionResultOfT.cs @@ -0,0 +1,95 @@ +// 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.DevTestLabs.Models; + +namespace Azure.ResourceManager.DevTestLabs +{ + internal partial class CustomImagesGetAllCollectionResultOfT : Pageable + { + private readonly CustomImages _client; + private readonly string _subscriptionId; + private readonly string _resourceGroupName; + private readonly string _labName; + private readonly string _expand; + private readonly string _filter; + private readonly int? _top; + private readonly string _orderby; + private readonly RequestContext _context; + + /// Initializes a new instance of CustomImagesGetAllCollectionResultOfT, which is used to iterate over the pages of a collection. + /// The CustomImages 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 name of the lab. + /// Specify the $expand query. Example: 'properties($select=vm)'. + /// The filter to apply to the operation. Example: '$filter=contains(name,'myName'). + /// The maximum number of resources to return from the operation. Example: '$top=10'. + /// The ordering expression for the results, using OData notation. Example: '$orderby=name desc'. + /// The request options, which can override default behaviors of the client pipeline on a per-call basis. + public CustomImagesGetAllCollectionResultOfT(CustomImages client, string subscriptionId, string resourceGroupName, string labName, string expand, string filter, int? top, string @orderby, RequestContext context) : base(context?.CancellationToken ?? default) + { + _client = client; + _subscriptionId = subscriptionId; + _resourceGroupName = resourceGroupName; + _labName = labName; + _expand = expand; + _filter = filter; + _top = top; + _orderby = @orderby; + _context = context; + } + + /// Gets the pages of CustomImagesGetAllCollectionResultOfT as an enumerable collection. + /// A continuation token indicating where to resume paging. + /// The number of items per page. + /// The pages of CustomImagesGetAllCollectionResultOfT 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; + } + CustomImageList result = CustomImageList.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.CreateNextGetAllRequest(nextLink, _subscriptionId, _resourceGroupName, _labName, _expand, _filter, _top, _orderby, _context) : _client.CreateGetAllRequest(_subscriptionId, _resourceGroupName, _labName, _expand, _filter, _top, _orderby, _context); + using DiagnosticScope scope = _client.ClientDiagnostics.CreateScope("DevTestLabCustomImageCollection.GetAll"); + scope.Start(); + try + { + return _client.Pipeline.ProcessMessage(message, _context); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + } +} diff --git a/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/CollectionResults/DevTestLabGlobalSchedulesGetByResourceGroupAsyncCollectionResultOfT.cs b/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/CollectionResults/DevTestLabGlobalSchedulesGetByResourceGroupAsyncCollectionResultOfT.cs new file mode 100644 index 000000000000..fa6f63e58d9f --- /dev/null +++ b/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/CollectionResults/DevTestLabGlobalSchedulesGetByResourceGroupAsyncCollectionResultOfT.cs @@ -0,0 +1,93 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; +using System.Threading.Tasks; +using Azure; +using Azure.Core; +using Azure.Core.Pipeline; +using Azure.ResourceManager.DevTestLabs.Models; + +namespace Azure.ResourceManager.DevTestLabs +{ + internal partial class DevTestLabGlobalSchedulesGetByResourceGroupAsyncCollectionResultOfT : AsyncPageable + { + private readonly DevTestLabGlobalSchedules _client; + private readonly string _subscriptionId; + private readonly string _resourceGroupName; + private readonly string _expand; + private readonly string _filter; + private readonly int? _top; + private readonly string _orderby; + private readonly RequestContext _context; + + /// Initializes a new instance of DevTestLabGlobalSchedulesGetByResourceGroupAsyncCollectionResultOfT, which is used to iterate over the pages of a collection. + /// The DevTestLabGlobalSchedules 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. + /// Specify the $expand query. Example: 'properties($select=status)'. + /// The filter to apply to the operation. Example: '$filter=contains(name,'myName'). + /// The maximum number of resources to return from the operation. Example: '$top=10'. + /// The ordering expression for the results, using OData notation. Example: '$orderby=name desc'. + /// The request options, which can override default behaviors of the client pipeline on a per-call basis. + public DevTestLabGlobalSchedulesGetByResourceGroupAsyncCollectionResultOfT(DevTestLabGlobalSchedules client, string subscriptionId, string resourceGroupName, string expand, string filter, int? top, string @orderby, RequestContext context) : base(context?.CancellationToken ?? default) + { + _client = client; + _subscriptionId = subscriptionId; + _resourceGroupName = resourceGroupName; + _expand = expand; + _filter = filter; + _top = top; + _orderby = @orderby; + _context = context; + } + + /// Gets the pages of DevTestLabGlobalSchedulesGetByResourceGroupAsyncCollectionResultOfT as an enumerable collection. + /// A continuation token indicating where to resume paging. + /// The number of items per page. + /// The pages of DevTestLabGlobalSchedulesGetByResourceGroupAsyncCollectionResultOfT 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; + } + ScheduleList result = ScheduleList.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, _expand, _filter, _top, _orderby, _context) : _client.CreateGetByResourceGroupRequest(_subscriptionId, _resourceGroupName, _expand, _filter, _top, _orderby, _context); + using DiagnosticScope scope = _client.ClientDiagnostics.CreateScope("DevTestLabGlobalScheduleCollection.GetAll"); + scope.Start(); + try + { + return await _client.Pipeline.ProcessMessageAsync(message, _context).ConfigureAwait(false); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + } +} diff --git a/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/CollectionResults/DevTestLabGlobalSchedulesGetByResourceGroupCollectionResultOfT.cs b/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/CollectionResults/DevTestLabGlobalSchedulesGetByResourceGroupCollectionResultOfT.cs new file mode 100644 index 000000000000..f97bda1cde1d --- /dev/null +++ b/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/CollectionResults/DevTestLabGlobalSchedulesGetByResourceGroupCollectionResultOfT.cs @@ -0,0 +1,92 @@ +// 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.DevTestLabs.Models; + +namespace Azure.ResourceManager.DevTestLabs +{ + internal partial class DevTestLabGlobalSchedulesGetByResourceGroupCollectionResultOfT : Pageable + { + private readonly DevTestLabGlobalSchedules _client; + private readonly string _subscriptionId; + private readonly string _resourceGroupName; + private readonly string _expand; + private readonly string _filter; + private readonly int? _top; + private readonly string _orderby; + private readonly RequestContext _context; + + /// Initializes a new instance of DevTestLabGlobalSchedulesGetByResourceGroupCollectionResultOfT, which is used to iterate over the pages of a collection. + /// The DevTestLabGlobalSchedules 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. + /// Specify the $expand query. Example: 'properties($select=status)'. + /// The filter to apply to the operation. Example: '$filter=contains(name,'myName'). + /// The maximum number of resources to return from the operation. Example: '$top=10'. + /// The ordering expression for the results, using OData notation. Example: '$orderby=name desc'. + /// The request options, which can override default behaviors of the client pipeline on a per-call basis. + public DevTestLabGlobalSchedulesGetByResourceGroupCollectionResultOfT(DevTestLabGlobalSchedules client, string subscriptionId, string resourceGroupName, string expand, string filter, int? top, string @orderby, RequestContext context) : base(context?.CancellationToken ?? default) + { + _client = client; + _subscriptionId = subscriptionId; + _resourceGroupName = resourceGroupName; + _expand = expand; + _filter = filter; + _top = top; + _orderby = @orderby; + _context = context; + } + + /// Gets the pages of DevTestLabGlobalSchedulesGetByResourceGroupCollectionResultOfT as an enumerable collection. + /// A continuation token indicating where to resume paging. + /// The number of items per page. + /// The pages of DevTestLabGlobalSchedulesGetByResourceGroupCollectionResultOfT 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; + } + ScheduleList result = ScheduleList.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, _expand, _filter, _top, _orderby, _context) : _client.CreateGetByResourceGroupRequest(_subscriptionId, _resourceGroupName, _expand, _filter, _top, _orderby, _context); + using DiagnosticScope scope = _client.ClientDiagnostics.CreateScope("DevTestLabGlobalScheduleCollection.GetAll"); + scope.Start(); + try + { + return _client.Pipeline.ProcessMessage(message, _context); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + } +} diff --git a/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/CollectionResults/DevTestLabGlobalSchedulesGetBySubscriptionAsyncCollectionResultOfT.cs b/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/CollectionResults/DevTestLabGlobalSchedulesGetBySubscriptionAsyncCollectionResultOfT.cs new file mode 100644 index 000000000000..38d4e2d07458 --- /dev/null +++ b/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/CollectionResults/DevTestLabGlobalSchedulesGetBySubscriptionAsyncCollectionResultOfT.cs @@ -0,0 +1,90 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; +using System.Threading.Tasks; +using Azure; +using Azure.Core; +using Azure.Core.Pipeline; +using Azure.ResourceManager.DevTestLabs.Models; + +namespace Azure.ResourceManager.DevTestLabs +{ + internal partial class DevTestLabGlobalSchedulesGetBySubscriptionAsyncCollectionResultOfT : AsyncPageable + { + private readonly DevTestLabGlobalSchedules _client; + private readonly string _subscriptionId; + private readonly string _expand; + private readonly string _filter; + private readonly int? _top; + private readonly string _orderby; + private readonly RequestContext _context; + + /// Initializes a new instance of DevTestLabGlobalSchedulesGetBySubscriptionAsyncCollectionResultOfT, which is used to iterate over the pages of a collection. + /// The DevTestLabGlobalSchedules client used to send requests. + /// The ID of the target subscription. The value must be an UUID. + /// Specify the $expand query. Example: 'properties($select=status)'. + /// The filter to apply to the operation. Example: '$filter=contains(name,'myName'). + /// The maximum number of resources to return from the operation. Example: '$top=10'. + /// The ordering expression for the results, using OData notation. Example: '$orderby=name desc'. + /// The request options, which can override default behaviors of the client pipeline on a per-call basis. + public DevTestLabGlobalSchedulesGetBySubscriptionAsyncCollectionResultOfT(DevTestLabGlobalSchedules client, string subscriptionId, string expand, string filter, int? top, string @orderby, RequestContext context) : base(context?.CancellationToken ?? default) + { + _client = client; + _subscriptionId = subscriptionId; + _expand = expand; + _filter = filter; + _top = top; + _orderby = @orderby; + _context = context; + } + + /// Gets the pages of DevTestLabGlobalSchedulesGetBySubscriptionAsyncCollectionResultOfT as an enumerable collection. + /// A continuation token indicating where to resume paging. + /// The number of items per page. + /// The pages of DevTestLabGlobalSchedulesGetBySubscriptionAsyncCollectionResultOfT 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; + } + ScheduleList result = ScheduleList.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, _expand, _filter, _top, _orderby, _context) : _client.CreateGetBySubscriptionRequest(_subscriptionId, _expand, _filter, _top, _orderby, _context); + using DiagnosticScope scope = _client.ClientDiagnostics.CreateScope("MockableDevTestLabsSubscriptionResource.GetDevTestLabGlobalSchedules"); + scope.Start(); + try + { + return await _client.Pipeline.ProcessMessageAsync(message, _context).ConfigureAwait(false); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + } +} diff --git a/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/CollectionResults/DevTestLabGlobalSchedulesGetBySubscriptionCollectionResultOfT.cs b/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/CollectionResults/DevTestLabGlobalSchedulesGetBySubscriptionCollectionResultOfT.cs new file mode 100644 index 000000000000..dbdce1fd28fb --- /dev/null +++ b/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/CollectionResults/DevTestLabGlobalSchedulesGetBySubscriptionCollectionResultOfT.cs @@ -0,0 +1,89 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; +using Azure; +using Azure.Core; +using Azure.Core.Pipeline; +using Azure.ResourceManager.DevTestLabs.Models; + +namespace Azure.ResourceManager.DevTestLabs +{ + internal partial class DevTestLabGlobalSchedulesGetBySubscriptionCollectionResultOfT : Pageable + { + private readonly DevTestLabGlobalSchedules _client; + private readonly string _subscriptionId; + private readonly string _expand; + private readonly string _filter; + private readonly int? _top; + private readonly string _orderby; + private readonly RequestContext _context; + + /// Initializes a new instance of DevTestLabGlobalSchedulesGetBySubscriptionCollectionResultOfT, which is used to iterate over the pages of a collection. + /// The DevTestLabGlobalSchedules client used to send requests. + /// The ID of the target subscription. The value must be an UUID. + /// Specify the $expand query. Example: 'properties($select=status)'. + /// The filter to apply to the operation. Example: '$filter=contains(name,'myName'). + /// The maximum number of resources to return from the operation. Example: '$top=10'. + /// The ordering expression for the results, using OData notation. Example: '$orderby=name desc'. + /// The request options, which can override default behaviors of the client pipeline on a per-call basis. + public DevTestLabGlobalSchedulesGetBySubscriptionCollectionResultOfT(DevTestLabGlobalSchedules client, string subscriptionId, string expand, string filter, int? top, string @orderby, RequestContext context) : base(context?.CancellationToken ?? default) + { + _client = client; + _subscriptionId = subscriptionId; + _expand = expand; + _filter = filter; + _top = top; + _orderby = @orderby; + _context = context; + } + + /// Gets the pages of DevTestLabGlobalSchedulesGetBySubscriptionCollectionResultOfT as an enumerable collection. + /// A continuation token indicating where to resume paging. + /// The number of items per page. + /// The pages of DevTestLabGlobalSchedulesGetBySubscriptionCollectionResultOfT 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; + } + ScheduleList result = ScheduleList.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, _expand, _filter, _top, _orderby, _context) : _client.CreateGetBySubscriptionRequest(_subscriptionId, _expand, _filter, _top, _orderby, _context); + using DiagnosticScope scope = _client.ClientDiagnostics.CreateScope("MockableDevTestLabsSubscriptionResource.GetDevTestLabGlobalSchedules"); + scope.Start(); + try + { + return _client.Pipeline.ProcessMessage(message, _context); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + } +} diff --git a/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/CollectionResults/DevTestLabSchedulesGetAllAsyncCollectionResultOfT.cs b/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/CollectionResults/DevTestLabSchedulesGetAllAsyncCollectionResultOfT.cs new file mode 100644 index 000000000000..906390cdc238 --- /dev/null +++ b/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/CollectionResults/DevTestLabSchedulesGetAllAsyncCollectionResultOfT.cs @@ -0,0 +1,96 @@ +// 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.DevTestLabs.Models; + +namespace Azure.ResourceManager.DevTestLabs +{ + internal partial class DevTestLabSchedulesGetAllAsyncCollectionResultOfT : AsyncPageable + { + private readonly DevTestLabSchedules _client; + private readonly string _subscriptionId; + private readonly string _resourceGroupName; + private readonly string _labName; + private readonly string _expand; + private readonly string _filter; + private readonly int? _top; + private readonly string _orderby; + private readonly RequestContext _context; + + /// Initializes a new instance of DevTestLabSchedulesGetAllAsyncCollectionResultOfT, which is used to iterate over the pages of a collection. + /// The DevTestLabSchedules 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. + /// labs. + /// Specify the $expand query. Example: 'properties($select=status)'. + /// The filter to apply to the operation. Example: '$filter=contains(name,'myName'). + /// The maximum number of resources to return from the operation. Example: '$top=10'. + /// The ordering expression for the results, using OData notation. Example: '$orderby=name desc'. + /// The request options, which can override default behaviors of the client pipeline on a per-call basis. + public DevTestLabSchedulesGetAllAsyncCollectionResultOfT(DevTestLabSchedules client, string subscriptionId, string resourceGroupName, string labName, string expand, string filter, int? top, string @orderby, RequestContext context) : base(context?.CancellationToken ?? default) + { + _client = client; + _subscriptionId = subscriptionId; + _resourceGroupName = resourceGroupName; + _labName = labName; + _expand = expand; + _filter = filter; + _top = top; + _orderby = @orderby; + _context = context; + } + + /// Gets the pages of DevTestLabSchedulesGetAllAsyncCollectionResultOfT as an enumerable collection. + /// A continuation token indicating where to resume paging. + /// The number of items per page. + /// The pages of DevTestLabSchedulesGetAllAsyncCollectionResultOfT 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; + } + ScheduleList result = ScheduleList.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.CreateNextGetAllRequest(nextLink, _subscriptionId, _resourceGroupName, _labName, _expand, _filter, _top, _orderby, _context) : _client.CreateGetAllRequest(_subscriptionId, _resourceGroupName, _labName, _expand, _filter, _top, _orderby, _context); + using DiagnosticScope scope = _client.ClientDiagnostics.CreateScope("DevTestLabScheduleCollection.GetAll"); + scope.Start(); + try + { + return await _client.Pipeline.ProcessMessageAsync(message, _context).ConfigureAwait(false); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + } +} diff --git a/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/CollectionResults/DevTestLabSchedulesGetAllCollectionResultOfT.cs b/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/CollectionResults/DevTestLabSchedulesGetAllCollectionResultOfT.cs new file mode 100644 index 000000000000..6d96bdfb3d30 --- /dev/null +++ b/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/CollectionResults/DevTestLabSchedulesGetAllCollectionResultOfT.cs @@ -0,0 +1,95 @@ +// 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.DevTestLabs.Models; + +namespace Azure.ResourceManager.DevTestLabs +{ + internal partial class DevTestLabSchedulesGetAllCollectionResultOfT : Pageable + { + private readonly DevTestLabSchedules _client; + private readonly string _subscriptionId; + private readonly string _resourceGroupName; + private readonly string _labName; + private readonly string _expand; + private readonly string _filter; + private readonly int? _top; + private readonly string _orderby; + private readonly RequestContext _context; + + /// Initializes a new instance of DevTestLabSchedulesGetAllCollectionResultOfT, which is used to iterate over the pages of a collection. + /// The DevTestLabSchedules 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. + /// labs. + /// Specify the $expand query. Example: 'properties($select=status)'. + /// The filter to apply to the operation. Example: '$filter=contains(name,'myName'). + /// The maximum number of resources to return from the operation. Example: '$top=10'. + /// The ordering expression for the results, using OData notation. Example: '$orderby=name desc'. + /// The request options, which can override default behaviors of the client pipeline on a per-call basis. + public DevTestLabSchedulesGetAllCollectionResultOfT(DevTestLabSchedules client, string subscriptionId, string resourceGroupName, string labName, string expand, string filter, int? top, string @orderby, RequestContext context) : base(context?.CancellationToken ?? default) + { + _client = client; + _subscriptionId = subscriptionId; + _resourceGroupName = resourceGroupName; + _labName = labName; + _expand = expand; + _filter = filter; + _top = top; + _orderby = @orderby; + _context = context; + } + + /// Gets the pages of DevTestLabSchedulesGetAllCollectionResultOfT as an enumerable collection. + /// A continuation token indicating where to resume paging. + /// The number of items per page. + /// The pages of DevTestLabSchedulesGetAllCollectionResultOfT 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; + } + ScheduleList result = ScheduleList.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.CreateNextGetAllRequest(nextLink, _subscriptionId, _resourceGroupName, _labName, _expand, _filter, _top, _orderby, _context) : _client.CreateGetAllRequest(_subscriptionId, _resourceGroupName, _labName, _expand, _filter, _top, _orderby, _context); + using DiagnosticScope scope = _client.ClientDiagnostics.CreateScope("DevTestLabScheduleCollection.GetAll"); + scope.Start(); + try + { + return _client.Pipeline.ProcessMessage(message, _context); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + } +} diff --git a/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/CollectionResults/DevTestLabSchedulesGetApplicableAsyncCollectionResultOfT.cs b/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/CollectionResults/DevTestLabSchedulesGetApplicableAsyncCollectionResultOfT.cs new file mode 100644 index 000000000000..aa8608d767ac --- /dev/null +++ b/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/CollectionResults/DevTestLabSchedulesGetApplicableAsyncCollectionResultOfT.cs @@ -0,0 +1,87 @@ +// 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.DevTestLabs.Models; + +namespace Azure.ResourceManager.DevTestLabs +{ + internal partial class DevTestLabSchedulesGetApplicableAsyncCollectionResultOfT : AsyncPageable + { + private readonly DevTestLabSchedules _client; + private readonly string _subscriptionId; + private readonly string _resourceGroupName; + private readonly string _labName; + private readonly string _name; + private readonly RequestContext _context; + + /// Initializes a new instance of DevTestLabSchedulesGetApplicableAsyncCollectionResultOfT, which is used to iterate over the pages of a collection. + /// The DevTestLabSchedules 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. + /// labs. + /// The name of the Schedule. + /// The request options, which can override default behaviors of the client pipeline on a per-call basis. + public DevTestLabSchedulesGetApplicableAsyncCollectionResultOfT(DevTestLabSchedules client, string subscriptionId, string resourceGroupName, string labName, string name, RequestContext context) : base(context?.CancellationToken ?? default) + { + _client = client; + _subscriptionId = subscriptionId; + _resourceGroupName = resourceGroupName; + _labName = labName; + _name = name; + _context = context; + } + + /// Gets the pages of DevTestLabSchedulesGetApplicableAsyncCollectionResultOfT as an enumerable collection. + /// A continuation token indicating where to resume paging. + /// The number of items per page. + /// The pages of DevTestLabSchedulesGetApplicableAsyncCollectionResultOfT 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; + } + ScheduleList result = ScheduleList.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.CreateNextGetApplicableRequest(nextLink, _subscriptionId, _resourceGroupName, _labName, _name, _context) : _client.CreateGetApplicableRequest(_subscriptionId, _resourceGroupName, _labName, _name, _context); + using DiagnosticScope scope = _client.ClientDiagnostics.CreateScope("DevTestLabScheduleResource.GetApplicable"); + scope.Start(); + try + { + return await _client.Pipeline.ProcessMessageAsync(message, _context).ConfigureAwait(false); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + } +} diff --git a/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/CollectionResults/DevTestLabSchedulesGetApplicableCollectionResultOfT.cs b/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/CollectionResults/DevTestLabSchedulesGetApplicableCollectionResultOfT.cs new file mode 100644 index 000000000000..cd189f323fcb --- /dev/null +++ b/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/CollectionResults/DevTestLabSchedulesGetApplicableCollectionResultOfT.cs @@ -0,0 +1,86 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; +using Azure; +using Azure.Core; +using Azure.Core.Pipeline; +using Azure.ResourceManager.DevTestLabs.Models; + +namespace Azure.ResourceManager.DevTestLabs +{ + internal partial class DevTestLabSchedulesGetApplicableCollectionResultOfT : Pageable + { + private readonly DevTestLabSchedules _client; + private readonly string _subscriptionId; + private readonly string _resourceGroupName; + private readonly string _labName; + private readonly string _name; + private readonly RequestContext _context; + + /// Initializes a new instance of DevTestLabSchedulesGetApplicableCollectionResultOfT, which is used to iterate over the pages of a collection. + /// The DevTestLabSchedules 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. + /// labs. + /// The name of the Schedule. + /// The request options, which can override default behaviors of the client pipeline on a per-call basis. + public DevTestLabSchedulesGetApplicableCollectionResultOfT(DevTestLabSchedules client, string subscriptionId, string resourceGroupName, string labName, string name, RequestContext context) : base(context?.CancellationToken ?? default) + { + _client = client; + _subscriptionId = subscriptionId; + _resourceGroupName = resourceGroupName; + _labName = labName; + _name = name; + _context = context; + } + + /// Gets the pages of DevTestLabSchedulesGetApplicableCollectionResultOfT as an enumerable collection. + /// A continuation token indicating where to resume paging. + /// The number of items per page. + /// The pages of DevTestLabSchedulesGetApplicableCollectionResultOfT 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; + } + ScheduleList result = ScheduleList.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.CreateNextGetApplicableRequest(nextLink, _subscriptionId, _resourceGroupName, _labName, _name, _context) : _client.CreateGetApplicableRequest(_subscriptionId, _resourceGroupName, _labName, _name, _context); + using DiagnosticScope scope = _client.ClientDiagnostics.CreateScope("DevTestLabScheduleResource.GetApplicable"); + scope.Start(); + try + { + return _client.Pipeline.ProcessMessage(message, _context); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + } +} diff --git a/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/CollectionResults/DevTestLabServiceFabricSchedulesGetAllAsyncCollectionResultOfT.cs b/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/CollectionResults/DevTestLabServiceFabricSchedulesGetAllAsyncCollectionResultOfT.cs new file mode 100644 index 000000000000..d769ab1fadf6 --- /dev/null +++ b/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/CollectionResults/DevTestLabServiceFabricSchedulesGetAllAsyncCollectionResultOfT.cs @@ -0,0 +1,102 @@ +// 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.DevTestLabs.Models; + +namespace Azure.ResourceManager.DevTestLabs +{ + internal partial class DevTestLabServiceFabricSchedulesGetAllAsyncCollectionResultOfT : AsyncPageable + { + private readonly DevTestLabServiceFabricSchedules _client; + private readonly string _subscriptionId; + private readonly string _resourceGroupName; + private readonly string _labName; + private readonly string _userName; + private readonly string _serviceFabricName; + private readonly string _expand; + private readonly string _filter; + private readonly int? _top; + private readonly string _orderby; + private readonly RequestContext _context; + + /// Initializes a new instance of DevTestLabServiceFabricSchedulesGetAllAsyncCollectionResultOfT, which is used to iterate over the pages of a collection. + /// The DevTestLabServiceFabricSchedules 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. + /// labs. + /// users. + /// servicefabrics. + /// Specify the $expand query. Example: 'properties($select=status)'. + /// The filter to apply to the operation. Example: '$filter=contains(name,'myName'). + /// The maximum number of resources to return from the operation. Example: '$top=10'. + /// The ordering expression for the results, using OData notation. Example: '$orderby=name desc'. + /// The request options, which can override default behaviors of the client pipeline on a per-call basis. + public DevTestLabServiceFabricSchedulesGetAllAsyncCollectionResultOfT(DevTestLabServiceFabricSchedules client, string subscriptionId, string resourceGroupName, string labName, string userName, string serviceFabricName, string expand, string filter, int? top, string @orderby, RequestContext context) : base(context?.CancellationToken ?? default) + { + _client = client; + _subscriptionId = subscriptionId; + _resourceGroupName = resourceGroupName; + _labName = labName; + _userName = userName; + _serviceFabricName = serviceFabricName; + _expand = expand; + _filter = filter; + _top = top; + _orderby = @orderby; + _context = context; + } + + /// Gets the pages of DevTestLabServiceFabricSchedulesGetAllAsyncCollectionResultOfT as an enumerable collection. + /// A continuation token indicating where to resume paging. + /// The number of items per page. + /// The pages of DevTestLabServiceFabricSchedulesGetAllAsyncCollectionResultOfT 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; + } + ScheduleList result = ScheduleList.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.CreateNextGetAllRequest(nextLink, _subscriptionId, _resourceGroupName, _labName, _userName, _serviceFabricName, _expand, _filter, _top, _orderby, _context) : _client.CreateGetAllRequest(_subscriptionId, _resourceGroupName, _labName, _userName, _serviceFabricName, _expand, _filter, _top, _orderby, _context); + using DiagnosticScope scope = _client.ClientDiagnostics.CreateScope("DevTestLabServiceFabricScheduleCollection.GetAll"); + scope.Start(); + try + { + return await _client.Pipeline.ProcessMessageAsync(message, _context).ConfigureAwait(false); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + } +} diff --git a/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/CollectionResults/DevTestLabServiceFabricSchedulesGetAllCollectionResultOfT.cs b/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/CollectionResults/DevTestLabServiceFabricSchedulesGetAllCollectionResultOfT.cs new file mode 100644 index 000000000000..fab19f2e3982 --- /dev/null +++ b/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/CollectionResults/DevTestLabServiceFabricSchedulesGetAllCollectionResultOfT.cs @@ -0,0 +1,101 @@ +// 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.DevTestLabs.Models; + +namespace Azure.ResourceManager.DevTestLabs +{ + internal partial class DevTestLabServiceFabricSchedulesGetAllCollectionResultOfT : Pageable + { + private readonly DevTestLabServiceFabricSchedules _client; + private readonly string _subscriptionId; + private readonly string _resourceGroupName; + private readonly string _labName; + private readonly string _userName; + private readonly string _serviceFabricName; + private readonly string _expand; + private readonly string _filter; + private readonly int? _top; + private readonly string _orderby; + private readonly RequestContext _context; + + /// Initializes a new instance of DevTestLabServiceFabricSchedulesGetAllCollectionResultOfT, which is used to iterate over the pages of a collection. + /// The DevTestLabServiceFabricSchedules 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. + /// labs. + /// users. + /// servicefabrics. + /// Specify the $expand query. Example: 'properties($select=status)'. + /// The filter to apply to the operation. Example: '$filter=contains(name,'myName'). + /// The maximum number of resources to return from the operation. Example: '$top=10'. + /// The ordering expression for the results, using OData notation. Example: '$orderby=name desc'. + /// The request options, which can override default behaviors of the client pipeline on a per-call basis. + public DevTestLabServiceFabricSchedulesGetAllCollectionResultOfT(DevTestLabServiceFabricSchedules client, string subscriptionId, string resourceGroupName, string labName, string userName, string serviceFabricName, string expand, string filter, int? top, string @orderby, RequestContext context) : base(context?.CancellationToken ?? default) + { + _client = client; + _subscriptionId = subscriptionId; + _resourceGroupName = resourceGroupName; + _labName = labName; + _userName = userName; + _serviceFabricName = serviceFabricName; + _expand = expand; + _filter = filter; + _top = top; + _orderby = @orderby; + _context = context; + } + + /// Gets the pages of DevTestLabServiceFabricSchedulesGetAllCollectionResultOfT as an enumerable collection. + /// A continuation token indicating where to resume paging. + /// The number of items per page. + /// The pages of DevTestLabServiceFabricSchedulesGetAllCollectionResultOfT 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; + } + ScheduleList result = ScheduleList.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.CreateNextGetAllRequest(nextLink, _subscriptionId, _resourceGroupName, _labName, _userName, _serviceFabricName, _expand, _filter, _top, _orderby, _context) : _client.CreateGetAllRequest(_subscriptionId, _resourceGroupName, _labName, _userName, _serviceFabricName, _expand, _filter, _top, _orderby, _context); + using DiagnosticScope scope = _client.ClientDiagnostics.CreateScope("DevTestLabServiceFabricScheduleCollection.GetAll"); + scope.Start(); + try + { + return _client.Pipeline.ProcessMessage(message, _context); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + } +} diff --git a/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/CollectionResults/DevTestLabVmSchedulesGetAllAsyncCollectionResultOfT.cs b/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/CollectionResults/DevTestLabVmSchedulesGetAllAsyncCollectionResultOfT.cs new file mode 100644 index 000000000000..e75488f71baf --- /dev/null +++ b/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/CollectionResults/DevTestLabVmSchedulesGetAllAsyncCollectionResultOfT.cs @@ -0,0 +1,99 @@ +// 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.DevTestLabs.Models; + +namespace Azure.ResourceManager.DevTestLabs +{ + internal partial class DevTestLabVmSchedulesGetAllAsyncCollectionResultOfT : AsyncPageable + { + private readonly DevTestLabVmSchedules _client; + private readonly string _subscriptionId; + private readonly string _resourceGroupName; + private readonly string _labName; + private readonly string _virtualMachineName; + private readonly string _expand; + private readonly string _filter; + private readonly int? _top; + private readonly string _orderby; + private readonly RequestContext _context; + + /// Initializes a new instance of DevTestLabVmSchedulesGetAllAsyncCollectionResultOfT, which is used to iterate over the pages of a collection. + /// The DevTestLabVmSchedules 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. + /// labs. + /// virtualmachines. + /// Specify the $expand query. Example: 'properties($select=status)'. + /// The filter to apply to the operation. Example: '$filter=contains(name,'myName'). + /// The maximum number of resources to return from the operation. Example: '$top=10'. + /// The ordering expression for the results, using OData notation. Example: '$orderby=name desc'. + /// The request options, which can override default behaviors of the client pipeline on a per-call basis. + public DevTestLabVmSchedulesGetAllAsyncCollectionResultOfT(DevTestLabVmSchedules client, string subscriptionId, string resourceGroupName, string labName, string virtualMachineName, string expand, string filter, int? top, string @orderby, RequestContext context) : base(context?.CancellationToken ?? default) + { + _client = client; + _subscriptionId = subscriptionId; + _resourceGroupName = resourceGroupName; + _labName = labName; + _virtualMachineName = virtualMachineName; + _expand = expand; + _filter = filter; + _top = top; + _orderby = @orderby; + _context = context; + } + + /// Gets the pages of DevTestLabVmSchedulesGetAllAsyncCollectionResultOfT as an enumerable collection. + /// A continuation token indicating where to resume paging. + /// The number of items per page. + /// The pages of DevTestLabVmSchedulesGetAllAsyncCollectionResultOfT 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; + } + ScheduleList result = ScheduleList.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.CreateNextGetAllRequest(nextLink, _subscriptionId, _resourceGroupName, _labName, _virtualMachineName, _expand, _filter, _top, _orderby, _context) : _client.CreateGetAllRequest(_subscriptionId, _resourceGroupName, _labName, _virtualMachineName, _expand, _filter, _top, _orderby, _context); + using DiagnosticScope scope = _client.ClientDiagnostics.CreateScope("DevTestLabVmScheduleCollection.GetAll"); + scope.Start(); + try + { + return await _client.Pipeline.ProcessMessageAsync(message, _context).ConfigureAwait(false); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + } +} diff --git a/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/CollectionResults/DevTestLabVmSchedulesGetAllCollectionResultOfT.cs b/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/CollectionResults/DevTestLabVmSchedulesGetAllCollectionResultOfT.cs new file mode 100644 index 000000000000..0bbf31fd51a7 --- /dev/null +++ b/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/CollectionResults/DevTestLabVmSchedulesGetAllCollectionResultOfT.cs @@ -0,0 +1,98 @@ +// 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.DevTestLabs.Models; + +namespace Azure.ResourceManager.DevTestLabs +{ + internal partial class DevTestLabVmSchedulesGetAllCollectionResultOfT : Pageable + { + private readonly DevTestLabVmSchedules _client; + private readonly string _subscriptionId; + private readonly string _resourceGroupName; + private readonly string _labName; + private readonly string _virtualMachineName; + private readonly string _expand; + private readonly string _filter; + private readonly int? _top; + private readonly string _orderby; + private readonly RequestContext _context; + + /// Initializes a new instance of DevTestLabVmSchedulesGetAllCollectionResultOfT, which is used to iterate over the pages of a collection. + /// The DevTestLabVmSchedules 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. + /// labs. + /// virtualmachines. + /// Specify the $expand query. Example: 'properties($select=status)'. + /// The filter to apply to the operation. Example: '$filter=contains(name,'myName'). + /// The maximum number of resources to return from the operation. Example: '$top=10'. + /// The ordering expression for the results, using OData notation. Example: '$orderby=name desc'. + /// The request options, which can override default behaviors of the client pipeline on a per-call basis. + public DevTestLabVmSchedulesGetAllCollectionResultOfT(DevTestLabVmSchedules client, string subscriptionId, string resourceGroupName, string labName, string virtualMachineName, string expand, string filter, int? top, string @orderby, RequestContext context) : base(context?.CancellationToken ?? default) + { + _client = client; + _subscriptionId = subscriptionId; + _resourceGroupName = resourceGroupName; + _labName = labName; + _virtualMachineName = virtualMachineName; + _expand = expand; + _filter = filter; + _top = top; + _orderby = @orderby; + _context = context; + } + + /// Gets the pages of DevTestLabVmSchedulesGetAllCollectionResultOfT as an enumerable collection. + /// A continuation token indicating where to resume paging. + /// The number of items per page. + /// The pages of DevTestLabVmSchedulesGetAllCollectionResultOfT 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; + } + ScheduleList result = ScheduleList.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.CreateNextGetAllRequest(nextLink, _subscriptionId, _resourceGroupName, _labName, _virtualMachineName, _expand, _filter, _top, _orderby, _context) : _client.CreateGetAllRequest(_subscriptionId, _resourceGroupName, _labName, _virtualMachineName, _expand, _filter, _top, _orderby, _context); + using DiagnosticScope scope = _client.ClientDiagnostics.CreateScope("DevTestLabVmScheduleCollection.GetAll"); + scope.Start(); + try + { + return _client.Pipeline.ProcessMessage(message, _context); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + } +} diff --git a/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/CollectionResults/DisksGetAllAsyncCollectionResultOfT.cs b/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/CollectionResults/DisksGetAllAsyncCollectionResultOfT.cs new file mode 100644 index 000000000000..754a44dd09a9 --- /dev/null +++ b/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/CollectionResults/DisksGetAllAsyncCollectionResultOfT.cs @@ -0,0 +1,99 @@ +// 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.DevTestLabs.Models; + +namespace Azure.ResourceManager.DevTestLabs +{ + internal partial class DisksGetAllAsyncCollectionResultOfT : AsyncPageable + { + private readonly Disks _client; + private readonly string _subscriptionId; + private readonly string _resourceGroupName; + private readonly string _labName; + private readonly string _userName; + private readonly string _expand; + private readonly string _filter; + private readonly int? _top; + private readonly string _orderby; + private readonly RequestContext _context; + + /// Initializes a new instance of DisksGetAllAsyncCollectionResultOfT, which is used to iterate over the pages of a collection. + /// The Disks 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 name of the lab. + /// The name of the user profile. + /// Specify the $expand query. Example: 'properties($select=diskType)'. + /// The filter to apply to the operation. Example: '$filter=contains(name,'myName'). + /// The maximum number of resources to return from the operation. Example: '$top=10'. + /// The ordering expression for the results, using OData notation. Example: '$orderby=name desc'. + /// The request options, which can override default behaviors of the client pipeline on a per-call basis. + public DisksGetAllAsyncCollectionResultOfT(Disks client, string subscriptionId, string resourceGroupName, string labName, string userName, string expand, string filter, int? top, string @orderby, RequestContext context) : base(context?.CancellationToken ?? default) + { + _client = client; + _subscriptionId = subscriptionId; + _resourceGroupName = resourceGroupName; + _labName = labName; + _userName = userName; + _expand = expand; + _filter = filter; + _top = top; + _orderby = @orderby; + _context = context; + } + + /// Gets the pages of DisksGetAllAsyncCollectionResultOfT as an enumerable collection. + /// A continuation token indicating where to resume paging. + /// The number of items per page. + /// The pages of DisksGetAllAsyncCollectionResultOfT 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; + } + DiskList result = DiskList.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.CreateNextGetAllRequest(nextLink, _subscriptionId, _resourceGroupName, _labName, _userName, _expand, _filter, _top, _orderby, _context) : _client.CreateGetAllRequest(_subscriptionId, _resourceGroupName, _labName, _userName, _expand, _filter, _top, _orderby, _context); + using DiagnosticScope scope = _client.ClientDiagnostics.CreateScope("DevTestLabDiskCollection.GetAll"); + scope.Start(); + try + { + return await _client.Pipeline.ProcessMessageAsync(message, _context).ConfigureAwait(false); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + } +} diff --git a/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/CollectionResults/DisksGetAllCollectionResultOfT.cs b/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/CollectionResults/DisksGetAllCollectionResultOfT.cs new file mode 100644 index 000000000000..e7c5e83677e4 --- /dev/null +++ b/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/CollectionResults/DisksGetAllCollectionResultOfT.cs @@ -0,0 +1,98 @@ +// 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.DevTestLabs.Models; + +namespace Azure.ResourceManager.DevTestLabs +{ + internal partial class DisksGetAllCollectionResultOfT : Pageable + { + private readonly Disks _client; + private readonly string _subscriptionId; + private readonly string _resourceGroupName; + private readonly string _labName; + private readonly string _userName; + private readonly string _expand; + private readonly string _filter; + private readonly int? _top; + private readonly string _orderby; + private readonly RequestContext _context; + + /// Initializes a new instance of DisksGetAllCollectionResultOfT, which is used to iterate over the pages of a collection. + /// The Disks 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 name of the lab. + /// The name of the user profile. + /// Specify the $expand query. Example: 'properties($select=diskType)'. + /// The filter to apply to the operation. Example: '$filter=contains(name,'myName'). + /// The maximum number of resources to return from the operation. Example: '$top=10'. + /// The ordering expression for the results, using OData notation. Example: '$orderby=name desc'. + /// The request options, which can override default behaviors of the client pipeline on a per-call basis. + public DisksGetAllCollectionResultOfT(Disks client, string subscriptionId, string resourceGroupName, string labName, string userName, string expand, string filter, int? top, string @orderby, RequestContext context) : base(context?.CancellationToken ?? default) + { + _client = client; + _subscriptionId = subscriptionId; + _resourceGroupName = resourceGroupName; + _labName = labName; + _userName = userName; + _expand = expand; + _filter = filter; + _top = top; + _orderby = @orderby; + _context = context; + } + + /// Gets the pages of DisksGetAllCollectionResultOfT as an enumerable collection. + /// A continuation token indicating where to resume paging. + /// The number of items per page. + /// The pages of DisksGetAllCollectionResultOfT 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; + } + DiskList result = DiskList.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.CreateNextGetAllRequest(nextLink, _subscriptionId, _resourceGroupName, _labName, _userName, _expand, _filter, _top, _orderby, _context) : _client.CreateGetAllRequest(_subscriptionId, _resourceGroupName, _labName, _userName, _expand, _filter, _top, _orderby, _context); + using DiagnosticScope scope = _client.ClientDiagnostics.CreateScope("DevTestLabDiskCollection.GetAll"); + scope.Start(); + try + { + return _client.Pipeline.ProcessMessage(message, _context); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + } +} diff --git a/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/CollectionResults/EnvironmentsGetAllAsyncCollectionResultOfT.cs b/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/CollectionResults/EnvironmentsGetAllAsyncCollectionResultOfT.cs new file mode 100644 index 000000000000..47c805b722d6 --- /dev/null +++ b/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/CollectionResults/EnvironmentsGetAllAsyncCollectionResultOfT.cs @@ -0,0 +1,99 @@ +// 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.DevTestLabs.Models; + +namespace Azure.ResourceManager.DevTestLabs +{ + internal partial class EnvironmentsGetAllAsyncCollectionResultOfT : AsyncPageable + { + private readonly Environments _client; + private readonly string _subscriptionId; + private readonly string _resourceGroupName; + private readonly string _labName; + private readonly string _userName; + private readonly string _expand; + private readonly string _filter; + private readonly int? _top; + private readonly string _orderby; + private readonly RequestContext _context; + + /// Initializes a new instance of EnvironmentsGetAllAsyncCollectionResultOfT, which is used to iterate over the pages of a collection. + /// The Environments 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 name of the lab. + /// The name of the user profile. + /// Specify the $expand query. Example: 'properties($select=deploymentProperties)'. + /// The filter to apply to the operation. Example: '$filter=contains(name,'myName'). + /// The maximum number of resources to return from the operation. Example: '$top=10'. + /// The ordering expression for the results, using OData notation. Example: '$orderby=name desc'. + /// The request options, which can override default behaviors of the client pipeline on a per-call basis. + public EnvironmentsGetAllAsyncCollectionResultOfT(Environments client, string subscriptionId, string resourceGroupName, string labName, string userName, string expand, string filter, int? top, string @orderby, RequestContext context) : base(context?.CancellationToken ?? default) + { + _client = client; + _subscriptionId = subscriptionId; + _resourceGroupName = resourceGroupName; + _labName = labName; + _userName = userName; + _expand = expand; + _filter = filter; + _top = top; + _orderby = @orderby; + _context = context; + } + + /// Gets the pages of EnvironmentsGetAllAsyncCollectionResultOfT as an enumerable collection. + /// A continuation token indicating where to resume paging. + /// The number of items per page. + /// The pages of EnvironmentsGetAllAsyncCollectionResultOfT 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; + } + DtlEnvironmentList result = DtlEnvironmentList.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.CreateNextGetAllRequest(nextLink, _subscriptionId, _resourceGroupName, _labName, _userName, _expand, _filter, _top, _orderby, _context) : _client.CreateGetAllRequest(_subscriptionId, _resourceGroupName, _labName, _userName, _expand, _filter, _top, _orderby, _context); + using DiagnosticScope scope = _client.ClientDiagnostics.CreateScope("DevTestLabEnvironmentCollection.GetAll"); + scope.Start(); + try + { + return await _client.Pipeline.ProcessMessageAsync(message, _context).ConfigureAwait(false); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + } +} diff --git a/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/CollectionResults/EnvironmentsGetAllCollectionResultOfT.cs b/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/CollectionResults/EnvironmentsGetAllCollectionResultOfT.cs new file mode 100644 index 000000000000..a92965ca3a09 --- /dev/null +++ b/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/CollectionResults/EnvironmentsGetAllCollectionResultOfT.cs @@ -0,0 +1,98 @@ +// 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.DevTestLabs.Models; + +namespace Azure.ResourceManager.DevTestLabs +{ + internal partial class EnvironmentsGetAllCollectionResultOfT : Pageable + { + private readonly Environments _client; + private readonly string _subscriptionId; + private readonly string _resourceGroupName; + private readonly string _labName; + private readonly string _userName; + private readonly string _expand; + private readonly string _filter; + private readonly int? _top; + private readonly string _orderby; + private readonly RequestContext _context; + + /// Initializes a new instance of EnvironmentsGetAllCollectionResultOfT, which is used to iterate over the pages of a collection. + /// The Environments 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 name of the lab. + /// The name of the user profile. + /// Specify the $expand query. Example: 'properties($select=deploymentProperties)'. + /// The filter to apply to the operation. Example: '$filter=contains(name,'myName'). + /// The maximum number of resources to return from the operation. Example: '$top=10'. + /// The ordering expression for the results, using OData notation. Example: '$orderby=name desc'. + /// The request options, which can override default behaviors of the client pipeline on a per-call basis. + public EnvironmentsGetAllCollectionResultOfT(Environments client, string subscriptionId, string resourceGroupName, string labName, string userName, string expand, string filter, int? top, string @orderby, RequestContext context) : base(context?.CancellationToken ?? default) + { + _client = client; + _subscriptionId = subscriptionId; + _resourceGroupName = resourceGroupName; + _labName = labName; + _userName = userName; + _expand = expand; + _filter = filter; + _top = top; + _orderby = @orderby; + _context = context; + } + + /// Gets the pages of EnvironmentsGetAllCollectionResultOfT as an enumerable collection. + /// A continuation token indicating where to resume paging. + /// The number of items per page. + /// The pages of EnvironmentsGetAllCollectionResultOfT 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; + } + DtlEnvironmentList result = DtlEnvironmentList.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.CreateNextGetAllRequest(nextLink, _subscriptionId, _resourceGroupName, _labName, _userName, _expand, _filter, _top, _orderby, _context) : _client.CreateGetAllRequest(_subscriptionId, _resourceGroupName, _labName, _userName, _expand, _filter, _top, _orderby, _context); + using DiagnosticScope scope = _client.ClientDiagnostics.CreateScope("DevTestLabEnvironmentCollection.GetAll"); + scope.Start(); + try + { + return _client.Pipeline.ProcessMessage(message, _context); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + } +} diff --git a/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/CollectionResults/FormulasGetAllAsyncCollectionResultOfT.cs b/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/CollectionResults/FormulasGetAllAsyncCollectionResultOfT.cs new file mode 100644 index 000000000000..8c93682c51cf --- /dev/null +++ b/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/CollectionResults/FormulasGetAllAsyncCollectionResultOfT.cs @@ -0,0 +1,96 @@ +// 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.DevTestLabs.Models; + +namespace Azure.ResourceManager.DevTestLabs +{ + internal partial class FormulasGetAllAsyncCollectionResultOfT : AsyncPageable + { + private readonly Formulas _client; + private readonly string _subscriptionId; + private readonly string _resourceGroupName; + private readonly string _labName; + private readonly string _expand; + private readonly string _filter; + private readonly int? _top; + private readonly string _orderby; + private readonly RequestContext _context; + + /// Initializes a new instance of FormulasGetAllAsyncCollectionResultOfT, which is used to iterate over the pages of a collection. + /// The Formulas 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 name of the lab. + /// Specify the $expand query. Example: 'properties($select=description)'. + /// The filter to apply to the operation. Example: '$filter=contains(name,'myName'). + /// The maximum number of resources to return from the operation. Example: '$top=10'. + /// The ordering expression for the results, using OData notation. Example: '$orderby=name desc'. + /// The request options, which can override default behaviors of the client pipeline on a per-call basis. + public FormulasGetAllAsyncCollectionResultOfT(Formulas client, string subscriptionId, string resourceGroupName, string labName, string expand, string filter, int? top, string @orderby, RequestContext context) : base(context?.CancellationToken ?? default) + { + _client = client; + _subscriptionId = subscriptionId; + _resourceGroupName = resourceGroupName; + _labName = labName; + _expand = expand; + _filter = filter; + _top = top; + _orderby = @orderby; + _context = context; + } + + /// Gets the pages of FormulasGetAllAsyncCollectionResultOfT as an enumerable collection. + /// A continuation token indicating where to resume paging. + /// The number of items per page. + /// The pages of FormulasGetAllAsyncCollectionResultOfT 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; + } + FormulaList result = FormulaList.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.CreateNextGetAllRequest(nextLink, _subscriptionId, _resourceGroupName, _labName, _expand, _filter, _top, _orderby, _context) : _client.CreateGetAllRequest(_subscriptionId, _resourceGroupName, _labName, _expand, _filter, _top, _orderby, _context); + using DiagnosticScope scope = _client.ClientDiagnostics.CreateScope("DevTestLabFormulaCollection.GetAll"); + scope.Start(); + try + { + return await _client.Pipeline.ProcessMessageAsync(message, _context).ConfigureAwait(false); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + } +} diff --git a/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/CollectionResults/FormulasGetAllCollectionResultOfT.cs b/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/CollectionResults/FormulasGetAllCollectionResultOfT.cs new file mode 100644 index 000000000000..0232cda01380 --- /dev/null +++ b/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/CollectionResults/FormulasGetAllCollectionResultOfT.cs @@ -0,0 +1,95 @@ +// 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.DevTestLabs.Models; + +namespace Azure.ResourceManager.DevTestLabs +{ + internal partial class FormulasGetAllCollectionResultOfT : Pageable + { + private readonly Formulas _client; + private readonly string _subscriptionId; + private readonly string _resourceGroupName; + private readonly string _labName; + private readonly string _expand; + private readonly string _filter; + private readonly int? _top; + private readonly string _orderby; + private readonly RequestContext _context; + + /// Initializes a new instance of FormulasGetAllCollectionResultOfT, which is used to iterate over the pages of a collection. + /// The Formulas 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 name of the lab. + /// Specify the $expand query. Example: 'properties($select=description)'. + /// The filter to apply to the operation. Example: '$filter=contains(name,'myName'). + /// The maximum number of resources to return from the operation. Example: '$top=10'. + /// The ordering expression for the results, using OData notation. Example: '$orderby=name desc'. + /// The request options, which can override default behaviors of the client pipeline on a per-call basis. + public FormulasGetAllCollectionResultOfT(Formulas client, string subscriptionId, string resourceGroupName, string labName, string expand, string filter, int? top, string @orderby, RequestContext context) : base(context?.CancellationToken ?? default) + { + _client = client; + _subscriptionId = subscriptionId; + _resourceGroupName = resourceGroupName; + _labName = labName; + _expand = expand; + _filter = filter; + _top = top; + _orderby = @orderby; + _context = context; + } + + /// Gets the pages of FormulasGetAllCollectionResultOfT as an enumerable collection. + /// A continuation token indicating where to resume paging. + /// The number of items per page. + /// The pages of FormulasGetAllCollectionResultOfT 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; + } + FormulaList result = FormulaList.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.CreateNextGetAllRequest(nextLink, _subscriptionId, _resourceGroupName, _labName, _expand, _filter, _top, _orderby, _context) : _client.CreateGetAllRequest(_subscriptionId, _resourceGroupName, _labName, _expand, _filter, _top, _orderby, _context); + using DiagnosticScope scope = _client.ClientDiagnostics.CreateScope("DevTestLabFormulaCollection.GetAll"); + scope.Start(); + try + { + return _client.Pipeline.ProcessMessage(message, _context); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + } +} diff --git a/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/CollectionResults/GalleryImagesGetGalleryImagesAsyncCollectionResultOfT.cs b/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/CollectionResults/GalleryImagesGetGalleryImagesAsyncCollectionResultOfT.cs new file mode 100644 index 000000000000..66786fe46f8c --- /dev/null +++ b/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/CollectionResults/GalleryImagesGetGalleryImagesAsyncCollectionResultOfT.cs @@ -0,0 +1,96 @@ +// 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.DevTestLabs.Models; + +namespace Azure.ResourceManager.DevTestLabs +{ + internal partial class GalleryImagesGetGalleryImagesAsyncCollectionResultOfT : AsyncPageable + { + private readonly GalleryImages _client; + private readonly string _subscriptionId; + private readonly string _resourceGroupName; + private readonly string _labName; + private readonly string _expand; + private readonly string _filter; + private readonly int? _top; + private readonly string _orderby; + private readonly RequestContext _context; + + /// Initializes a new instance of GalleryImagesGetGalleryImagesAsyncCollectionResultOfT, which is used to iterate over the pages of a collection. + /// The GalleryImages 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 name of the lab. + /// Specify the $expand query. Example: 'properties($select=displayName)'. + /// The filter to apply to the operation. Example: '$filter=contains(name,'myName'). + /// The maximum number of resources to return from the operation. Example: '$top=10'. + /// The ordering expression for the results, using OData notation. Example: '$orderby=name desc'. + /// The request options, which can override default behaviors of the client pipeline on a per-call basis. + public GalleryImagesGetGalleryImagesAsyncCollectionResultOfT(GalleryImages client, string subscriptionId, string resourceGroupName, string labName, string expand, string filter, int? top, string @orderby, RequestContext context) : base(context?.CancellationToken ?? default) + { + _client = client; + _subscriptionId = subscriptionId; + _resourceGroupName = resourceGroupName; + _labName = labName; + _expand = expand; + _filter = filter; + _top = top; + _orderby = @orderby; + _context = context; + } + + /// Gets the pages of GalleryImagesGetGalleryImagesAsyncCollectionResultOfT as an enumerable collection. + /// A continuation token indicating where to resume paging. + /// The number of items per page. + /// The pages of GalleryImagesGetGalleryImagesAsyncCollectionResultOfT 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; + } + GalleryImageList result = GalleryImageList.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.CreateNextGetGalleryImagesRequest(nextLink, _subscriptionId, _resourceGroupName, _labName, _expand, _filter, _top, _orderby, _context) : _client.CreateGetGalleryImagesRequest(_subscriptionId, _resourceGroupName, _labName, _expand, _filter, _top, _orderby, _context); + using DiagnosticScope scope = _client.ClientDiagnostics.CreateScope("DevTestLabResource.GetGalleryImages"); + scope.Start(); + try + { + return await _client.Pipeline.ProcessMessageAsync(message, _context).ConfigureAwait(false); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + } +} diff --git a/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/CollectionResults/GalleryImagesGetGalleryImagesCollectionResultOfT.cs b/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/CollectionResults/GalleryImagesGetGalleryImagesCollectionResultOfT.cs new file mode 100644 index 000000000000..7836ad326c37 --- /dev/null +++ b/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/CollectionResults/GalleryImagesGetGalleryImagesCollectionResultOfT.cs @@ -0,0 +1,95 @@ +// 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.DevTestLabs.Models; + +namespace Azure.ResourceManager.DevTestLabs +{ + internal partial class GalleryImagesGetGalleryImagesCollectionResultOfT : Pageable + { + private readonly GalleryImages _client; + private readonly string _subscriptionId; + private readonly string _resourceGroupName; + private readonly string _labName; + private readonly string _expand; + private readonly string _filter; + private readonly int? _top; + private readonly string _orderby; + private readonly RequestContext _context; + + /// Initializes a new instance of GalleryImagesGetGalleryImagesCollectionResultOfT, which is used to iterate over the pages of a collection. + /// The GalleryImages 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 name of the lab. + /// Specify the $expand query. Example: 'properties($select=displayName)'. + /// The filter to apply to the operation. Example: '$filter=contains(name,'myName'). + /// The maximum number of resources to return from the operation. Example: '$top=10'. + /// The ordering expression for the results, using OData notation. Example: '$orderby=name desc'. + /// The request options, which can override default behaviors of the client pipeline on a per-call basis. + public GalleryImagesGetGalleryImagesCollectionResultOfT(GalleryImages client, string subscriptionId, string resourceGroupName, string labName, string expand, string filter, int? top, string @orderby, RequestContext context) : base(context?.CancellationToken ?? default) + { + _client = client; + _subscriptionId = subscriptionId; + _resourceGroupName = resourceGroupName; + _labName = labName; + _expand = expand; + _filter = filter; + _top = top; + _orderby = @orderby; + _context = context; + } + + /// Gets the pages of GalleryImagesGetGalleryImagesCollectionResultOfT as an enumerable collection. + /// A continuation token indicating where to resume paging. + /// The number of items per page. + /// The pages of GalleryImagesGetGalleryImagesCollectionResultOfT 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; + } + GalleryImageList result = GalleryImageList.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.CreateNextGetGalleryImagesRequest(nextLink, _subscriptionId, _resourceGroupName, _labName, _expand, _filter, _top, _orderby, _context) : _client.CreateGetGalleryImagesRequest(_subscriptionId, _resourceGroupName, _labName, _expand, _filter, _top, _orderby, _context); + using DiagnosticScope scope = _client.ClientDiagnostics.CreateScope("DevTestLabResource.GetGalleryImages"); + scope.Start(); + try + { + return _client.Pipeline.ProcessMessage(message, _context); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + } +} diff --git a/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/CollectionResults/LabsGetByResourceGroupAsyncCollectionResultOfT.cs b/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/CollectionResults/LabsGetByResourceGroupAsyncCollectionResultOfT.cs new file mode 100644 index 000000000000..ef688b29dc72 --- /dev/null +++ b/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/CollectionResults/LabsGetByResourceGroupAsyncCollectionResultOfT.cs @@ -0,0 +1,93 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; +using System.Threading.Tasks; +using Azure; +using Azure.Core; +using Azure.Core.Pipeline; +using Azure.ResourceManager.DevTestLabs.Models; + +namespace Azure.ResourceManager.DevTestLabs +{ + internal partial class LabsGetByResourceGroupAsyncCollectionResultOfT : AsyncPageable + { + private readonly Labs _client; + private readonly string _subscriptionId; + private readonly string _resourceGroupName; + private readonly string _expand; + private readonly string _filter; + private readonly int? _top; + private readonly string _orderby; + private readonly RequestContext _context; + + /// Initializes a new instance of LabsGetByResourceGroupAsyncCollectionResultOfT, which is used to iterate over the pages of a collection. + /// The Labs 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. + /// Specify the $expand query. Example: 'properties($select=defaultStorageAccount)'. + /// The filter to apply to the operation. Example: '$filter=contains(name,'myName'). + /// The maximum number of resources to return from the operation. Example: '$top=10'. + /// The ordering expression for the results, using OData notation. Example: '$orderby=name desc'. + /// The request options, which can override default behaviors of the client pipeline on a per-call basis. + public LabsGetByResourceGroupAsyncCollectionResultOfT(Labs client, string subscriptionId, string resourceGroupName, string expand, string filter, int? top, string @orderby, RequestContext context) : base(context?.CancellationToken ?? default) + { + _client = client; + _subscriptionId = subscriptionId; + _resourceGroupName = resourceGroupName; + _expand = expand; + _filter = filter; + _top = top; + _orderby = @orderby; + _context = context; + } + + /// Gets the pages of LabsGetByResourceGroupAsyncCollectionResultOfT as an enumerable collection. + /// A continuation token indicating where to resume paging. + /// The number of items per page. + /// The pages of LabsGetByResourceGroupAsyncCollectionResultOfT 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; + } + LabList result = LabList.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, _expand, _filter, _top, _orderby, _context) : _client.CreateGetByResourceGroupRequest(_subscriptionId, _resourceGroupName, _expand, _filter, _top, _orderby, _context); + using DiagnosticScope scope = _client.ClientDiagnostics.CreateScope("DevTestLabCollection.GetAll"); + scope.Start(); + try + { + return await _client.Pipeline.ProcessMessageAsync(message, _context).ConfigureAwait(false); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + } +} diff --git a/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/CollectionResults/LabsGetByResourceGroupCollectionResultOfT.cs b/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/CollectionResults/LabsGetByResourceGroupCollectionResultOfT.cs new file mode 100644 index 000000000000..b77c9146a1e1 --- /dev/null +++ b/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/CollectionResults/LabsGetByResourceGroupCollectionResultOfT.cs @@ -0,0 +1,92 @@ +// 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.DevTestLabs.Models; + +namespace Azure.ResourceManager.DevTestLabs +{ + internal partial class LabsGetByResourceGroupCollectionResultOfT : Pageable + { + private readonly Labs _client; + private readonly string _subscriptionId; + private readonly string _resourceGroupName; + private readonly string _expand; + private readonly string _filter; + private readonly int? _top; + private readonly string _orderby; + private readonly RequestContext _context; + + /// Initializes a new instance of LabsGetByResourceGroupCollectionResultOfT, which is used to iterate over the pages of a collection. + /// The Labs 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. + /// Specify the $expand query. Example: 'properties($select=defaultStorageAccount)'. + /// The filter to apply to the operation. Example: '$filter=contains(name,'myName'). + /// The maximum number of resources to return from the operation. Example: '$top=10'. + /// The ordering expression for the results, using OData notation. Example: '$orderby=name desc'. + /// The request options, which can override default behaviors of the client pipeline on a per-call basis. + public LabsGetByResourceGroupCollectionResultOfT(Labs client, string subscriptionId, string resourceGroupName, string expand, string filter, int? top, string @orderby, RequestContext context) : base(context?.CancellationToken ?? default) + { + _client = client; + _subscriptionId = subscriptionId; + _resourceGroupName = resourceGroupName; + _expand = expand; + _filter = filter; + _top = top; + _orderby = @orderby; + _context = context; + } + + /// Gets the pages of LabsGetByResourceGroupCollectionResultOfT as an enumerable collection. + /// A continuation token indicating where to resume paging. + /// The number of items per page. + /// The pages of LabsGetByResourceGroupCollectionResultOfT 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; + } + LabList result = LabList.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, _expand, _filter, _top, _orderby, _context) : _client.CreateGetByResourceGroupRequest(_subscriptionId, _resourceGroupName, _expand, _filter, _top, _orderby, _context); + using DiagnosticScope scope = _client.ClientDiagnostics.CreateScope("DevTestLabCollection.GetAll"); + scope.Start(); + try + { + return _client.Pipeline.ProcessMessage(message, _context); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + } +} diff --git a/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/CollectionResults/LabsGetBySubscriptionAsyncCollectionResultOfT.cs b/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/CollectionResults/LabsGetBySubscriptionAsyncCollectionResultOfT.cs new file mode 100644 index 000000000000..97973f0bc6b1 --- /dev/null +++ b/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/CollectionResults/LabsGetBySubscriptionAsyncCollectionResultOfT.cs @@ -0,0 +1,90 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; +using System.Threading.Tasks; +using Azure; +using Azure.Core; +using Azure.Core.Pipeline; +using Azure.ResourceManager.DevTestLabs.Models; + +namespace Azure.ResourceManager.DevTestLabs +{ + internal partial class LabsGetBySubscriptionAsyncCollectionResultOfT : AsyncPageable + { + private readonly Labs _client; + private readonly string _subscriptionId; + private readonly string _expand; + private readonly string _filter; + private readonly int? _top; + private readonly string _orderby; + private readonly RequestContext _context; + + /// Initializes a new instance of LabsGetBySubscriptionAsyncCollectionResultOfT, which is used to iterate over the pages of a collection. + /// The Labs client used to send requests. + /// The ID of the target subscription. The value must be an UUID. + /// Specify the $expand query. Example: 'properties($select=defaultStorageAccount)'. + /// The filter to apply to the operation. Example: '$filter=contains(name,'myName'). + /// The maximum number of resources to return from the operation. Example: '$top=10'. + /// The ordering expression for the results, using OData notation. Example: '$orderby=name desc'. + /// The request options, which can override default behaviors of the client pipeline on a per-call basis. + public LabsGetBySubscriptionAsyncCollectionResultOfT(Labs client, string subscriptionId, string expand, string filter, int? top, string @orderby, RequestContext context) : base(context?.CancellationToken ?? default) + { + _client = client; + _subscriptionId = subscriptionId; + _expand = expand; + _filter = filter; + _top = top; + _orderby = @orderby; + _context = context; + } + + /// Gets the pages of LabsGetBySubscriptionAsyncCollectionResultOfT as an enumerable collection. + /// A continuation token indicating where to resume paging. + /// The number of items per page. + /// The pages of LabsGetBySubscriptionAsyncCollectionResultOfT 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; + } + LabList result = LabList.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, _expand, _filter, _top, _orderby, _context) : _client.CreateGetBySubscriptionRequest(_subscriptionId, _expand, _filter, _top, _orderby, _context); + using DiagnosticScope scope = _client.ClientDiagnostics.CreateScope("MockableDevTestLabsSubscriptionResource.GetDevTestLabs"); + scope.Start(); + try + { + return await _client.Pipeline.ProcessMessageAsync(message, _context).ConfigureAwait(false); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + } +} diff --git a/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/CollectionResults/LabsGetBySubscriptionCollectionResultOfT.cs b/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/CollectionResults/LabsGetBySubscriptionCollectionResultOfT.cs new file mode 100644 index 000000000000..3c31678b5384 --- /dev/null +++ b/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/CollectionResults/LabsGetBySubscriptionCollectionResultOfT.cs @@ -0,0 +1,89 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; +using Azure; +using Azure.Core; +using Azure.Core.Pipeline; +using Azure.ResourceManager.DevTestLabs.Models; + +namespace Azure.ResourceManager.DevTestLabs +{ + internal partial class LabsGetBySubscriptionCollectionResultOfT : Pageable + { + private readonly Labs _client; + private readonly string _subscriptionId; + private readonly string _expand; + private readonly string _filter; + private readonly int? _top; + private readonly string _orderby; + private readonly RequestContext _context; + + /// Initializes a new instance of LabsGetBySubscriptionCollectionResultOfT, which is used to iterate over the pages of a collection. + /// The Labs client used to send requests. + /// The ID of the target subscription. The value must be an UUID. + /// Specify the $expand query. Example: 'properties($select=defaultStorageAccount)'. + /// The filter to apply to the operation. Example: '$filter=contains(name,'myName'). + /// The maximum number of resources to return from the operation. Example: '$top=10'. + /// The ordering expression for the results, using OData notation. Example: '$orderby=name desc'. + /// The request options, which can override default behaviors of the client pipeline on a per-call basis. + public LabsGetBySubscriptionCollectionResultOfT(Labs client, string subscriptionId, string expand, string filter, int? top, string @orderby, RequestContext context) : base(context?.CancellationToken ?? default) + { + _client = client; + _subscriptionId = subscriptionId; + _expand = expand; + _filter = filter; + _top = top; + _orderby = @orderby; + _context = context; + } + + /// Gets the pages of LabsGetBySubscriptionCollectionResultOfT as an enumerable collection. + /// A continuation token indicating where to resume paging. + /// The number of items per page. + /// The pages of LabsGetBySubscriptionCollectionResultOfT 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; + } + LabList result = LabList.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, _expand, _filter, _top, _orderby, _context) : _client.CreateGetBySubscriptionRequest(_subscriptionId, _expand, _filter, _top, _orderby, _context); + using DiagnosticScope scope = _client.ClientDiagnostics.CreateScope("MockableDevTestLabsSubscriptionResource.GetDevTestLabs"); + scope.Start(); + try + { + return _client.Pipeline.ProcessMessage(message, _context); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + } +} diff --git a/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/CollectionResults/LabsGetDevTestLabVhdsAsyncCollectionResultOfT.cs b/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/CollectionResults/LabsGetDevTestLabVhdsAsyncCollectionResultOfT.cs new file mode 100644 index 000000000000..58c4975d75af --- /dev/null +++ b/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/CollectionResults/LabsGetDevTestLabVhdsAsyncCollectionResultOfT.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.DevTestLabs.Models; + +namespace Azure.ResourceManager.DevTestLabs +{ + internal partial class LabsGetDevTestLabVhdsAsyncCollectionResultOfT : AsyncPageable + { + private readonly Labs _client; + private readonly string _subscriptionId; + private readonly string _resourceGroupName; + private readonly string _name; + private readonly RequestContext _context; + + /// Initializes a new instance of LabsGetDevTestLabVhdsAsyncCollectionResultOfT, which is used to iterate over the pages of a collection. + /// The Labs 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 name of the lab. + /// The request options, which can override default behaviors of the client pipeline on a per-call basis. + public LabsGetDevTestLabVhdsAsyncCollectionResultOfT(Labs client, string subscriptionId, string resourceGroupName, string name, RequestContext context) : base(context?.CancellationToken ?? default) + { + _client = client; + _subscriptionId = subscriptionId; + _resourceGroupName = resourceGroupName; + _name = name; + _context = context; + } + + /// Gets the pages of LabsGetDevTestLabVhdsAsyncCollectionResultOfT as an enumerable collection. + /// A continuation token indicating where to resume paging. + /// The number of items per page. + /// The pages of LabsGetDevTestLabVhdsAsyncCollectionResultOfT 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; + } + LabVhdList result = LabVhdList.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.CreateNextGetDevTestLabVhdsRequest(nextLink, _subscriptionId, _resourceGroupName, _name, _context) : _client.CreateGetDevTestLabVhdsRequest(_subscriptionId, _resourceGroupName, _name, _context); + using DiagnosticScope scope = _client.ClientDiagnostics.CreateScope("DevTestLabResource.GetDevTestLabVhds"); + scope.Start(); + try + { + return await _client.Pipeline.ProcessMessageAsync(message, _context).ConfigureAwait(false); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + } +} diff --git a/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/CollectionResults/LabsGetDevTestLabVhdsCollectionResultOfT.cs b/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/CollectionResults/LabsGetDevTestLabVhdsCollectionResultOfT.cs new file mode 100644 index 000000000000..ce58aa7fecf7 --- /dev/null +++ b/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/CollectionResults/LabsGetDevTestLabVhdsCollectionResultOfT.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.DevTestLabs.Models; + +namespace Azure.ResourceManager.DevTestLabs +{ + internal partial class LabsGetDevTestLabVhdsCollectionResultOfT : Pageable + { + private readonly Labs _client; + private readonly string _subscriptionId; + private readonly string _resourceGroupName; + private readonly string _name; + private readonly RequestContext _context; + + /// Initializes a new instance of LabsGetDevTestLabVhdsCollectionResultOfT, which is used to iterate over the pages of a collection. + /// The Labs 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 name of the lab. + /// The request options, which can override default behaviors of the client pipeline on a per-call basis. + public LabsGetDevTestLabVhdsCollectionResultOfT(Labs client, string subscriptionId, string resourceGroupName, string name, RequestContext context) : base(context?.CancellationToken ?? default) + { + _client = client; + _subscriptionId = subscriptionId; + _resourceGroupName = resourceGroupName; + _name = name; + _context = context; + } + + /// Gets the pages of LabsGetDevTestLabVhdsCollectionResultOfT as an enumerable collection. + /// A continuation token indicating where to resume paging. + /// The number of items per page. + /// The pages of LabsGetDevTestLabVhdsCollectionResultOfT 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; + } + LabVhdList result = LabVhdList.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.CreateNextGetDevTestLabVhdsRequest(nextLink, _subscriptionId, _resourceGroupName, _name, _context) : _client.CreateGetDevTestLabVhdsRequest(_subscriptionId, _resourceGroupName, _name, _context); + using DiagnosticScope scope = _client.ClientDiagnostics.CreateScope("DevTestLabResource.GetDevTestLabVhds"); + scope.Start(); + try + { + return _client.Pipeline.ProcessMessage(message, _context); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + } +} diff --git a/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/CollectionResults/NotificationChannelsGetAllAsyncCollectionResultOfT.cs b/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/CollectionResults/NotificationChannelsGetAllAsyncCollectionResultOfT.cs new file mode 100644 index 000000000000..e2d72996ea55 --- /dev/null +++ b/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/CollectionResults/NotificationChannelsGetAllAsyncCollectionResultOfT.cs @@ -0,0 +1,96 @@ +// 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.DevTestLabs.Models; + +namespace Azure.ResourceManager.DevTestLabs +{ + internal partial class NotificationChannelsGetAllAsyncCollectionResultOfT : AsyncPageable + { + private readonly NotificationChannels _client; + private readonly string _subscriptionId; + private readonly string _resourceGroupName; + private readonly string _labName; + private readonly string _expand; + private readonly string _filter; + private readonly int? _top; + private readonly string _orderby; + private readonly RequestContext _context; + + /// Initializes a new instance of NotificationChannelsGetAllAsyncCollectionResultOfT, which is used to iterate over the pages of a collection. + /// The NotificationChannels 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 name of the lab. + /// Specify the $expand query. Example: 'properties($select=webHookUrl)'. + /// The filter to apply to the operation. Example: '$filter=contains(name,'myName'). + /// The maximum number of resources to return from the operation. Example: '$top=10'. + /// The ordering expression for the results, using OData notation. Example: '$orderby=name desc'. + /// The request options, which can override default behaviors of the client pipeline on a per-call basis. + public NotificationChannelsGetAllAsyncCollectionResultOfT(NotificationChannels client, string subscriptionId, string resourceGroupName, string labName, string expand, string filter, int? top, string @orderby, RequestContext context) : base(context?.CancellationToken ?? default) + { + _client = client; + _subscriptionId = subscriptionId; + _resourceGroupName = resourceGroupName; + _labName = labName; + _expand = expand; + _filter = filter; + _top = top; + _orderby = @orderby; + _context = context; + } + + /// Gets the pages of NotificationChannelsGetAllAsyncCollectionResultOfT as an enumerable collection. + /// A continuation token indicating where to resume paging. + /// The number of items per page. + /// The pages of NotificationChannelsGetAllAsyncCollectionResultOfT 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; + } + NotificationChannelList result = NotificationChannelList.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.CreateNextGetAllRequest(nextLink, _subscriptionId, _resourceGroupName, _labName, _expand, _filter, _top, _orderby, _context) : _client.CreateGetAllRequest(_subscriptionId, _resourceGroupName, _labName, _expand, _filter, _top, _orderby, _context); + using DiagnosticScope scope = _client.ClientDiagnostics.CreateScope("DevTestLabNotificationChannelCollection.GetAll"); + scope.Start(); + try + { + return await _client.Pipeline.ProcessMessageAsync(message, _context).ConfigureAwait(false); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + } +} diff --git a/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/CollectionResults/NotificationChannelsGetAllCollectionResultOfT.cs b/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/CollectionResults/NotificationChannelsGetAllCollectionResultOfT.cs new file mode 100644 index 000000000000..366a33b32098 --- /dev/null +++ b/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/CollectionResults/NotificationChannelsGetAllCollectionResultOfT.cs @@ -0,0 +1,95 @@ +// 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.DevTestLabs.Models; + +namespace Azure.ResourceManager.DevTestLabs +{ + internal partial class NotificationChannelsGetAllCollectionResultOfT : Pageable + { + private readonly NotificationChannels _client; + private readonly string _subscriptionId; + private readonly string _resourceGroupName; + private readonly string _labName; + private readonly string _expand; + private readonly string _filter; + private readonly int? _top; + private readonly string _orderby; + private readonly RequestContext _context; + + /// Initializes a new instance of NotificationChannelsGetAllCollectionResultOfT, which is used to iterate over the pages of a collection. + /// The NotificationChannels 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 name of the lab. + /// Specify the $expand query. Example: 'properties($select=webHookUrl)'. + /// The filter to apply to the operation. Example: '$filter=contains(name,'myName'). + /// The maximum number of resources to return from the operation. Example: '$top=10'. + /// The ordering expression for the results, using OData notation. Example: '$orderby=name desc'. + /// The request options, which can override default behaviors of the client pipeline on a per-call basis. + public NotificationChannelsGetAllCollectionResultOfT(NotificationChannels client, string subscriptionId, string resourceGroupName, string labName, string expand, string filter, int? top, string @orderby, RequestContext context) : base(context?.CancellationToken ?? default) + { + _client = client; + _subscriptionId = subscriptionId; + _resourceGroupName = resourceGroupName; + _labName = labName; + _expand = expand; + _filter = filter; + _top = top; + _orderby = @orderby; + _context = context; + } + + /// Gets the pages of NotificationChannelsGetAllCollectionResultOfT as an enumerable collection. + /// A continuation token indicating where to resume paging. + /// The number of items per page. + /// The pages of NotificationChannelsGetAllCollectionResultOfT 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; + } + NotificationChannelList result = NotificationChannelList.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.CreateNextGetAllRequest(nextLink, _subscriptionId, _resourceGroupName, _labName, _expand, _filter, _top, _orderby, _context) : _client.CreateGetAllRequest(_subscriptionId, _resourceGroupName, _labName, _expand, _filter, _top, _orderby, _context); + using DiagnosticScope scope = _client.ClientDiagnostics.CreateScope("DevTestLabNotificationChannelCollection.GetAll"); + scope.Start(); + try + { + return _client.Pipeline.ProcessMessage(message, _context); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + } +} diff --git a/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/CollectionResults/PoliciesGetAllAsyncCollectionResultOfT.cs b/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/CollectionResults/PoliciesGetAllAsyncCollectionResultOfT.cs new file mode 100644 index 000000000000..571601898ca0 --- /dev/null +++ b/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/CollectionResults/PoliciesGetAllAsyncCollectionResultOfT.cs @@ -0,0 +1,99 @@ +// 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.DevTestLabs.Models; + +namespace Azure.ResourceManager.DevTestLabs +{ + internal partial class PoliciesGetAllAsyncCollectionResultOfT : AsyncPageable + { + private readonly Policies _client; + private readonly string _subscriptionId; + private readonly string _resourceGroupName; + private readonly string _labName; + private readonly string _policySetName; + private readonly string _expand; + private readonly string _filter; + private readonly int? _top; + private readonly string _orderby; + private readonly RequestContext _context; + + /// Initializes a new instance of PoliciesGetAllAsyncCollectionResultOfT, which is used to iterate over the pages of a collection. + /// The Policies 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. + /// labs. + /// policysets. + /// Specify the $expand query. Example: 'properties($select=description)'. + /// The filter to apply to the operation. Example: '$filter=contains(name,'myName'). + /// The maximum number of resources to return from the operation. Example: '$top=10'. + /// The ordering expression for the results, using OData notation. Example: '$orderby=name desc'. + /// The request options, which can override default behaviors of the client pipeline on a per-call basis. + public PoliciesGetAllAsyncCollectionResultOfT(Policies client, string subscriptionId, string resourceGroupName, string labName, string policySetName, string expand, string filter, int? top, string @orderby, RequestContext context) : base(context?.CancellationToken ?? default) + { + _client = client; + _subscriptionId = subscriptionId; + _resourceGroupName = resourceGroupName; + _labName = labName; + _policySetName = policySetName; + _expand = expand; + _filter = filter; + _top = top; + _orderby = @orderby; + _context = context; + } + + /// Gets the pages of PoliciesGetAllAsyncCollectionResultOfT as an enumerable collection. + /// A continuation token indicating where to resume paging. + /// The number of items per page. + /// The pages of PoliciesGetAllAsyncCollectionResultOfT 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; + } + PolicyList result = PolicyList.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.CreateNextGetAllRequest(nextLink, _subscriptionId, _resourceGroupName, _labName, _policySetName, _expand, _filter, _top, _orderby, _context) : _client.CreateGetAllRequest(_subscriptionId, _resourceGroupName, _labName, _policySetName, _expand, _filter, _top, _orderby, _context); + using DiagnosticScope scope = _client.ClientDiagnostics.CreateScope("DevTestLabPolicyCollection.GetAll"); + scope.Start(); + try + { + return await _client.Pipeline.ProcessMessageAsync(message, _context).ConfigureAwait(false); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + } +} diff --git a/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/CollectionResults/PoliciesGetAllCollectionResultOfT.cs b/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/CollectionResults/PoliciesGetAllCollectionResultOfT.cs new file mode 100644 index 000000000000..ecdd6b4488a7 --- /dev/null +++ b/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/CollectionResults/PoliciesGetAllCollectionResultOfT.cs @@ -0,0 +1,98 @@ +// 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.DevTestLabs.Models; + +namespace Azure.ResourceManager.DevTestLabs +{ + internal partial class PoliciesGetAllCollectionResultOfT : Pageable + { + private readonly Policies _client; + private readonly string _subscriptionId; + private readonly string _resourceGroupName; + private readonly string _labName; + private readonly string _policySetName; + private readonly string _expand; + private readonly string _filter; + private readonly int? _top; + private readonly string _orderby; + private readonly RequestContext _context; + + /// Initializes a new instance of PoliciesGetAllCollectionResultOfT, which is used to iterate over the pages of a collection. + /// The Policies 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. + /// labs. + /// policysets. + /// Specify the $expand query. Example: 'properties($select=description)'. + /// The filter to apply to the operation. Example: '$filter=contains(name,'myName'). + /// The maximum number of resources to return from the operation. Example: '$top=10'. + /// The ordering expression for the results, using OData notation. Example: '$orderby=name desc'. + /// The request options, which can override default behaviors of the client pipeline on a per-call basis. + public PoliciesGetAllCollectionResultOfT(Policies client, string subscriptionId, string resourceGroupName, string labName, string policySetName, string expand, string filter, int? top, string @orderby, RequestContext context) : base(context?.CancellationToken ?? default) + { + _client = client; + _subscriptionId = subscriptionId; + _resourceGroupName = resourceGroupName; + _labName = labName; + _policySetName = policySetName; + _expand = expand; + _filter = filter; + _top = top; + _orderby = @orderby; + _context = context; + } + + /// Gets the pages of PoliciesGetAllCollectionResultOfT as an enumerable collection. + /// A continuation token indicating where to resume paging. + /// The number of items per page. + /// The pages of PoliciesGetAllCollectionResultOfT 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; + } + PolicyList result = PolicyList.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.CreateNextGetAllRequest(nextLink, _subscriptionId, _resourceGroupName, _labName, _policySetName, _expand, _filter, _top, _orderby, _context) : _client.CreateGetAllRequest(_subscriptionId, _resourceGroupName, _labName, _policySetName, _expand, _filter, _top, _orderby, _context); + using DiagnosticScope scope = _client.ClientDiagnostics.CreateScope("DevTestLabPolicyCollection.GetAll"); + scope.Start(); + try + { + return _client.Pipeline.ProcessMessage(message, _context); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + } +} diff --git a/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/CollectionResults/SecretsGetAllAsyncCollectionResultOfT.cs b/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/CollectionResults/SecretsGetAllAsyncCollectionResultOfT.cs new file mode 100644 index 000000000000..fd447c306d37 --- /dev/null +++ b/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/CollectionResults/SecretsGetAllAsyncCollectionResultOfT.cs @@ -0,0 +1,99 @@ +// 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.DevTestLabs.Models; + +namespace Azure.ResourceManager.DevTestLabs +{ + internal partial class SecretsGetAllAsyncCollectionResultOfT : AsyncPageable + { + private readonly Secrets _client; + private readonly string _subscriptionId; + private readonly string _resourceGroupName; + private readonly string _labName; + private readonly string _userName; + private readonly string _expand; + private readonly string _filter; + private readonly int? _top; + private readonly string _orderby; + private readonly RequestContext _context; + + /// Initializes a new instance of SecretsGetAllAsyncCollectionResultOfT, which is used to iterate over the pages of a collection. + /// The Secrets 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 name of the lab. + /// The name of the user profile. + /// Specify the $expand query. Example: 'properties($select=value)'. + /// The filter to apply to the operation. Example: '$filter=contains(name,'myName'). + /// The maximum number of resources to return from the operation. Example: '$top=10'. + /// The ordering expression for the results, using OData notation. Example: '$orderby=name desc'. + /// The request options, which can override default behaviors of the client pipeline on a per-call basis. + public SecretsGetAllAsyncCollectionResultOfT(Secrets client, string subscriptionId, string resourceGroupName, string labName, string userName, string expand, string filter, int? top, string @orderby, RequestContext context) : base(context?.CancellationToken ?? default) + { + _client = client; + _subscriptionId = subscriptionId; + _resourceGroupName = resourceGroupName; + _labName = labName; + _userName = userName; + _expand = expand; + _filter = filter; + _top = top; + _orderby = @orderby; + _context = context; + } + + /// Gets the pages of SecretsGetAllAsyncCollectionResultOfT as an enumerable collection. + /// A continuation token indicating where to resume paging. + /// The number of items per page. + /// The pages of SecretsGetAllAsyncCollectionResultOfT 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; + } + SecretList result = SecretList.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.CreateNextGetAllRequest(nextLink, _subscriptionId, _resourceGroupName, _labName, _userName, _expand, _filter, _top, _orderby, _context) : _client.CreateGetAllRequest(_subscriptionId, _resourceGroupName, _labName, _userName, _expand, _filter, _top, _orderby, _context); + using DiagnosticScope scope = _client.ClientDiagnostics.CreateScope("DevTestLabSecretCollection.GetAll"); + scope.Start(); + try + { + return await _client.Pipeline.ProcessMessageAsync(message, _context).ConfigureAwait(false); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + } +} diff --git a/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/CollectionResults/SecretsGetAllCollectionResultOfT.cs b/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/CollectionResults/SecretsGetAllCollectionResultOfT.cs new file mode 100644 index 000000000000..0298d5d09dc7 --- /dev/null +++ b/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/CollectionResults/SecretsGetAllCollectionResultOfT.cs @@ -0,0 +1,98 @@ +// 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.DevTestLabs.Models; + +namespace Azure.ResourceManager.DevTestLabs +{ + internal partial class SecretsGetAllCollectionResultOfT : Pageable + { + private readonly Secrets _client; + private readonly string _subscriptionId; + private readonly string _resourceGroupName; + private readonly string _labName; + private readonly string _userName; + private readonly string _expand; + private readonly string _filter; + private readonly int? _top; + private readonly string _orderby; + private readonly RequestContext _context; + + /// Initializes a new instance of SecretsGetAllCollectionResultOfT, which is used to iterate over the pages of a collection. + /// The Secrets 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 name of the lab. + /// The name of the user profile. + /// Specify the $expand query. Example: 'properties($select=value)'. + /// The filter to apply to the operation. Example: '$filter=contains(name,'myName'). + /// The maximum number of resources to return from the operation. Example: '$top=10'. + /// The ordering expression for the results, using OData notation. Example: '$orderby=name desc'. + /// The request options, which can override default behaviors of the client pipeline on a per-call basis. + public SecretsGetAllCollectionResultOfT(Secrets client, string subscriptionId, string resourceGroupName, string labName, string userName, string expand, string filter, int? top, string @orderby, RequestContext context) : base(context?.CancellationToken ?? default) + { + _client = client; + _subscriptionId = subscriptionId; + _resourceGroupName = resourceGroupName; + _labName = labName; + _userName = userName; + _expand = expand; + _filter = filter; + _top = top; + _orderby = @orderby; + _context = context; + } + + /// Gets the pages of SecretsGetAllCollectionResultOfT as an enumerable collection. + /// A continuation token indicating where to resume paging. + /// The number of items per page. + /// The pages of SecretsGetAllCollectionResultOfT 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; + } + SecretList result = SecretList.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.CreateNextGetAllRequest(nextLink, _subscriptionId, _resourceGroupName, _labName, _userName, _expand, _filter, _top, _orderby, _context) : _client.CreateGetAllRequest(_subscriptionId, _resourceGroupName, _labName, _userName, _expand, _filter, _top, _orderby, _context); + using DiagnosticScope scope = _client.ClientDiagnostics.CreateScope("DevTestLabSecretCollection.GetAll"); + scope.Start(); + try + { + return _client.Pipeline.ProcessMessage(message, _context); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + } +} diff --git a/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/CollectionResults/ServiceFabricsGetAllAsyncCollectionResultOfT.cs b/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/CollectionResults/ServiceFabricsGetAllAsyncCollectionResultOfT.cs new file mode 100644 index 000000000000..8a71994e56cf --- /dev/null +++ b/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/CollectionResults/ServiceFabricsGetAllAsyncCollectionResultOfT.cs @@ -0,0 +1,99 @@ +// 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.DevTestLabs.Models; + +namespace Azure.ResourceManager.DevTestLabs +{ + internal partial class ServiceFabricsGetAllAsyncCollectionResultOfT : AsyncPageable + { + private readonly ServiceFabrics _client; + private readonly string _subscriptionId; + private readonly string _resourceGroupName; + private readonly string _labName; + private readonly string _userName; + private readonly string _expand; + private readonly string _filter; + private readonly int? _top; + private readonly string _orderby; + private readonly RequestContext _context; + + /// Initializes a new instance of ServiceFabricsGetAllAsyncCollectionResultOfT, which is used to iterate over the pages of a collection. + /// The ServiceFabrics 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 name of the lab. + /// The name of the user profile. + /// Specify the $expand query. Example: 'properties($expand=applicableSchedule)'. + /// The filter to apply to the operation. Example: '$filter=contains(name,'myName'). + /// The maximum number of resources to return from the operation. Example: '$top=10'. + /// The ordering expression for the results, using OData notation. Example: '$orderby=name desc'. + /// The request options, which can override default behaviors of the client pipeline on a per-call basis. + public ServiceFabricsGetAllAsyncCollectionResultOfT(ServiceFabrics client, string subscriptionId, string resourceGroupName, string labName, string userName, string expand, string filter, int? top, string @orderby, RequestContext context) : base(context?.CancellationToken ?? default) + { + _client = client; + _subscriptionId = subscriptionId; + _resourceGroupName = resourceGroupName; + _labName = labName; + _userName = userName; + _expand = expand; + _filter = filter; + _top = top; + _orderby = @orderby; + _context = context; + } + + /// Gets the pages of ServiceFabricsGetAllAsyncCollectionResultOfT as an enumerable collection. + /// A continuation token indicating where to resume paging. + /// The number of items per page. + /// The pages of ServiceFabricsGetAllAsyncCollectionResultOfT 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; + } + ServiceFabricList result = ServiceFabricList.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.CreateNextGetAllRequest(nextLink, _subscriptionId, _resourceGroupName, _labName, _userName, _expand, _filter, _top, _orderby, _context) : _client.CreateGetAllRequest(_subscriptionId, _resourceGroupName, _labName, _userName, _expand, _filter, _top, _orderby, _context); + using DiagnosticScope scope = _client.ClientDiagnostics.CreateScope("DevTestLabServiceFabricCollection.GetAll"); + scope.Start(); + try + { + return await _client.Pipeline.ProcessMessageAsync(message, _context).ConfigureAwait(false); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + } +} diff --git a/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/CollectionResults/ServiceFabricsGetAllCollectionResultOfT.cs b/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/CollectionResults/ServiceFabricsGetAllCollectionResultOfT.cs new file mode 100644 index 000000000000..5709118119e4 --- /dev/null +++ b/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/CollectionResults/ServiceFabricsGetAllCollectionResultOfT.cs @@ -0,0 +1,98 @@ +// 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.DevTestLabs.Models; + +namespace Azure.ResourceManager.DevTestLabs +{ + internal partial class ServiceFabricsGetAllCollectionResultOfT : Pageable + { + private readonly ServiceFabrics _client; + private readonly string _subscriptionId; + private readonly string _resourceGroupName; + private readonly string _labName; + private readonly string _userName; + private readonly string _expand; + private readonly string _filter; + private readonly int? _top; + private readonly string _orderby; + private readonly RequestContext _context; + + /// Initializes a new instance of ServiceFabricsGetAllCollectionResultOfT, which is used to iterate over the pages of a collection. + /// The ServiceFabrics 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 name of the lab. + /// The name of the user profile. + /// Specify the $expand query. Example: 'properties($expand=applicableSchedule)'. + /// The filter to apply to the operation. Example: '$filter=contains(name,'myName'). + /// The maximum number of resources to return from the operation. Example: '$top=10'. + /// The ordering expression for the results, using OData notation. Example: '$orderby=name desc'. + /// The request options, which can override default behaviors of the client pipeline on a per-call basis. + public ServiceFabricsGetAllCollectionResultOfT(ServiceFabrics client, string subscriptionId, string resourceGroupName, string labName, string userName, string expand, string filter, int? top, string @orderby, RequestContext context) : base(context?.CancellationToken ?? default) + { + _client = client; + _subscriptionId = subscriptionId; + _resourceGroupName = resourceGroupName; + _labName = labName; + _userName = userName; + _expand = expand; + _filter = filter; + _top = top; + _orderby = @orderby; + _context = context; + } + + /// Gets the pages of ServiceFabricsGetAllCollectionResultOfT as an enumerable collection. + /// A continuation token indicating where to resume paging. + /// The number of items per page. + /// The pages of ServiceFabricsGetAllCollectionResultOfT 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; + } + ServiceFabricList result = ServiceFabricList.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.CreateNextGetAllRequest(nextLink, _subscriptionId, _resourceGroupName, _labName, _userName, _expand, _filter, _top, _orderby, _context) : _client.CreateGetAllRequest(_subscriptionId, _resourceGroupName, _labName, _userName, _expand, _filter, _top, _orderby, _context); + using DiagnosticScope scope = _client.ClientDiagnostics.CreateScope("DevTestLabServiceFabricCollection.GetAll"); + scope.Start(); + try + { + return _client.Pipeline.ProcessMessage(message, _context); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + } +} diff --git a/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/CollectionResults/UsersGetAllAsyncCollectionResultOfT.cs b/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/CollectionResults/UsersGetAllAsyncCollectionResultOfT.cs new file mode 100644 index 000000000000..fc94674f7ba5 --- /dev/null +++ b/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/CollectionResults/UsersGetAllAsyncCollectionResultOfT.cs @@ -0,0 +1,96 @@ +// 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.DevTestLabs.Models; + +namespace Azure.ResourceManager.DevTestLabs +{ + internal partial class UsersGetAllAsyncCollectionResultOfT : AsyncPageable + { + private readonly Users _client; + private readonly string _subscriptionId; + private readonly string _resourceGroupName; + private readonly string _labName; + private readonly string _expand; + private readonly string _filter; + private readonly int? _top; + private readonly string _orderby; + private readonly RequestContext _context; + + /// Initializes a new instance of UsersGetAllAsyncCollectionResultOfT, which is used to iterate over the pages of a collection. + /// The Users 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 name of the lab. + /// Specify the $expand query. Example: 'properties($select=identity)'. + /// The filter to apply to the operation. Example: '$filter=contains(name,'myName'). + /// The maximum number of resources to return from the operation. Example: '$top=10'. + /// The ordering expression for the results, using OData notation. Example: '$orderby=name desc'. + /// The request options, which can override default behaviors of the client pipeline on a per-call basis. + public UsersGetAllAsyncCollectionResultOfT(Users client, string subscriptionId, string resourceGroupName, string labName, string expand, string filter, int? top, string @orderby, RequestContext context) : base(context?.CancellationToken ?? default) + { + _client = client; + _subscriptionId = subscriptionId; + _resourceGroupName = resourceGroupName; + _labName = labName; + _expand = expand; + _filter = filter; + _top = top; + _orderby = @orderby; + _context = context; + } + + /// Gets the pages of UsersGetAllAsyncCollectionResultOfT as an enumerable collection. + /// A continuation token indicating where to resume paging. + /// The number of items per page. + /// The pages of UsersGetAllAsyncCollectionResultOfT 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; + } + UserList result = UserList.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.CreateNextGetAllRequest(nextLink, _subscriptionId, _resourceGroupName, _labName, _expand, _filter, _top, _orderby, _context) : _client.CreateGetAllRequest(_subscriptionId, _resourceGroupName, _labName, _expand, _filter, _top, _orderby, _context); + using DiagnosticScope scope = _client.ClientDiagnostics.CreateScope("DevTestLabUserCollection.GetAll"); + scope.Start(); + try + { + return await _client.Pipeline.ProcessMessageAsync(message, _context).ConfigureAwait(false); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + } +} diff --git a/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/CollectionResults/UsersGetAllCollectionResultOfT.cs b/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/CollectionResults/UsersGetAllCollectionResultOfT.cs new file mode 100644 index 000000000000..de39b6282543 --- /dev/null +++ b/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/CollectionResults/UsersGetAllCollectionResultOfT.cs @@ -0,0 +1,95 @@ +// 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.DevTestLabs.Models; + +namespace Azure.ResourceManager.DevTestLabs +{ + internal partial class UsersGetAllCollectionResultOfT : Pageable + { + private readonly Users _client; + private readonly string _subscriptionId; + private readonly string _resourceGroupName; + private readonly string _labName; + private readonly string _expand; + private readonly string _filter; + private readonly int? _top; + private readonly string _orderby; + private readonly RequestContext _context; + + /// Initializes a new instance of UsersGetAllCollectionResultOfT, which is used to iterate over the pages of a collection. + /// The Users 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 name of the lab. + /// Specify the $expand query. Example: 'properties($select=identity)'. + /// The filter to apply to the operation. Example: '$filter=contains(name,'myName'). + /// The maximum number of resources to return from the operation. Example: '$top=10'. + /// The ordering expression for the results, using OData notation. Example: '$orderby=name desc'. + /// The request options, which can override default behaviors of the client pipeline on a per-call basis. + public UsersGetAllCollectionResultOfT(Users client, string subscriptionId, string resourceGroupName, string labName, string expand, string filter, int? top, string @orderby, RequestContext context) : base(context?.CancellationToken ?? default) + { + _client = client; + _subscriptionId = subscriptionId; + _resourceGroupName = resourceGroupName; + _labName = labName; + _expand = expand; + _filter = filter; + _top = top; + _orderby = @orderby; + _context = context; + } + + /// Gets the pages of UsersGetAllCollectionResultOfT as an enumerable collection. + /// A continuation token indicating where to resume paging. + /// The number of items per page. + /// The pages of UsersGetAllCollectionResultOfT 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; + } + UserList result = UserList.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.CreateNextGetAllRequest(nextLink, _subscriptionId, _resourceGroupName, _labName, _expand, _filter, _top, _orderby, _context) : _client.CreateGetAllRequest(_subscriptionId, _resourceGroupName, _labName, _expand, _filter, _top, _orderby, _context); + using DiagnosticScope scope = _client.ClientDiagnostics.CreateScope("DevTestLabUserCollection.GetAll"); + scope.Start(); + try + { + return _client.Pipeline.ProcessMessage(message, _context); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + } +} diff --git a/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/CollectionResults/VirtualMachinesGetAllAsyncCollectionResultOfT.cs b/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/CollectionResults/VirtualMachinesGetAllAsyncCollectionResultOfT.cs new file mode 100644 index 000000000000..f89713098b50 --- /dev/null +++ b/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/CollectionResults/VirtualMachinesGetAllAsyncCollectionResultOfT.cs @@ -0,0 +1,96 @@ +// 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.DevTestLabs.Models; + +namespace Azure.ResourceManager.DevTestLabs +{ + internal partial class VirtualMachinesGetAllAsyncCollectionResultOfT : AsyncPageable + { + private readonly VirtualMachines _client; + private readonly string _subscriptionId; + private readonly string _resourceGroupName; + private readonly string _labName; + private readonly string _expand; + private readonly string _filter; + private readonly int? _top; + private readonly string _orderby; + private readonly RequestContext _context; + + /// Initializes a new instance of VirtualMachinesGetAllAsyncCollectionResultOfT, which is used to iterate over the pages of a collection. + /// The VirtualMachines 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 name of the lab. + /// Specify the $expand query. Example: 'properties($expand=artifacts,computeVm,networkInterface,applicableSchedule)'. + /// The filter to apply to the operation. Example: '$filter=contains(name,'myName'). + /// The maximum number of resources to return from the operation. Example: '$top=10'. + /// The ordering expression for the results, using OData notation. Example: '$orderby=name desc'. + /// The request options, which can override default behaviors of the client pipeline on a per-call basis. + public VirtualMachinesGetAllAsyncCollectionResultOfT(VirtualMachines client, string subscriptionId, string resourceGroupName, string labName, string expand, string filter, int? top, string @orderby, RequestContext context) : base(context?.CancellationToken ?? default) + { + _client = client; + _subscriptionId = subscriptionId; + _resourceGroupName = resourceGroupName; + _labName = labName; + _expand = expand; + _filter = filter; + _top = top; + _orderby = @orderby; + _context = context; + } + + /// Gets the pages of VirtualMachinesGetAllAsyncCollectionResultOfT as an enumerable collection. + /// A continuation token indicating where to resume paging. + /// The number of items per page. + /// The pages of VirtualMachinesGetAllAsyncCollectionResultOfT 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; + } + LabVirtualMachineList result = LabVirtualMachineList.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.CreateNextGetAllRequest(nextLink, _subscriptionId, _resourceGroupName, _labName, _expand, _filter, _top, _orderby, _context) : _client.CreateGetAllRequest(_subscriptionId, _resourceGroupName, _labName, _expand, _filter, _top, _orderby, _context); + using DiagnosticScope scope = _client.ClientDiagnostics.CreateScope("DevTestLabVmCollection.GetAll"); + scope.Start(); + try + { + return await _client.Pipeline.ProcessMessageAsync(message, _context).ConfigureAwait(false); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + } +} diff --git a/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/CollectionResults/VirtualMachinesGetAllCollectionResultOfT.cs b/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/CollectionResults/VirtualMachinesGetAllCollectionResultOfT.cs new file mode 100644 index 000000000000..bf7eaa26b49e --- /dev/null +++ b/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/CollectionResults/VirtualMachinesGetAllCollectionResultOfT.cs @@ -0,0 +1,95 @@ +// 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.DevTestLabs.Models; + +namespace Azure.ResourceManager.DevTestLabs +{ + internal partial class VirtualMachinesGetAllCollectionResultOfT : Pageable + { + private readonly VirtualMachines _client; + private readonly string _subscriptionId; + private readonly string _resourceGroupName; + private readonly string _labName; + private readonly string _expand; + private readonly string _filter; + private readonly int? _top; + private readonly string _orderby; + private readonly RequestContext _context; + + /// Initializes a new instance of VirtualMachinesGetAllCollectionResultOfT, which is used to iterate over the pages of a collection. + /// The VirtualMachines 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 name of the lab. + /// Specify the $expand query. Example: 'properties($expand=artifacts,computeVm,networkInterface,applicableSchedule)'. + /// The filter to apply to the operation. Example: '$filter=contains(name,'myName'). + /// The maximum number of resources to return from the operation. Example: '$top=10'. + /// The ordering expression for the results, using OData notation. Example: '$orderby=name desc'. + /// The request options, which can override default behaviors of the client pipeline on a per-call basis. + public VirtualMachinesGetAllCollectionResultOfT(VirtualMachines client, string subscriptionId, string resourceGroupName, string labName, string expand, string filter, int? top, string @orderby, RequestContext context) : base(context?.CancellationToken ?? default) + { + _client = client; + _subscriptionId = subscriptionId; + _resourceGroupName = resourceGroupName; + _labName = labName; + _expand = expand; + _filter = filter; + _top = top; + _orderby = @orderby; + _context = context; + } + + /// Gets the pages of VirtualMachinesGetAllCollectionResultOfT as an enumerable collection. + /// A continuation token indicating where to resume paging. + /// The number of items per page. + /// The pages of VirtualMachinesGetAllCollectionResultOfT 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; + } + LabVirtualMachineList result = LabVirtualMachineList.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.CreateNextGetAllRequest(nextLink, _subscriptionId, _resourceGroupName, _labName, _expand, _filter, _top, _orderby, _context) : _client.CreateGetAllRequest(_subscriptionId, _resourceGroupName, _labName, _expand, _filter, _top, _orderby, _context); + using DiagnosticScope scope = _client.ClientDiagnostics.CreateScope("DevTestLabVmCollection.GetAll"); + scope.Start(); + try + { + return _client.Pipeline.ProcessMessage(message, _context); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + } +} diff --git a/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/CollectionResults/VirtualNetworksGetAllAsyncCollectionResultOfT.cs b/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/CollectionResults/VirtualNetworksGetAllAsyncCollectionResultOfT.cs new file mode 100644 index 000000000000..e8e20300714e --- /dev/null +++ b/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/CollectionResults/VirtualNetworksGetAllAsyncCollectionResultOfT.cs @@ -0,0 +1,96 @@ +// 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.DevTestLabs.Models; + +namespace Azure.ResourceManager.DevTestLabs +{ + internal partial class VirtualNetworksGetAllAsyncCollectionResultOfT : AsyncPageable + { + private readonly VirtualNetworks _client; + private readonly string _subscriptionId; + private readonly string _resourceGroupName; + private readonly string _labName; + private readonly string _expand; + private readonly string _filter; + private readonly int? _top; + private readonly string _orderby; + private readonly RequestContext _context; + + /// Initializes a new instance of VirtualNetworksGetAllAsyncCollectionResultOfT, which is used to iterate over the pages of a collection. + /// The VirtualNetworks 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 name of the lab. + /// Specify the $expand query. Example: 'properties($expand=externalSubnets)'. + /// The filter to apply to the operation. Example: '$filter=contains(name,'myName'). + /// The maximum number of resources to return from the operation. Example: '$top=10'. + /// The ordering expression for the results, using OData notation. Example: '$orderby=name desc'. + /// The request options, which can override default behaviors of the client pipeline on a per-call basis. + public VirtualNetworksGetAllAsyncCollectionResultOfT(VirtualNetworks client, string subscriptionId, string resourceGroupName, string labName, string expand, string filter, int? top, string @orderby, RequestContext context) : base(context?.CancellationToken ?? default) + { + _client = client; + _subscriptionId = subscriptionId; + _resourceGroupName = resourceGroupName; + _labName = labName; + _expand = expand; + _filter = filter; + _top = top; + _orderby = @orderby; + _context = context; + } + + /// Gets the pages of VirtualNetworksGetAllAsyncCollectionResultOfT as an enumerable collection. + /// A continuation token indicating where to resume paging. + /// The number of items per page. + /// The pages of VirtualNetworksGetAllAsyncCollectionResultOfT 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; + } + VirtualNetworkList result = VirtualNetworkList.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.CreateNextGetAllRequest(nextLink, _subscriptionId, _resourceGroupName, _labName, _expand, _filter, _top, _orderby, _context) : _client.CreateGetAllRequest(_subscriptionId, _resourceGroupName, _labName, _expand, _filter, _top, _orderby, _context); + using DiagnosticScope scope = _client.ClientDiagnostics.CreateScope("DevTestLabVirtualNetworkCollection.GetAll"); + scope.Start(); + try + { + return await _client.Pipeline.ProcessMessageAsync(message, _context).ConfigureAwait(false); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + } +} diff --git a/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/CollectionResults/VirtualNetworksGetAllCollectionResultOfT.cs b/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/CollectionResults/VirtualNetworksGetAllCollectionResultOfT.cs new file mode 100644 index 000000000000..9947f295702a --- /dev/null +++ b/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/CollectionResults/VirtualNetworksGetAllCollectionResultOfT.cs @@ -0,0 +1,95 @@ +// 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.DevTestLabs.Models; + +namespace Azure.ResourceManager.DevTestLabs +{ + internal partial class VirtualNetworksGetAllCollectionResultOfT : Pageable + { + private readonly VirtualNetworks _client; + private readonly string _subscriptionId; + private readonly string _resourceGroupName; + private readonly string _labName; + private readonly string _expand; + private readonly string _filter; + private readonly int? _top; + private readonly string _orderby; + private readonly RequestContext _context; + + /// Initializes a new instance of VirtualNetworksGetAllCollectionResultOfT, which is used to iterate over the pages of a collection. + /// The VirtualNetworks 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 name of the lab. + /// Specify the $expand query. Example: 'properties($expand=externalSubnets)'. + /// The filter to apply to the operation. Example: '$filter=contains(name,'myName'). + /// The maximum number of resources to return from the operation. Example: '$top=10'. + /// The ordering expression for the results, using OData notation. Example: '$orderby=name desc'. + /// The request options, which can override default behaviors of the client pipeline on a per-call basis. + public VirtualNetworksGetAllCollectionResultOfT(VirtualNetworks client, string subscriptionId, string resourceGroupName, string labName, string expand, string filter, int? top, string @orderby, RequestContext context) : base(context?.CancellationToken ?? default) + { + _client = client; + _subscriptionId = subscriptionId; + _resourceGroupName = resourceGroupName; + _labName = labName; + _expand = expand; + _filter = filter; + _top = top; + _orderby = @orderby; + _context = context; + } + + /// Gets the pages of VirtualNetworksGetAllCollectionResultOfT as an enumerable collection. + /// A continuation token indicating where to resume paging. + /// The number of items per page. + /// The pages of VirtualNetworksGetAllCollectionResultOfT 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; + } + VirtualNetworkList result = VirtualNetworkList.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.CreateNextGetAllRequest(nextLink, _subscriptionId, _resourceGroupName, _labName, _expand, _filter, _top, _orderby, _context) : _client.CreateGetAllRequest(_subscriptionId, _resourceGroupName, _labName, _expand, _filter, _top, _orderby, _context); + using DiagnosticScope scope = _client.ClientDiagnostics.CreateScope("DevTestLabVirtualNetworkCollection.GetAll"); + scope.Start(); + try + { + return _client.Pipeline.ProcessMessage(message, _context); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + } +} diff --git a/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/DevTestLabArmTemplateCollection.cs b/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/DevTestLabArmTemplateCollection.cs index a3b638600caa..87475a7b7c4c 100644 --- a/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/DevTestLabArmTemplateCollection.cs +++ b/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/DevTestLabArmTemplateCollection.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.DevTestLabs { @@ -24,70 +25,76 @@ namespace Azure.ResourceManager.DevTestLabs /// public partial class DevTestLabArmTemplateCollection : ArmCollection, IEnumerable, IAsyncEnumerable { - private readonly ClientDiagnostics _devTestLabArmTemplateArmTemplatesClientDiagnostics; - private readonly ArmTemplatesRestOperations _devTestLabArmTemplateArmTemplatesRestClient; + private readonly ClientDiagnostics _armTemplatesClientDiagnostics; + private readonly ArmTemplates _armTemplatesRestClient; - /// Initializes a new instance of the class for mocking. + /// Initializes a new instance of DevTestLabArmTemplateCollection for mocking. protected DevTestLabArmTemplateCollection() { } - /// 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 DevTestLabArmTemplateCollection(ArmClient client, ResourceIdentifier id) : base(client, id) { - _devTestLabArmTemplateArmTemplatesClientDiagnostics = new ClientDiagnostics("Azure.ResourceManager.DevTestLabs", DevTestLabArmTemplateResource.ResourceType.Namespace, Diagnostics); - TryGetApiVersion(DevTestLabArmTemplateResource.ResourceType, out string devTestLabArmTemplateArmTemplatesApiVersion); - _devTestLabArmTemplateArmTemplatesRestClient = new ArmTemplatesRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, devTestLabArmTemplateArmTemplatesApiVersion); -#if DEBUG - ValidateResourceId(Id); -#endif + TryGetApiVersion(DevTestLabArmTemplateResource.ResourceType, out string devTestLabArmTemplateApiVersion); + _armTemplatesClientDiagnostics = new ClientDiagnostics("Azure.ResourceManager.DevTestLabs", DevTestLabArmTemplateResource.ResourceType.Namespace, Diagnostics); + _armTemplatesRestClient = new ArmTemplates(_armTemplatesClientDiagnostics, Pipeline, Endpoint, devTestLabArmTemplateApiVersion ?? "2018-09-15"); + ValidateResourceId(id); } + /// + [Conditional("DEBUG")] internal static void ValidateResourceId(ResourceIdentifier id) { if (id.ResourceType != DevTestLabArtifactSourceResource.ResourceType) - throw new ArgumentException(string.Format(CultureInfo.CurrentCulture, "Invalid resource type {0} expected {1}", id.ResourceType, DevTestLabArtifactSourceResource.ResourceType), nameof(id)); + { + throw new ArgumentException(string.Format("Invalid resource type {0} expected {1}", id.ResourceType, DevTestLabArtifactSourceResource.ResourceType), id); + } } /// /// Get azure resource manager template. /// /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/artifactsources/{artifactSourceName}/armtemplates/{name} + /// Request Path. + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/artifactsources/{artifactSourceName}/armtemplates/{name}. /// /// - /// Operation Id - /// ArmTemplates_Get + /// Operation Id. + /// ArmTemplates_Get. /// /// - /// Default Api Version - /// 2018-09-15 - /// - /// - /// Resource - /// + /// Default Api Version. + /// 2018-09-15. /// /// /// /// The name of the azure resource manager template. /// Specify the $expand query. Example: 'properties($select=displayName)'. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. - public virtual async Task> GetAsync(string name, string expand = null, CancellationToken cancellationToken = default) + /// is an empty string, and was expected to be non-empty. + public virtual async Task> GetAsync(string name, string expand = default, CancellationToken cancellationToken = default) { Argument.AssertNotNullOrEmpty(name, nameof(name)); - using var scope = _devTestLabArmTemplateArmTemplatesClientDiagnostics.CreateScope("DevTestLabArmTemplateCollection.Get"); + using DiagnosticScope scope = _armTemplatesClientDiagnostics.CreateScope("DevTestLabArmTemplateCollection.Get"); scope.Start(); try { - var response = await _devTestLabArmTemplateArmTemplatesRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, name, expand, cancellationToken).ConfigureAwait(false); + RequestContext context = new RequestContext + { + CancellationToken = cancellationToken + }; + HttpMessage message = _armTemplatesRestClient.CreateGetRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, name, expand, context); + Response result = await Pipeline.ProcessMessageAsync(message, context).ConfigureAwait(false); + Response response = Response.FromValue(DevTestLabArmTemplateData.FromResponse(result), result); if (response.Value == null) + { throw new RequestFailedException(response.GetRawResponse()); + } return Response.FromValue(new DevTestLabArmTemplateResource(Client, response.Value), response.GetRawResponse()); } catch (Exception e) @@ -101,39 +108,43 @@ public virtual async Task> GetAsync(stri /// Get azure resource manager template. /// /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/artifactsources/{artifactSourceName}/armtemplates/{name} - /// - /// - /// Operation Id - /// ArmTemplates_Get + /// Request Path. + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/artifactsources/{artifactSourceName}/armtemplates/{name}. /// /// - /// Default Api Version - /// 2018-09-15 + /// Operation Id. + /// ArmTemplates_Get. /// /// - /// Resource - /// + /// Default Api Version. + /// 2018-09-15. /// /// /// /// The name of the azure resource manager template. /// Specify the $expand query. Example: 'properties($select=displayName)'. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. - public virtual Response Get(string name, string expand = null, CancellationToken cancellationToken = default) + /// is an empty string, and was expected to be non-empty. + public virtual Response Get(string name, string expand = default, CancellationToken cancellationToken = default) { Argument.AssertNotNullOrEmpty(name, nameof(name)); - using var scope = _devTestLabArmTemplateArmTemplatesClientDiagnostics.CreateScope("DevTestLabArmTemplateCollection.Get"); + using DiagnosticScope scope = _armTemplatesClientDiagnostics.CreateScope("DevTestLabArmTemplateCollection.Get"); scope.Start(); try { - var response = _devTestLabArmTemplateArmTemplatesRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, name, expand, cancellationToken); + RequestContext context = new RequestContext + { + CancellationToken = cancellationToken + }; + HttpMessage message = _armTemplatesRestClient.CreateGetRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, name, expand, context); + Response result = Pipeline.ProcessMessage(message, context); + Response response = Response.FromValue(DevTestLabArmTemplateData.FromResponse(result), result); if (response.Value == null) + { throw new RequestFailedException(response.GetRawResponse()); + } return Response.FromValue(new DevTestLabArmTemplateResource(Client, response.Value), response.GetRawResponse()); } catch (Exception e) @@ -147,20 +158,16 @@ public virtual Response Get(string name, string e /// List azure resource manager templates in a given artifact source. /// /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/artifactsources/{artifactSourceName}/armtemplates - /// - /// - /// Operation Id - /// ArmTemplates_List + /// Request Path. + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/artifactsources/{artifactSourceName}/armtemplates. /// /// - /// Default Api Version - /// 2018-09-15 + /// Operation Id. + /// ArmTemplates_List. /// /// - /// Resource - /// + /// Default Api Version. + /// 2018-09-15. /// /// /// @@ -169,32 +176,40 @@ public virtual Response Get(string name, string e /// The maximum number of resources to return from the operation. Example: '$top=10'. /// The ordering expression for the results, using OData notation. Example: '$orderby=name desc'. /// The cancellation token to use. - /// An async collection of that may take multiple service requests to iterate over. - public virtual AsyncPageable GetAllAsync(string expand = null, string filter = null, int? top = null, string orderby = null, CancellationToken cancellationToken = default) + /// A collection of that may take multiple service requests to iterate over. + public virtual AsyncPageable GetAllAsync(string expand = default, string filter = default, int? top = default, string @orderby = default, CancellationToken cancellationToken = default) { - HttpMessage FirstPageRequest(int? pageSizeHint) => _devTestLabArmTemplateArmTemplatesRestClient.CreateListRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, expand, filter, top, orderby); - HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _devTestLabArmTemplateArmTemplatesRestClient.CreateListNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, expand, filter, top, orderby); - return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new DevTestLabArmTemplateResource(Client, DevTestLabArmTemplateData.DeserializeDevTestLabArmTemplateData(e)), _devTestLabArmTemplateArmTemplatesClientDiagnostics, Pipeline, "DevTestLabArmTemplateCollection.GetAll", "value", "nextLink", cancellationToken); + RequestContext context = new RequestContext + { + CancellationToken = cancellationToken + }; + return new AsyncPageableWrapper(new ArmTemplatesGetAllAsyncCollectionResultOfT( + _armTemplatesRestClient, + Id.SubscriptionId, + Id.ResourceGroupName, + Id.Parent.Name, + Id.Name, + expand, + filter, + top, + @orderby, + context), data => new DevTestLabArmTemplateResource(Client, data)); } /// /// List azure resource manager templates in a given artifact source. /// /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/artifactsources/{artifactSourceName}/armtemplates - /// - /// - /// Operation Id - /// ArmTemplates_List + /// Request Path. + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/artifactsources/{artifactSourceName}/armtemplates. /// /// - /// Default Api Version - /// 2018-09-15 + /// Operation Id. + /// ArmTemplates_List. /// /// - /// Resource - /// + /// Default Api Version. + /// 2018-09-15. /// /// /// @@ -204,48 +219,74 @@ public virtual AsyncPageable GetAllAsync(string e /// The ordering expression for the results, using OData notation. Example: '$orderby=name desc'. /// The cancellation token to use. /// A collection of that may take multiple service requests to iterate over. - public virtual Pageable GetAll(string expand = null, string filter = null, int? top = null, string orderby = null, CancellationToken cancellationToken = default) + public virtual Pageable GetAll(string expand = default, string filter = default, int? top = default, string @orderby = default, CancellationToken cancellationToken = default) { - HttpMessage FirstPageRequest(int? pageSizeHint) => _devTestLabArmTemplateArmTemplatesRestClient.CreateListRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, expand, filter, top, orderby); - HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _devTestLabArmTemplateArmTemplatesRestClient.CreateListNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, expand, filter, top, orderby); - return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new DevTestLabArmTemplateResource(Client, DevTestLabArmTemplateData.DeserializeDevTestLabArmTemplateData(e)), _devTestLabArmTemplateArmTemplatesClientDiagnostics, Pipeline, "DevTestLabArmTemplateCollection.GetAll", "value", "nextLink", cancellationToken); + RequestContext context = new RequestContext + { + CancellationToken = cancellationToken + }; + return new PageableWrapper(new ArmTemplatesGetAllCollectionResultOfT( + _armTemplatesRestClient, + Id.SubscriptionId, + Id.ResourceGroupName, + Id.Parent.Name, + Id.Name, + expand, + filter, + top, + @orderby, + context), data => new DevTestLabArmTemplateResource(Client, data)); } /// /// Checks to see if the resource exists in azure. /// /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/artifactsources/{artifactSourceName}/armtemplates/{name} + /// Request Path. + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/artifactsources/{artifactSourceName}/armtemplates/{name}. /// /// - /// Operation Id - /// ArmTemplates_Get + /// Operation Id. + /// ArmTemplates_Get. /// /// - /// Default Api Version - /// 2018-09-15 - /// - /// - /// Resource - /// + /// Default Api Version. + /// 2018-09-15. /// /// /// /// The name of the azure resource manager template. /// Specify the $expand query. Example: 'properties($select=displayName)'. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. - public virtual async Task> ExistsAsync(string name, string expand = null, CancellationToken cancellationToken = default) + /// is an empty string, and was expected to be non-empty. + public virtual async Task> ExistsAsync(string name, string expand = default, CancellationToken cancellationToken = default) { Argument.AssertNotNullOrEmpty(name, nameof(name)); - using var scope = _devTestLabArmTemplateArmTemplatesClientDiagnostics.CreateScope("DevTestLabArmTemplateCollection.Exists"); + using DiagnosticScope scope = _armTemplatesClientDiagnostics.CreateScope("DevTestLabArmTemplateCollection.Exists"); scope.Start(); try { - var response = await _devTestLabArmTemplateArmTemplatesRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, name, expand, cancellationToken: cancellationToken).ConfigureAwait(false); + RequestContext context = new RequestContext + { + CancellationToken = cancellationToken + }; + HttpMessage message = _armTemplatesRestClient.CreateGetRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, name, expand, context); + await Pipeline.SendAsync(message, context.CancellationToken).ConfigureAwait(false); + Response result = message.Response; + Response response = default; + switch (result.Status) + { + case 200: + response = Response.FromValue(DevTestLabArmTemplateData.FromResponse(result), result); + break; + case 404: + response = Response.FromValue((DevTestLabArmTemplateData)null, result); + break; + default: + throw new RequestFailedException(result); + } return Response.FromValue(response.Value != null, response.GetRawResponse()); } catch (Exception e) @@ -259,37 +300,51 @@ public virtual async Task> ExistsAsync(string name, string expand /// Checks to see if the resource exists in azure. /// /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/artifactsources/{artifactSourceName}/armtemplates/{name} + /// Request Path. + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/artifactsources/{artifactSourceName}/armtemplates/{name}. /// /// - /// Operation Id - /// ArmTemplates_Get + /// Operation Id. + /// ArmTemplates_Get. /// /// - /// Default Api Version - /// 2018-09-15 - /// - /// - /// Resource - /// + /// Default Api Version. + /// 2018-09-15. /// /// /// /// The name of the azure resource manager template. /// Specify the $expand query. Example: 'properties($select=displayName)'. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. - public virtual Response Exists(string name, string expand = null, CancellationToken cancellationToken = default) + /// is an empty string, and was expected to be non-empty. + public virtual Response Exists(string name, string expand = default, CancellationToken cancellationToken = default) { Argument.AssertNotNullOrEmpty(name, nameof(name)); - using var scope = _devTestLabArmTemplateArmTemplatesClientDiagnostics.CreateScope("DevTestLabArmTemplateCollection.Exists"); + using DiagnosticScope scope = _armTemplatesClientDiagnostics.CreateScope("DevTestLabArmTemplateCollection.Exists"); scope.Start(); try { - var response = _devTestLabArmTemplateArmTemplatesRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, name, expand, cancellationToken: cancellationToken); + RequestContext context = new RequestContext + { + CancellationToken = cancellationToken + }; + HttpMessage message = _armTemplatesRestClient.CreateGetRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, name, expand, context); + Pipeline.Send(message, context.CancellationToken); + Response result = message.Response; + Response response = default; + switch (result.Status) + { + case 200: + response = Response.FromValue(DevTestLabArmTemplateData.FromResponse(result), result); + break; + case 404: + response = Response.FromValue((DevTestLabArmTemplateData)null, result); + break; + default: + throw new RequestFailedException(result); + } return Response.FromValue(response.Value != null, response.GetRawResponse()); } catch (Exception e) @@ -303,39 +358,55 @@ public virtual Response Exists(string name, string expand = null, Cancella /// Tries to get details for this resource from the service. /// /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/artifactsources/{artifactSourceName}/armtemplates/{name} + /// Request Path. + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/artifactsources/{artifactSourceName}/armtemplates/{name}. /// /// - /// Operation Id - /// ArmTemplates_Get + /// Operation Id. + /// ArmTemplates_Get. /// /// - /// Default Api Version - /// 2018-09-15 - /// - /// - /// Resource - /// + /// Default Api Version. + /// 2018-09-15. /// /// /// /// The name of the azure resource manager template. /// Specify the $expand query. Example: 'properties($select=displayName)'. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. - public virtual async Task> GetIfExistsAsync(string name, string expand = null, CancellationToken cancellationToken = default) + /// is an empty string, and was expected to be non-empty. + public virtual async Task> GetIfExistsAsync(string name, string expand = default, CancellationToken cancellationToken = default) { Argument.AssertNotNullOrEmpty(name, nameof(name)); - using var scope = _devTestLabArmTemplateArmTemplatesClientDiagnostics.CreateScope("DevTestLabArmTemplateCollection.GetIfExists"); + using DiagnosticScope scope = _armTemplatesClientDiagnostics.CreateScope("DevTestLabArmTemplateCollection.GetIfExists"); scope.Start(); try { - var response = await _devTestLabArmTemplateArmTemplatesRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, name, expand, cancellationToken: cancellationToken).ConfigureAwait(false); + RequestContext context = new RequestContext + { + CancellationToken = cancellationToken + }; + HttpMessage message = _armTemplatesRestClient.CreateGetRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, name, expand, context); + await Pipeline.SendAsync(message, context.CancellationToken).ConfigureAwait(false); + Response result = message.Response; + Response response = default; + switch (result.Status) + { + case 200: + response = Response.FromValue(DevTestLabArmTemplateData.FromResponse(result), result); + break; + case 404: + response = Response.FromValue((DevTestLabArmTemplateData)null, result); + break; + default: + throw new RequestFailedException(result); + } if (response.Value == null) + { return new NoValueResponse(response.GetRawResponse()); + } return Response.FromValue(new DevTestLabArmTemplateResource(Client, response.Value), response.GetRawResponse()); } catch (Exception e) @@ -349,39 +420,55 @@ public virtual async Task> GetIf /// Tries to get details for this resource from the service. /// /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/artifactsources/{artifactSourceName}/armtemplates/{name} - /// - /// - /// Operation Id - /// ArmTemplates_Get + /// Request Path. + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/artifactsources/{artifactSourceName}/armtemplates/{name}. /// /// - /// Default Api Version - /// 2018-09-15 + /// Operation Id. + /// ArmTemplates_Get. /// /// - /// Resource - /// + /// Default Api Version. + /// 2018-09-15. /// /// /// /// The name of the azure resource manager template. /// Specify the $expand query. Example: 'properties($select=displayName)'. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. - public virtual NullableResponse GetIfExists(string name, string expand = null, CancellationToken cancellationToken = default) + /// is an empty string, and was expected to be non-empty. + public virtual NullableResponse GetIfExists(string name, string expand = default, CancellationToken cancellationToken = default) { Argument.AssertNotNullOrEmpty(name, nameof(name)); - using var scope = _devTestLabArmTemplateArmTemplatesClientDiagnostics.CreateScope("DevTestLabArmTemplateCollection.GetIfExists"); + using DiagnosticScope scope = _armTemplatesClientDiagnostics.CreateScope("DevTestLabArmTemplateCollection.GetIfExists"); scope.Start(); try { - var response = _devTestLabArmTemplateArmTemplatesRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, name, expand, cancellationToken: cancellationToken); + RequestContext context = new RequestContext + { + CancellationToken = cancellationToken + }; + HttpMessage message = _armTemplatesRestClient.CreateGetRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, name, expand, context); + Pipeline.Send(message, context.CancellationToken); + Response result = message.Response; + Response response = default; + switch (result.Status) + { + case 200: + response = Response.FromValue(DevTestLabArmTemplateData.FromResponse(result), result); + break; + case 404: + response = Response.FromValue((DevTestLabArmTemplateData)null, result); + break; + default: + throw new RequestFailedException(result); + } if (response.Value == null) + { return new NoValueResponse(response.GetRawResponse()); + } return Response.FromValue(new DevTestLabArmTemplateResource(Client, response.Value), response.GetRawResponse()); } catch (Exception e) @@ -401,6 +488,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/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/DevTestLabArmTemplateData.Serialization.cs b/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/DevTestLabArmTemplateData.Serialization.cs index 7046ea6748db..cbbb11ba9bb1 100644 --- a/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/DevTestLabArmTemplateData.Serialization.cs +++ b/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/DevTestLabArmTemplateData.Serialization.cs @@ -10,16 +10,47 @@ using System.Collections.Generic; using System.Text; using System.Text.Json; +using Azure; using Azure.Core; using Azure.ResourceManager.DevTestLabs.Models; using Azure.ResourceManager.Models; namespace Azure.ResourceManager.DevTestLabs { - public partial class DevTestLabArmTemplateData : IUtf8JsonSerializable, IJsonModel + /// An Azure Resource Manager template. + public partial class DevTestLabArmTemplateData : TrackedResourceData, IJsonModel { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + /// Initializes a new instance of for deserialization. + internal DevTestLabArmTemplateData() + { + } + /// 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)) + { + return DeserializeDevTestLabArmTemplateData(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(DevTestLabArmTemplateData)} does not support reading '{options.Format}' format."); + } + } + + /// The to deserialize the from. + internal static DevTestLabArmTemplateData FromResponse(Response response) + { + using JsonDocument document = JsonDocument.Parse(response.Content, ModelSerializationExtensions.JsonDocumentOptions); + return DeserializeDevTestLabArmTemplateData(document.RootElement, ModelSerializationExtensions.WireOptions); + } + + /// The JSON writer. + /// The client options for reading and writing models. void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) { writer.WriteStartObject(); @@ -31,252 +62,153 @@ 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(DevTestLabArmTemplateData)} does not support writing '{format}' format."); } - base.JsonModelWriteCore(writer, options); writer.WritePropertyName("properties"u8); - writer.WriteStartObject(); - if (options.Format != "W" && Optional.IsDefined(DisplayName)) + writer.WriteObjectValue(Properties, options); + if (Optional.IsCollectionDefined(Tags)) { - writer.WritePropertyName("displayName"u8); - writer.WriteStringValue(DisplayName); - } - if (options.Format != "W" && Optional.IsDefined(Description)) - { - writer.WritePropertyName("description"u8); - writer.WriteStringValue(Description); - } - if (options.Format != "W" && Optional.IsDefined(Publisher)) - { - writer.WritePropertyName("publisher"u8); - writer.WriteStringValue(Publisher); - } - if (options.Format != "W" && Optional.IsDefined(Icon)) - { - writer.WritePropertyName("icon"u8); - writer.WriteStringValue(Icon); - } - if (options.Format != "W" && Optional.IsDefined(Contents)) - { - writer.WritePropertyName("contents"u8); -#if NET6_0_OR_GREATER - writer.WriteRawValue(Contents); -#else - using (JsonDocument document = JsonDocument.Parse(Contents, ModelSerializationExtensions.JsonDocumentOptions)) - { - JsonSerializer.Serialize(writer, document.RootElement); - } -#endif - } - if (options.Format != "W" && Optional.IsDefined(CreatedOn)) - { - writer.WritePropertyName("createdDate"u8); - writer.WriteStringValue(CreatedOn.Value, "O"); - } - if (options.Format != "W" && Optional.IsCollectionDefined(ParametersValueFilesInfo)) - { - writer.WritePropertyName("parametersValueFilesInfo"u8); - writer.WriteStartArray(); - foreach (var item in ParametersValueFilesInfo) + writer.WritePropertyName("tags"u8); + writer.WriteStartObject(); + foreach (var item in Tags) { - writer.WriteObjectValue(item, options); + writer.WritePropertyName(item.Key); + if (item.Value == null) + { + writer.WriteNullValue(); + continue; + } + writer.WriteStringValue(item.Value); } - writer.WriteEndArray(); - } - if (options.Format != "W" && Optional.IsDefined(IsEnabled)) - { - writer.WritePropertyName("enabled"u8); - writer.WriteBooleanValue(IsEnabled.Value); + writer.WriteEndObject(); } - writer.WriteEndObject(); } - DevTestLabArmTemplateData IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + /// The JSON reader. + /// The client options for reading and writing models. + DevTestLabArmTemplateData IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) => (DevTestLabArmTemplateData)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(DevTestLabArmTemplateData)} does not support reading '{format}' format."); } - using JsonDocument document = JsonDocument.ParseValue(ref reader); return DeserializeDevTestLabArmTemplateData(document.RootElement, options); } - internal static DevTestLabArmTemplateData DeserializeDevTestLabArmTemplateData(JsonElement element, ModelReaderWriterOptions options = null) + /// The JSON element to deserialize. + /// The client options for reading and writing models. + internal static DevTestLabArmTemplateData DeserializeDevTestLabArmTemplateData(JsonElement element, ModelReaderWriterOptions options) { - options ??= ModelSerializationExtensions.WireOptions; - if (element.ValueKind == JsonValueKind.Null) { return null; } - IDictionary tags = default; - AzureLocation location = default; ResourceIdentifier id = default; string name = default; - ResourceType type = default; + ResourceType resourceType = default; SystemData systemData = default; - string displayName = default; - string description = default; - string publisher = default; - string icon = default; - BinaryData contents = default; - DateTimeOffset? createdDate = default; - IReadOnlyList parametersValueFilesInfo = default; - bool? enabled = default; - IDictionary serializedAdditionalRawData = default; - Dictionary rawDataDictionary = new Dictionary(); - foreach (var property in element.EnumerateObject()) + IDictionary additionalBinaryDataProperties = new ChangeTrackingDictionary(); + AzureLocation location = default; + ArmTemplateProperties properties = default; + IDictionary tags = default; + foreach (var prop in element.EnumerateObject()) { - if (property.NameEquals("tags"u8)) + if (prop.NameEquals("id"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()) - { - dictionary.Add(property0.Name, property0.Value.GetString()); - } - tags = dictionary; + id = new ResourceIdentifier(prop.Value.GetString()); continue; } - if (property.NameEquals("location"u8)) + if (prop.NameEquals("name"u8)) { - location = new AzureLocation(property.Value.GetString()); + name = prop.Value.GetString(); continue; } - if (property.NameEquals("id"u8)) + if (prop.NameEquals("type"u8)) { - id = new ResourceIdentifier(property.Value.GetString()); + if (prop.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + resourceType = new ResourceType(prop.Value.GetString()); continue; } - if (property.NameEquals("name"u8)) + if (prop.NameEquals("systemData"u8)) { - name = property.Value.GetString(); + if (prop.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + systemData = ModelReaderWriter.Read(new BinaryData(Encoding.UTF8.GetBytes(prop.Value.GetRawText())), ModelSerializationExtensions.WireOptions, AzureResourceManagerDevTestLabsContext.Default); 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) - { - continue; - } - systemData = ModelReaderWriter.Read(new BinaryData(Encoding.UTF8.GetBytes(property.Value.GetRawText())), ModelSerializationExtensions.WireOptions, AzureResourceManagerDevTestLabsContext.Default); + properties = ArmTemplateProperties.DeserializeArmTemplateProperties(prop.Value, options); continue; } - if (property.NameEquals("properties"u8)) + if (prop.NameEquals("tags"u8)) { - if (property.Value.ValueKind == JsonValueKind.Null) + if (prop.Value.ValueKind == JsonValueKind.Null) { - property.ThrowNonNullablePropertyIsNull(); continue; } - foreach (var property0 in property.Value.EnumerateObject()) + Dictionary dictionary = new Dictionary(); + foreach (var prop0 in prop.Value.EnumerateObject()) { - if (property0.NameEquals("displayName"u8)) - { - displayName = property0.Value.GetString(); - continue; - } - if (property0.NameEquals("description"u8)) - { - description = property0.Value.GetString(); - continue; - } - if (property0.NameEquals("publisher"u8)) - { - publisher = property0.Value.GetString(); - continue; - } - if (property0.NameEquals("icon"u8)) - { - icon = property0.Value.GetString(); - continue; - } - if (property0.NameEquals("contents"u8)) - { - if (property0.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - contents = BinaryData.FromString(property0.Value.GetRawText()); - continue; - } - if (property0.NameEquals("createdDate"u8)) + if (prop0.Value.ValueKind == JsonValueKind.Null) { - if (property0.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - createdDate = property0.Value.GetDateTimeOffset("O"); - continue; + dictionary.Add(prop0.Name, null); } - if (property0.NameEquals("parametersValueFilesInfo"u8)) + else { - if (property0.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - List array = new List(); - foreach (var item in property0.Value.EnumerateArray()) - { - array.Add(DevTestLabParametersValueFileInfo.DeserializeDevTestLabParametersValueFileInfo(item, options)); - } - parametersValueFilesInfo = array; - continue; - } - if (property0.NameEquals("enabled"u8)) - { - if (property0.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - enabled = property0.Value.GetBoolean(); - continue; + dictionary.Add(prop0.Name, prop0.Value.GetString()); } } + tags = dictionary; 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 DevTestLabArmTemplateData( id, name, - type, + resourceType, systemData, - tags ?? new ChangeTrackingDictionary(), + additionalBinaryDataProperties, location, - displayName, - description, - publisher, - icon, - contents, - createdDate, - parametersValueFilesInfo ?? new ChangeTrackingList(), - enabled, - serializedAdditionalRawData); + properties, + tags ?? new ChangeTrackingDictionary()); } - 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": @@ -286,22 +218,11 @@ BinaryData IPersistableModel.Write(ModelReaderWriterO } } - DevTestLabArmTemplateData 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 DeserializeDevTestLabArmTemplateData(document.RootElement, options); - } - default: - throw new FormatException($"The model {nameof(DevTestLabArmTemplateData)} does not support reading '{options.Format}' format."); - } - } + /// The data to parse. + /// The client options for reading and writing models. + DevTestLabArmTemplateData IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) => (DevTestLabArmTemplateData)PersistableModelCreateCore(data, options); + /// The client options for reading and writing models. string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; } } diff --git a/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/DevTestLabArmTemplateData.cs b/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/DevTestLabArmTemplateData.cs index 0244ad2d48e6..2a9bbdfe0368 100644 --- a/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/DevTestLabArmTemplateData.cs +++ b/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/DevTestLabArmTemplateData.cs @@ -13,129 +13,108 @@ namespace Azure.ResourceManager.DevTestLabs { - /// - /// A class representing the DevTestLabArmTemplate data model. - /// An Azure Resource Manager template. - /// + /// An Azure Resource Manager template. public partial class DevTestLabArmTemplateData : 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. - public DevTestLabArmTemplateData(AzureLocation location) : base(location) + /// The geo-location where the resource lives. + /// The properties of the resource. + internal DevTestLabArmTemplateData(AzureLocation location, ArmTemplateProperties properties) : base(location) { - ParametersValueFilesInfo = new ChangeTrackingList(); + Properties = properties; } /// Initializes a new instance of . - /// The id. - /// The name. - /// The resourceType. - /// The systemData. - /// The tags. - /// The location. - /// The display name of the ARM template. - /// The description of the ARM template. - /// The publisher of the ARM template. - /// The URI to the icon of the ARM template. - /// The contents of the ARM template. - /// The creation date of the armTemplate. - /// File name and parameter values information from all azuredeploy.*.parameters.json for the ARM template. - /// Whether or not ARM template is enabled for use by lab user. - /// Keeps track of any properties unknown to the library. - internal DevTestLabArmTemplateData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, IDictionary tags, AzureLocation location, string displayName, string description, string publisher, string icon, BinaryData contents, DateTimeOffset? createdOn, IReadOnlyList parametersValueFilesInfo, bool? isEnabled, IDictionary serializedAdditionalRawData) : base(id, name, resourceType, systemData, tags, 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. + /// The geo-location where the resource lives. + /// The properties of the resource. + /// Resource tags. + internal DevTestLabArmTemplateData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, IDictionary additionalBinaryDataProperties, AzureLocation location, ArmTemplateProperties properties, IDictionary tags) : base(id, name, resourceType, systemData, tags, location) { - DisplayName = displayName; - Description = description; - Publisher = publisher; - Icon = icon; - Contents = contents; - CreatedOn = createdOn; - ParametersValueFilesInfo = parametersValueFilesInfo; - IsEnabled = isEnabled; - _serializedAdditionalRawData = serializedAdditionalRawData; + _additionalBinaryDataProperties = additionalBinaryDataProperties; + Properties = properties; } - /// Initializes a new instance of for deserialization. - internal DevTestLabArmTemplateData() + /// The properties of the resource. + internal ArmTemplateProperties Properties { get; } + + /// The display name of the ARM template. + public string DisplayName { + get + { + return Properties.DisplayName; + } } - /// The display name of the ARM template. - public string DisplayName { get; } /// The description of the ARM template. - public string Description { get; } + public string Description + { + get + { + return Properties.Description; + } + } + /// The publisher of the ARM template. - public string Publisher { get; } + public string Publisher + { + get + { + return Properties.Publisher; + } + } + /// The URI to the icon of the ARM template. - public string Icon { get; } - /// - /// The contents of the ARM template. - /// - /// To assign an object to 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" }. - /// - /// - /// - /// - public BinaryData Contents { get; } + public string Icon + { + get + { + return Properties.Icon; + } + } + + /// The contents of the ARM template. + public BinaryData Contents + { + get + { + return Properties.Contents; + } + } + /// The creation date of the armTemplate. - public DateTimeOffset? CreatedOn { get; } + public DateTimeOffset? CreatedOn + { + get + { + return Properties.CreatedOn; + } + } + /// File name and parameter values information from all azuredeploy.*.parameters.json for the ARM template. - public IReadOnlyList ParametersValueFilesInfo { get; } + public IReadOnlyList ParametersValueFilesInfo + { + get + { + return Properties is null ? default : Properties.ParametersValueFilesInfo; + } + } + /// Whether or not ARM template is enabled for use by lab user. - public bool? IsEnabled { get; } + public bool? IsEnabled + { + get + { + return Properties.IsEnabled; + } + } } } diff --git a/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/DevTestLabArmTemplateResource.Serialization.cs b/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/DevTestLabArmTemplateResource.Serialization.cs index 67d57d6d4ebe..585cce27873d 100644 --- a/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/DevTestLabArmTemplateResource.Serialization.cs +++ b/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/DevTestLabArmTemplateResource.Serialization.cs @@ -11,19 +11,29 @@ namespace Azure.ResourceManager.DevTestLabs { + /// public partial class DevTestLabArmTemplateResource : IJsonModel { - private static DevTestLabArmTemplateData s_dataDeserializationInstance; - private static DevTestLabArmTemplateData DataDeserializationInstance => s_dataDeserializationInstance ??= new(); + private static IJsonModel s_dataDeserializationInstance; + private static IJsonModel DataDeserializationInstance => s_dataDeserializationInstance ??= new DevTestLabArmTemplateData(); + + /// 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); - DevTestLabArmTemplateData 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. + DevTestLabArmTemplateData 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, AzureResourceManagerDevTestLabsContext.Default); + /// The binary data to be processed. + /// The client options for reading and writing models. DevTestLabArmTemplateData IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) => ModelReaderWriter.Read(data, options, AzureResourceManagerDevTestLabsContext.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/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/DevTestLabArmTemplateResource.cs b/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/DevTestLabArmTemplateResource.cs index 0a5f871b2d01..be6a3663d8d2 100644 --- a/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/DevTestLabArmTemplateResource.cs +++ b/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/DevTestLabArmTemplateResource.cs @@ -6,47 +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.DevTestLabs { /// - /// A Class representing a DevTestLabArmTemplate 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 GetDevTestLabArmTemplateResource method. - /// Otherwise you can get one from its parent resource using the GetDevTestLabArmTemplate method. + /// A class representing a DevTestLabArmTemplate 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 GetDevTestLabArmTemplates method. /// public partial class DevTestLabArmTemplateResource : ArmResource { - /// Generate the resource identifier of a instance. - /// The subscriptionId. - /// The resourceGroupName. - /// The labName. - /// The artifactSourceName. - /// The name. - public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string labName, string artifactSourceName, string name) - { - var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/artifactsources/{artifactSourceName}/armtemplates/{name}"; - return new ResourceIdentifier(resourceId); - } - - private readonly ClientDiagnostics _devTestLabArmTemplateArmTemplatesClientDiagnostics; - private readonly ArmTemplatesRestOperations _devTestLabArmTemplateArmTemplatesRestClient; + private readonly ClientDiagnostics _armTemplatesClientDiagnostics; + private readonly ArmTemplates _armTemplatesRestClient; private readonly DevTestLabArmTemplateData _data; - /// Gets the resource type for the operations. public static readonly ResourceType ResourceType = "Microsoft.DevTestLab/labs/artifactsources/armtemplates"; - /// Initializes a new instance of the class for mocking. + /// Initializes a new instance of DevTestLabArmTemplateResource for mocking. protected DevTestLabArmTemplateResource() { } - /// 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 DevTestLabArmTemplateResource(ArmClient client, DevTestLabArmTemplateData data) : this(client, data.Id) @@ -55,72 +43,95 @@ internal DevTestLabArmTemplateResource(ArmClient client, DevTestLabArmTemplateDa _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 DevTestLabArmTemplateResource(ArmClient client, ResourceIdentifier id) : base(client, id) { - _devTestLabArmTemplateArmTemplatesClientDiagnostics = new ClientDiagnostics("Azure.ResourceManager.DevTestLabs", ResourceType.Namespace, Diagnostics); - TryGetApiVersion(ResourceType, out string devTestLabArmTemplateArmTemplatesApiVersion); - _devTestLabArmTemplateArmTemplatesRestClient = new ArmTemplatesRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, devTestLabArmTemplateArmTemplatesApiVersion); -#if DEBUG - ValidateResourceId(Id); -#endif + TryGetApiVersion(ResourceType, out string devTestLabArmTemplateApiVersion); + _armTemplatesClientDiagnostics = new ClientDiagnostics("Azure.ResourceManager.DevTestLabs", ResourceType.Namespace, Diagnostics); + _armTemplatesRestClient = new ArmTemplates(_armTemplatesClientDiagnostics, Pipeline, Endpoint, devTestLabArmTemplateApiVersion ?? "2018-09-15"); + 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 DevTestLabArmTemplateData 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 labName. + /// The artifactSourceName. + /// The name. + public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string labName, string artifactSourceName, string name) + { + string resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/artifactsources/{artifactSourceName}/armtemplates/{name}"; + 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 azure resource manager template. /// /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/artifactsources/{artifactSourceName}/armtemplates/{name} + /// Request Path. + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/artifactsources/{artifactSourceName}/armtemplates/{name}. /// /// - /// Operation Id - /// ArmTemplates_Get + /// Operation Id. + /// ArmTemplates_Get. /// /// - /// Default Api Version - /// 2018-09-15 + /// Default Api Version. + /// 2018-09-15. /// /// - /// Resource - /// + /// Resource. + /// . /// /// /// /// Specify the $expand query. Example: 'properties($select=displayName)'. /// The cancellation token to use. - public virtual async Task> GetAsync(string expand = null, CancellationToken cancellationToken = default) + public virtual async Task> GetAsync(string expand = default, CancellationToken cancellationToken = default) { - using var scope = _devTestLabArmTemplateArmTemplatesClientDiagnostics.CreateScope("DevTestLabArmTemplateResource.Get"); + using DiagnosticScope scope = _armTemplatesClientDiagnostics.CreateScope("DevTestLabArmTemplateResource.Get"); scope.Start(); try { - var response = await _devTestLabArmTemplateArmTemplatesRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, expand, cancellationToken).ConfigureAwait(false); + RequestContext context = new RequestContext + { + CancellationToken = cancellationToken + }; + HttpMessage message = _armTemplatesRestClient.CreateGetRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, expand, context); + Response result = await Pipeline.ProcessMessageAsync(message, context).ConfigureAwait(false); + Response response = Response.FromValue(DevTestLabArmTemplateData.FromResponse(result), result); if (response.Value == null) + { throw new RequestFailedException(response.GetRawResponse()); + } return Response.FromValue(new DevTestLabArmTemplateResource(Client, response.Value), response.GetRawResponse()); } catch (Exception e) @@ -134,34 +145,42 @@ public virtual async Task> GetAsync(stri /// Get azure resource manager template. /// /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/artifactsources/{artifactSourceName}/armtemplates/{name} + /// Request Path. + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/artifactsources/{artifactSourceName}/armtemplates/{name}. /// /// - /// Operation Id - /// ArmTemplates_Get + /// Operation Id. + /// ArmTemplates_Get. /// /// - /// Default Api Version - /// 2018-09-15 + /// Default Api Version. + /// 2018-09-15. /// /// - /// Resource - /// + /// Resource. + /// . /// /// /// /// Specify the $expand query. Example: 'properties($select=displayName)'. /// The cancellation token to use. - public virtual Response Get(string expand = null, CancellationToken cancellationToken = default) + public virtual Response Get(string expand = default, CancellationToken cancellationToken = default) { - using var scope = _devTestLabArmTemplateArmTemplatesClientDiagnostics.CreateScope("DevTestLabArmTemplateResource.Get"); + using DiagnosticScope scope = _armTemplatesClientDiagnostics.CreateScope("DevTestLabArmTemplateResource.Get"); scope.Start(); try { - var response = _devTestLabArmTemplateArmTemplatesRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, expand, cancellationToken); + RequestContext context = new RequestContext + { + CancellationToken = cancellationToken + }; + HttpMessage message = _armTemplatesRestClient.CreateGetRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, expand, context); + Response result = Pipeline.ProcessMessage(message, context); + Response response = Response.FromValue(DevTestLabArmTemplateData.FromResponse(result), result); if (response.Value == null) + { throw new RequestFailedException(response.GetRawResponse()); + } return Response.FromValue(new DevTestLabArmTemplateResource(Client, response.Value), response.GetRawResponse()); } catch (Exception e) diff --git a/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/DevTestLabArtifactCollection.cs b/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/DevTestLabArtifactCollection.cs index eb011576d9e8..6ab22d45bbc5 100644 --- a/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/DevTestLabArtifactCollection.cs +++ b/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/DevTestLabArtifactCollection.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.DevTestLabs { @@ -24,70 +25,76 @@ namespace Azure.ResourceManager.DevTestLabs /// public partial class DevTestLabArtifactCollection : ArmCollection, IEnumerable, IAsyncEnumerable { - private readonly ClientDiagnostics _devTestLabArtifactArtifactsClientDiagnostics; - private readonly ArtifactsRestOperations _devTestLabArtifactArtifactsRestClient; + private readonly ClientDiagnostics _artifactsClientDiagnostics; + private readonly Artifacts _artifactsRestClient; - /// Initializes a new instance of the class for mocking. + /// Initializes a new instance of DevTestLabArtifactCollection for mocking. protected DevTestLabArtifactCollection() { } - /// 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 DevTestLabArtifactCollection(ArmClient client, ResourceIdentifier id) : base(client, id) { - _devTestLabArtifactArtifactsClientDiagnostics = new ClientDiagnostics("Azure.ResourceManager.DevTestLabs", DevTestLabArtifactResource.ResourceType.Namespace, Diagnostics); - TryGetApiVersion(DevTestLabArtifactResource.ResourceType, out string devTestLabArtifactArtifactsApiVersion); - _devTestLabArtifactArtifactsRestClient = new ArtifactsRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, devTestLabArtifactArtifactsApiVersion); -#if DEBUG - ValidateResourceId(Id); -#endif + TryGetApiVersion(DevTestLabArtifactResource.ResourceType, out string devTestLabArtifactApiVersion); + _artifactsClientDiagnostics = new ClientDiagnostics("Azure.ResourceManager.DevTestLabs", DevTestLabArtifactResource.ResourceType.Namespace, Diagnostics); + _artifactsRestClient = new Artifacts(_artifactsClientDiagnostics, Pipeline, Endpoint, devTestLabArtifactApiVersion ?? "2018-09-15"); + ValidateResourceId(id); } + /// + [Conditional("DEBUG")] internal static void ValidateResourceId(ResourceIdentifier id) { if (id.ResourceType != DevTestLabArtifactSourceResource.ResourceType) - throw new ArgumentException(string.Format(CultureInfo.CurrentCulture, "Invalid resource type {0} expected {1}", id.ResourceType, DevTestLabArtifactSourceResource.ResourceType), nameof(id)); + { + throw new ArgumentException(string.Format("Invalid resource type {0} expected {1}", id.ResourceType, DevTestLabArtifactSourceResource.ResourceType), id); + } } /// /// Get artifact. /// /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/artifactsources/{artifactSourceName}/artifacts/{name} + /// Request Path. + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/artifactsources/{artifactSourceName}/artifacts/{name}. /// /// - /// Operation Id - /// Artifacts_Get + /// Operation Id. + /// Artifacts_Get. /// /// - /// Default Api Version - /// 2018-09-15 - /// - /// - /// Resource - /// + /// Default Api Version. + /// 2018-09-15. /// /// /// /// The name of the artifact. /// Specify the $expand query. Example: 'properties($select=title)'. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. - public virtual async Task> GetAsync(string name, string expand = null, CancellationToken cancellationToken = default) + /// is an empty string, and was expected to be non-empty. + public virtual async Task> GetAsync(string name, string expand = default, CancellationToken cancellationToken = default) { Argument.AssertNotNullOrEmpty(name, nameof(name)); - using var scope = _devTestLabArtifactArtifactsClientDiagnostics.CreateScope("DevTestLabArtifactCollection.Get"); + using DiagnosticScope scope = _artifactsClientDiagnostics.CreateScope("DevTestLabArtifactCollection.Get"); scope.Start(); try { - var response = await _devTestLabArtifactArtifactsRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, name, expand, cancellationToken).ConfigureAwait(false); + RequestContext context = new RequestContext + { + CancellationToken = cancellationToken + }; + HttpMessage message = _artifactsRestClient.CreateGetRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, name, expand, context); + Response result = await Pipeline.ProcessMessageAsync(message, context).ConfigureAwait(false); + Response response = Response.FromValue(DevTestLabArtifactData.FromResponse(result), result); if (response.Value == null) + { throw new RequestFailedException(response.GetRawResponse()); + } return Response.FromValue(new DevTestLabArtifactResource(Client, response.Value), response.GetRawResponse()); } catch (Exception e) @@ -101,39 +108,43 @@ public virtual async Task> GetAsync(string /// Get artifact. /// /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/artifactsources/{artifactSourceName}/artifacts/{name} - /// - /// - /// Operation Id - /// Artifacts_Get + /// Request Path. + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/artifactsources/{artifactSourceName}/artifacts/{name}. /// /// - /// Default Api Version - /// 2018-09-15 + /// Operation Id. + /// Artifacts_Get. /// /// - /// Resource - /// + /// Default Api Version. + /// 2018-09-15. /// /// /// /// The name of the artifact. /// Specify the $expand query. Example: 'properties($select=title)'. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. - public virtual Response Get(string name, string expand = null, CancellationToken cancellationToken = default) + /// is an empty string, and was expected to be non-empty. + public virtual Response Get(string name, string expand = default, CancellationToken cancellationToken = default) { Argument.AssertNotNullOrEmpty(name, nameof(name)); - using var scope = _devTestLabArtifactArtifactsClientDiagnostics.CreateScope("DevTestLabArtifactCollection.Get"); + using DiagnosticScope scope = _artifactsClientDiagnostics.CreateScope("DevTestLabArtifactCollection.Get"); scope.Start(); try { - var response = _devTestLabArtifactArtifactsRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, name, expand, cancellationToken); + RequestContext context = new RequestContext + { + CancellationToken = cancellationToken + }; + HttpMessage message = _artifactsRestClient.CreateGetRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, name, expand, context); + Response result = Pipeline.ProcessMessage(message, context); + Response response = Response.FromValue(DevTestLabArtifactData.FromResponse(result), result); if (response.Value == null) + { throw new RequestFailedException(response.GetRawResponse()); + } return Response.FromValue(new DevTestLabArtifactResource(Client, response.Value), response.GetRawResponse()); } catch (Exception e) @@ -147,20 +158,16 @@ public virtual Response Get(string name, string expa /// List artifacts in a given artifact source. /// /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/artifactsources/{artifactSourceName}/artifacts - /// - /// - /// Operation Id - /// Artifacts_List + /// Request Path. + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/artifactsources/{artifactSourceName}/artifacts. /// /// - /// Default Api Version - /// 2018-09-15 + /// Operation Id. + /// Artifacts_List. /// /// - /// Resource - /// + /// Default Api Version. + /// 2018-09-15. /// /// /// @@ -169,32 +176,40 @@ public virtual Response Get(string name, string expa /// The maximum number of resources to return from the operation. Example: '$top=10'. /// The ordering expression for the results, using OData notation. Example: '$orderby=name desc'. /// The cancellation token to use. - /// An async collection of that may take multiple service requests to iterate over. - public virtual AsyncPageable GetAllAsync(string expand = null, string filter = null, int? top = null, string orderby = null, CancellationToken cancellationToken = default) + /// A collection of that may take multiple service requests to iterate over. + public virtual AsyncPageable GetAllAsync(string expand = default, string filter = default, int? top = default, string @orderby = default, CancellationToken cancellationToken = default) { - HttpMessage FirstPageRequest(int? pageSizeHint) => _devTestLabArtifactArtifactsRestClient.CreateListRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, expand, filter, top, orderby); - HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _devTestLabArtifactArtifactsRestClient.CreateListNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, expand, filter, top, orderby); - return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new DevTestLabArtifactResource(Client, DevTestLabArtifactData.DeserializeDevTestLabArtifactData(e)), _devTestLabArtifactArtifactsClientDiagnostics, Pipeline, "DevTestLabArtifactCollection.GetAll", "value", "nextLink", cancellationToken); + RequestContext context = new RequestContext + { + CancellationToken = cancellationToken + }; + return new AsyncPageableWrapper(new ArtifactsGetAllAsyncCollectionResultOfT( + _artifactsRestClient, + Id.SubscriptionId, + Id.ResourceGroupName, + Id.Parent.Name, + Id.Name, + expand, + filter, + top, + @orderby, + context), data => new DevTestLabArtifactResource(Client, data)); } /// /// List artifacts in a given artifact source. /// /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/artifactsources/{artifactSourceName}/artifacts - /// - /// - /// Operation Id - /// Artifacts_List + /// Request Path. + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/artifactsources/{artifactSourceName}/artifacts. /// /// - /// Default Api Version - /// 2018-09-15 + /// Operation Id. + /// Artifacts_List. /// /// - /// Resource - /// + /// Default Api Version. + /// 2018-09-15. /// /// /// @@ -204,48 +219,74 @@ public virtual AsyncPageable GetAllAsync(string expa /// The ordering expression for the results, using OData notation. Example: '$orderby=name desc'. /// The cancellation token to use. /// A collection of that may take multiple service requests to iterate over. - public virtual Pageable GetAll(string expand = null, string filter = null, int? top = null, string orderby = null, CancellationToken cancellationToken = default) + public virtual Pageable GetAll(string expand = default, string filter = default, int? top = default, string @orderby = default, CancellationToken cancellationToken = default) { - HttpMessage FirstPageRequest(int? pageSizeHint) => _devTestLabArtifactArtifactsRestClient.CreateListRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, expand, filter, top, orderby); - HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _devTestLabArtifactArtifactsRestClient.CreateListNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, expand, filter, top, orderby); - return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new DevTestLabArtifactResource(Client, DevTestLabArtifactData.DeserializeDevTestLabArtifactData(e)), _devTestLabArtifactArtifactsClientDiagnostics, Pipeline, "DevTestLabArtifactCollection.GetAll", "value", "nextLink", cancellationToken); + RequestContext context = new RequestContext + { + CancellationToken = cancellationToken + }; + return new PageableWrapper(new ArtifactsGetAllCollectionResultOfT( + _artifactsRestClient, + Id.SubscriptionId, + Id.ResourceGroupName, + Id.Parent.Name, + Id.Name, + expand, + filter, + top, + @orderby, + context), data => new DevTestLabArtifactResource(Client, data)); } /// /// Checks to see if the resource exists in azure. /// /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/artifactsources/{artifactSourceName}/artifacts/{name} + /// Request Path. + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/artifactsources/{artifactSourceName}/artifacts/{name}. /// /// - /// Operation Id - /// Artifacts_Get + /// Operation Id. + /// Artifacts_Get. /// /// - /// Default Api Version - /// 2018-09-15 - /// - /// - /// Resource - /// + /// Default Api Version. + /// 2018-09-15. /// /// /// /// The name of the artifact. /// Specify the $expand query. Example: 'properties($select=title)'. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. - public virtual async Task> ExistsAsync(string name, string expand = null, CancellationToken cancellationToken = default) + /// is an empty string, and was expected to be non-empty. + public virtual async Task> ExistsAsync(string name, string expand = default, CancellationToken cancellationToken = default) { Argument.AssertNotNullOrEmpty(name, nameof(name)); - using var scope = _devTestLabArtifactArtifactsClientDiagnostics.CreateScope("DevTestLabArtifactCollection.Exists"); + using DiagnosticScope scope = _artifactsClientDiagnostics.CreateScope("DevTestLabArtifactCollection.Exists"); scope.Start(); try { - var response = await _devTestLabArtifactArtifactsRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, name, expand, cancellationToken: cancellationToken).ConfigureAwait(false); + RequestContext context = new RequestContext + { + CancellationToken = cancellationToken + }; + HttpMessage message = _artifactsRestClient.CreateGetRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, name, expand, context); + await Pipeline.SendAsync(message, context.CancellationToken).ConfigureAwait(false); + Response result = message.Response; + Response response = default; + switch (result.Status) + { + case 200: + response = Response.FromValue(DevTestLabArtifactData.FromResponse(result), result); + break; + case 404: + response = Response.FromValue((DevTestLabArtifactData)null, result); + break; + default: + throw new RequestFailedException(result); + } return Response.FromValue(response.Value != null, response.GetRawResponse()); } catch (Exception e) @@ -259,37 +300,51 @@ public virtual async Task> ExistsAsync(string name, string expand /// Checks to see if the resource exists in azure. /// /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/artifactsources/{artifactSourceName}/artifacts/{name} + /// Request Path. + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/artifactsources/{artifactSourceName}/artifacts/{name}. /// /// - /// Operation Id - /// Artifacts_Get + /// Operation Id. + /// Artifacts_Get. /// /// - /// Default Api Version - /// 2018-09-15 - /// - /// - /// Resource - /// + /// Default Api Version. + /// 2018-09-15. /// /// /// /// The name of the artifact. /// Specify the $expand query. Example: 'properties($select=title)'. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. - public virtual Response Exists(string name, string expand = null, CancellationToken cancellationToken = default) + /// is an empty string, and was expected to be non-empty. + public virtual Response Exists(string name, string expand = default, CancellationToken cancellationToken = default) { Argument.AssertNotNullOrEmpty(name, nameof(name)); - using var scope = _devTestLabArtifactArtifactsClientDiagnostics.CreateScope("DevTestLabArtifactCollection.Exists"); + using DiagnosticScope scope = _artifactsClientDiagnostics.CreateScope("DevTestLabArtifactCollection.Exists"); scope.Start(); try { - var response = _devTestLabArtifactArtifactsRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, name, expand, cancellationToken: cancellationToken); + RequestContext context = new RequestContext + { + CancellationToken = cancellationToken + }; + HttpMessage message = _artifactsRestClient.CreateGetRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, name, expand, context); + Pipeline.Send(message, context.CancellationToken); + Response result = message.Response; + Response response = default; + switch (result.Status) + { + case 200: + response = Response.FromValue(DevTestLabArtifactData.FromResponse(result), result); + break; + case 404: + response = Response.FromValue((DevTestLabArtifactData)null, result); + break; + default: + throw new RequestFailedException(result); + } return Response.FromValue(response.Value != null, response.GetRawResponse()); } catch (Exception e) @@ -303,39 +358,55 @@ public virtual Response Exists(string name, string expand = null, Cancella /// Tries to get details for this resource from the service. /// /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/artifactsources/{artifactSourceName}/artifacts/{name} + /// Request Path. + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/artifactsources/{artifactSourceName}/artifacts/{name}. /// /// - /// Operation Id - /// Artifacts_Get + /// Operation Id. + /// Artifacts_Get. /// /// - /// Default Api Version - /// 2018-09-15 - /// - /// - /// Resource - /// + /// Default Api Version. + /// 2018-09-15. /// /// /// /// The name of the artifact. /// Specify the $expand query. Example: 'properties($select=title)'. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. - public virtual async Task> GetIfExistsAsync(string name, string expand = null, CancellationToken cancellationToken = default) + /// is an empty string, and was expected to be non-empty. + public virtual async Task> GetIfExistsAsync(string name, string expand = default, CancellationToken cancellationToken = default) { Argument.AssertNotNullOrEmpty(name, nameof(name)); - using var scope = _devTestLabArtifactArtifactsClientDiagnostics.CreateScope("DevTestLabArtifactCollection.GetIfExists"); + using DiagnosticScope scope = _artifactsClientDiagnostics.CreateScope("DevTestLabArtifactCollection.GetIfExists"); scope.Start(); try { - var response = await _devTestLabArtifactArtifactsRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, name, expand, cancellationToken: cancellationToken).ConfigureAwait(false); + RequestContext context = new RequestContext + { + CancellationToken = cancellationToken + }; + HttpMessage message = _artifactsRestClient.CreateGetRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, name, expand, context); + await Pipeline.SendAsync(message, context.CancellationToken).ConfigureAwait(false); + Response result = message.Response; + Response response = default; + switch (result.Status) + { + case 200: + response = Response.FromValue(DevTestLabArtifactData.FromResponse(result), result); + break; + case 404: + response = Response.FromValue((DevTestLabArtifactData)null, result); + break; + default: + throw new RequestFailedException(result); + } if (response.Value == null) + { return new NoValueResponse(response.GetRawResponse()); + } return Response.FromValue(new DevTestLabArtifactResource(Client, response.Value), response.GetRawResponse()); } catch (Exception e) @@ -349,39 +420,55 @@ public virtual async Task> GetIfExi /// Tries to get details for this resource from the service. /// /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/artifactsources/{artifactSourceName}/artifacts/{name} - /// - /// - /// Operation Id - /// Artifacts_Get + /// Request Path. + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/artifactsources/{artifactSourceName}/artifacts/{name}. /// /// - /// Default Api Version - /// 2018-09-15 + /// Operation Id. + /// Artifacts_Get. /// /// - /// Resource - /// + /// Default Api Version. + /// 2018-09-15. /// /// /// /// The name of the artifact. /// Specify the $expand query. Example: 'properties($select=title)'. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. - public virtual NullableResponse GetIfExists(string name, string expand = null, CancellationToken cancellationToken = default) + /// is an empty string, and was expected to be non-empty. + public virtual NullableResponse GetIfExists(string name, string expand = default, CancellationToken cancellationToken = default) { Argument.AssertNotNullOrEmpty(name, nameof(name)); - using var scope = _devTestLabArtifactArtifactsClientDiagnostics.CreateScope("DevTestLabArtifactCollection.GetIfExists"); + using DiagnosticScope scope = _artifactsClientDiagnostics.CreateScope("DevTestLabArtifactCollection.GetIfExists"); scope.Start(); try { - var response = _devTestLabArtifactArtifactsRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, name, expand, cancellationToken: cancellationToken); + RequestContext context = new RequestContext + { + CancellationToken = cancellationToken + }; + HttpMessage message = _artifactsRestClient.CreateGetRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, name, expand, context); + Pipeline.Send(message, context.CancellationToken); + Response result = message.Response; + Response response = default; + switch (result.Status) + { + case 200: + response = Response.FromValue(DevTestLabArtifactData.FromResponse(result), result); + break; + case 404: + response = Response.FromValue((DevTestLabArtifactData)null, result); + break; + default: + throw new RequestFailedException(result); + } if (response.Value == null) + { return new NoValueResponse(response.GetRawResponse()); + } return Response.FromValue(new DevTestLabArtifactResource(Client, response.Value), response.GetRawResponse()); } catch (Exception e) @@ -401,6 +488,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/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/DevTestLabArtifactData.Serialization.cs b/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/DevTestLabArtifactData.Serialization.cs index 27053d440602..74f72baecda5 100644 --- a/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/DevTestLabArtifactData.Serialization.cs +++ b/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/DevTestLabArtifactData.Serialization.cs @@ -10,15 +10,47 @@ using System.Collections.Generic; using System.Text; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.ResourceManager.DevTestLabs.Models; using Azure.ResourceManager.Models; namespace Azure.ResourceManager.DevTestLabs { - public partial class DevTestLabArtifactData : IUtf8JsonSerializable, IJsonModel + /// An artifact. + public partial class DevTestLabArtifactData : TrackedResourceData, IJsonModel { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + /// Initializes a new instance of for deserialization. + internal DevTestLabArtifactData() + { + } + + /// 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)) + { + return DeserializeDevTestLabArtifactData(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(DevTestLabArtifactData)} does not support reading '{options.Format}' format."); + } + } + + /// The to deserialize the from. + internal static DevTestLabArtifactData FromResponse(Response response) + { + using JsonDocument document = JsonDocument.Parse(response.Content, ModelSerializationExtensions.JsonDocumentOptions); + return DeserializeDevTestLabArtifactData(document.RootElement, ModelSerializationExtensions.WireOptions); + } + /// The JSON writer. + /// The client options for reading and writing models. void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) { writer.WriteStartObject(); @@ -30,234 +62,153 @@ void IJsonModel.Write(Utf8JsonWriter writer, ModelReader /// 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(DevTestLabArtifactData)} does not support writing '{format}' format."); } - base.JsonModelWriteCore(writer, options); writer.WritePropertyName("properties"u8); - writer.WriteStartObject(); - if (options.Format != "W" && Optional.IsDefined(Title)) - { - writer.WritePropertyName("title"u8); - writer.WriteStringValue(Title); - } - if (options.Format != "W" && Optional.IsDefined(Description)) + writer.WriteObjectValue(Properties, options); + if (Optional.IsCollectionDefined(Tags)) { - writer.WritePropertyName("description"u8); - writer.WriteStringValue(Description); - } - if (options.Format != "W" && Optional.IsDefined(Publisher)) - { - writer.WritePropertyName("publisher"u8); - writer.WriteStringValue(Publisher); - } - if (options.Format != "W" && Optional.IsDefined(FilePath)) - { - writer.WritePropertyName("filePath"u8); - writer.WriteStringValue(FilePath); - } - if (options.Format != "W" && Optional.IsDefined(Icon)) - { - writer.WritePropertyName("icon"u8); - writer.WriteStringValue(Icon); - } - if (options.Format != "W" && Optional.IsDefined(TargetOSType)) - { - writer.WritePropertyName("targetOsType"u8); - writer.WriteStringValue(TargetOSType); - } - if (options.Format != "W" && Optional.IsDefined(Parameters)) - { - writer.WritePropertyName("parameters"u8); -#if NET6_0_OR_GREATER - writer.WriteRawValue(Parameters); -#else - using (JsonDocument document = JsonDocument.Parse(Parameters, ModelSerializationExtensions.JsonDocumentOptions)) + writer.WritePropertyName("tags"u8); + writer.WriteStartObject(); + foreach (var item in Tags) { - JsonSerializer.Serialize(writer, document.RootElement); + writer.WritePropertyName(item.Key); + if (item.Value == null) + { + writer.WriteNullValue(); + continue; + } + writer.WriteStringValue(item.Value); } -#endif - } - if (options.Format != "W" && Optional.IsDefined(CreatedOn)) - { - writer.WritePropertyName("createdDate"u8); - writer.WriteStringValue(CreatedOn.Value, "O"); + writer.WriteEndObject(); } - writer.WriteEndObject(); } - DevTestLabArtifactData IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + /// The JSON reader. + /// The client options for reading and writing models. + DevTestLabArtifactData IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) => (DevTestLabArtifactData)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(DevTestLabArtifactData)} does not support reading '{format}' format."); } - using JsonDocument document = JsonDocument.ParseValue(ref reader); return DeserializeDevTestLabArtifactData(document.RootElement, options); } - internal static DevTestLabArtifactData DeserializeDevTestLabArtifactData(JsonElement element, ModelReaderWriterOptions options = null) + /// The JSON element to deserialize. + /// The client options for reading and writing models. + internal static DevTestLabArtifactData DeserializeDevTestLabArtifactData(JsonElement element, ModelReaderWriterOptions options) { - options ??= ModelSerializationExtensions.WireOptions; - if (element.ValueKind == JsonValueKind.Null) { return null; } - IDictionary tags = default; - AzureLocation location = default; ResourceIdentifier id = default; string name = default; - ResourceType type = default; + ResourceType resourceType = default; SystemData systemData = default; - string title = default; - string description = default; - string publisher = default; - string filePath = default; - string icon = default; - string targetOSType = default; - BinaryData parameters = default; - DateTimeOffset? createdDate = default; - IDictionary serializedAdditionalRawData = default; - Dictionary rawDataDictionary = new Dictionary(); - foreach (var property in element.EnumerateObject()) + IDictionary additionalBinaryDataProperties = new ChangeTrackingDictionary(); + AzureLocation location = default; + ArtifactProperties properties = default; + IDictionary tags = default; + foreach (var prop in element.EnumerateObject()) { - if (property.NameEquals("tags"u8)) + if (prop.NameEquals("id"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()) - { - dictionary.Add(property0.Name, property0.Value.GetString()); - } - tags = dictionary; + id = new ResourceIdentifier(prop.Value.GetString()); continue; } - if (property.NameEquals("location"u8)) + if (prop.NameEquals("name"u8)) { - location = new AzureLocation(property.Value.GetString()); + name = prop.Value.GetString(); continue; } - if (property.NameEquals("id"u8)) + if (prop.NameEquals("type"u8)) { - id = new ResourceIdentifier(property.Value.GetString()); + if (prop.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + resourceType = new ResourceType(prop.Value.GetString()); continue; } - if (property.NameEquals("name"u8)) + if (prop.NameEquals("systemData"u8)) { - name = property.Value.GetString(); + if (prop.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + systemData = ModelReaderWriter.Read(new BinaryData(Encoding.UTF8.GetBytes(prop.Value.GetRawText())), ModelSerializationExtensions.WireOptions, AzureResourceManagerDevTestLabsContext.Default); 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) - { - continue; - } - systemData = ModelReaderWriter.Read(new BinaryData(Encoding.UTF8.GetBytes(property.Value.GetRawText())), ModelSerializationExtensions.WireOptions, AzureResourceManagerDevTestLabsContext.Default); + properties = ArtifactProperties.DeserializeArtifactProperties(prop.Value, options); continue; } - if (property.NameEquals("properties"u8)) + if (prop.NameEquals("tags"u8)) { - if (property.Value.ValueKind == JsonValueKind.Null) + if (prop.Value.ValueKind == JsonValueKind.Null) { - property.ThrowNonNullablePropertyIsNull(); continue; } - foreach (var property0 in property.Value.EnumerateObject()) + Dictionary dictionary = new Dictionary(); + foreach (var prop0 in prop.Value.EnumerateObject()) { - if (property0.NameEquals("title"u8)) - { - title = property0.Value.GetString(); - continue; - } - if (property0.NameEquals("description"u8)) - { - description = property0.Value.GetString(); - continue; - } - if (property0.NameEquals("publisher"u8)) - { - publisher = property0.Value.GetString(); - continue; - } - if (property0.NameEquals("filePath"u8)) - { - filePath = property0.Value.GetString(); - continue; - } - if (property0.NameEquals("icon"u8)) + if (prop0.Value.ValueKind == JsonValueKind.Null) { - icon = property0.Value.GetString(); - continue; + dictionary.Add(prop0.Name, null); } - if (property0.NameEquals("targetOsType"u8)) + else { - targetOSType = property0.Value.GetString(); - continue; - } - if (property0.NameEquals("parameters"u8)) - { - if (property0.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - parameters = BinaryData.FromString(property0.Value.GetRawText()); - continue; - } - if (property0.NameEquals("createdDate"u8)) - { - if (property0.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - createdDate = property0.Value.GetDateTimeOffset("O"); - continue; + dictionary.Add(prop0.Name, prop0.Value.GetString()); } } + tags = dictionary; 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 DevTestLabArtifactData( id, name, - type, + resourceType, systemData, - tags ?? new ChangeTrackingDictionary(), + additionalBinaryDataProperties, location, - title, - description, - publisher, - filePath, - icon, - targetOSType, - parameters, - createdDate, - serializedAdditionalRawData); + properties, + tags ?? new ChangeTrackingDictionary()); } - 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": @@ -267,22 +218,11 @@ BinaryData IPersistableModel.Write(ModelReaderWriterOpti } } - DevTestLabArtifactData 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 DeserializeDevTestLabArtifactData(document.RootElement, options); - } - default: - throw new FormatException($"The model {nameof(DevTestLabArtifactData)} does not support reading '{options.Format}' format."); - } - } + /// The data to parse. + /// The client options for reading and writing models. + DevTestLabArtifactData IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) => (DevTestLabArtifactData)PersistableModelCreateCore(data, options); + /// The client options for reading and writing models. string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; } } diff --git a/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/DevTestLabArtifactData.cs b/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/DevTestLabArtifactData.cs index fff241c6ebad..23486bc67ef5 100644 --- a/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/DevTestLabArtifactData.cs +++ b/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/DevTestLabArtifactData.cs @@ -8,132 +8,113 @@ using System; using System.Collections.Generic; using Azure.Core; +using Azure.ResourceManager.DevTestLabs.Models; using Azure.ResourceManager.Models; namespace Azure.ResourceManager.DevTestLabs { - /// - /// A class representing the DevTestLabArtifact data model. - /// An artifact. - /// + /// An artifact. public partial class DevTestLabArtifactData : 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. - public DevTestLabArtifactData(AzureLocation location) : base(location) + /// The geo-location where the resource lives. + /// The properties of the resource. + internal DevTestLabArtifactData(AzureLocation location, ArtifactProperties properties) : base(location) { + Properties = properties; } /// Initializes a new instance of . - /// The id. - /// The name. - /// The resourceType. - /// The systemData. - /// The tags. - /// The location. - /// The artifact's title. - /// The artifact's description. - /// The artifact's publisher. - /// The file path to the artifact. - /// The URI to the artifact icon. - /// The artifact's target OS. - /// The artifact's parameters. - /// The artifact's creation date. - /// Keeps track of any properties unknown to the library. - internal DevTestLabArtifactData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, IDictionary tags, AzureLocation location, string title, string description, string publisher, string filePath, string icon, string targetOSType, BinaryData parameters, DateTimeOffset? createdOn, IDictionary serializedAdditionalRawData) : base(id, name, resourceType, systemData, tags, 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. + /// The geo-location where the resource lives. + /// The properties of the resource. + /// Resource tags. + internal DevTestLabArtifactData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, IDictionary additionalBinaryDataProperties, AzureLocation location, ArtifactProperties properties, IDictionary tags) : base(id, name, resourceType, systemData, tags, location) { - Title = title; - Description = description; - Publisher = publisher; - FilePath = filePath; - Icon = icon; - TargetOSType = targetOSType; - Parameters = parameters; - CreatedOn = createdOn; - _serializedAdditionalRawData = serializedAdditionalRawData; + _additionalBinaryDataProperties = additionalBinaryDataProperties; + Properties = properties; } - /// Initializes a new instance of for deserialization. - internal DevTestLabArtifactData() + /// The properties of the resource. + internal ArtifactProperties Properties { get; } + + /// The artifact's title. + public string Title { + get + { + return Properties.Title; + } } - /// The artifact's title. - public string Title { get; } /// The artifact's description. - public string Description { get; } + public string Description + { + get + { + return Properties.Description; + } + } + /// The artifact's publisher. - public string Publisher { get; } + public string Publisher + { + get + { + return Properties.Publisher; + } + } + /// The file path to the artifact. - public string FilePath { get; } + public string FilePath + { + get + { + return Properties.FilePath; + } + } + /// The URI to the artifact icon. - public string Icon { get; } + public string Icon + { + get + { + return Properties.Icon; + } + } + /// The artifact's target OS. - public string TargetOSType { get; } - /// - /// The artifact's parameters. - /// - /// To assign an object to 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" }. - /// - /// - /// - /// - public BinaryData Parameters { get; } + public string TargetOSType + { + get + { + return Properties.TargetOSType; + } + } + + /// The artifact's parameters. + public BinaryData Parameters + { + get + { + return Properties.Parameters; + } + } + /// The artifact's creation date. - public DateTimeOffset? CreatedOn { get; } + public DateTimeOffset? CreatedOn + { + get + { + return Properties.CreatedOn; + } + } } } diff --git a/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/DevTestLabArtifactResource.Serialization.cs b/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/DevTestLabArtifactResource.Serialization.cs index c0892f1aab4d..528f7a02a219 100644 --- a/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/DevTestLabArtifactResource.Serialization.cs +++ b/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/DevTestLabArtifactResource.Serialization.cs @@ -11,19 +11,29 @@ namespace Azure.ResourceManager.DevTestLabs { + /// public partial class DevTestLabArtifactResource : IJsonModel { - private static DevTestLabArtifactData s_dataDeserializationInstance; - private static DevTestLabArtifactData DataDeserializationInstance => s_dataDeserializationInstance ??= new(); + private static IJsonModel s_dataDeserializationInstance; + private static IJsonModel DataDeserializationInstance => s_dataDeserializationInstance ??= new DevTestLabArtifactData(); + + /// 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); - DevTestLabArtifactData 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. + DevTestLabArtifactData 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, AzureResourceManagerDevTestLabsContext.Default); + /// The binary data to be processed. + /// The client options for reading and writing models. DevTestLabArtifactData IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) => ModelReaderWriter.Read(data, options, AzureResourceManagerDevTestLabsContext.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/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/DevTestLabArtifactResource.cs b/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/DevTestLabArtifactResource.cs index fa7a94ce2566..1b02abaace7e 100644 --- a/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/DevTestLabArtifactResource.cs +++ b/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/DevTestLabArtifactResource.cs @@ -6,48 +6,36 @@ #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; using Azure.ResourceManager.DevTestLabs.Models; namespace Azure.ResourceManager.DevTestLabs { /// - /// A Class representing a DevTestLabArtifact 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 GetDevTestLabArtifactResource method. - /// Otherwise you can get one from its parent resource using the GetDevTestLabArtifact method. + /// A class representing a DevTestLabArtifact 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 GetDevTestLabArtifacts method. /// public partial class DevTestLabArtifactResource : ArmResource { - /// Generate the resource identifier of a instance. - /// The subscriptionId. - /// The resourceGroupName. - /// The labName. - /// The artifactSourceName. - /// The name. - public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string labName, string artifactSourceName, string name) - { - var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/artifactsources/{artifactSourceName}/artifacts/{name}"; - return new ResourceIdentifier(resourceId); - } - - private readonly ClientDiagnostics _devTestLabArtifactArtifactsClientDiagnostics; - private readonly ArtifactsRestOperations _devTestLabArtifactArtifactsRestClient; + private readonly ClientDiagnostics _artifactsClientDiagnostics; + private readonly Artifacts _artifactsRestClient; private readonly DevTestLabArtifactData _data; - /// Gets the resource type for the operations. public static readonly ResourceType ResourceType = "Microsoft.DevTestLab/labs/artifactsources/artifacts"; - /// Initializes a new instance of the class for mocking. + /// Initializes a new instance of DevTestLabArtifactResource for mocking. protected DevTestLabArtifactResource() { } - /// 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 DevTestLabArtifactResource(ArmClient client, DevTestLabArtifactData data) : this(client, data.Id) @@ -56,72 +44,95 @@ internal DevTestLabArtifactResource(ArmClient client, DevTestLabArtifactData dat _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 DevTestLabArtifactResource(ArmClient client, ResourceIdentifier id) : base(client, id) { - _devTestLabArtifactArtifactsClientDiagnostics = new ClientDiagnostics("Azure.ResourceManager.DevTestLabs", ResourceType.Namespace, Diagnostics); - TryGetApiVersion(ResourceType, out string devTestLabArtifactArtifactsApiVersion); - _devTestLabArtifactArtifactsRestClient = new ArtifactsRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, devTestLabArtifactArtifactsApiVersion); -#if DEBUG - ValidateResourceId(Id); -#endif + TryGetApiVersion(ResourceType, out string devTestLabArtifactApiVersion); + _artifactsClientDiagnostics = new ClientDiagnostics("Azure.ResourceManager.DevTestLabs", ResourceType.Namespace, Diagnostics); + _artifactsRestClient = new Artifacts(_artifactsClientDiagnostics, Pipeline, Endpoint, devTestLabArtifactApiVersion ?? "2018-09-15"); + 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 DevTestLabArtifactData 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 labName. + /// The artifactSourceName. + /// The name. + public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string labName, string artifactSourceName, string name) + { + string resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/artifactsources/{artifactSourceName}/artifacts/{name}"; + 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 artifact. /// /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/artifactsources/{artifactSourceName}/artifacts/{name} + /// Request Path. + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/artifactsources/{artifactSourceName}/artifacts/{name}. /// /// - /// Operation Id - /// Artifacts_Get + /// Operation Id. + /// Artifacts_Get. /// /// - /// Default Api Version - /// 2018-09-15 + /// Default Api Version. + /// 2018-09-15. /// /// - /// Resource - /// + /// Resource. + /// . /// /// /// /// Specify the $expand query. Example: 'properties($select=title)'. /// The cancellation token to use. - public virtual async Task> GetAsync(string expand = null, CancellationToken cancellationToken = default) + public virtual async Task> GetAsync(string expand = default, CancellationToken cancellationToken = default) { - using var scope = _devTestLabArtifactArtifactsClientDiagnostics.CreateScope("DevTestLabArtifactResource.Get"); + using DiagnosticScope scope = _artifactsClientDiagnostics.CreateScope("DevTestLabArtifactResource.Get"); scope.Start(); try { - var response = await _devTestLabArtifactArtifactsRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, expand, cancellationToken).ConfigureAwait(false); + RequestContext context = new RequestContext + { + CancellationToken = cancellationToken + }; + HttpMessage message = _artifactsRestClient.CreateGetRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, expand, context); + Response result = await Pipeline.ProcessMessageAsync(message, context).ConfigureAwait(false); + Response response = Response.FromValue(DevTestLabArtifactData.FromResponse(result), result); if (response.Value == null) + { throw new RequestFailedException(response.GetRawResponse()); + } return Response.FromValue(new DevTestLabArtifactResource(Client, response.Value), response.GetRawResponse()); } catch (Exception e) @@ -135,34 +146,42 @@ public virtual async Task> GetAsync(string /// Get artifact. /// /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/artifactsources/{artifactSourceName}/artifacts/{name} + /// Request Path. + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/artifactsources/{artifactSourceName}/artifacts/{name}. /// /// - /// Operation Id - /// Artifacts_Get + /// Operation Id. + /// Artifacts_Get. /// /// - /// Default Api Version - /// 2018-09-15 + /// Default Api Version. + /// 2018-09-15. /// /// - /// Resource - /// + /// Resource. + /// . /// /// /// /// Specify the $expand query. Example: 'properties($select=title)'. /// The cancellation token to use. - public virtual Response Get(string expand = null, CancellationToken cancellationToken = default) + public virtual Response Get(string expand = default, CancellationToken cancellationToken = default) { - using var scope = _devTestLabArtifactArtifactsClientDiagnostics.CreateScope("DevTestLabArtifactResource.Get"); + using DiagnosticScope scope = _artifactsClientDiagnostics.CreateScope("DevTestLabArtifactResource.Get"); scope.Start(); try { - var response = _devTestLabArtifactArtifactsRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, expand, cancellationToken); + RequestContext context = new RequestContext + { + CancellationToken = cancellationToken + }; + HttpMessage message = _artifactsRestClient.CreateGetRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, expand, context); + Response result = Pipeline.ProcessMessage(message, context); + Response response = Response.FromValue(DevTestLabArtifactData.FromResponse(result), result); if (response.Value == null) + { throw new RequestFailedException(response.GetRawResponse()); + } return Response.FromValue(new DevTestLabArtifactResource(Client, response.Value), response.GetRawResponse()); } catch (Exception e) @@ -176,20 +195,20 @@ public virtual Response Get(string expand = null, Ca /// Generates an ARM template for the given artifact, uploads the required files to a storage account, and validates the generated artifact. /// /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/artifactsources/{artifactSourceName}/artifacts/{name}/generateArmTemplate + /// Request Path. + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/artifactsources/{artifactSourceName}/artifacts/{name}/generateArmTemplate. /// /// - /// Operation Id - /// Artifacts_GenerateArmTemplate + /// Operation Id. + /// Artifacts_GenerateArmTemplate. /// /// - /// Default Api Version - /// 2018-09-15 + /// Default Api Version. + /// 2018-09-15. /// /// - /// Resource - /// + /// Resource. + /// . /// /// /// @@ -200,11 +219,21 @@ public virtual async Task> GenerateArmTempla { Argument.AssertNotNull(content, nameof(content)); - using var scope = _devTestLabArtifactArtifactsClientDiagnostics.CreateScope("DevTestLabArtifactResource.GenerateArmTemplate"); + using DiagnosticScope scope = _artifactsClientDiagnostics.CreateScope("DevTestLabArtifactResource.GenerateArmTemplate"); scope.Start(); try { - var response = await _devTestLabArtifactArtifactsRestClient.GenerateArmTemplateAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, content, cancellationToken).ConfigureAwait(false); + RequestContext context = new RequestContext + { + CancellationToken = cancellationToken + }; + HttpMessage message = _artifactsRestClient.CreateGenerateArmTemplateRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, DevTestLabArtifactGenerateArmTemplateContent.ToRequestContent(content), context); + Response result = await Pipeline.ProcessMessageAsync(message, context).ConfigureAwait(false); + Response response = Response.FromValue(DevTestLabArmTemplateInfo.FromResponse(result), result); + if (response.Value == null) + { + throw new RequestFailedException(response.GetRawResponse()); + } return response; } catch (Exception e) @@ -218,20 +247,20 @@ public virtual async Task> GenerateArmTempla /// Generates an ARM template for the given artifact, uploads the required files to a storage account, and validates the generated artifact. /// /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/artifactsources/{artifactSourceName}/artifacts/{name}/generateArmTemplate + /// Request Path. + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/artifactsources/{artifactSourceName}/artifacts/{name}/generateArmTemplate. /// /// - /// Operation Id - /// Artifacts_GenerateArmTemplate + /// Operation Id. + /// Artifacts_GenerateArmTemplate. /// /// - /// Default Api Version - /// 2018-09-15 + /// Default Api Version. + /// 2018-09-15. /// /// - /// Resource - /// + /// Resource. + /// . /// /// /// @@ -242,11 +271,21 @@ public virtual Response GenerateArmTemplate(DevTestLa { Argument.AssertNotNull(content, nameof(content)); - using var scope = _devTestLabArtifactArtifactsClientDiagnostics.CreateScope("DevTestLabArtifactResource.GenerateArmTemplate"); + using DiagnosticScope scope = _artifactsClientDiagnostics.CreateScope("DevTestLabArtifactResource.GenerateArmTemplate"); scope.Start(); try { - var response = _devTestLabArtifactArtifactsRestClient.GenerateArmTemplate(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, content, cancellationToken); + RequestContext context = new RequestContext + { + CancellationToken = cancellationToken + }; + HttpMessage message = _artifactsRestClient.CreateGenerateArmTemplateRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, DevTestLabArtifactGenerateArmTemplateContent.ToRequestContent(content), context); + Response result = Pipeline.ProcessMessage(message, context); + Response response = Response.FromValue(DevTestLabArmTemplateInfo.FromResponse(result), result); + if (response.Value == null) + { + throw new RequestFailedException(response.GetRawResponse()); + } return response; } catch (Exception e) diff --git a/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/DevTestLabArtifactSourceCollection.cs b/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/DevTestLabArtifactSourceCollection.cs index 2c81d54581fa..0a5b1ac19f87 100644 --- a/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/DevTestLabArtifactSourceCollection.cs +++ b/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/DevTestLabArtifactSourceCollection.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.DevTestLabs { @@ -24,51 +25,49 @@ namespace Azure.ResourceManager.DevTestLabs /// public partial class DevTestLabArtifactSourceCollection : ArmCollection, IEnumerable, IAsyncEnumerable { - private readonly ClientDiagnostics _devTestLabArtifactSourceArtifactSourcesClientDiagnostics; - private readonly ArtifactSourcesRestOperations _devTestLabArtifactSourceArtifactSourcesRestClient; + private readonly ClientDiagnostics _artifactSourcesClientDiagnostics; + private readonly ArtifactSources _artifactSourcesRestClient; - /// Initializes a new instance of the class for mocking. + /// Initializes a new instance of DevTestLabArtifactSourceCollection for mocking. protected DevTestLabArtifactSourceCollection() { } - /// 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 DevTestLabArtifactSourceCollection(ArmClient client, ResourceIdentifier id) : base(client, id) { - _devTestLabArtifactSourceArtifactSourcesClientDiagnostics = new ClientDiagnostics("Azure.ResourceManager.DevTestLabs", DevTestLabArtifactSourceResource.ResourceType.Namespace, Diagnostics); - TryGetApiVersion(DevTestLabArtifactSourceResource.ResourceType, out string devTestLabArtifactSourceArtifactSourcesApiVersion); - _devTestLabArtifactSourceArtifactSourcesRestClient = new ArtifactSourcesRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, devTestLabArtifactSourceArtifactSourcesApiVersion); -#if DEBUG - ValidateResourceId(Id); -#endif + TryGetApiVersion(DevTestLabArtifactSourceResource.ResourceType, out string devTestLabArtifactSourceApiVersion); + _artifactSourcesClientDiagnostics = new ClientDiagnostics("Azure.ResourceManager.DevTestLabs", DevTestLabArtifactSourceResource.ResourceType.Namespace, Diagnostics); + _artifactSourcesRestClient = new ArtifactSources(_artifactSourcesClientDiagnostics, Pipeline, Endpoint, devTestLabArtifactSourceApiVersion ?? "2018-09-15"); + ValidateResourceId(id); } + /// + [Conditional("DEBUG")] internal static void ValidateResourceId(ResourceIdentifier id) { if (id.ResourceType != DevTestLabResource.ResourceType) - throw new ArgumentException(string.Format(CultureInfo.CurrentCulture, "Invalid resource type {0} expected {1}", id.ResourceType, DevTestLabResource.ResourceType), nameof(id)); + { + throw new ArgumentException(string.Format("Invalid resource type {0} expected {1}", id.ResourceType, DevTestLabResource.ResourceType), id); + } } /// /// Create or replace an existing artifact source. /// /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/artifactsources/{name} - /// - /// - /// Operation Id - /// ArtifactSources_CreateOrUpdate + /// Request Path. + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/artifactsources/{name}. /// /// - /// Default Api Version - /// 2018-09-15 + /// Operation Id. + /// ArtifactSources_CreateOrUpdate. /// /// - /// Resource - /// + /// Default Api Version. + /// 2018-09-15. /// /// /// @@ -76,23 +75,31 @@ internal static void ValidateResourceId(ResourceIdentifier id) /// The name of the artifact source. /// Properties of an artifact source. /// 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 name, DevTestLabArtifactSourceData data, CancellationToken cancellationToken = default) { Argument.AssertNotNullOrEmpty(name, nameof(name)); Argument.AssertNotNull(data, nameof(data)); - using var scope = _devTestLabArtifactSourceArtifactSourcesClientDiagnostics.CreateScope("DevTestLabArtifactSourceCollection.CreateOrUpdate"); + using DiagnosticScope scope = _artifactSourcesClientDiagnostics.CreateScope("DevTestLabArtifactSourceCollection.CreateOrUpdate"); scope.Start(); try { - var response = await _devTestLabArtifactSourceArtifactSourcesRestClient.CreateOrUpdateAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, name, data, cancellationToken).ConfigureAwait(false); - var uri = _devTestLabArtifactSourceArtifactSourcesRestClient.CreateCreateOrUpdateRequestUri(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, name, data); - var rehydrationToken = NextLinkOperationImplementation.GetRehydrationToken(RequestMethod.Put, uri.ToUri(), uri.ToString(), "None", null, OperationFinalStateVia.OriginalUri.ToString()); - var operation = new DevTestLabsArmOperation(Response.FromValue(new DevTestLabArtifactSourceResource(Client, response), response.GetRawResponse()), rehydrationToken); + RequestContext context = new RequestContext + { + CancellationToken = cancellationToken + }; + HttpMessage message = _artifactSourcesRestClient.CreateCreateOrUpdateRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, name, DevTestLabArtifactSourceData.ToRequestContent(data), context); + Response result = await Pipeline.ProcessMessageAsync(message, context).ConfigureAwait(false); + Response response = Response.FromValue(DevTestLabArtifactSourceData.FromResponse(result), result); + RequestUriBuilder uri = message.Request.Uri; + RehydrationToken rehydrationToken = NextLinkOperationImplementation.GetRehydrationToken(RequestMethod.Put, uri.ToUri(), uri.ToString(), "None", null, OperationFinalStateVia.OriginalUri.ToString()); + DevTestLabsArmOperation operation = new DevTestLabsArmOperation(Response.FromValue(new DevTestLabArtifactSourceResource(Client, response.Value), response.GetRawResponse()), rehydrationToken); if (waitUntil == WaitUntil.Completed) + { await operation.WaitForCompletionAsync(cancellationToken).ConfigureAwait(false); + } return operation; } catch (Exception e) @@ -106,20 +113,16 @@ public virtual async Task> Create /// Create or replace an existing artifact source. /// /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/artifactsources/{name} + /// Request Path. + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/artifactsources/{name}. /// /// - /// Operation Id - /// ArtifactSources_CreateOrUpdate + /// Operation Id. + /// ArtifactSources_CreateOrUpdate. /// /// - /// Default Api Version - /// 2018-09-15 - /// - /// - /// Resource - /// + /// Default Api Version. + /// 2018-09-15. /// /// /// @@ -127,23 +130,31 @@ public virtual async Task> Create /// The name of the artifact source. /// Properties of an artifact source. /// 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 name, DevTestLabArtifactSourceData data, CancellationToken cancellationToken = default) { Argument.AssertNotNullOrEmpty(name, nameof(name)); Argument.AssertNotNull(data, nameof(data)); - using var scope = _devTestLabArtifactSourceArtifactSourcesClientDiagnostics.CreateScope("DevTestLabArtifactSourceCollection.CreateOrUpdate"); + using DiagnosticScope scope = _artifactSourcesClientDiagnostics.CreateScope("DevTestLabArtifactSourceCollection.CreateOrUpdate"); scope.Start(); try { - var response = _devTestLabArtifactSourceArtifactSourcesRestClient.CreateOrUpdate(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, name, data, cancellationToken); - var uri = _devTestLabArtifactSourceArtifactSourcesRestClient.CreateCreateOrUpdateRequestUri(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, name, data); - var rehydrationToken = NextLinkOperationImplementation.GetRehydrationToken(RequestMethod.Put, uri.ToUri(), uri.ToString(), "None", null, OperationFinalStateVia.OriginalUri.ToString()); - var operation = new DevTestLabsArmOperation(Response.FromValue(new DevTestLabArtifactSourceResource(Client, response), response.GetRawResponse()), rehydrationToken); + RequestContext context = new RequestContext + { + CancellationToken = cancellationToken + }; + HttpMessage message = _artifactSourcesRestClient.CreateCreateOrUpdateRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, name, DevTestLabArtifactSourceData.ToRequestContent(data), context); + Response result = Pipeline.ProcessMessage(message, context); + Response response = Response.FromValue(DevTestLabArtifactSourceData.FromResponse(result), result); + RequestUriBuilder uri = message.Request.Uri; + RehydrationToken rehydrationToken = NextLinkOperationImplementation.GetRehydrationToken(RequestMethod.Put, uri.ToUri(), uri.ToString(), "None", null, OperationFinalStateVia.OriginalUri.ToString()); + DevTestLabsArmOperation operation = new DevTestLabsArmOperation(Response.FromValue(new DevTestLabArtifactSourceResource(Client, response.Value), response.GetRawResponse()), rehydrationToken); if (waitUntil == WaitUntil.Completed) + { operation.WaitForCompletion(cancellationToken); + } return operation; } catch (Exception e) @@ -157,39 +168,43 @@ public virtual ArmOperation CreateOrUpdate(Wai /// Get artifact source. /// /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/artifactsources/{name} + /// Request Path. + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/artifactsources/{name}. /// /// - /// Operation Id - /// ArtifactSources_Get + /// Operation Id. + /// ArtifactSources_Get. /// /// - /// Default Api Version - /// 2018-09-15 - /// - /// - /// Resource - /// + /// Default Api Version. + /// 2018-09-15. /// /// /// /// The name of the artifact source. /// Specify the $expand query. Example: 'properties($select=displayName)'. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. - public virtual async Task> GetAsync(string name, string expand = null, CancellationToken cancellationToken = default) + /// is an empty string, and was expected to be non-empty. + public virtual async Task> GetAsync(string name, string expand = default, CancellationToken cancellationToken = default) { Argument.AssertNotNullOrEmpty(name, nameof(name)); - using var scope = _devTestLabArtifactSourceArtifactSourcesClientDiagnostics.CreateScope("DevTestLabArtifactSourceCollection.Get"); + using DiagnosticScope scope = _artifactSourcesClientDiagnostics.CreateScope("DevTestLabArtifactSourceCollection.Get"); scope.Start(); try { - var response = await _devTestLabArtifactSourceArtifactSourcesRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, name, expand, cancellationToken).ConfigureAwait(false); + RequestContext context = new RequestContext + { + CancellationToken = cancellationToken + }; + HttpMessage message = _artifactSourcesRestClient.CreateGetRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, name, expand, context); + Response result = await Pipeline.ProcessMessageAsync(message, context).ConfigureAwait(false); + Response response = Response.FromValue(DevTestLabArtifactSourceData.FromResponse(result), result); if (response.Value == null) + { throw new RequestFailedException(response.GetRawResponse()); + } return Response.FromValue(new DevTestLabArtifactSourceResource(Client, response.Value), response.GetRawResponse()); } catch (Exception e) @@ -203,39 +218,43 @@ public virtual async Task> GetAsync(s /// Get artifact source. /// /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/artifactsources/{name} - /// - /// - /// Operation Id - /// ArtifactSources_Get + /// Request Path. + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/artifactsources/{name}. /// /// - /// Default Api Version - /// 2018-09-15 + /// Operation Id. + /// ArtifactSources_Get. /// /// - /// Resource - /// + /// Default Api Version. + /// 2018-09-15. /// /// /// /// The name of the artifact source. /// Specify the $expand query. Example: 'properties($select=displayName)'. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. - public virtual Response Get(string name, string expand = null, CancellationToken cancellationToken = default) + /// is an empty string, and was expected to be non-empty. + public virtual Response Get(string name, string expand = default, CancellationToken cancellationToken = default) { Argument.AssertNotNullOrEmpty(name, nameof(name)); - using var scope = _devTestLabArtifactSourceArtifactSourcesClientDiagnostics.CreateScope("DevTestLabArtifactSourceCollection.Get"); + using DiagnosticScope scope = _artifactSourcesClientDiagnostics.CreateScope("DevTestLabArtifactSourceCollection.Get"); scope.Start(); try { - var response = _devTestLabArtifactSourceArtifactSourcesRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, name, expand, cancellationToken); + RequestContext context = new RequestContext + { + CancellationToken = cancellationToken + }; + HttpMessage message = _artifactSourcesRestClient.CreateGetRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, name, expand, context); + Response result = Pipeline.ProcessMessage(message, context); + Response response = Response.FromValue(DevTestLabArtifactSourceData.FromResponse(result), result); if (response.Value == null) + { throw new RequestFailedException(response.GetRawResponse()); + } return Response.FromValue(new DevTestLabArtifactSourceResource(Client, response.Value), response.GetRawResponse()); } catch (Exception e) @@ -249,20 +268,16 @@ public virtual Response Get(string name, strin /// List artifact sources in a given lab. /// /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/artifactsources + /// Request Path. + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/artifactsources. /// /// - /// Operation Id - /// ArtifactSources_List + /// Operation Id. + /// ArtifactSources_List. /// /// - /// Default Api Version - /// 2018-09-15 - /// - /// - /// Resource - /// + /// Default Api Version. + /// 2018-09-15. /// /// /// @@ -271,32 +286,39 @@ public virtual Response Get(string name, strin /// The maximum number of resources to return from the operation. Example: '$top=10'. /// The ordering expression for the results, using OData notation. Example: '$orderby=name desc'. /// The cancellation token to use. - /// An async collection of that may take multiple service requests to iterate over. - public virtual AsyncPageable GetAllAsync(string expand = null, string filter = null, int? top = null, string orderby = null, CancellationToken cancellationToken = default) + /// A collection of that may take multiple service requests to iterate over. + public virtual AsyncPageable GetAllAsync(string expand = default, string filter = default, int? top = default, string @orderby = default, CancellationToken cancellationToken = default) { - HttpMessage FirstPageRequest(int? pageSizeHint) => _devTestLabArtifactSourceArtifactSourcesRestClient.CreateListRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, expand, filter, top, orderby); - HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _devTestLabArtifactSourceArtifactSourcesRestClient.CreateListNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName, Id.Name, expand, filter, top, orderby); - return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new DevTestLabArtifactSourceResource(Client, DevTestLabArtifactSourceData.DeserializeDevTestLabArtifactSourceData(e)), _devTestLabArtifactSourceArtifactSourcesClientDiagnostics, Pipeline, "DevTestLabArtifactSourceCollection.GetAll", "value", "nextLink", cancellationToken); + RequestContext context = new RequestContext + { + CancellationToken = cancellationToken + }; + return new AsyncPageableWrapper(new ArtifactSourcesGetAllAsyncCollectionResultOfT( + _artifactSourcesRestClient, + Id.SubscriptionId, + Id.ResourceGroupName, + Id.Name, + expand, + filter, + top, + @orderby, + context), data => new DevTestLabArtifactSourceResource(Client, data)); } /// /// List artifact sources in a given lab. /// /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/artifactsources - /// - /// - /// Operation Id - /// ArtifactSources_List + /// Request Path. + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/artifactsources. /// /// - /// Default Api Version - /// 2018-09-15 + /// Operation Id. + /// ArtifactSources_List. /// /// - /// Resource - /// + /// Default Api Version. + /// 2018-09-15. /// /// /// @@ -306,48 +328,73 @@ public virtual AsyncPageable GetAllAsync(strin /// The ordering expression for the results, using OData notation. Example: '$orderby=name desc'. /// The cancellation token to use. /// A collection of that may take multiple service requests to iterate over. - public virtual Pageable GetAll(string expand = null, string filter = null, int? top = null, string orderby = null, CancellationToken cancellationToken = default) + public virtual Pageable GetAll(string expand = default, string filter = default, int? top = default, string @orderby = default, CancellationToken cancellationToken = default) { - HttpMessage FirstPageRequest(int? pageSizeHint) => _devTestLabArtifactSourceArtifactSourcesRestClient.CreateListRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, expand, filter, top, orderby); - HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _devTestLabArtifactSourceArtifactSourcesRestClient.CreateListNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName, Id.Name, expand, filter, top, orderby); - return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new DevTestLabArtifactSourceResource(Client, DevTestLabArtifactSourceData.DeserializeDevTestLabArtifactSourceData(e)), _devTestLabArtifactSourceArtifactSourcesClientDiagnostics, Pipeline, "DevTestLabArtifactSourceCollection.GetAll", "value", "nextLink", cancellationToken); + RequestContext context = new RequestContext + { + CancellationToken = cancellationToken + }; + return new PageableWrapper(new ArtifactSourcesGetAllCollectionResultOfT( + _artifactSourcesRestClient, + Id.SubscriptionId, + Id.ResourceGroupName, + Id.Name, + expand, + filter, + top, + @orderby, + context), data => new DevTestLabArtifactSourceResource(Client, data)); } /// /// Checks to see if the resource exists in azure. /// /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/artifactsources/{name} - /// - /// - /// Operation Id - /// ArtifactSources_Get + /// Request Path. + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/artifactsources/{name}. /// /// - /// Default Api Version - /// 2018-09-15 + /// Operation Id. + /// ArtifactSources_Get. /// /// - /// Resource - /// + /// Default Api Version. + /// 2018-09-15. /// /// /// /// The name of the artifact source. /// Specify the $expand query. Example: 'properties($select=displayName)'. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. - public virtual async Task> ExistsAsync(string name, string expand = null, CancellationToken cancellationToken = default) + /// is an empty string, and was expected to be non-empty. + public virtual async Task> ExistsAsync(string name, string expand = default, CancellationToken cancellationToken = default) { Argument.AssertNotNullOrEmpty(name, nameof(name)); - using var scope = _devTestLabArtifactSourceArtifactSourcesClientDiagnostics.CreateScope("DevTestLabArtifactSourceCollection.Exists"); + using DiagnosticScope scope = _artifactSourcesClientDiagnostics.CreateScope("DevTestLabArtifactSourceCollection.Exists"); scope.Start(); try { - var response = await _devTestLabArtifactSourceArtifactSourcesRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, name, expand, cancellationToken: cancellationToken).ConfigureAwait(false); + RequestContext context = new RequestContext + { + CancellationToken = cancellationToken + }; + HttpMessage message = _artifactSourcesRestClient.CreateGetRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, name, expand, context); + await Pipeline.SendAsync(message, context.CancellationToken).ConfigureAwait(false); + Response result = message.Response; + Response response = default; + switch (result.Status) + { + case 200: + response = Response.FromValue(DevTestLabArtifactSourceData.FromResponse(result), result); + break; + case 404: + response = Response.FromValue((DevTestLabArtifactSourceData)null, result); + break; + default: + throw new RequestFailedException(result); + } return Response.FromValue(response.Value != null, response.GetRawResponse()); } catch (Exception e) @@ -361,37 +408,51 @@ public virtual async Task> ExistsAsync(string name, string expand /// Checks to see if the resource exists in azure. /// /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/artifactsources/{name} + /// Request Path. + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/artifactsources/{name}. /// /// - /// Operation Id - /// ArtifactSources_Get + /// Operation Id. + /// ArtifactSources_Get. /// /// - /// Default Api Version - /// 2018-09-15 - /// - /// - /// Resource - /// + /// Default Api Version. + /// 2018-09-15. /// /// /// /// The name of the artifact source. /// Specify the $expand query. Example: 'properties($select=displayName)'. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. - public virtual Response Exists(string name, string expand = null, CancellationToken cancellationToken = default) + /// is an empty string, and was expected to be non-empty. + public virtual Response Exists(string name, string expand = default, CancellationToken cancellationToken = default) { Argument.AssertNotNullOrEmpty(name, nameof(name)); - using var scope = _devTestLabArtifactSourceArtifactSourcesClientDiagnostics.CreateScope("DevTestLabArtifactSourceCollection.Exists"); + using DiagnosticScope scope = _artifactSourcesClientDiagnostics.CreateScope("DevTestLabArtifactSourceCollection.Exists"); scope.Start(); try { - var response = _devTestLabArtifactSourceArtifactSourcesRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, name, expand, cancellationToken: cancellationToken); + RequestContext context = new RequestContext + { + CancellationToken = cancellationToken + }; + HttpMessage message = _artifactSourcesRestClient.CreateGetRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, name, expand, context); + Pipeline.Send(message, context.CancellationToken); + Response result = message.Response; + Response response = default; + switch (result.Status) + { + case 200: + response = Response.FromValue(DevTestLabArtifactSourceData.FromResponse(result), result); + break; + case 404: + response = Response.FromValue((DevTestLabArtifactSourceData)null, result); + break; + default: + throw new RequestFailedException(result); + } return Response.FromValue(response.Value != null, response.GetRawResponse()); } catch (Exception e) @@ -405,39 +466,55 @@ public virtual Response Exists(string name, string expand = null, Cancella /// Tries to get details for this resource from the service. /// /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/artifactsources/{name} - /// - /// - /// Operation Id - /// ArtifactSources_Get + /// Request Path. + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/artifactsources/{name}. /// /// - /// Default Api Version - /// 2018-09-15 + /// Operation Id. + /// ArtifactSources_Get. /// /// - /// Resource - /// + /// Default Api Version. + /// 2018-09-15. /// /// /// /// The name of the artifact source. /// Specify the $expand query. Example: 'properties($select=displayName)'. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. - public virtual async Task> GetIfExistsAsync(string name, string expand = null, CancellationToken cancellationToken = default) + /// is an empty string, and was expected to be non-empty. + public virtual async Task> GetIfExistsAsync(string name, string expand = default, CancellationToken cancellationToken = default) { Argument.AssertNotNullOrEmpty(name, nameof(name)); - using var scope = _devTestLabArtifactSourceArtifactSourcesClientDiagnostics.CreateScope("DevTestLabArtifactSourceCollection.GetIfExists"); + using DiagnosticScope scope = _artifactSourcesClientDiagnostics.CreateScope("DevTestLabArtifactSourceCollection.GetIfExists"); scope.Start(); try { - var response = await _devTestLabArtifactSourceArtifactSourcesRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, name, expand, cancellationToken: cancellationToken).ConfigureAwait(false); + RequestContext context = new RequestContext + { + CancellationToken = cancellationToken + }; + HttpMessage message = _artifactSourcesRestClient.CreateGetRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, name, expand, context); + await Pipeline.SendAsync(message, context.CancellationToken).ConfigureAwait(false); + Response result = message.Response; + Response response = default; + switch (result.Status) + { + case 200: + response = Response.FromValue(DevTestLabArtifactSourceData.FromResponse(result), result); + break; + case 404: + response = Response.FromValue((DevTestLabArtifactSourceData)null, result); + break; + default: + throw new RequestFailedException(result); + } if (response.Value == null) + { return new NoValueResponse(response.GetRawResponse()); + } return Response.FromValue(new DevTestLabArtifactSourceResource(Client, response.Value), response.GetRawResponse()); } catch (Exception e) @@ -451,39 +528,55 @@ public virtual async Task> Ge /// Tries to get details for this resource from the service. /// /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/artifactsources/{name} + /// Request Path. + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/artifactsources/{name}. /// /// - /// Operation Id - /// ArtifactSources_Get + /// Operation Id. + /// ArtifactSources_Get. /// /// - /// Default Api Version - /// 2018-09-15 - /// - /// - /// Resource - /// + /// Default Api Version. + /// 2018-09-15. /// /// /// /// The name of the artifact source. /// Specify the $expand query. Example: 'properties($select=displayName)'. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. - public virtual NullableResponse GetIfExists(string name, string expand = null, CancellationToken cancellationToken = default) + /// is an empty string, and was expected to be non-empty. + public virtual NullableResponse GetIfExists(string name, string expand = default, CancellationToken cancellationToken = default) { Argument.AssertNotNullOrEmpty(name, nameof(name)); - using var scope = _devTestLabArtifactSourceArtifactSourcesClientDiagnostics.CreateScope("DevTestLabArtifactSourceCollection.GetIfExists"); + using DiagnosticScope scope = _artifactSourcesClientDiagnostics.CreateScope("DevTestLabArtifactSourceCollection.GetIfExists"); scope.Start(); try { - var response = _devTestLabArtifactSourceArtifactSourcesRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, name, expand, cancellationToken: cancellationToken); + RequestContext context = new RequestContext + { + CancellationToken = cancellationToken + }; + HttpMessage message = _artifactSourcesRestClient.CreateGetRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, name, expand, context); + Pipeline.Send(message, context.CancellationToken); + Response result = message.Response; + Response response = default; + switch (result.Status) + { + case 200: + response = Response.FromValue(DevTestLabArtifactSourceData.FromResponse(result), result); + break; + case 404: + response = Response.FromValue((DevTestLabArtifactSourceData)null, result); + break; + default: + throw new RequestFailedException(result); + } if (response.Value == null) + { return new NoValueResponse(response.GetRawResponse()); + } return Response.FromValue(new DevTestLabArtifactSourceResource(Client, response.Value), response.GetRawResponse()); } catch (Exception e) @@ -503,6 +596,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/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/DevTestLabArtifactSourceData.Serialization.cs b/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/DevTestLabArtifactSourceData.Serialization.cs index efb45c076f34..613280f03e74 100644 --- a/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/DevTestLabArtifactSourceData.Serialization.cs +++ b/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/DevTestLabArtifactSourceData.Serialization.cs @@ -10,16 +10,47 @@ using System.Collections.Generic; using System.Text; using System.Text.Json; +using Azure; using Azure.Core; using Azure.ResourceManager.DevTestLabs.Models; using Azure.ResourceManager.Models; namespace Azure.ResourceManager.DevTestLabs { - public partial class DevTestLabArtifactSourceData : IUtf8JsonSerializable, IJsonModel + /// Properties of an artifact source. + public partial class DevTestLabArtifactSourceData : TrackedResourceData, IJsonModel { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + /// Initializes a new instance of for deserialization. + internal DevTestLabArtifactSourceData() + { + } + + /// 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)) + { + return DeserializeDevTestLabArtifactSourceData(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(DevTestLabArtifactSourceData)} does not support reading '{options.Format}' format."); + } + } + + /// The to deserialize the from. + internal static DevTestLabArtifactSourceData FromResponse(Response response) + { + using JsonDocument document = JsonDocument.Parse(response.Content, ModelSerializationExtensions.JsonDocumentOptions); + return DeserializeDevTestLabArtifactSourceData(document.RootElement, ModelSerializationExtensions.WireOptions); + } + /// The JSON writer. + /// The client options for reading and writing models. void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) { writer.WriteStartObject(); @@ -31,275 +62,153 @@ void IJsonModel.Write(Utf8JsonWriter writer, Model /// 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(DevTestLabArtifactSourceData)} does not support writing '{format}' format."); } - base.JsonModelWriteCore(writer, options); writer.WritePropertyName("properties"u8); - writer.WriteStartObject(); - if (Optional.IsDefined(DisplayName)) - { - writer.WritePropertyName("displayName"u8); - writer.WriteStringValue(DisplayName); - } - if (Optional.IsDefined(Uri)) - { - writer.WritePropertyName("uri"u8); - writer.WriteStringValue(Uri.AbsoluteUri); - } - if (Optional.IsDefined(SourceType)) - { - writer.WritePropertyName("sourceType"u8); - writer.WriteStringValue(SourceType.Value.ToString()); - } - if (Optional.IsDefined(FolderPath)) + writer.WriteObjectValue(Properties, options); + if (Optional.IsCollectionDefined(Tags)) { - writer.WritePropertyName("folderPath"u8); - writer.WriteStringValue(FolderPath); - } - if (Optional.IsDefined(ArmTemplateFolderPath)) - { - writer.WritePropertyName("armTemplateFolderPath"u8); - writer.WriteStringValue(ArmTemplateFolderPath); - } - if (Optional.IsDefined(BranchRef)) - { - writer.WritePropertyName("branchRef"u8); - writer.WriteStringValue(BranchRef); - } - if (Optional.IsDefined(SecurityToken)) - { - writer.WritePropertyName("securityToken"u8); - writer.WriteStringValue(SecurityToken); - } - if (Optional.IsDefined(Status)) - { - writer.WritePropertyName("status"u8); - writer.WriteStringValue(Status.Value.ToString()); - } - if (options.Format != "W" && Optional.IsDefined(CreatedOn)) - { - writer.WritePropertyName("createdDate"u8); - writer.WriteStringValue(CreatedOn.Value, "O"); - } - if (options.Format != "W" && Optional.IsDefined(ProvisioningState)) - { - writer.WritePropertyName("provisioningState"u8); - writer.WriteStringValue(ProvisioningState); - } - if (options.Format != "W" && Optional.IsDefined(UniqueIdentifier)) - { - writer.WritePropertyName("uniqueIdentifier"u8); - writer.WriteStringValue(UniqueIdentifier.Value); + writer.WritePropertyName("tags"u8); + writer.WriteStartObject(); + foreach (var item in Tags) + { + writer.WritePropertyName(item.Key); + if (item.Value == null) + { + writer.WriteNullValue(); + continue; + } + writer.WriteStringValue(item.Value); + } + writer.WriteEndObject(); } - writer.WriteEndObject(); } - DevTestLabArtifactSourceData IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + /// The JSON reader. + /// The client options for reading and writing models. + DevTestLabArtifactSourceData IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) => (DevTestLabArtifactSourceData)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(DevTestLabArtifactSourceData)} does not support reading '{format}' format."); } - using JsonDocument document = JsonDocument.ParseValue(ref reader); return DeserializeDevTestLabArtifactSourceData(document.RootElement, options); } - internal static DevTestLabArtifactSourceData DeserializeDevTestLabArtifactSourceData(JsonElement element, ModelReaderWriterOptions options = null) + /// The JSON element to deserialize. + /// The client options for reading and writing models. + internal static DevTestLabArtifactSourceData DeserializeDevTestLabArtifactSourceData(JsonElement element, ModelReaderWriterOptions options) { - options ??= ModelSerializationExtensions.WireOptions; - if (element.ValueKind == JsonValueKind.Null) { return null; } - IDictionary tags = default; - AzureLocation location = default; ResourceIdentifier id = default; string name = default; - ResourceType type = default; + ResourceType resourceType = default; SystemData systemData = default; - string displayName = default; - Uri uri = default; - DevTestLabSourceControlType? sourceType = default; - string folderPath = default; - string armTemplateFolderPath = default; - string branchRef = default; - string securityToken = default; - DevTestLabEnableStatus? status = default; - DateTimeOffset? createdDate = default; - string provisioningState = default; - Guid? uniqueIdentifier = default; - IDictionary serializedAdditionalRawData = default; - Dictionary rawDataDictionary = new Dictionary(); - foreach (var property in element.EnumerateObject()) + IDictionary additionalBinaryDataProperties = new ChangeTrackingDictionary(); + AzureLocation location = default; + ArtifactSourceProperties properties = default; + IDictionary tags = default; + foreach (var prop in element.EnumerateObject()) { - if (property.NameEquals("tags"u8)) + if (prop.NameEquals("id"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()) - { - dictionary.Add(property0.Name, property0.Value.GetString()); - } - tags = dictionary; + id = new ResourceIdentifier(prop.Value.GetString()); continue; } - if (property.NameEquals("location"u8)) + if (prop.NameEquals("name"u8)) { - location = new AzureLocation(property.Value.GetString()); + name = prop.Value.GetString(); continue; } - if (property.NameEquals("id"u8)) + if (prop.NameEquals("type"u8)) { - id = new ResourceIdentifier(property.Value.GetString()); + if (prop.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + resourceType = new ResourceType(prop.Value.GetString()); continue; } - if (property.NameEquals("name"u8)) + if (prop.NameEquals("systemData"u8)) { - name = property.Value.GetString(); + if (prop.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + systemData = ModelReaderWriter.Read(new BinaryData(Encoding.UTF8.GetBytes(prop.Value.GetRawText())), ModelSerializationExtensions.WireOptions, AzureResourceManagerDevTestLabsContext.Default); 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) - { - continue; - } - systemData = ModelReaderWriter.Read(new BinaryData(Encoding.UTF8.GetBytes(property.Value.GetRawText())), ModelSerializationExtensions.WireOptions, AzureResourceManagerDevTestLabsContext.Default); + properties = ArtifactSourceProperties.DeserializeArtifactSourceProperties(prop.Value, options); continue; } - if (property.NameEquals("properties"u8)) + if (prop.NameEquals("tags"u8)) { - if (property.Value.ValueKind == JsonValueKind.Null) + if (prop.Value.ValueKind == JsonValueKind.Null) { - property.ThrowNonNullablePropertyIsNull(); continue; } - foreach (var property0 in property.Value.EnumerateObject()) + Dictionary dictionary = new Dictionary(); + foreach (var prop0 in prop.Value.EnumerateObject()) { - if (property0.NameEquals("displayName"u8)) - { - displayName = property0.Value.GetString(); - continue; - } - if (property0.NameEquals("uri"u8)) - { - if (property0.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - uri = new Uri(property0.Value.GetString()); - continue; - } - if (property0.NameEquals("sourceType"u8)) - { - if (property0.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - sourceType = new DevTestLabSourceControlType(property0.Value.GetString()); - continue; - } - if (property0.NameEquals("folderPath"u8)) - { - folderPath = property0.Value.GetString(); - continue; - } - if (property0.NameEquals("armTemplateFolderPath"u8)) - { - armTemplateFolderPath = property0.Value.GetString(); - continue; - } - if (property0.NameEquals("branchRef"u8)) - { - branchRef = property0.Value.GetString(); - continue; - } - if (property0.NameEquals("securityToken"u8)) + if (prop0.Value.ValueKind == JsonValueKind.Null) { - securityToken = property0.Value.GetString(); - continue; + dictionary.Add(prop0.Name, null); } - if (property0.NameEquals("status"u8)) + else { - if (property0.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - status = new DevTestLabEnableStatus(property0.Value.GetString()); - continue; - } - if (property0.NameEquals("createdDate"u8)) - { - if (property0.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - createdDate = property0.Value.GetDateTimeOffset("O"); - continue; - } - if (property0.NameEquals("provisioningState"u8)) - { - provisioningState = property0.Value.GetString(); - continue; - } - if (property0.NameEquals("uniqueIdentifier"u8)) - { - if (property0.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - uniqueIdentifier = property0.Value.GetGuid(); - continue; + dictionary.Add(prop0.Name, prop0.Value.GetString()); } } + tags = dictionary; 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 DevTestLabArtifactSourceData( id, name, - type, + resourceType, systemData, - tags ?? new ChangeTrackingDictionary(), + additionalBinaryDataProperties, location, - displayName, - uri, - sourceType, - folderPath, - armTemplateFolderPath, - branchRef, - securityToken, - status, - createdDate, - provisioningState, - uniqueIdentifier, - serializedAdditionalRawData); + properties, + tags ?? new ChangeTrackingDictionary()); } - 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": @@ -309,22 +218,23 @@ BinaryData IPersistableModel.Write(ModelReaderWrit } } - DevTestLabArtifactSourceData 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. + DevTestLabArtifactSourceData IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) => (DevTestLabArtifactSourceData)PersistableModelCreateCore(data, options); - switch (format) + /// The client options for reading and writing models. + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + + /// The to serialize into . + internal static RequestContent ToRequestContent(DevTestLabArtifactSourceData devTestLabArtifactSourceData) + { + if (devTestLabArtifactSourceData == null) { - case "J": - { - using JsonDocument document = JsonDocument.Parse(data, ModelSerializationExtensions.JsonDocumentOptions); - return DeserializeDevTestLabArtifactSourceData(document.RootElement, options); - } - default: - throw new FormatException($"The model {nameof(DevTestLabArtifactSourceData)} does not support reading '{options.Format}' format."); + return null; } + Utf8JsonRequestContent content = new Utf8JsonRequestContent(); + content.JsonWriter.WriteObjectValue(devTestLabArtifactSourceData, ModelSerializationExtensions.WireOptions); + return content; } - - string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; } } diff --git a/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/DevTestLabArtifactSourceData.cs b/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/DevTestLabArtifactSourceData.cs index d677679d2d41..60cc01ff7e9e 100644 --- a/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/DevTestLabArtifactSourceData.cs +++ b/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/DevTestLabArtifactSourceData.cs @@ -13,111 +13,198 @@ namespace Azure.ResourceManager.DevTestLabs { - /// - /// A class representing the DevTestLabArtifactSource data model. - /// Properties of an artifact source. - /// + /// Properties of an artifact source. public partial class DevTestLabArtifactSourceData : 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 DevTestLabArtifactSourceData(AzureLocation location) : base(location) { + } /// Initializes a new instance of . - /// The id. - /// The name. - /// The resourceType. - /// The systemData. - /// The tags. - /// The location. - /// The artifact source's display name. - /// The artifact source's URI. - /// The artifact source's type. - /// The folder containing artifacts. - /// The folder containing Azure Resource Manager templates. - /// The artifact source's branch reference. - /// The security token to authenticate to the artifact source. - /// Indicates if the artifact source is enabled (values: Enabled, Disabled). - /// The artifact source's creation date. - /// The provisioning status of the resource. - /// The unique immutable identifier of a resource (Guid). - /// Keeps track of any properties unknown to the library. - internal DevTestLabArtifactSourceData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, IDictionary tags, AzureLocation location, string displayName, Uri uri, DevTestLabSourceControlType? sourceType, string folderPath, string armTemplateFolderPath, string branchRef, string securityToken, DevTestLabEnableStatus? status, DateTimeOffset? createdOn, string provisioningState, Guid? uniqueIdentifier, IDictionary serializedAdditionalRawData) : base(id, name, resourceType, systemData, tags, 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. + /// The geo-location where the resource lives. + /// The properties of the resource. + /// Resource tags. + internal DevTestLabArtifactSourceData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, IDictionary additionalBinaryDataProperties, AzureLocation location, ArtifactSourceProperties properties, IDictionary tags) : base(id, name, resourceType, systemData, tags, location) { - DisplayName = displayName; - Uri = uri; - SourceType = sourceType; - FolderPath = folderPath; - ArmTemplateFolderPath = armTemplateFolderPath; - BranchRef = branchRef; - SecurityToken = securityToken; - Status = status; - CreatedOn = createdOn; - ProvisioningState = provisioningState; - UniqueIdentifier = uniqueIdentifier; - _serializedAdditionalRawData = serializedAdditionalRawData; + _additionalBinaryDataProperties = additionalBinaryDataProperties; + Properties = properties; } - /// Initializes a new instance of for deserialization. - internal DevTestLabArtifactSourceData() + /// The properties of the resource. + internal ArtifactSourceProperties Properties { get; set; } + + /// The artifact source's display name. + public string DisplayName { + get + { + return Properties is null ? default : Properties.DisplayName; + } + set + { + if (Properties is null) + { + Properties = new ArtifactSourceProperties(); + } + Properties.DisplayName = value; + } } - /// The artifact source's display name. - public string DisplayName { get; set; } /// The artifact source's URI. - public Uri Uri { get; set; } + public Uri Uri + { + get + { + return Properties is null ? default : Properties.Uri; + } + set + { + if (Properties is null) + { + Properties = new ArtifactSourceProperties(); + } + Properties.Uri = value; + } + } + /// The artifact source's type. - public DevTestLabSourceControlType? SourceType { get; set; } + public DevTestLabSourceControlType? SourceType + { + get + { + return Properties is null ? default : Properties.SourceType; + } + set + { + if (Properties is null) + { + Properties = new ArtifactSourceProperties(); + } + Properties.SourceType = value.Value; + } + } + /// The folder containing artifacts. - public string FolderPath { get; set; } + public string FolderPath + { + get + { + return Properties is null ? default : Properties.FolderPath; + } + set + { + if (Properties is null) + { + Properties = new ArtifactSourceProperties(); + } + Properties.FolderPath = value; + } + } + /// The folder containing Azure Resource Manager templates. - public string ArmTemplateFolderPath { get; set; } + public string ArmTemplateFolderPath + { + get + { + return Properties is null ? default : Properties.ArmTemplateFolderPath; + } + set + { + if (Properties is null) + { + Properties = new ArtifactSourceProperties(); + } + Properties.ArmTemplateFolderPath = value; + } + } + /// The artifact source's branch reference. - public string BranchRef { get; set; } + public string BranchRef + { + get + { + return Properties is null ? default : Properties.BranchRef; + } + set + { + if (Properties is null) + { + Properties = new ArtifactSourceProperties(); + } + Properties.BranchRef = value; + } + } + /// The security token to authenticate to the artifact source. - public string SecurityToken { get; set; } + public string SecurityToken + { + get + { + return Properties is null ? default : Properties.SecurityToken; + } + set + { + if (Properties is null) + { + Properties = new ArtifactSourceProperties(); + } + Properties.SecurityToken = value; + } + } + /// Indicates if the artifact source is enabled (values: Enabled, Disabled). - public DevTestLabEnableStatus? Status { get; set; } + public DevTestLabEnableStatus? Status + { + get + { + return Properties is null ? default : Properties.Status; + } + set + { + if (Properties is null) + { + Properties = new ArtifactSourceProperties(); + } + Properties.Status = value.Value; + } + } + /// The artifact source's creation date. - public DateTimeOffset? CreatedOn { get; } + public DateTimeOffset? CreatedOn + { + get + { + return Properties is null ? default : Properties.CreatedOn; + } + } + /// The provisioning status of the resource. - public string ProvisioningState { get; } + public string ProvisioningState + { + get + { + return Properties is null ? default : Properties.ProvisioningState; + } + } + /// The unique immutable identifier of a resource (Guid). - public Guid? UniqueIdentifier { get; } + public Guid? UniqueIdentifier + { + get + { + return Properties is null ? default : Properties.UniqueIdentifier; + } + } } } diff --git a/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/DevTestLabArtifactSourceResource.Serialization.cs b/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/DevTestLabArtifactSourceResource.Serialization.cs index 1f0840c0cf9e..268ca50c0622 100644 --- a/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/DevTestLabArtifactSourceResource.Serialization.cs +++ b/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/DevTestLabArtifactSourceResource.Serialization.cs @@ -11,19 +11,29 @@ namespace Azure.ResourceManager.DevTestLabs { + /// public partial class DevTestLabArtifactSourceResource : IJsonModel { - private static DevTestLabArtifactSourceData s_dataDeserializationInstance; - private static DevTestLabArtifactSourceData DataDeserializationInstance => s_dataDeserializationInstance ??= new(); + private static IJsonModel s_dataDeserializationInstance; + private static IJsonModel DataDeserializationInstance => s_dataDeserializationInstance ??= new DevTestLabArtifactSourceData(); + + /// 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); - DevTestLabArtifactSourceData 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. + DevTestLabArtifactSourceData 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, AzureResourceManagerDevTestLabsContext.Default); + /// The binary data to be processed. + /// The client options for reading and writing models. DevTestLabArtifactSourceData IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) => ModelReaderWriter.Read(data, options, AzureResourceManagerDevTestLabsContext.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/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/DevTestLabArtifactSourceResource.cs b/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/DevTestLabArtifactSourceResource.cs index a94d4045bb49..4fd58672622c 100644 --- a/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/DevTestLabArtifactSourceResource.cs +++ b/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/DevTestLabArtifactSourceResource.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.DevTestLabs.Models; +using Azure.ResourceManager.Resources; namespace Azure.ResourceManager.DevTestLabs { /// - /// A Class representing a DevTestLabArtifactSource 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 GetDevTestLabArtifactSourceResource method. - /// Otherwise you can get one from its parent resource using the GetDevTestLabArtifactSource method. + /// A class representing a DevTestLabArtifactSource 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 GetDevTestLabArtifactSources method. /// public partial class DevTestLabArtifactSourceResource : ArmResource { - /// Generate the resource identifier of a instance. - /// The subscriptionId. - /// The resourceGroupName. - /// The labName. - /// The name. - public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string labName, string name) - { - var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/artifactsources/{name}"; - return new ResourceIdentifier(resourceId); - } - - private readonly ClientDiagnostics _devTestLabArtifactSourceArtifactSourcesClientDiagnostics; - private readonly ArtifactSourcesRestOperations _devTestLabArtifactSourceArtifactSourcesRestClient; + private readonly ClientDiagnostics _artifactSourcesClientDiagnostics; + private readonly ArtifactSources _artifactSourcesRestClient; private readonly DevTestLabArtifactSourceData _data; - /// Gets the resource type for the operations. public static readonly ResourceType ResourceType = "Microsoft.DevTestLab/labs/artifactsources"; - /// Initializes a new instance of the class for mocking. + /// Initializes a new instance of DevTestLabArtifactSourceResource for mocking. protected DevTestLabArtifactSourceResource() { } - /// 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 DevTestLabArtifactSourceResource(ArmClient client, DevTestLabArtifactSourceData data) : this(client, data.Id) @@ -56,214 +46,94 @@ internal DevTestLabArtifactSourceResource(ArmClient client, DevTestLabArtifactSo _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 DevTestLabArtifactSourceResource(ArmClient client, ResourceIdentifier id) : base(client, id) { - _devTestLabArtifactSourceArtifactSourcesClientDiagnostics = new ClientDiagnostics("Azure.ResourceManager.DevTestLabs", ResourceType.Namespace, Diagnostics); - TryGetApiVersion(ResourceType, out string devTestLabArtifactSourceArtifactSourcesApiVersion); - _devTestLabArtifactSourceArtifactSourcesRestClient = new ArtifactSourcesRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, devTestLabArtifactSourceArtifactSourcesApiVersion); -#if DEBUG - ValidateResourceId(Id); -#endif + TryGetApiVersion(ResourceType, out string devTestLabArtifactSourceApiVersion); + _artifactSourcesClientDiagnostics = new ClientDiagnostics("Azure.ResourceManager.DevTestLabs", ResourceType.Namespace, Diagnostics); + _artifactSourcesRestClient = new ArtifactSources(_artifactSourcesClientDiagnostics, Pipeline, Endpoint, devTestLabArtifactSourceApiVersion ?? "2018-09-15"); + 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 DevTestLabArtifactSourceData 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 DevTestLabArmTemplateResources in the DevTestLabArtifactSource. - /// An object representing collection of DevTestLabArmTemplateResources and their operations over a DevTestLabArmTemplateResource. - public virtual DevTestLabArmTemplateCollection GetDevTestLabArmTemplates() - { - return GetCachedClient(client => new DevTestLabArmTemplateCollection(client, Id)); - } - - /// - /// Get azure resource manager template. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/artifactsources/{artifactSourceName}/armtemplates/{name} - /// - /// - /// Operation Id - /// ArmTemplates_Get - /// - /// - /// Default Api Version - /// 2018-09-15 - /// - /// - /// Resource - /// - /// - /// - /// - /// The name of the azure resource manager template. - /// Specify the $expand query. Example: 'properties($select=displayName)'. - /// The cancellation token to use. - /// is null. - /// is an empty string, and was expected to be non-empty. - [ForwardsClientCalls] - public virtual async Task> GetDevTestLabArmTemplateAsync(string name, string expand = null, CancellationToken cancellationToken = default) - { - return await GetDevTestLabArmTemplates().GetAsync(name, expand, cancellationToken).ConfigureAwait(false); - } - - /// - /// Get azure resource manager template. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/artifactsources/{artifactSourceName}/armtemplates/{name} - /// - /// - /// Operation Id - /// ArmTemplates_Get - /// - /// - /// Default Api Version - /// 2018-09-15 - /// - /// - /// Resource - /// - /// - /// - /// - /// The name of the azure resource manager template. - /// Specify the $expand query. Example: 'properties($select=displayName)'. - /// The cancellation token to use. - /// is null. - /// is an empty string, and was expected to be non-empty. - [ForwardsClientCalls] - public virtual Response GetDevTestLabArmTemplate(string name, string expand = null, CancellationToken cancellationToken = default) - { - return GetDevTestLabArmTemplates().Get(name, expand, cancellationToken); - } - - /// Gets a collection of DevTestLabArtifactResources in the DevTestLabArtifactSource. - /// An object representing collection of DevTestLabArtifactResources and their operations over a DevTestLabArtifactResource. - public virtual DevTestLabArtifactCollection GetDevTestLabArtifacts() - { - return GetCachedClient(client => new DevTestLabArtifactCollection(client, Id)); - } - - /// - /// Get artifact. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/artifactsources/{artifactSourceName}/artifacts/{name} - /// - /// - /// Operation Id - /// Artifacts_Get - /// - /// - /// Default Api Version - /// 2018-09-15 - /// - /// - /// Resource - /// - /// - /// - /// - /// The name of the artifact. - /// Specify the $expand query. Example: 'properties($select=title)'. - /// The cancellation token to use. - /// is null. - /// is an empty string, and was expected to be non-empty. - [ForwardsClientCalls] - public virtual async Task> GetDevTestLabArtifactAsync(string name, string expand = null, CancellationToken cancellationToken = default) + /// Generate the resource identifier for this resource. + /// The subscriptionId. + /// The resourceGroupName. + /// The labName. + /// The name. + public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string labName, string name) { - return await GetDevTestLabArtifacts().GetAsync(name, expand, cancellationToken).ConfigureAwait(false); + string resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/artifactsources/{name}"; + return new ResourceIdentifier(resourceId); } - /// - /// Get artifact. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/artifactsources/{artifactSourceName}/artifacts/{name} - /// - /// - /// Operation Id - /// Artifacts_Get - /// - /// - /// Default Api Version - /// 2018-09-15 - /// - /// - /// Resource - /// - /// - /// - /// - /// The name of the artifact. - /// Specify the $expand query. Example: 'properties($select=title)'. - /// The cancellation token to use. - /// is null. - /// is an empty string, and was expected to be non-empty. - [ForwardsClientCalls] - public virtual Response GetDevTestLabArtifact(string name, string expand = null, CancellationToken cancellationToken = default) + /// + [Conditional("DEBUG")] + internal static void ValidateResourceId(ResourceIdentifier id) { - return GetDevTestLabArtifacts().Get(name, expand, cancellationToken); + if (id.ResourceType != ResourceType) + { + throw new ArgumentException(string.Format("Invalid resource type {0} expected {1}", id.ResourceType, ResourceType), id); + } } /// /// Get artifact source. /// /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/artifactsources/{name} + /// Request Path. + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/artifactsources/{name}. /// /// - /// Operation Id - /// ArtifactSources_Get + /// Operation Id. + /// ArtifactSources_Get. /// /// - /// Default Api Version - /// 2018-09-15 + /// Default Api Version. + /// 2018-09-15. /// /// - /// Resource - /// + /// Resource. + /// . /// /// /// /// Specify the $expand query. Example: 'properties($select=displayName)'. /// The cancellation token to use. - public virtual async Task> GetAsync(string expand = null, CancellationToken cancellationToken = default) + public virtual async Task> GetAsync(string expand = default, CancellationToken cancellationToken = default) { - using var scope = _devTestLabArtifactSourceArtifactSourcesClientDiagnostics.CreateScope("DevTestLabArtifactSourceResource.Get"); + using DiagnosticScope scope = _artifactSourcesClientDiagnostics.CreateScope("DevTestLabArtifactSourceResource.Get"); scope.Start(); try { - var response = await _devTestLabArtifactSourceArtifactSourcesRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, expand, cancellationToken).ConfigureAwait(false); + RequestContext context = new RequestContext + { + CancellationToken = cancellationToken + }; + HttpMessage message = _artifactSourcesRestClient.CreateGetRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, expand, context); + Response result = await Pipeline.ProcessMessageAsync(message, context).ConfigureAwait(false); + Response response = Response.FromValue(DevTestLabArtifactSourceData.FromResponse(result), result); if (response.Value == null) + { throw new RequestFailedException(response.GetRawResponse()); + } return Response.FromValue(new DevTestLabArtifactSourceResource(Client, response.Value), response.GetRawResponse()); } catch (Exception e) @@ -277,34 +147,42 @@ public virtual async Task> GetAsync(s /// Get artifact source. /// /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/artifactsources/{name} + /// Request Path. + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/artifactsources/{name}. /// /// - /// Operation Id - /// ArtifactSources_Get + /// Operation Id. + /// ArtifactSources_Get. /// /// - /// Default Api Version - /// 2018-09-15 + /// Default Api Version. + /// 2018-09-15. /// /// - /// Resource - /// + /// Resource. + /// . /// /// /// /// Specify the $expand query. Example: 'properties($select=displayName)'. /// The cancellation token to use. - public virtual Response Get(string expand = null, CancellationToken cancellationToken = default) + public virtual Response Get(string expand = default, CancellationToken cancellationToken = default) { - using var scope = _devTestLabArtifactSourceArtifactSourcesClientDiagnostics.CreateScope("DevTestLabArtifactSourceResource.Get"); + using DiagnosticScope scope = _artifactSourcesClientDiagnostics.CreateScope("DevTestLabArtifactSourceResource.Get"); scope.Start(); try { - var response = _devTestLabArtifactSourceArtifactSourcesRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, expand, cancellationToken); + RequestContext context = new RequestContext + { + CancellationToken = cancellationToken + }; + HttpMessage message = _artifactSourcesRestClient.CreateGetRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, expand, context); + Response result = Pipeline.ProcessMessage(message, context); + Response response = Response.FromValue(DevTestLabArtifactSourceData.FromResponse(result), result); if (response.Value == null) + { throw new RequestFailedException(response.GetRawResponse()); + } return Response.FromValue(new DevTestLabArtifactSourceResource(Client, response.Value), response.GetRawResponse()); } catch (Exception e) @@ -315,41 +193,49 @@ public virtual Response Get(string expand = nu } /// - /// Delete artifact source. + /// Allows modifying tags of artifact sources. All other properties will be ignored. /// /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/artifactsources/{name} + /// Request Path. + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/artifactsources/{name}. /// /// - /// Operation Id - /// ArtifactSources_Delete + /// Operation Id. + /// ArtifactSources_Update. /// /// - /// Default Api Version - /// 2018-09-15 + /// Default Api Version. + /// 2018-09-15. /// /// - /// Resource - /// + /// Resource. + /// . /// /// /// - /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. + /// Properties of an artifact source. /// The cancellation token to use. - public virtual async Task DeleteAsync(WaitUntil waitUntil, CancellationToken cancellationToken = default) + /// is null. + public virtual async Task> UpdateAsync(DevTestLabArtifactSourcePatch patch, CancellationToken cancellationToken = default) { - using var scope = _devTestLabArtifactSourceArtifactSourcesClientDiagnostics.CreateScope("DevTestLabArtifactSourceResource.Delete"); + Argument.AssertNotNull(patch, nameof(patch)); + + using DiagnosticScope scope = _artifactSourcesClientDiagnostics.CreateScope("DevTestLabArtifactSourceResource.Update"); scope.Start(); try { - var response = await _devTestLabArtifactSourceArtifactSourcesRestClient.DeleteAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, cancellationToken).ConfigureAwait(false); - var uri = _devTestLabArtifactSourceArtifactSourcesRestClient.CreateDeleteRequestUri(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name); - var rehydrationToken = NextLinkOperationImplementation.GetRehydrationToken(RequestMethod.Delete, uri.ToUri(), uri.ToString(), "None", null, OperationFinalStateVia.OriginalUri.ToString()); - var operation = new DevTestLabsArmOperation(response, rehydrationToken); - if (waitUntil == WaitUntil.Completed) - await operation.WaitForCompletionResponseAsync(cancellationToken).ConfigureAwait(false); - return operation; + RequestContext context = new RequestContext + { + CancellationToken = cancellationToken + }; + HttpMessage message = _artifactSourcesRestClient.CreateUpdateRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, DevTestLabArtifactSourcePatch.ToRequestContent(patch), context); + Response result = await Pipeline.ProcessMessageAsync(message, context).ConfigureAwait(false); + Response response = Response.FromValue(DevTestLabArtifactSourceData.FromResponse(result), result); + if (response.Value == null) + { + throw new RequestFailedException(response.GetRawResponse()); + } + return Response.FromValue(new DevTestLabArtifactSourceResource(Client, response.Value), response.GetRawResponse()); } catch (Exception e) { @@ -359,41 +245,49 @@ public virtual async Task DeleteAsync(WaitUntil waitUntil, Cancell } /// - /// Delete artifact source. + /// Allows modifying tags of artifact sources. All other properties will be ignored. /// /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/artifactsources/{name} + /// Request Path. + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/artifactsources/{name}. /// /// - /// Operation Id - /// ArtifactSources_Delete + /// Operation Id. + /// ArtifactSources_Update. /// /// - /// Default Api Version - /// 2018-09-15 + /// Default Api Version. + /// 2018-09-15. /// /// - /// Resource - /// + /// Resource. + /// . /// /// /// - /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. + /// Properties of an artifact source. /// The cancellation token to use. - public virtual ArmOperation Delete(WaitUntil waitUntil, CancellationToken cancellationToken = default) + /// is null. + public virtual Response Update(DevTestLabArtifactSourcePatch patch, CancellationToken cancellationToken = default) { - using var scope = _devTestLabArtifactSourceArtifactSourcesClientDiagnostics.CreateScope("DevTestLabArtifactSourceResource.Delete"); + Argument.AssertNotNull(patch, nameof(patch)); + + using DiagnosticScope scope = _artifactSourcesClientDiagnostics.CreateScope("DevTestLabArtifactSourceResource.Update"); scope.Start(); try { - var response = _devTestLabArtifactSourceArtifactSourcesRestClient.Delete(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, cancellationToken); - var uri = _devTestLabArtifactSourceArtifactSourcesRestClient.CreateDeleteRequestUri(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name); - var rehydrationToken = NextLinkOperationImplementation.GetRehydrationToken(RequestMethod.Delete, uri.ToUri(), uri.ToString(), "None", null, OperationFinalStateVia.OriginalUri.ToString()); - var operation = new DevTestLabsArmOperation(response, rehydrationToken); - if (waitUntil == WaitUntil.Completed) - operation.WaitForCompletionResponse(cancellationToken); - return operation; + RequestContext context = new RequestContext + { + CancellationToken = cancellationToken + }; + HttpMessage message = _artifactSourcesRestClient.CreateUpdateRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, DevTestLabArtifactSourcePatch.ToRequestContent(patch), context); + Response result = Pipeline.ProcessMessage(message, context); + Response response = Response.FromValue(DevTestLabArtifactSourceData.FromResponse(result), result); + if (response.Value == null) + { + throw new RequestFailedException(response.GetRawResponse()); + } + return Response.FromValue(new DevTestLabArtifactSourceResource(Client, response.Value), response.GetRawResponse()); } catch (Exception e) { @@ -403,39 +297,48 @@ public virtual ArmOperation Delete(WaitUntil waitUntil, CancellationToken cancel } /// - /// Allows modifying tags of artifact sources. All other properties will be ignored. + /// Delete artifact source. /// /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/artifactsources/{name} + /// Request Path. + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/artifactsources/{name}. /// /// - /// Operation Id - /// ArtifactSources_Update + /// Operation Id. + /// ArtifactSources_Delete. /// /// - /// Default Api Version - /// 2018-09-15 + /// Default Api Version. + /// 2018-09-15. /// /// - /// Resource - /// + /// Resource. + /// . /// /// /// - /// Properties of an artifact source. + /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. /// The cancellation token to use. - /// is null. - public virtual async Task> UpdateAsync(DevTestLabArtifactSourcePatch patch, CancellationToken cancellationToken = default) + public virtual async Task DeleteAsync(WaitUntil waitUntil, CancellationToken cancellationToken = default) { - Argument.AssertNotNull(patch, nameof(patch)); - - using var scope = _devTestLabArtifactSourceArtifactSourcesClientDiagnostics.CreateScope("DevTestLabArtifactSourceResource.Update"); + using DiagnosticScope scope = _artifactSourcesClientDiagnostics.CreateScope("DevTestLabArtifactSourceResource.Delete"); scope.Start(); try { - var response = await _devTestLabArtifactSourceArtifactSourcesRestClient.UpdateAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, patch, cancellationToken).ConfigureAwait(false); - return Response.FromValue(new DevTestLabArtifactSourceResource(Client, response.Value), response.GetRawResponse()); + RequestContext context = new RequestContext + { + CancellationToken = cancellationToken + }; + HttpMessage message = _artifactSourcesRestClient.CreateDeleteRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, context); + Response response = await Pipeline.ProcessMessageAsync(message, context).ConfigureAwait(false); + RequestUriBuilder uri = message.Request.Uri; + RehydrationToken rehydrationToken = NextLinkOperationImplementation.GetRehydrationToken(RequestMethod.Delete, uri.ToUri(), uri.ToString(), "None", null, OperationFinalStateVia.OriginalUri.ToString()); + DevTestLabsArmOperation operation = new DevTestLabsArmOperation(response, rehydrationToken); + if (waitUntil == WaitUntil.Completed) + { + await operation.WaitForCompletionResponseAsync(cancellationToken).ConfigureAwait(false); + } + return operation; } catch (Exception e) { @@ -445,39 +348,48 @@ public virtual async Task> UpdateAsyn } /// - /// Allows modifying tags of artifact sources. All other properties will be ignored. + /// Delete artifact source. /// /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/artifactsources/{name} + /// Request Path. + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/artifactsources/{name}. /// /// - /// Operation Id - /// ArtifactSources_Update + /// Operation Id. + /// ArtifactSources_Delete. /// /// - /// Default Api Version - /// 2018-09-15 + /// Default Api Version. + /// 2018-09-15. /// /// - /// Resource - /// + /// Resource. + /// . /// /// /// - /// Properties of an artifact source. + /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. /// The cancellation token to use. - /// is null. - public virtual Response Update(DevTestLabArtifactSourcePatch patch, CancellationToken cancellationToken = default) + public virtual ArmOperation Delete(WaitUntil waitUntil, CancellationToken cancellationToken = default) { - Argument.AssertNotNull(patch, nameof(patch)); - - using var scope = _devTestLabArtifactSourceArtifactSourcesClientDiagnostics.CreateScope("DevTestLabArtifactSourceResource.Update"); + using DiagnosticScope scope = _artifactSourcesClientDiagnostics.CreateScope("DevTestLabArtifactSourceResource.Delete"); scope.Start(); try { - var response = _devTestLabArtifactSourceArtifactSourcesRestClient.Update(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, patch, cancellationToken); - return Response.FromValue(new DevTestLabArtifactSourceResource(Client, response.Value), response.GetRawResponse()); + RequestContext context = new RequestContext + { + CancellationToken = cancellationToken + }; + HttpMessage message = _artifactSourcesRestClient.CreateDeleteRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, context); + Response response = Pipeline.ProcessMessage(message, context); + RequestUriBuilder uri = message.Request.Uri; + RehydrationToken rehydrationToken = NextLinkOperationImplementation.GetRehydrationToken(RequestMethod.Delete, uri.ToUri(), uri.ToString(), "None", null, OperationFinalStateVia.OriginalUri.ToString()); + DevTestLabsArmOperation operation = new DevTestLabsArmOperation(response, rehydrationToken); + if (waitUntil == WaitUntil.Completed) + { + operation.WaitForCompletionResponse(cancellationToken); + } + return operation; } catch (Exception e) { @@ -486,27 +398,7 @@ public virtual Response Update(DevTestLabArtif } } - /// - /// Add a tag to the current resource. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/artifactsources/{name} - /// - /// - /// Operation Id - /// ArtifactSources_Get - /// - /// - /// Default Api Version - /// 2018-09-15 - /// - /// - /// Resource - /// - /// - /// - /// + /// Add a tag to the current resource. /// The key for the tag. /// The value for the tag. /// The cancellation token to use. @@ -516,29 +408,35 @@ public virtual async Task> AddTagAsyn Argument.AssertNotNull(key, nameof(key)); Argument.AssertNotNull(value, nameof(value)); - using var scope = _devTestLabArtifactSourceArtifactSourcesClientDiagnostics.CreateScope("DevTestLabArtifactSourceResource.AddTag"); + using DiagnosticScope scope = _artifactSourcesClientDiagnostics.CreateScope("DevTestLabArtifactSourceResource.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 _devTestLabArtifactSourceArtifactSourcesRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, null, cancellationToken).ConfigureAwait(false); - return Response.FromValue(new DevTestLabArtifactSourceResource(Client, originalResponse.Value), originalResponse.GetRawResponse()); + await GetTagResource().CreateOrUpdateAsync(WaitUntil.Completed, originalTags.Value.Data, cancellationToken).ConfigureAwait(false); + RequestContext context = new RequestContext + { + CancellationToken = cancellationToken + }; + HttpMessage message = _artifactSourcesRestClient.CreateGetRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, default, context); + Response result = await Pipeline.ProcessMessageAsync(message, context).ConfigureAwait(false); + Response response = Response.FromValue(DevTestLabArtifactSourceData.FromResponse(result), result); + return Response.FromValue(new DevTestLabArtifactSourceResource(Client, response.Value), response.GetRawResponse()); } else { - var current = (await GetAsync(cancellationToken: cancellationToken).ConfigureAwait(false)).Value.Data; - var patch = new DevTestLabArtifactSourcePatch(); - foreach (var tag in current.Tags) + DevTestLabArtifactSourceData current = (await GetAsync(cancellationToken: cancellationToken).ConfigureAwait(false)).Value.Data; + DevTestLabArtifactSourcePatch patch = new DevTestLabArtifactSourcePatch(); + 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) @@ -548,27 +446,7 @@ public virtual async Task> AddTagAsyn } } - /// - /// Add a tag to the current resource. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/artifactsources/{name} - /// - /// - /// Operation Id - /// ArtifactSources_Get - /// - /// - /// Default Api Version - /// 2018-09-15 - /// - /// - /// Resource - /// - /// - /// - /// + /// Add a tag to the current resource. /// The key for the tag. /// The value for the tag. /// The cancellation token to use. @@ -578,29 +456,35 @@ public virtual Response AddTag(string key, str Argument.AssertNotNull(key, nameof(key)); Argument.AssertNotNull(value, nameof(value)); - using var scope = _devTestLabArtifactSourceArtifactSourcesClientDiagnostics.CreateScope("DevTestLabArtifactSourceResource.AddTag"); + using DiagnosticScope scope = _artifactSourcesClientDiagnostics.CreateScope("DevTestLabArtifactSourceResource.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 = _devTestLabArtifactSourceArtifactSourcesRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, null, cancellationToken); - return Response.FromValue(new DevTestLabArtifactSourceResource(Client, originalResponse.Value), originalResponse.GetRawResponse()); + GetTagResource().CreateOrUpdate(WaitUntil.Completed, originalTags.Value.Data, cancellationToken); + RequestContext context = new RequestContext + { + CancellationToken = cancellationToken + }; + HttpMessage message = _artifactSourcesRestClient.CreateGetRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, default, context); + Response result = Pipeline.ProcessMessage(message, context); + Response response = Response.FromValue(DevTestLabArtifactSourceData.FromResponse(result), result); + return Response.FromValue(new DevTestLabArtifactSourceResource(Client, response.Value), response.GetRawResponse()); } else { - var current = Get(cancellationToken: cancellationToken).Value.Data; - var patch = new DevTestLabArtifactSourcePatch(); - foreach (var tag in current.Tags) + DevTestLabArtifactSourceData current = Get(cancellationToken: cancellationToken).Value.Data; + DevTestLabArtifactSourcePatch patch = new DevTestLabArtifactSourcePatch(); + 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) @@ -610,54 +494,40 @@ public virtual Response AddTag(string key, str } } - /// - /// Replace the tags on the resource with the given set. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/artifactsources/{name} - /// - /// - /// Operation Id - /// ArtifactSources_Get - /// - /// - /// Default Api Version - /// 2018-09-15 - /// - /// - /// 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 = _devTestLabArtifactSourceArtifactSourcesClientDiagnostics.CreateScope("DevTestLabArtifactSourceResource.SetTags"); + using DiagnosticScope scope = _artifactSourcesClientDiagnostics.CreateScope("DevTestLabArtifactSourceResource.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 _devTestLabArtifactSourceArtifactSourcesRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, null, cancellationToken).ConfigureAwait(false); - return Response.FromValue(new DevTestLabArtifactSourceResource(Client, originalResponse.Value), originalResponse.GetRawResponse()); + await GetTagResource().CreateOrUpdateAsync(WaitUntil.Completed, originalTags.Value.Data, cancellationToken).ConfigureAwait(false); + RequestContext context = new RequestContext + { + CancellationToken = cancellationToken + }; + HttpMessage message = _artifactSourcesRestClient.CreateGetRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, default, context); + Response result = await Pipeline.ProcessMessageAsync(message, context).ConfigureAwait(false); + Response response = Response.FromValue(DevTestLabArtifactSourceData.FromResponse(result), result); + return Response.FromValue(new DevTestLabArtifactSourceResource(Client, response.Value), response.GetRawResponse()); } else { - var current = (await GetAsync(cancellationToken: cancellationToken).ConfigureAwait(false)).Value.Data; - var patch = new DevTestLabArtifactSourcePatch(); + DevTestLabArtifactSourceData current = (await GetAsync(cancellationToken: cancellationToken).ConfigureAwait(false)).Value.Data; + DevTestLabArtifactSourcePatch patch = new DevTestLabArtifactSourcePatch(); 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) @@ -667,54 +537,40 @@ public virtual async Task> SetTagsAsy } } - /// - /// Replace the tags on the resource with the given set. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/artifactsources/{name} - /// - /// - /// Operation Id - /// ArtifactSources_Get - /// - /// - /// Default Api Version - /// 2018-09-15 - /// - /// - /// 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 = _devTestLabArtifactSourceArtifactSourcesClientDiagnostics.CreateScope("DevTestLabArtifactSourceResource.SetTags"); + using DiagnosticScope scope = _artifactSourcesClientDiagnostics.CreateScope("DevTestLabArtifactSourceResource.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 = _devTestLabArtifactSourceArtifactSourcesRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, null, cancellationToken); - return Response.FromValue(new DevTestLabArtifactSourceResource(Client, originalResponse.Value), originalResponse.GetRawResponse()); + GetTagResource().CreateOrUpdate(WaitUntil.Completed, originalTags.Value.Data, cancellationToken); + RequestContext context = new RequestContext + { + CancellationToken = cancellationToken + }; + HttpMessage message = _artifactSourcesRestClient.CreateGetRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, default, context); + Response result = Pipeline.ProcessMessage(message, context); + Response response = Response.FromValue(DevTestLabArtifactSourceData.FromResponse(result), result); + return Response.FromValue(new DevTestLabArtifactSourceResource(Client, response.Value), response.GetRawResponse()); } else { - var current = Get(cancellationToken: cancellationToken).Value.Data; - var patch = new DevTestLabArtifactSourcePatch(); + DevTestLabArtifactSourceData current = Get(cancellationToken: cancellationToken).Value.Data; + DevTestLabArtifactSourcePatch patch = new DevTestLabArtifactSourcePatch(); 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) @@ -724,27 +580,7 @@ public virtual Response SetTags(IDictionary - /// Removes a tag by key from the resource. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/artifactsources/{name} - /// - /// - /// Operation Id - /// ArtifactSources_Get - /// - /// - /// Default Api Version - /// 2018-09-15 - /// - /// - /// Resource - /// - /// - /// - /// + /// Removes a tag by key from the resource. /// The key for the tag. /// The cancellation token to use. /// is null. @@ -752,29 +588,35 @@ public virtual async Task> RemoveTagA { Argument.AssertNotNull(key, nameof(key)); - using var scope = _devTestLabArtifactSourceArtifactSourcesClientDiagnostics.CreateScope("DevTestLabArtifactSourceResource.RemoveTag"); + using DiagnosticScope scope = _artifactSourcesClientDiagnostics.CreateScope("DevTestLabArtifactSourceResource.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 _devTestLabArtifactSourceArtifactSourcesRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, null, cancellationToken).ConfigureAwait(false); - return Response.FromValue(new DevTestLabArtifactSourceResource(Client, originalResponse.Value), originalResponse.GetRawResponse()); + await GetTagResource().CreateOrUpdateAsync(WaitUntil.Completed, originalTags.Value.Data, cancellationToken).ConfigureAwait(false); + RequestContext context = new RequestContext + { + CancellationToken = cancellationToken + }; + HttpMessage message = _artifactSourcesRestClient.CreateGetRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, default, context); + Response result = await Pipeline.ProcessMessageAsync(message, context).ConfigureAwait(false); + Response response = Response.FromValue(DevTestLabArtifactSourceData.FromResponse(result), result); + return Response.FromValue(new DevTestLabArtifactSourceResource(Client, response.Value), response.GetRawResponse()); } else { - var current = (await GetAsync(cancellationToken: cancellationToken).ConfigureAwait(false)).Value.Data; - var patch = new DevTestLabArtifactSourcePatch(); - foreach (var tag in current.Tags) + DevTestLabArtifactSourceData current = (await GetAsync(cancellationToken: cancellationToken).ConfigureAwait(false)).Value.Data; + DevTestLabArtifactSourcePatch patch = new DevTestLabArtifactSourcePatch(); + 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) @@ -784,27 +626,7 @@ public virtual async Task> RemoveTagA } } - /// - /// Removes a tag by key from the resource. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/artifactsources/{name} - /// - /// - /// Operation Id - /// ArtifactSources_Get - /// - /// - /// Default Api Version - /// 2018-09-15 - /// - /// - /// Resource - /// - /// - /// - /// + /// Removes a tag by key from the resource. /// The key for the tag. /// The cancellation token to use. /// is null. @@ -812,29 +634,35 @@ public virtual Response RemoveTag(string key, { Argument.AssertNotNull(key, nameof(key)); - using var scope = _devTestLabArtifactSourceArtifactSourcesClientDiagnostics.CreateScope("DevTestLabArtifactSourceResource.RemoveTag"); + using DiagnosticScope scope = _artifactSourcesClientDiagnostics.CreateScope("DevTestLabArtifactSourceResource.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 = _devTestLabArtifactSourceArtifactSourcesRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, null, cancellationToken); - return Response.FromValue(new DevTestLabArtifactSourceResource(Client, originalResponse.Value), originalResponse.GetRawResponse()); + GetTagResource().CreateOrUpdate(WaitUntil.Completed, originalTags.Value.Data, cancellationToken); + RequestContext context = new RequestContext + { + CancellationToken = cancellationToken + }; + HttpMessage message = _artifactSourcesRestClient.CreateGetRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, default, context); + Response result = Pipeline.ProcessMessage(message, context); + Response response = Response.FromValue(DevTestLabArtifactSourceData.FromResponse(result), result); + return Response.FromValue(new DevTestLabArtifactSourceResource(Client, response.Value), response.GetRawResponse()); } else { - var current = Get(cancellationToken: cancellationToken).Value.Data; - var patch = new DevTestLabArtifactSourcePatch(); - foreach (var tag in current.Tags) + DevTestLabArtifactSourceData current = Get(cancellationToken: cancellationToken).Value.Data; + DevTestLabArtifactSourcePatch patch = new DevTestLabArtifactSourcePatch(); + 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) @@ -843,5 +671,75 @@ public virtual Response RemoveTag(string key, throw; } } + + /// Gets a collection of DevTestLabArmTemplates in the . + /// An object representing collection of DevTestLabArmTemplates and their operations over a DevTestLabArmTemplateResource. + public virtual DevTestLabArmTemplateCollection GetDevTestLabArmTemplates() + { + return GetCachedClient(client => new DevTestLabArmTemplateCollection(client, Id)); + } + + /// Get azure resource manager template. + /// The name of the azure resource manager template. + /// Specify the $expand query. Example: 'properties($select=displayName)'. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public virtual async Task> GetDevTestLabArmTemplateAsync(string name, string expand = default, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(name, nameof(name)); + + return await GetDevTestLabArmTemplates().GetAsync(name, expand, cancellationToken).ConfigureAwait(false); + } + + /// Get azure resource manager template. + /// The name of the azure resource manager template. + /// Specify the $expand query. Example: 'properties($select=displayName)'. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public virtual Response GetDevTestLabArmTemplate(string name, string expand = default, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(name, nameof(name)); + + return GetDevTestLabArmTemplates().Get(name, expand, cancellationToken); + } + + /// Gets a collection of DevTestLabArtifacts in the . + /// An object representing collection of DevTestLabArtifacts and their operations over a DevTestLabArtifactResource. + public virtual DevTestLabArtifactCollection GetDevTestLabArtifacts() + { + return GetCachedClient(client => new DevTestLabArtifactCollection(client, Id)); + } + + /// Get artifact. + /// The name of the artifact. + /// Specify the $expand query. Example: 'properties($select=title)'. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public virtual async Task> GetDevTestLabArtifactAsync(string name, string expand = default, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(name, nameof(name)); + + return await GetDevTestLabArtifacts().GetAsync(name, expand, cancellationToken).ConfigureAwait(false); + } + + /// Get artifact. + /// The name of the artifact. + /// Specify the $expand query. Example: 'properties($select=title)'. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public virtual Response GetDevTestLabArtifact(string name, string expand = default, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(name, nameof(name)); + + return GetDevTestLabArtifacts().Get(name, expand, cancellationToken); + } } } diff --git a/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/DevTestLabCollection.cs b/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/DevTestLabCollection.cs index 992d569cfe8d..4e9585d49220 100644 --- a/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/DevTestLabCollection.cs +++ b/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/DevTestLabCollection.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.DevTestLabs @@ -25,51 +26,57 @@ namespace Azure.ResourceManager.DevTestLabs /// public partial class DevTestLabCollection : ArmCollection, IEnumerable, IAsyncEnumerable { - private readonly ClientDiagnostics _devTestLabLabsClientDiagnostics; - private readonly LabsRestOperations _devTestLabLabsRestClient; + private readonly ClientDiagnostics _labsClientDiagnostics; + private readonly Labs _labsRestClient; + private readonly ClientDiagnostics _galleryImagesClientDiagnostics; + private readonly GalleryImages _galleryImagesRestClient; + private readonly ClientDiagnostics _policySetsClientDiagnostics; + private readonly PolicySets _policySetsRestClient; - /// Initializes a new instance of the class for mocking. + /// Initializes a new instance of DevTestLabCollection for mocking. protected DevTestLabCollection() { } - /// 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 DevTestLabCollection(ArmClient client, ResourceIdentifier id) : base(client, id) { - _devTestLabLabsClientDiagnostics = new ClientDiagnostics("Azure.ResourceManager.DevTestLabs", DevTestLabResource.ResourceType.Namespace, Diagnostics); - TryGetApiVersion(DevTestLabResource.ResourceType, out string devTestLabLabsApiVersion); - _devTestLabLabsRestClient = new LabsRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, devTestLabLabsApiVersion); -#if DEBUG - ValidateResourceId(Id); -#endif + TryGetApiVersion(DevTestLabResource.ResourceType, out string devTestLabApiVersion); + _labsClientDiagnostics = new ClientDiagnostics("Azure.ResourceManager.DevTestLabs", DevTestLabResource.ResourceType.Namespace, Diagnostics); + _labsRestClient = new Labs(_labsClientDiagnostics, Pipeline, Endpoint, devTestLabApiVersion ?? "2018-09-15"); + _galleryImagesClientDiagnostics = new ClientDiagnostics("Azure.ResourceManager.DevTestLabs", DevTestLabResource.ResourceType.Namespace, Diagnostics); + _galleryImagesRestClient = new GalleryImages(_galleryImagesClientDiagnostics, Pipeline, Endpoint, devTestLabApiVersion ?? "2018-09-15"); + _policySetsClientDiagnostics = new ClientDiagnostics("Azure.ResourceManager.DevTestLabs", DevTestLabResource.ResourceType.Namespace, Diagnostics); + _policySetsRestClient = new PolicySets(_policySetsClientDiagnostics, Pipeline, Endpoint, devTestLabApiVersion ?? "2018-09-15"); + 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 or replace an existing lab. This operation can take a while to complete. /// /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{name} - /// - /// - /// Operation Id - /// Labs_CreateOrUpdate + /// Request Path. + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{name}. /// /// - /// Default Api Version - /// 2018-09-15 + /// Operation Id. + /// Labs_CreateOrUpdate. /// /// - /// Resource - /// + /// Default Api Version. + /// 2018-09-15. /// /// /// @@ -77,21 +84,34 @@ internal static void ValidateResourceId(ResourceIdentifier id) /// The name of the lab. /// A lab. /// 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 name, DevTestLabData data, CancellationToken cancellationToken = default) { Argument.AssertNotNullOrEmpty(name, nameof(name)); Argument.AssertNotNull(data, nameof(data)); - using var scope = _devTestLabLabsClientDiagnostics.CreateScope("DevTestLabCollection.CreateOrUpdate"); + using DiagnosticScope scope = _labsClientDiagnostics.CreateScope("DevTestLabCollection.CreateOrUpdate"); scope.Start(); try { - var response = await _devTestLabLabsRestClient.CreateOrUpdateAsync(Id.SubscriptionId, Id.ResourceGroupName, name, data, cancellationToken).ConfigureAwait(false); - var operation = new DevTestLabsArmOperation(new DevTestLabOperationSource(Client), _devTestLabLabsClientDiagnostics, Pipeline, _devTestLabLabsRestClient.CreateCreateOrUpdateRequest(Id.SubscriptionId, Id.ResourceGroupName, name, data).Request, response, OperationFinalStateVia.Location); + RequestContext context = new RequestContext + { + CancellationToken = cancellationToken + }; + HttpMessage message = _labsRestClient.CreateCreateOrUpdateRequest(Id.SubscriptionId, Id.ResourceGroupName, name, DevTestLabData.ToRequestContent(data), context); + Response response = await Pipeline.ProcessMessageAsync(message, context).ConfigureAwait(false); + DevTestLabsArmOperation operation = new DevTestLabsArmOperation( + new DevTestLabOperationSource(Client), + _labsClientDiagnostics, + Pipeline, + message.Request, + response, + OperationFinalStateVia.Location); if (waitUntil == WaitUntil.Completed) + { await operation.WaitForCompletionAsync(cancellationToken).ConfigureAwait(false); + } return operation; } catch (Exception e) @@ -105,20 +125,16 @@ public virtual async Task> CreateOrUpdateAsync( /// Create or replace an existing lab. This operation can take a while to complete. /// /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{name} + /// Request Path. + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{name}. /// /// - /// Operation Id - /// Labs_CreateOrUpdate + /// Operation Id. + /// Labs_CreateOrUpdate. /// /// - /// Default Api Version - /// 2018-09-15 - /// - /// - /// Resource - /// + /// Default Api Version. + /// 2018-09-15. /// /// /// @@ -126,21 +142,34 @@ public virtual async Task> CreateOrUpdateAsync( /// The name of the lab. /// A lab. /// 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 name, DevTestLabData data, CancellationToken cancellationToken = default) { Argument.AssertNotNullOrEmpty(name, nameof(name)); Argument.AssertNotNull(data, nameof(data)); - using var scope = _devTestLabLabsClientDiagnostics.CreateScope("DevTestLabCollection.CreateOrUpdate"); + using DiagnosticScope scope = _labsClientDiagnostics.CreateScope("DevTestLabCollection.CreateOrUpdate"); scope.Start(); try { - var response = _devTestLabLabsRestClient.CreateOrUpdate(Id.SubscriptionId, Id.ResourceGroupName, name, data, cancellationToken); - var operation = new DevTestLabsArmOperation(new DevTestLabOperationSource(Client), _devTestLabLabsClientDiagnostics, Pipeline, _devTestLabLabsRestClient.CreateCreateOrUpdateRequest(Id.SubscriptionId, Id.ResourceGroupName, name, data).Request, response, OperationFinalStateVia.Location); + RequestContext context = new RequestContext + { + CancellationToken = cancellationToken + }; + HttpMessage message = _labsRestClient.CreateCreateOrUpdateRequest(Id.SubscriptionId, Id.ResourceGroupName, name, DevTestLabData.ToRequestContent(data), context); + Response response = Pipeline.ProcessMessage(message, context); + DevTestLabsArmOperation operation = new DevTestLabsArmOperation( + new DevTestLabOperationSource(Client), + _labsClientDiagnostics, + Pipeline, + message.Request, + response, + OperationFinalStateVia.Location); if (waitUntil == WaitUntil.Completed) + { operation.WaitForCompletion(cancellationToken); + } return operation; } catch (Exception e) @@ -154,39 +183,43 @@ public virtual ArmOperation CreateOrUpdate(WaitUntil waitUnt /// Get lab. /// /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{name} + /// Request Path. + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{name}. /// /// - /// Operation Id - /// Labs_Get + /// Operation Id. + /// Labs_Get. /// /// - /// Default Api Version - /// 2018-09-15 - /// - /// - /// Resource - /// + /// Default Api Version. + /// 2018-09-15. /// /// /// /// The name of the lab. /// Specify the $expand query. Example: 'properties($select=defaultStorageAccount)'. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. - public virtual async Task> GetAsync(string name, string expand = null, CancellationToken cancellationToken = default) + /// is an empty string, and was expected to be non-empty. + public virtual async Task> GetAsync(string name, string expand = default, CancellationToken cancellationToken = default) { Argument.AssertNotNullOrEmpty(name, nameof(name)); - using var scope = _devTestLabLabsClientDiagnostics.CreateScope("DevTestLabCollection.Get"); + using DiagnosticScope scope = _labsClientDiagnostics.CreateScope("DevTestLabCollection.Get"); scope.Start(); try { - var response = await _devTestLabLabsRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, name, expand, cancellationToken).ConfigureAwait(false); + RequestContext context = new RequestContext + { + CancellationToken = cancellationToken + }; + HttpMessage message = _labsRestClient.CreateGetRequest(Id.SubscriptionId, Id.ResourceGroupName, name, expand, context); + Response result = await Pipeline.ProcessMessageAsync(message, context).ConfigureAwait(false); + Response response = Response.FromValue(DevTestLabData.FromResponse(result), result); if (response.Value == null) + { throw new RequestFailedException(response.GetRawResponse()); + } return Response.FromValue(new DevTestLabResource(Client, response.Value), response.GetRawResponse()); } catch (Exception e) @@ -200,39 +233,43 @@ public virtual async Task> GetAsync(string name, st /// Get lab. /// /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{name} - /// - /// - /// Operation Id - /// Labs_Get + /// Request Path. + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{name}. /// /// - /// Default Api Version - /// 2018-09-15 + /// Operation Id. + /// Labs_Get. /// /// - /// Resource - /// + /// Default Api Version. + /// 2018-09-15. /// /// /// /// The name of the lab. /// Specify the $expand query. Example: 'properties($select=defaultStorageAccount)'. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. - public virtual Response Get(string name, string expand = null, CancellationToken cancellationToken = default) + /// is an empty string, and was expected to be non-empty. + public virtual Response Get(string name, string expand = default, CancellationToken cancellationToken = default) { Argument.AssertNotNullOrEmpty(name, nameof(name)); - using var scope = _devTestLabLabsClientDiagnostics.CreateScope("DevTestLabCollection.Get"); + using DiagnosticScope scope = _labsClientDiagnostics.CreateScope("DevTestLabCollection.Get"); scope.Start(); try { - var response = _devTestLabLabsRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, name, expand, cancellationToken); + RequestContext context = new RequestContext + { + CancellationToken = cancellationToken + }; + HttpMessage message = _labsRestClient.CreateGetRequest(Id.SubscriptionId, Id.ResourceGroupName, name, expand, context); + Response result = Pipeline.ProcessMessage(message, context); + Response response = Response.FromValue(DevTestLabData.FromResponse(result), result); if (response.Value == null) + { throw new RequestFailedException(response.GetRawResponse()); + } return Response.FromValue(new DevTestLabResource(Client, response.Value), response.GetRawResponse()); } catch (Exception e) @@ -246,20 +283,16 @@ public virtual Response Get(string name, string expand = nul /// List labs in a resource group. /// /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs + /// Request Path. + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs. /// /// - /// Operation Id - /// Labs_ListByResourceGroup + /// Operation Id. + /// Labs_ListByResourceGroup. /// /// - /// Default Api Version - /// 2018-09-15 - /// - /// - /// Resource - /// + /// Default Api Version. + /// 2018-09-15. /// /// /// @@ -268,32 +301,38 @@ public virtual Response Get(string name, string expand = nul /// The maximum number of resources to return from the operation. Example: '$top=10'. /// The ordering expression for the results, using OData notation. Example: '$orderby=name desc'. /// The cancellation token to use. - /// An async collection of that may take multiple service requests to iterate over. - public virtual AsyncPageable GetAllAsync(string expand = null, string filter = null, int? top = null, string orderby = null, CancellationToken cancellationToken = default) + /// A collection of that may take multiple service requests to iterate over. + public virtual AsyncPageable GetAllAsync(string expand = default, string filter = default, int? top = default, string @orderby = default, CancellationToken cancellationToken = default) { - HttpMessage FirstPageRequest(int? pageSizeHint) => _devTestLabLabsRestClient.CreateListByResourceGroupRequest(Id.SubscriptionId, Id.ResourceGroupName, expand, filter, top, orderby); - HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _devTestLabLabsRestClient.CreateListByResourceGroupNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName, expand, filter, top, orderby); - return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new DevTestLabResource(Client, DevTestLabData.DeserializeDevTestLabData(e)), _devTestLabLabsClientDiagnostics, Pipeline, "DevTestLabCollection.GetAll", "value", "nextLink", cancellationToken); + RequestContext context = new RequestContext + { + CancellationToken = cancellationToken + }; + return new AsyncPageableWrapper(new LabsGetByResourceGroupAsyncCollectionResultOfT( + _labsRestClient, + Id.SubscriptionId, + Id.ResourceGroupName, + expand, + filter, + top, + @orderby, + context), data => new DevTestLabResource(Client, data)); } /// /// List labs in a resource group. /// /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs - /// - /// - /// Operation Id - /// Labs_ListByResourceGroup + /// Request Path. + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs. /// /// - /// Default Api Version - /// 2018-09-15 + /// Operation Id. + /// Labs_ListByResourceGroup. /// /// - /// Resource - /// + /// Default Api Version. + /// 2018-09-15. /// /// /// @@ -303,48 +342,72 @@ public virtual AsyncPageable GetAllAsync(string expand = nul /// The ordering expression for the results, using OData notation. Example: '$orderby=name desc'. /// The cancellation token to use. /// A collection of that may take multiple service requests to iterate over. - public virtual Pageable GetAll(string expand = null, string filter = null, int? top = null, string orderby = null, CancellationToken cancellationToken = default) + public virtual Pageable GetAll(string expand = default, string filter = default, int? top = default, string @orderby = default, CancellationToken cancellationToken = default) { - HttpMessage FirstPageRequest(int? pageSizeHint) => _devTestLabLabsRestClient.CreateListByResourceGroupRequest(Id.SubscriptionId, Id.ResourceGroupName, expand, filter, top, orderby); - HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _devTestLabLabsRestClient.CreateListByResourceGroupNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName, expand, filter, top, orderby); - return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new DevTestLabResource(Client, DevTestLabData.DeserializeDevTestLabData(e)), _devTestLabLabsClientDiagnostics, Pipeline, "DevTestLabCollection.GetAll", "value", "nextLink", cancellationToken); + RequestContext context = new RequestContext + { + CancellationToken = cancellationToken + }; + return new PageableWrapper(new LabsGetByResourceGroupCollectionResultOfT( + _labsRestClient, + Id.SubscriptionId, + Id.ResourceGroupName, + expand, + filter, + top, + @orderby, + context), data => new DevTestLabResource(Client, data)); } /// /// Checks to see if the resource exists in azure. /// /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{name} - /// - /// - /// Operation Id - /// Labs_Get + /// Request Path. + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{name}. /// /// - /// Default Api Version - /// 2018-09-15 + /// Operation Id. + /// Labs_Get. /// /// - /// Resource - /// + /// Default Api Version. + /// 2018-09-15. /// /// /// /// The name of the lab. /// Specify the $expand query. Example: 'properties($select=defaultStorageAccount)'. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. - public virtual async Task> ExistsAsync(string name, string expand = null, CancellationToken cancellationToken = default) + /// is an empty string, and was expected to be non-empty. + public virtual async Task> ExistsAsync(string name, string expand = default, CancellationToken cancellationToken = default) { Argument.AssertNotNullOrEmpty(name, nameof(name)); - using var scope = _devTestLabLabsClientDiagnostics.CreateScope("DevTestLabCollection.Exists"); + using DiagnosticScope scope = _labsClientDiagnostics.CreateScope("DevTestLabCollection.Exists"); scope.Start(); try { - var response = await _devTestLabLabsRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, name, expand, cancellationToken: cancellationToken).ConfigureAwait(false); + RequestContext context = new RequestContext + { + CancellationToken = cancellationToken + }; + HttpMessage message = _labsRestClient.CreateGetRequest(Id.SubscriptionId, Id.ResourceGroupName, name, expand, context); + await Pipeline.SendAsync(message, context.CancellationToken).ConfigureAwait(false); + Response result = message.Response; + Response response = default; + switch (result.Status) + { + case 200: + response = Response.FromValue(DevTestLabData.FromResponse(result), result); + break; + case 404: + response = Response.FromValue((DevTestLabData)null, result); + break; + default: + throw new RequestFailedException(result); + } return Response.FromValue(response.Value != null, response.GetRawResponse()); } catch (Exception e) @@ -358,37 +421,51 @@ public virtual async Task> ExistsAsync(string name, string expand /// Checks to see if the resource exists in azure. /// /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{name} + /// Request Path. + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{name}. /// /// - /// Operation Id - /// Labs_Get + /// Operation Id. + /// Labs_Get. /// /// - /// Default Api Version - /// 2018-09-15 - /// - /// - /// Resource - /// + /// Default Api Version. + /// 2018-09-15. /// /// /// /// The name of the lab. /// Specify the $expand query. Example: 'properties($select=defaultStorageAccount)'. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. - public virtual Response Exists(string name, string expand = null, CancellationToken cancellationToken = default) + /// is an empty string, and was expected to be non-empty. + public virtual Response Exists(string name, string expand = default, CancellationToken cancellationToken = default) { Argument.AssertNotNullOrEmpty(name, nameof(name)); - using var scope = _devTestLabLabsClientDiagnostics.CreateScope("DevTestLabCollection.Exists"); + using DiagnosticScope scope = _labsClientDiagnostics.CreateScope("DevTestLabCollection.Exists"); scope.Start(); try { - var response = _devTestLabLabsRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, name, expand, cancellationToken: cancellationToken); + RequestContext context = new RequestContext + { + CancellationToken = cancellationToken + }; + HttpMessage message = _labsRestClient.CreateGetRequest(Id.SubscriptionId, Id.ResourceGroupName, name, expand, context); + Pipeline.Send(message, context.CancellationToken); + Response result = message.Response; + Response response = default; + switch (result.Status) + { + case 200: + response = Response.FromValue(DevTestLabData.FromResponse(result), result); + break; + case 404: + response = Response.FromValue((DevTestLabData)null, result); + break; + default: + throw new RequestFailedException(result); + } return Response.FromValue(response.Value != null, response.GetRawResponse()); } catch (Exception e) @@ -402,39 +479,55 @@ public virtual Response Exists(string name, string expand = null, Cancella /// Tries to get details for this resource from the service. /// /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{name} - /// - /// - /// Operation Id - /// Labs_Get + /// Request Path. + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{name}. /// /// - /// Default Api Version - /// 2018-09-15 + /// Operation Id. + /// Labs_Get. /// /// - /// Resource - /// + /// Default Api Version. + /// 2018-09-15. /// /// /// /// The name of the lab. /// Specify the $expand query. Example: 'properties($select=defaultStorageAccount)'. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. - public virtual async Task> GetIfExistsAsync(string name, string expand = null, CancellationToken cancellationToken = default) + /// is an empty string, and was expected to be non-empty. + public virtual async Task> GetIfExistsAsync(string name, string expand = default, CancellationToken cancellationToken = default) { Argument.AssertNotNullOrEmpty(name, nameof(name)); - using var scope = _devTestLabLabsClientDiagnostics.CreateScope("DevTestLabCollection.GetIfExists"); + using DiagnosticScope scope = _labsClientDiagnostics.CreateScope("DevTestLabCollection.GetIfExists"); scope.Start(); try { - var response = await _devTestLabLabsRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, name, expand, cancellationToken: cancellationToken).ConfigureAwait(false); + RequestContext context = new RequestContext + { + CancellationToken = cancellationToken + }; + HttpMessage message = _labsRestClient.CreateGetRequest(Id.SubscriptionId, Id.ResourceGroupName, name, expand, context); + await Pipeline.SendAsync(message, context.CancellationToken).ConfigureAwait(false); + Response result = message.Response; + Response response = default; + switch (result.Status) + { + case 200: + response = Response.FromValue(DevTestLabData.FromResponse(result), result); + break; + case 404: + response = Response.FromValue((DevTestLabData)null, result); + break; + default: + throw new RequestFailedException(result); + } if (response.Value == null) + { return new NoValueResponse(response.GetRawResponse()); + } return Response.FromValue(new DevTestLabResource(Client, response.Value), response.GetRawResponse()); } catch (Exception e) @@ -448,39 +541,55 @@ public virtual async Task> GetIfExistsAsync /// Tries to get details for this resource from the service. /// /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{name} + /// Request Path. + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{name}. /// /// - /// Operation Id - /// Labs_Get + /// Operation Id. + /// Labs_Get. /// /// - /// Default Api Version - /// 2018-09-15 - /// - /// - /// Resource - /// + /// Default Api Version. + /// 2018-09-15. /// /// /// /// The name of the lab. /// Specify the $expand query. Example: 'properties($select=defaultStorageAccount)'. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. - public virtual NullableResponse GetIfExists(string name, string expand = null, CancellationToken cancellationToken = default) + /// is an empty string, and was expected to be non-empty. + public virtual NullableResponse GetIfExists(string name, string expand = default, CancellationToken cancellationToken = default) { Argument.AssertNotNullOrEmpty(name, nameof(name)); - using var scope = _devTestLabLabsClientDiagnostics.CreateScope("DevTestLabCollection.GetIfExists"); + using DiagnosticScope scope = _labsClientDiagnostics.CreateScope("DevTestLabCollection.GetIfExists"); scope.Start(); try { - var response = _devTestLabLabsRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, name, expand, cancellationToken: cancellationToken); + RequestContext context = new RequestContext + { + CancellationToken = cancellationToken + }; + HttpMessage message = _labsRestClient.CreateGetRequest(Id.SubscriptionId, Id.ResourceGroupName, name, expand, context); + Pipeline.Send(message, context.CancellationToken); + Response result = message.Response; + Response response = default; + switch (result.Status) + { + case 200: + response = Response.FromValue(DevTestLabData.FromResponse(result), result); + break; + case 404: + response = Response.FromValue((DevTestLabData)null, result); + break; + default: + throw new RequestFailedException(result); + } if (response.Value == null) + { return new NoValueResponse(response.GetRawResponse()); + } return Response.FromValue(new DevTestLabResource(Client, response.Value), response.GetRawResponse()); } catch (Exception e) @@ -500,6 +609,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/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/DevTestLabCostCollection.cs b/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/DevTestLabCostCollection.cs index 021f62af0ad0..447b9a083459 100644 --- a/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/DevTestLabCostCollection.cs +++ b/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/DevTestLabCostCollection.cs @@ -6,11 +6,13 @@ #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.DevTestLabs { @@ -21,51 +23,49 @@ namespace Azure.ResourceManager.DevTestLabs /// public partial class DevTestLabCostCollection : ArmCollection { - private readonly ClientDiagnostics _devTestLabCostCostsClientDiagnostics; - private readonly CostsRestOperations _devTestLabCostCostsRestClient; + private readonly ClientDiagnostics _costsClientDiagnostics; + private readonly Costs _costsRestClient; - /// Initializes a new instance of the class for mocking. + /// Initializes a new instance of DevTestLabCostCollection for mocking. protected DevTestLabCostCollection() { } - /// 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 DevTestLabCostCollection(ArmClient client, ResourceIdentifier id) : base(client, id) { - _devTestLabCostCostsClientDiagnostics = new ClientDiagnostics("Azure.ResourceManager.DevTestLabs", DevTestLabCostResource.ResourceType.Namespace, Diagnostics); - TryGetApiVersion(DevTestLabCostResource.ResourceType, out string devTestLabCostCostsApiVersion); - _devTestLabCostCostsRestClient = new CostsRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, devTestLabCostCostsApiVersion); -#if DEBUG - ValidateResourceId(Id); -#endif + TryGetApiVersion(DevTestLabCostResource.ResourceType, out string devTestLabCostApiVersion); + _costsClientDiagnostics = new ClientDiagnostics("Azure.ResourceManager.DevTestLabs", DevTestLabCostResource.ResourceType.Namespace, Diagnostics); + _costsRestClient = new Costs(_costsClientDiagnostics, Pipeline, Endpoint, devTestLabCostApiVersion ?? "2018-09-15"); + ValidateResourceId(id); } + /// + [Conditional("DEBUG")] internal static void ValidateResourceId(ResourceIdentifier id) { if (id.ResourceType != DevTestLabResource.ResourceType) - throw new ArgumentException(string.Format(CultureInfo.CurrentCulture, "Invalid resource type {0} expected {1}", id.ResourceType, DevTestLabResource.ResourceType), nameof(id)); + { + throw new ArgumentException(string.Format("Invalid resource type {0} expected {1}", id.ResourceType, DevTestLabResource.ResourceType), id); + } } /// /// Create or replace an existing cost. /// /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/costs/{name} + /// Request Path. + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/costs/{name}. /// /// - /// Operation Id - /// Costs_CreateOrUpdate + /// Operation Id. + /// Costs_CreateOrUpdate. /// /// - /// Default Api Version - /// 2018-09-15 - /// - /// - /// Resource - /// + /// Default Api Version. + /// 2018-09-15. /// /// /// @@ -73,23 +73,31 @@ internal static void ValidateResourceId(ResourceIdentifier id) /// The name of the cost. /// A cost item. /// 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 name, DevTestLabCostData data, CancellationToken cancellationToken = default) { Argument.AssertNotNullOrEmpty(name, nameof(name)); Argument.AssertNotNull(data, nameof(data)); - using var scope = _devTestLabCostCostsClientDiagnostics.CreateScope("DevTestLabCostCollection.CreateOrUpdate"); + using DiagnosticScope scope = _costsClientDiagnostics.CreateScope("DevTestLabCostCollection.CreateOrUpdate"); scope.Start(); try { - var response = await _devTestLabCostCostsRestClient.CreateOrUpdateAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, name, data, cancellationToken).ConfigureAwait(false); - var uri = _devTestLabCostCostsRestClient.CreateCreateOrUpdateRequestUri(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, name, data); - var rehydrationToken = NextLinkOperationImplementation.GetRehydrationToken(RequestMethod.Put, uri.ToUri(), uri.ToString(), "None", null, OperationFinalStateVia.OriginalUri.ToString()); - var operation = new DevTestLabsArmOperation(Response.FromValue(new DevTestLabCostResource(Client, response), response.GetRawResponse()), rehydrationToken); + RequestContext context = new RequestContext + { + CancellationToken = cancellationToken + }; + HttpMessage message = _costsRestClient.CreateCreateOrUpdateRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, name, DevTestLabCostData.ToRequestContent(data), context); + Response result = await Pipeline.ProcessMessageAsync(message, context).ConfigureAwait(false); + Response response = Response.FromValue(DevTestLabCostData.FromResponse(result), result); + RequestUriBuilder uri = message.Request.Uri; + RehydrationToken rehydrationToken = NextLinkOperationImplementation.GetRehydrationToken(RequestMethod.Put, uri.ToUri(), uri.ToString(), "None", null, OperationFinalStateVia.OriginalUri.ToString()); + DevTestLabsArmOperation operation = new DevTestLabsArmOperation(Response.FromValue(new DevTestLabCostResource(Client, response.Value), response.GetRawResponse()), rehydrationToken); if (waitUntil == WaitUntil.Completed) + { await operation.WaitForCompletionAsync(cancellationToken).ConfigureAwait(false); + } return operation; } catch (Exception e) @@ -103,20 +111,16 @@ public virtual async Task> CreateOrUpdateAs /// Create or replace an existing cost. /// /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/costs/{name} - /// - /// - /// Operation Id - /// Costs_CreateOrUpdate + /// Request Path. + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/costs/{name}. /// /// - /// Default Api Version - /// 2018-09-15 + /// Operation Id. + /// Costs_CreateOrUpdate. /// /// - /// Resource - /// + /// Default Api Version. + /// 2018-09-15. /// /// /// @@ -124,23 +128,31 @@ public virtual async Task> CreateOrUpdateAs /// The name of the cost. /// A cost item. /// 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 name, DevTestLabCostData data, CancellationToken cancellationToken = default) { Argument.AssertNotNullOrEmpty(name, nameof(name)); Argument.AssertNotNull(data, nameof(data)); - using var scope = _devTestLabCostCostsClientDiagnostics.CreateScope("DevTestLabCostCollection.CreateOrUpdate"); + using DiagnosticScope scope = _costsClientDiagnostics.CreateScope("DevTestLabCostCollection.CreateOrUpdate"); scope.Start(); try { - var response = _devTestLabCostCostsRestClient.CreateOrUpdate(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, name, data, cancellationToken); - var uri = _devTestLabCostCostsRestClient.CreateCreateOrUpdateRequestUri(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, name, data); - var rehydrationToken = NextLinkOperationImplementation.GetRehydrationToken(RequestMethod.Put, uri.ToUri(), uri.ToString(), "None", null, OperationFinalStateVia.OriginalUri.ToString()); - var operation = new DevTestLabsArmOperation(Response.FromValue(new DevTestLabCostResource(Client, response), response.GetRawResponse()), rehydrationToken); + RequestContext context = new RequestContext + { + CancellationToken = cancellationToken + }; + HttpMessage message = _costsRestClient.CreateCreateOrUpdateRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, name, DevTestLabCostData.ToRequestContent(data), context); + Response result = Pipeline.ProcessMessage(message, context); + Response response = Response.FromValue(DevTestLabCostData.FromResponse(result), result); + RequestUriBuilder uri = message.Request.Uri; + RehydrationToken rehydrationToken = NextLinkOperationImplementation.GetRehydrationToken(RequestMethod.Put, uri.ToUri(), uri.ToString(), "None", null, OperationFinalStateVia.OriginalUri.ToString()); + DevTestLabsArmOperation operation = new DevTestLabsArmOperation(Response.FromValue(new DevTestLabCostResource(Client, response.Value), response.GetRawResponse()), rehydrationToken); if (waitUntil == WaitUntil.Completed) + { operation.WaitForCompletion(cancellationToken); + } return operation; } catch (Exception e) @@ -154,39 +166,43 @@ public virtual ArmOperation CreateOrUpdate(WaitUntil wai /// Get cost. /// /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/costs/{name} - /// - /// - /// Operation Id - /// Costs_Get + /// Request Path. + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/costs/{name}. /// /// - /// Default Api Version - /// 2018-09-15 + /// Operation Id. + /// Costs_Get. /// /// - /// Resource - /// + /// Default Api Version. + /// 2018-09-15. /// /// /// /// The name of the cost. /// Specify the $expand query. Example: 'properties($expand=labCostDetails)'. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. - public virtual async Task> GetAsync(string name, string expand = null, CancellationToken cancellationToken = default) + /// is an empty string, and was expected to be non-empty. + public virtual async Task> GetAsync(string name, string expand = default, CancellationToken cancellationToken = default) { Argument.AssertNotNullOrEmpty(name, nameof(name)); - using var scope = _devTestLabCostCostsClientDiagnostics.CreateScope("DevTestLabCostCollection.Get"); + using DiagnosticScope scope = _costsClientDiagnostics.CreateScope("DevTestLabCostCollection.Get"); scope.Start(); try { - var response = await _devTestLabCostCostsRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, name, expand, cancellationToken).ConfigureAwait(false); + RequestContext context = new RequestContext + { + CancellationToken = cancellationToken + }; + HttpMessage message = _costsRestClient.CreateGetRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, name, expand, context); + Response result = await Pipeline.ProcessMessageAsync(message, context).ConfigureAwait(false); + Response response = Response.FromValue(DevTestLabCostData.FromResponse(result), result); if (response.Value == null) + { throw new RequestFailedException(response.GetRawResponse()); + } return Response.FromValue(new DevTestLabCostResource(Client, response.Value), response.GetRawResponse()); } catch (Exception e) @@ -200,39 +216,43 @@ public virtual async Task> GetAsync(string name /// Get cost. /// /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/costs/{name} - /// - /// - /// Operation Id - /// Costs_Get + /// Request Path. + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/costs/{name}. /// /// - /// Default Api Version - /// 2018-09-15 + /// Operation Id. + /// Costs_Get. /// /// - /// Resource - /// + /// Default Api Version. + /// 2018-09-15. /// /// /// /// The name of the cost. /// Specify the $expand query. Example: 'properties($expand=labCostDetails)'. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. - public virtual Response Get(string name, string expand = null, CancellationToken cancellationToken = default) + /// is an empty string, and was expected to be non-empty. + public virtual Response Get(string name, string expand = default, CancellationToken cancellationToken = default) { Argument.AssertNotNullOrEmpty(name, nameof(name)); - using var scope = _devTestLabCostCostsClientDiagnostics.CreateScope("DevTestLabCostCollection.Get"); + using DiagnosticScope scope = _costsClientDiagnostics.CreateScope("DevTestLabCostCollection.Get"); scope.Start(); try { - var response = _devTestLabCostCostsRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, name, expand, cancellationToken); + RequestContext context = new RequestContext + { + CancellationToken = cancellationToken + }; + HttpMessage message = _costsRestClient.CreateGetRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, name, expand, context); + Response result = Pipeline.ProcessMessage(message, context); + Response response = Response.FromValue(DevTestLabCostData.FromResponse(result), result); if (response.Value == null) + { throw new RequestFailedException(response.GetRawResponse()); + } return Response.FromValue(new DevTestLabCostResource(Client, response.Value), response.GetRawResponse()); } catch (Exception e) @@ -246,37 +266,51 @@ public virtual Response Get(string name, string expand = /// Checks to see if the resource exists in azure. /// /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/costs/{name} - /// - /// - /// Operation Id - /// Costs_Get + /// Request Path. + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/costs/{name}. /// /// - /// Default Api Version - /// 2018-09-15 + /// Operation Id. + /// Costs_Get. /// /// - /// Resource - /// + /// Default Api Version. + /// 2018-09-15. /// /// /// /// The name of the cost. /// Specify the $expand query. Example: 'properties($expand=labCostDetails)'. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. - public virtual async Task> ExistsAsync(string name, string expand = null, CancellationToken cancellationToken = default) + /// is an empty string, and was expected to be non-empty. + public virtual async Task> ExistsAsync(string name, string expand = default, CancellationToken cancellationToken = default) { Argument.AssertNotNullOrEmpty(name, nameof(name)); - using var scope = _devTestLabCostCostsClientDiagnostics.CreateScope("DevTestLabCostCollection.Exists"); + using DiagnosticScope scope = _costsClientDiagnostics.CreateScope("DevTestLabCostCollection.Exists"); scope.Start(); try { - var response = await _devTestLabCostCostsRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, name, expand, cancellationToken: cancellationToken).ConfigureAwait(false); + RequestContext context = new RequestContext + { + CancellationToken = cancellationToken + }; + HttpMessage message = _costsRestClient.CreateGetRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, name, expand, context); + await Pipeline.SendAsync(message, context.CancellationToken).ConfigureAwait(false); + Response result = message.Response; + Response response = default; + switch (result.Status) + { + case 200: + response = Response.FromValue(DevTestLabCostData.FromResponse(result), result); + break; + case 404: + response = Response.FromValue((DevTestLabCostData)null, result); + break; + default: + throw new RequestFailedException(result); + } return Response.FromValue(response.Value != null, response.GetRawResponse()); } catch (Exception e) @@ -290,37 +324,51 @@ public virtual async Task> ExistsAsync(string name, string expand /// Checks to see if the resource exists in azure. /// /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/costs/{name} + /// Request Path. + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/costs/{name}. /// /// - /// Operation Id - /// Costs_Get + /// Operation Id. + /// Costs_Get. /// /// - /// Default Api Version - /// 2018-09-15 - /// - /// - /// Resource - /// + /// Default Api Version. + /// 2018-09-15. /// /// /// /// The name of the cost. /// Specify the $expand query. Example: 'properties($expand=labCostDetails)'. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. - public virtual Response Exists(string name, string expand = null, CancellationToken cancellationToken = default) + /// is an empty string, and was expected to be non-empty. + public virtual Response Exists(string name, string expand = default, CancellationToken cancellationToken = default) { Argument.AssertNotNullOrEmpty(name, nameof(name)); - using var scope = _devTestLabCostCostsClientDiagnostics.CreateScope("DevTestLabCostCollection.Exists"); + using DiagnosticScope scope = _costsClientDiagnostics.CreateScope("DevTestLabCostCollection.Exists"); scope.Start(); try { - var response = _devTestLabCostCostsRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, name, expand, cancellationToken: cancellationToken); + RequestContext context = new RequestContext + { + CancellationToken = cancellationToken + }; + HttpMessage message = _costsRestClient.CreateGetRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, name, expand, context); + Pipeline.Send(message, context.CancellationToken); + Response result = message.Response; + Response response = default; + switch (result.Status) + { + case 200: + response = Response.FromValue(DevTestLabCostData.FromResponse(result), result); + break; + case 404: + response = Response.FromValue((DevTestLabCostData)null, result); + break; + default: + throw new RequestFailedException(result); + } return Response.FromValue(response.Value != null, response.GetRawResponse()); } catch (Exception e) @@ -334,39 +382,55 @@ public virtual Response Exists(string name, string expand = null, Cancella /// Tries to get details for this resource from the service. /// /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/costs/{name} + /// Request Path. + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/costs/{name}. /// /// - /// Operation Id - /// Costs_Get + /// Operation Id. + /// Costs_Get. /// /// - /// Default Api Version - /// 2018-09-15 - /// - /// - /// Resource - /// + /// Default Api Version. + /// 2018-09-15. /// /// /// /// The name of the cost. /// Specify the $expand query. Example: 'properties($expand=labCostDetails)'. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. - public virtual async Task> GetIfExistsAsync(string name, string expand = null, CancellationToken cancellationToken = default) + /// is an empty string, and was expected to be non-empty. + public virtual async Task> GetIfExistsAsync(string name, string expand = default, CancellationToken cancellationToken = default) { Argument.AssertNotNullOrEmpty(name, nameof(name)); - using var scope = _devTestLabCostCostsClientDiagnostics.CreateScope("DevTestLabCostCollection.GetIfExists"); + using DiagnosticScope scope = _costsClientDiagnostics.CreateScope("DevTestLabCostCollection.GetIfExists"); scope.Start(); try { - var response = await _devTestLabCostCostsRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, name, expand, cancellationToken: cancellationToken).ConfigureAwait(false); + RequestContext context = new RequestContext + { + CancellationToken = cancellationToken + }; + HttpMessage message = _costsRestClient.CreateGetRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, name, expand, context); + await Pipeline.SendAsync(message, context.CancellationToken).ConfigureAwait(false); + Response result = message.Response; + Response response = default; + switch (result.Status) + { + case 200: + response = Response.FromValue(DevTestLabCostData.FromResponse(result), result); + break; + case 404: + response = Response.FromValue((DevTestLabCostData)null, result); + break; + default: + throw new RequestFailedException(result); + } if (response.Value == null) + { return new NoValueResponse(response.GetRawResponse()); + } return Response.FromValue(new DevTestLabCostResource(Client, response.Value), response.GetRawResponse()); } catch (Exception e) @@ -380,39 +444,55 @@ public virtual async Task> GetIfExistsA /// Tries to get details for this resource from the service. /// /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/costs/{name} + /// Request Path. + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/costs/{name}. /// /// - /// Operation Id - /// Costs_Get + /// Operation Id. + /// Costs_Get. /// /// - /// Default Api Version - /// 2018-09-15 - /// - /// - /// Resource - /// + /// Default Api Version. + /// 2018-09-15. /// /// /// /// The name of the cost. /// Specify the $expand query. Example: 'properties($expand=labCostDetails)'. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. - public virtual NullableResponse GetIfExists(string name, string expand = null, CancellationToken cancellationToken = default) + /// is an empty string, and was expected to be non-empty. + public virtual NullableResponse GetIfExists(string name, string expand = default, CancellationToken cancellationToken = default) { Argument.AssertNotNullOrEmpty(name, nameof(name)); - using var scope = _devTestLabCostCostsClientDiagnostics.CreateScope("DevTestLabCostCollection.GetIfExists"); + using DiagnosticScope scope = _costsClientDiagnostics.CreateScope("DevTestLabCostCollection.GetIfExists"); scope.Start(); try { - var response = _devTestLabCostCostsRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, name, expand, cancellationToken: cancellationToken); + RequestContext context = new RequestContext + { + CancellationToken = cancellationToken + }; + HttpMessage message = _costsRestClient.CreateGetRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, name, expand, context); + Pipeline.Send(message, context.CancellationToken); + Response result = message.Response; + Response response = default; + switch (result.Status) + { + case 200: + response = Response.FromValue(DevTestLabCostData.FromResponse(result), result); + break; + case 404: + response = Response.FromValue((DevTestLabCostData)null, result); + break; + default: + throw new RequestFailedException(result); + } if (response.Value == null) + { return new NoValueResponse(response.GetRawResponse()); + } return Response.FromValue(new DevTestLabCostResource(Client, response.Value), response.GetRawResponse()); } catch (Exception e) diff --git a/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/DevTestLabCostData.Serialization.cs b/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/DevTestLabCostData.Serialization.cs index 519e0d0f5c3f..0c38978de0c7 100644 --- a/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/DevTestLabCostData.Serialization.cs +++ b/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/DevTestLabCostData.Serialization.cs @@ -10,16 +10,47 @@ using System.Collections.Generic; using System.Text; using System.Text.Json; +using Azure; using Azure.Core; using Azure.ResourceManager.DevTestLabs.Models; using Azure.ResourceManager.Models; namespace Azure.ResourceManager.DevTestLabs { - public partial class DevTestLabCostData : IUtf8JsonSerializable, IJsonModel + /// A cost item. + public partial class DevTestLabCostData : TrackedResourceData, IJsonModel { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + /// Initializes a new instance of for deserialization. + internal DevTestLabCostData() + { + } + /// 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)) + { + return DeserializeDevTestLabCostData(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(DevTestLabCostData)} does not support reading '{options.Format}' format."); + } + } + + /// The to deserialize the from. + internal static DevTestLabCostData FromResponse(Response response) + { + using JsonDocument document = JsonDocument.Parse(response.Content, ModelSerializationExtensions.JsonDocumentOptions); + return DeserializeDevTestLabCostData(document.RootElement, ModelSerializationExtensions.WireOptions); + } + + /// The JSON writer. + /// The client options for reading and writing models. void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) { writer.WriteStartObject(); @@ -31,295 +62,153 @@ void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWrit /// 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(DevTestLabCostData)} does not support writing '{format}' format."); } - base.JsonModelWriteCore(writer, options); writer.WritePropertyName("properties"u8); - writer.WriteStartObject(); - if (Optional.IsDefined(TargetCost)) - { - writer.WritePropertyName("targetCost"u8); - writer.WriteObjectValue(TargetCost, options); - } - if (options.Format != "W" && Optional.IsDefined(LabCostSummary)) - { - writer.WritePropertyName("labCostSummary"u8); - writer.WriteObjectValue(LabCostSummary, options); - } - if (options.Format != "W" && Optional.IsCollectionDefined(LabCostDetails)) - { - writer.WritePropertyName("labCostDetails"u8); - writer.WriteStartArray(); - foreach (var item in LabCostDetails) - { - writer.WriteObjectValue(item, options); - } - writer.WriteEndArray(); - } - if (options.Format != "W" && Optional.IsCollectionDefined(ResourceCosts)) + writer.WriteObjectValue(Properties, options); + if (Optional.IsCollectionDefined(Tags)) { - writer.WritePropertyName("resourceCosts"u8); - writer.WriteStartArray(); - foreach (var item in ResourceCosts) + writer.WritePropertyName("tags"u8); + writer.WriteStartObject(); + foreach (var item in Tags) { - writer.WriteObjectValue(item, options); + writer.WritePropertyName(item.Key); + if (item.Value == null) + { + writer.WriteNullValue(); + continue; + } + writer.WriteStringValue(item.Value); } - writer.WriteEndArray(); - } - if (Optional.IsDefined(CurrencyCode)) - { - writer.WritePropertyName("currencyCode"u8); - writer.WriteStringValue(CurrencyCode); - } - if (Optional.IsDefined(StartOn)) - { - writer.WritePropertyName("startDateTime"u8); - writer.WriteStringValue(StartOn.Value, "O"); - } - if (Optional.IsDefined(EndOn)) - { - writer.WritePropertyName("endDateTime"u8); - writer.WriteStringValue(EndOn.Value, "O"); - } - if (Optional.IsDefined(CreatedOn)) - { - writer.WritePropertyName("createdDate"u8); - writer.WriteStringValue(CreatedOn.Value, "O"); + writer.WriteEndObject(); } - if (options.Format != "W" && Optional.IsDefined(ProvisioningState)) - { - writer.WritePropertyName("provisioningState"u8); - writer.WriteStringValue(ProvisioningState); - } - if (options.Format != "W" && Optional.IsDefined(UniqueIdentifier)) - { - writer.WritePropertyName("uniqueIdentifier"u8); - writer.WriteStringValue(UniqueIdentifier.Value); - } - writer.WriteEndObject(); } - DevTestLabCostData IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + /// The JSON reader. + /// The client options for reading and writing models. + DevTestLabCostData IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) => (DevTestLabCostData)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(DevTestLabCostData)} does not support reading '{format}' format."); } - using JsonDocument document = JsonDocument.ParseValue(ref reader); return DeserializeDevTestLabCostData(document.RootElement, options); } - internal static DevTestLabCostData DeserializeDevTestLabCostData(JsonElement element, ModelReaderWriterOptions options = null) + /// The JSON element to deserialize. + /// The client options for reading and writing models. + internal static DevTestLabCostData DeserializeDevTestLabCostData(JsonElement element, ModelReaderWriterOptions options) { - options ??= ModelSerializationExtensions.WireOptions; - if (element.ValueKind == JsonValueKind.Null) { return null; } - IDictionary tags = default; - AzureLocation location = default; ResourceIdentifier id = default; string name = default; - ResourceType type = default; + ResourceType resourceType = default; SystemData systemData = default; - DevTestLabTargetCost targetCost = default; - LabCostSummaryProperties labCostSummary = default; - IReadOnlyList labCostDetails = default; - IReadOnlyList resourceCosts = default; - string currencyCode = default; - DateTimeOffset? startDateTime = default; - DateTimeOffset? endDateTime = default; - DateTimeOffset? createdDate = default; - string provisioningState = default; - Guid? uniqueIdentifier = default; - IDictionary serializedAdditionalRawData = default; - Dictionary rawDataDictionary = new Dictionary(); - foreach (var property in element.EnumerateObject()) + IDictionary additionalBinaryDataProperties = new ChangeTrackingDictionary(); + AzureLocation location = default; + LabCostProperties properties = default; + IDictionary tags = default; + foreach (var prop in element.EnumerateObject()) { - if (property.NameEquals("tags"u8)) + if (prop.NameEquals("id"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()) - { - dictionary.Add(property0.Name, property0.Value.GetString()); - } - tags = dictionary; + id = new ResourceIdentifier(prop.Value.GetString()); continue; } - if (property.NameEquals("location"u8)) + if (prop.NameEquals("name"u8)) { - location = new AzureLocation(property.Value.GetString()); + name = prop.Value.GetString(); continue; } - if (property.NameEquals("id"u8)) + if (prop.NameEquals("type"u8)) { - id = new ResourceIdentifier(property.Value.GetString()); + if (prop.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + resourceType = new ResourceType(prop.Value.GetString()); continue; } - if (property.NameEquals("name"u8)) + if (prop.NameEquals("systemData"u8)) { - name = property.Value.GetString(); + if (prop.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + systemData = ModelReaderWriter.Read(new BinaryData(Encoding.UTF8.GetBytes(prop.Value.GetRawText())), ModelSerializationExtensions.WireOptions, AzureResourceManagerDevTestLabsContext.Default); 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) - { - continue; - } - systemData = ModelReaderWriter.Read(new BinaryData(Encoding.UTF8.GetBytes(property.Value.GetRawText())), ModelSerializationExtensions.WireOptions, AzureResourceManagerDevTestLabsContext.Default); + properties = LabCostProperties.DeserializeLabCostProperties(prop.Value, options); continue; } - if (property.NameEquals("properties"u8)) + if (prop.NameEquals("tags"u8)) { - if (property.Value.ValueKind == JsonValueKind.Null) + if (prop.Value.ValueKind == JsonValueKind.Null) { - property.ThrowNonNullablePropertyIsNull(); continue; } - foreach (var property0 in property.Value.EnumerateObject()) + Dictionary dictionary = new Dictionary(); + foreach (var prop0 in prop.Value.EnumerateObject()) { - if (property0.NameEquals("targetCost"u8)) - { - if (property0.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - targetCost = DevTestLabTargetCost.DeserializeDevTestLabTargetCost(property0.Value, options); - continue; - } - if (property0.NameEquals("labCostSummary"u8)) + if (prop0.Value.ValueKind == JsonValueKind.Null) { - if (property0.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - labCostSummary = LabCostSummaryProperties.DeserializeLabCostSummaryProperties(property0.Value, options); - continue; + dictionary.Add(prop0.Name, null); } - if (property0.NameEquals("labCostDetails"u8)) + else { - if (property0.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - List array = new List(); - foreach (var item in property0.Value.EnumerateArray()) - { - array.Add(DevTestLabCostDetails.DeserializeDevTestLabCostDetails(item, options)); - } - labCostDetails = array; - continue; - } - if (property0.NameEquals("resourceCosts"u8)) - { - if (property0.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - List array = new List(); - foreach (var item in property0.Value.EnumerateArray()) - { - array.Add(DevTestLabResourceCost.DeserializeDevTestLabResourceCost(item, options)); - } - resourceCosts = array; - continue; - } - if (property0.NameEquals("currencyCode"u8)) - { - currencyCode = property0.Value.GetString(); - continue; - } - if (property0.NameEquals("startDateTime"u8)) - { - if (property0.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - startDateTime = property0.Value.GetDateTimeOffset("O"); - continue; - } - if (property0.NameEquals("endDateTime"u8)) - { - if (property0.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - endDateTime = property0.Value.GetDateTimeOffset("O"); - continue; - } - if (property0.NameEquals("createdDate"u8)) - { - if (property0.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - createdDate = property0.Value.GetDateTimeOffset("O"); - continue; - } - if (property0.NameEquals("provisioningState"u8)) - { - provisioningState = property0.Value.GetString(); - continue; - } - if (property0.NameEquals("uniqueIdentifier"u8)) - { - if (property0.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - uniqueIdentifier = property0.Value.GetGuid(); - continue; + dictionary.Add(prop0.Name, prop0.Value.GetString()); } } + tags = dictionary; 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 DevTestLabCostData( id, name, - type, + resourceType, systemData, - tags ?? new ChangeTrackingDictionary(), + additionalBinaryDataProperties, location, - targetCost, - labCostSummary, - labCostDetails ?? new ChangeTrackingList(), - resourceCosts ?? new ChangeTrackingList(), - currencyCode, - startDateTime, - endDateTime, - createdDate, - provisioningState, - uniqueIdentifier, - serializedAdditionalRawData); + properties, + tags ?? new ChangeTrackingDictionary()); } - 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": @@ -329,22 +218,23 @@ BinaryData IPersistableModel.Write(ModelReaderWriterOptions } } - DevTestLabCostData 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. + DevTestLabCostData IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) => (DevTestLabCostData)PersistableModelCreateCore(data, options); - switch (format) + /// The client options for reading and writing models. + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + + /// The to serialize into . + internal static RequestContent ToRequestContent(DevTestLabCostData devTestLabCostData) + { + if (devTestLabCostData == null) { - case "J": - { - using JsonDocument document = JsonDocument.Parse(data, ModelSerializationExtensions.JsonDocumentOptions); - return DeserializeDevTestLabCostData(document.RootElement, options); - } - default: - throw new FormatException($"The model {nameof(DevTestLabCostData)} does not support reading '{options.Format}' format."); + return null; } + Utf8JsonRequestContent content = new Utf8JsonRequestContent(); + content.JsonWriter.WriteObjectValue(devTestLabCostData, ModelSerializationExtensions.WireOptions); + return content; } - - string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; } } diff --git a/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/DevTestLabCostData.cs b/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/DevTestLabCostData.cs index 1d2eb25f1b71..d5a594c6c068 100644 --- a/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/DevTestLabCostData.cs +++ b/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/DevTestLabCostData.cs @@ -13,115 +13,173 @@ namespace Azure.ResourceManager.DevTestLabs { - /// - /// A class representing the DevTestLabCost data model. - /// A cost item. - /// + /// A cost item. public partial class DevTestLabCostData : 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 DevTestLabCostData(AzureLocation location) : base(location) { - LabCostDetails = new ChangeTrackingList(); - ResourceCosts = new ChangeTrackingList(); + } /// Initializes a new instance of . - /// The id. - /// The name. - /// The resourceType. - /// The systemData. - /// The tags. - /// The location. - /// The target cost properties. - /// The lab cost summary component of the cost data. - /// The lab cost details component of the cost data. - /// The resource cost component of the cost data. - /// The currency code of the cost. - /// The start time of the cost data. - /// The end time of the cost data. - /// The creation date of the cost. - /// The provisioning status of the resource. - /// The unique immutable identifier of a resource (Guid). - /// Keeps track of any properties unknown to the library. - internal DevTestLabCostData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, IDictionary tags, AzureLocation location, DevTestLabTargetCost targetCost, LabCostSummaryProperties labCostSummary, IReadOnlyList labCostDetails, IReadOnlyList resourceCosts, string currencyCode, DateTimeOffset? startOn, DateTimeOffset? endOn, DateTimeOffset? createdOn, string provisioningState, Guid? uniqueIdentifier, IDictionary serializedAdditionalRawData) : base(id, name, resourceType, systemData, tags, 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. + /// The geo-location where the resource lives. + /// The properties of the resource. + /// Resource tags. + internal DevTestLabCostData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, IDictionary additionalBinaryDataProperties, AzureLocation location, LabCostProperties properties, IDictionary tags) : base(id, name, resourceType, systemData, tags, location) { - TargetCost = targetCost; - LabCostSummary = labCostSummary; - LabCostDetails = labCostDetails; - ResourceCosts = resourceCosts; - CurrencyCode = currencyCode; - StartOn = startOn; - EndOn = endOn; - CreatedOn = createdOn; - ProvisioningState = provisioningState; - UniqueIdentifier = uniqueIdentifier; - _serializedAdditionalRawData = serializedAdditionalRawData; + _additionalBinaryDataProperties = additionalBinaryDataProperties; + Properties = properties; } - /// Initializes a new instance of for deserialization. - internal DevTestLabCostData() - { - } + /// The properties of the resource. + internal LabCostProperties Properties { get; set; } /// The target cost properties. - public DevTestLabTargetCost TargetCost { get; set; } - /// The lab cost summary component of the cost data. - internal LabCostSummaryProperties LabCostSummary { get; } - /// The cost component of the cost item. - public double? EstimatedLabCost + public DevTestLabTargetCost TargetCost { - get => LabCostSummary?.EstimatedLabCost; + get + { + return Properties is null ? default : Properties.TargetCost; + } + set + { + if (Properties is null) + { + Properties = new LabCostProperties(); + } + Properties.TargetCost = value; + } } /// The lab cost details component of the cost data. - public IReadOnlyList LabCostDetails { get; } + public IReadOnlyList LabCostDetails + { + get + { + if (Properties is null) + { + Properties = new LabCostProperties(); + } + return Properties.LabCostDetails; + } + } + /// The resource cost component of the cost data. - public IReadOnlyList ResourceCosts { get; } + public IReadOnlyList ResourceCosts + { + get + { + if (Properties is null) + { + Properties = new LabCostProperties(); + } + return Properties.ResourceCosts; + } + } + /// The currency code of the cost. - public string CurrencyCode { get; set; } + public string CurrencyCode + { + get + { + return Properties is null ? default : Properties.CurrencyCode; + } + set + { + if (Properties is null) + { + Properties = new LabCostProperties(); + } + Properties.CurrencyCode = value; + } + } + /// The start time of the cost data. - public DateTimeOffset? StartOn { get; set; } + public DateTimeOffset? StartOn + { + get + { + return Properties is null ? default : Properties.StartOn; + } + set + { + if (Properties is null) + { + Properties = new LabCostProperties(); + } + Properties.StartOn = value.Value; + } + } + /// The end time of the cost data. - public DateTimeOffset? EndOn { get; set; } + public DateTimeOffset? EndOn + { + get + { + return Properties is null ? default : Properties.EndOn; + } + set + { + if (Properties is null) + { + Properties = new LabCostProperties(); + } + Properties.EndOn = value.Value; + } + } + /// The creation date of the cost. - public DateTimeOffset? CreatedOn { get; set; } + public DateTimeOffset? CreatedOn + { + get + { + return Properties is null ? default : Properties.CreatedOn; + } + set + { + if (Properties is null) + { + Properties = new LabCostProperties(); + } + Properties.CreatedOn = value.Value; + } + } + /// The provisioning status of the resource. - public string ProvisioningState { get; } + public string ProvisioningState + { + get + { + return Properties is null ? default : Properties.ProvisioningState; + } + } + /// The unique immutable identifier of a resource (Guid). - public Guid? UniqueIdentifier { get; } + public Guid? UniqueIdentifier + { + get + { + return Properties is null ? default : Properties.UniqueIdentifier; + } + } + + /// The cost component of the cost item. + public double? EstimatedLabCost + { + get + { + return Properties is null ? default : Properties.EstimatedLabCost; + } + } } } diff --git a/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/DevTestLabCostResource.Serialization.cs b/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/DevTestLabCostResource.Serialization.cs index f91f7600fa6b..c03c8a1f3dd8 100644 --- a/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/DevTestLabCostResource.Serialization.cs +++ b/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/DevTestLabCostResource.Serialization.cs @@ -11,19 +11,29 @@ namespace Azure.ResourceManager.DevTestLabs { + /// public partial class DevTestLabCostResource : IJsonModel { - private static DevTestLabCostData s_dataDeserializationInstance; - private static DevTestLabCostData DataDeserializationInstance => s_dataDeserializationInstance ??= new(); + private static IJsonModel s_dataDeserializationInstance; + private static IJsonModel DataDeserializationInstance => s_dataDeserializationInstance ??= new DevTestLabCostData(); + + /// 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); - DevTestLabCostData 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. + DevTestLabCostData 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, AzureResourceManagerDevTestLabsContext.Default); + /// The binary data to be processed. + /// The client options for reading and writing models. DevTestLabCostData IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) => ModelReaderWriter.Read(data, options, AzureResourceManagerDevTestLabsContext.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/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/DevTestLabCostResource.cs b/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/DevTestLabCostResource.cs index 1e62c624f979..93ab1b1b8b2a 100644 --- a/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/DevTestLabCostResource.cs +++ b/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/DevTestLabCostResource.cs @@ -7,46 +7,36 @@ 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; namespace Azure.ResourceManager.DevTestLabs { /// - /// A Class representing a DevTestLabCost 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 GetDevTestLabCostResource method. - /// Otherwise you can get one from its parent resource using the GetDevTestLabCost method. + /// A class representing a DevTestLabCost 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 GetDevTestLabCosts method. /// public partial class DevTestLabCostResource : ArmResource { - /// Generate the resource identifier of a instance. - /// The subscriptionId. - /// The resourceGroupName. - /// The labName. - /// The name. - public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string labName, string name) - { - var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/costs/{name}"; - return new ResourceIdentifier(resourceId); - } - - private readonly ClientDiagnostics _devTestLabCostCostsClientDiagnostics; - private readonly CostsRestOperations _devTestLabCostCostsRestClient; + private readonly ClientDiagnostics _costsClientDiagnostics; + private readonly Costs _costsRestClient; private readonly DevTestLabCostData _data; - /// Gets the resource type for the operations. public static readonly ResourceType ResourceType = "Microsoft.DevTestLab/labs/costs"; - /// Initializes a new instance of the class for mocking. + /// Initializes a new instance of DevTestLabCostResource for mocking. protected DevTestLabCostResource() { } - /// 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 DevTestLabCostResource(ArmClient client, DevTestLabCostData data) : this(client, data.Id) @@ -55,72 +45,94 @@ internal DevTestLabCostResource(ArmClient client, DevTestLabCostData data) : thi _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 DevTestLabCostResource(ArmClient client, ResourceIdentifier id) : base(client, id) { - _devTestLabCostCostsClientDiagnostics = new ClientDiagnostics("Azure.ResourceManager.DevTestLabs", ResourceType.Namespace, Diagnostics); - TryGetApiVersion(ResourceType, out string devTestLabCostCostsApiVersion); - _devTestLabCostCostsRestClient = new CostsRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, devTestLabCostCostsApiVersion); -#if DEBUG - ValidateResourceId(Id); -#endif + TryGetApiVersion(ResourceType, out string devTestLabCostApiVersion); + _costsClientDiagnostics = new ClientDiagnostics("Azure.ResourceManager.DevTestLabs", ResourceType.Namespace, Diagnostics); + _costsRestClient = new Costs(_costsClientDiagnostics, Pipeline, Endpoint, devTestLabCostApiVersion ?? "2018-09-15"); + 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 DevTestLabCostData 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 labName. + /// The name. + public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string labName, string name) + { + string resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/costs/{name}"; + 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 cost. /// /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/costs/{name} + /// Request Path. + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/costs/{name}. /// /// - /// Operation Id - /// Costs_Get + /// Operation Id. + /// Costs_Get. /// /// - /// Default Api Version - /// 2018-09-15 + /// Default Api Version. + /// 2018-09-15. /// /// - /// Resource - /// + /// Resource. + /// . /// /// /// /// Specify the $expand query. Example: 'properties($expand=labCostDetails)'. /// The cancellation token to use. - public virtual async Task> GetAsync(string expand = null, CancellationToken cancellationToken = default) + public virtual async Task> GetAsync(string expand = default, CancellationToken cancellationToken = default) { - using var scope = _devTestLabCostCostsClientDiagnostics.CreateScope("DevTestLabCostResource.Get"); + using DiagnosticScope scope = _costsClientDiagnostics.CreateScope("DevTestLabCostResource.Get"); scope.Start(); try { - var response = await _devTestLabCostCostsRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, expand, cancellationToken).ConfigureAwait(false); + RequestContext context = new RequestContext + { + CancellationToken = cancellationToken + }; + HttpMessage message = _costsRestClient.CreateGetRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, expand, context); + Response result = await Pipeline.ProcessMessageAsync(message, context).ConfigureAwait(false); + Response response = Response.FromValue(DevTestLabCostData.FromResponse(result), result); if (response.Value == null) + { throw new RequestFailedException(response.GetRawResponse()); + } return Response.FromValue(new DevTestLabCostResource(Client, response.Value), response.GetRawResponse()); } catch (Exception e) @@ -134,34 +146,42 @@ public virtual async Task> GetAsync(string expa /// Get cost. /// /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/costs/{name} + /// Request Path. + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/costs/{name}. /// /// - /// Operation Id - /// Costs_Get + /// Operation Id. + /// Costs_Get. /// /// - /// Default Api Version - /// 2018-09-15 + /// Default Api Version. + /// 2018-09-15. /// /// - /// Resource - /// + /// Resource. + /// . /// /// /// /// Specify the $expand query. Example: 'properties($expand=labCostDetails)'. /// The cancellation token to use. - public virtual Response Get(string expand = null, CancellationToken cancellationToken = default) + public virtual Response Get(string expand = default, CancellationToken cancellationToken = default) { - using var scope = _devTestLabCostCostsClientDiagnostics.CreateScope("DevTestLabCostResource.Get"); + using DiagnosticScope scope = _costsClientDiagnostics.CreateScope("DevTestLabCostResource.Get"); scope.Start(); try { - var response = _devTestLabCostCostsRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, expand, cancellationToken); + RequestContext context = new RequestContext + { + CancellationToken = cancellationToken + }; + HttpMessage message = _costsRestClient.CreateGetRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, expand, context); + Response result = Pipeline.ProcessMessage(message, context); + Response response = Response.FromValue(DevTestLabCostData.FromResponse(result), result); if (response.Value == null) + { throw new RequestFailedException(response.GetRawResponse()); + } return Response.FromValue(new DevTestLabCostResource(Client, response.Value), response.GetRawResponse()); } catch (Exception e) @@ -172,23 +192,23 @@ public virtual Response Get(string expand = null, Cancel } /// - /// Create or replace an existing cost. + /// Update a DevTestLabCost. /// /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/costs/{name} + /// Request Path. + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/costs/{name}. /// /// - /// Operation Id - /// Costs_CreateOrUpdate + /// Operation Id. + /// Costs_CreateOrUpdate. /// /// - /// Default Api Version - /// 2018-09-15 + /// Default Api Version. + /// 2018-09-15. /// /// - /// Resource - /// + /// Resource. + /// . /// /// /// @@ -200,16 +220,24 @@ public virtual async Task> UpdateAsync(Wait { Argument.AssertNotNull(data, nameof(data)); - using var scope = _devTestLabCostCostsClientDiagnostics.CreateScope("DevTestLabCostResource.Update"); + using DiagnosticScope scope = _costsClientDiagnostics.CreateScope("DevTestLabCostResource.Update"); scope.Start(); try { - var response = await _devTestLabCostCostsRestClient.CreateOrUpdateAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, data, cancellationToken).ConfigureAwait(false); - var uri = _devTestLabCostCostsRestClient.CreateCreateOrUpdateRequestUri(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, data); - var rehydrationToken = NextLinkOperationImplementation.GetRehydrationToken(RequestMethod.Put, uri.ToUri(), uri.ToString(), "None", null, OperationFinalStateVia.OriginalUri.ToString()); - var operation = new DevTestLabsArmOperation(Response.FromValue(new DevTestLabCostResource(Client, response), response.GetRawResponse()), rehydrationToken); + RequestContext context = new RequestContext + { + CancellationToken = cancellationToken + }; + HttpMessage message = _costsRestClient.CreateCreateOrUpdateRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, DevTestLabCostData.ToRequestContent(data), context); + Response result = await Pipeline.ProcessMessageAsync(message, context).ConfigureAwait(false); + Response response = Response.FromValue(DevTestLabCostData.FromResponse(result), result); + RequestUriBuilder uri = message.Request.Uri; + RehydrationToken rehydrationToken = NextLinkOperationImplementation.GetRehydrationToken(RequestMethod.Put, uri.ToUri(), uri.ToString(), "None", null, OperationFinalStateVia.OriginalUri.ToString()); + DevTestLabsArmOperation operation = new DevTestLabsArmOperation(Response.FromValue(new DevTestLabCostResource(Client, response.Value), response.GetRawResponse()), rehydrationToken); if (waitUntil == WaitUntil.Completed) + { await operation.WaitForCompletionAsync(cancellationToken).ConfigureAwait(false); + } return operation; } catch (Exception e) @@ -220,23 +248,23 @@ public virtual async Task> UpdateAsync(Wait } /// - /// Create or replace an existing cost. + /// Update a DevTestLabCost. /// /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/costs/{name} + /// Request Path. + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/costs/{name}. /// /// - /// Operation Id - /// Costs_CreateOrUpdate + /// Operation Id. + /// Costs_CreateOrUpdate. /// /// - /// Default Api Version - /// 2018-09-15 + /// Default Api Version. + /// 2018-09-15. /// /// - /// Resource - /// + /// Resource. + /// . /// /// /// @@ -248,16 +276,24 @@ public virtual ArmOperation Update(WaitUntil waitUntil, { Argument.AssertNotNull(data, nameof(data)); - using var scope = _devTestLabCostCostsClientDiagnostics.CreateScope("DevTestLabCostResource.Update"); + using DiagnosticScope scope = _costsClientDiagnostics.CreateScope("DevTestLabCostResource.Update"); scope.Start(); try { - var response = _devTestLabCostCostsRestClient.CreateOrUpdate(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, data, cancellationToken); - var uri = _devTestLabCostCostsRestClient.CreateCreateOrUpdateRequestUri(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, data); - var rehydrationToken = NextLinkOperationImplementation.GetRehydrationToken(RequestMethod.Put, uri.ToUri(), uri.ToString(), "None", null, OperationFinalStateVia.OriginalUri.ToString()); - var operation = new DevTestLabsArmOperation(Response.FromValue(new DevTestLabCostResource(Client, response), response.GetRawResponse()), rehydrationToken); + RequestContext context = new RequestContext + { + CancellationToken = cancellationToken + }; + HttpMessage message = _costsRestClient.CreateCreateOrUpdateRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, DevTestLabCostData.ToRequestContent(data), context); + Response result = Pipeline.ProcessMessage(message, context); + Response response = Response.FromValue(DevTestLabCostData.FromResponse(result), result); + RequestUriBuilder uri = message.Request.Uri; + RehydrationToken rehydrationToken = NextLinkOperationImplementation.GetRehydrationToken(RequestMethod.Put, uri.ToUri(), uri.ToString(), "None", null, OperationFinalStateVia.OriginalUri.ToString()); + DevTestLabsArmOperation operation = new DevTestLabsArmOperation(Response.FromValue(new DevTestLabCostResource(Client, response.Value), response.GetRawResponse()), rehydrationToken); if (waitUntil == WaitUntil.Completed) + { operation.WaitForCompletion(cancellationToken); + } return operation; } catch (Exception e) @@ -267,27 +303,7 @@ public virtual ArmOperation Update(WaitUntil waitUntil, } } - /// - /// Add a tag to the current resource. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/costs/{name} - /// - /// - /// Operation Id - /// Costs_Get - /// - /// - /// Default Api Version - /// 2018-09-15 - /// - /// - /// Resource - /// - /// - /// - /// + /// Add a tag to the current resource. /// The key for the tag. /// The value for the tag. /// The cancellation token to use. @@ -297,23 +313,29 @@ public virtual async Task> AddTagAsync(string k Argument.AssertNotNull(key, nameof(key)); Argument.AssertNotNull(value, nameof(value)); - using var scope = _devTestLabCostCostsClientDiagnostics.CreateScope("DevTestLabCostResource.AddTag"); + using DiagnosticScope scope = _costsClientDiagnostics.CreateScope("DevTestLabCostResource.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 _devTestLabCostCostsRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, null, cancellationToken).ConfigureAwait(false); - return Response.FromValue(new DevTestLabCostResource(Client, originalResponse.Value), originalResponse.GetRawResponse()); + await GetTagResource().CreateOrUpdateAsync(WaitUntil.Completed, originalTags.Value.Data, cancellationToken).ConfigureAwait(false); + RequestContext context = new RequestContext + { + CancellationToken = cancellationToken + }; + HttpMessage message = _costsRestClient.CreateGetRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, default, context); + Response result = await Pipeline.ProcessMessageAsync(message, context).ConfigureAwait(false); + Response response = Response.FromValue(DevTestLabCostData.FromResponse(result), result); + return Response.FromValue(new DevTestLabCostResource(Client, response.Value), response.GetRawResponse()); } else { - var current = (await GetAsync(cancellationToken: cancellationToken).ConfigureAwait(false)).Value.Data; + DevTestLabCostData current = (await GetAsync(cancellationToken: cancellationToken).ConfigureAwait(false)).Value.Data; current.Tags[key] = value; - var result = await UpdateAsync(WaitUntil.Completed, current, cancellationToken: cancellationToken).ConfigureAwait(false); + ArmOperation result = await UpdateAsync(WaitUntil.Completed, current, cancellationToken: cancellationToken).ConfigureAwait(false); return Response.FromValue(result.Value, result.GetRawResponse()); } } @@ -324,27 +346,7 @@ public virtual async Task> AddTagAsync(string k } } - /// - /// Add a tag to the current resource. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/costs/{name} - /// - /// - /// Operation Id - /// Costs_Get - /// - /// - /// Default Api Version - /// 2018-09-15 - /// - /// - /// Resource - /// - /// - /// - /// + /// Add a tag to the current resource. /// The key for the tag. /// The value for the tag. /// The cancellation token to use. @@ -354,23 +356,29 @@ public virtual Response AddTag(string key, string value, Argument.AssertNotNull(key, nameof(key)); Argument.AssertNotNull(value, nameof(value)); - using var scope = _devTestLabCostCostsClientDiagnostics.CreateScope("DevTestLabCostResource.AddTag"); + using DiagnosticScope scope = _costsClientDiagnostics.CreateScope("DevTestLabCostResource.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 = _devTestLabCostCostsRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, null, cancellationToken); - return Response.FromValue(new DevTestLabCostResource(Client, originalResponse.Value), originalResponse.GetRawResponse()); + GetTagResource().CreateOrUpdate(WaitUntil.Completed, originalTags.Value.Data, cancellationToken); + RequestContext context = new RequestContext + { + CancellationToken = cancellationToken + }; + HttpMessage message = _costsRestClient.CreateGetRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, default, context); + Response result = Pipeline.ProcessMessage(message, context); + Response response = Response.FromValue(DevTestLabCostData.FromResponse(result), result); + return Response.FromValue(new DevTestLabCostResource(Client, response.Value), response.GetRawResponse()); } else { - var current = Get(cancellationToken: cancellationToken).Value.Data; + DevTestLabCostData current = Get(cancellationToken: cancellationToken).Value.Data; current.Tags[key] = value; - var result = Update(WaitUntil.Completed, current, cancellationToken: cancellationToken); + ArmOperation result = Update(WaitUntil.Completed, current, cancellationToken: cancellationToken); return Response.FromValue(result.Value, result.GetRawResponse()); } } @@ -381,52 +389,38 @@ public virtual Response AddTag(string key, string value, } } - /// - /// Replace the tags on the resource with the given set. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/costs/{name} - /// - /// - /// Operation Id - /// Costs_Get - /// - /// - /// Default Api Version - /// 2018-09-15 - /// - /// - /// 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 = _devTestLabCostCostsClientDiagnostics.CreateScope("DevTestLabCostResource.SetTags"); + using DiagnosticScope scope = _costsClientDiagnostics.CreateScope("DevTestLabCostResource.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 _devTestLabCostCostsRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, null, cancellationToken).ConfigureAwait(false); - return Response.FromValue(new DevTestLabCostResource(Client, originalResponse.Value), originalResponse.GetRawResponse()); + await GetTagResource().CreateOrUpdateAsync(WaitUntil.Completed, originalTags.Value.Data, cancellationToken).ConfigureAwait(false); + RequestContext context = new RequestContext + { + CancellationToken = cancellationToken + }; + HttpMessage message = _costsRestClient.CreateGetRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, default, context); + Response result = await Pipeline.ProcessMessageAsync(message, context).ConfigureAwait(false); + Response response = Response.FromValue(DevTestLabCostData.FromResponse(result), result); + return Response.FromValue(new DevTestLabCostResource(Client, response.Value), response.GetRawResponse()); } else { - var current = (await GetAsync(cancellationToken: cancellationToken).ConfigureAwait(false)).Value.Data; + DevTestLabCostData current = (await GetAsync(cancellationToken: cancellationToken).ConfigureAwait(false)).Value.Data; current.Tags.ReplaceWith(tags); - var result = await UpdateAsync(WaitUntil.Completed, current, cancellationToken: cancellationToken).ConfigureAwait(false); + ArmOperation result = await UpdateAsync(WaitUntil.Completed, current, cancellationToken: cancellationToken).ConfigureAwait(false); return Response.FromValue(result.Value, result.GetRawResponse()); } } @@ -437,52 +431,38 @@ public virtual async Task> SetTagsAsync(IDictio } } - /// - /// Replace the tags on the resource with the given set. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/costs/{name} - /// - /// - /// Operation Id - /// Costs_Get - /// - /// - /// Default Api Version - /// 2018-09-15 - /// - /// - /// 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 = _devTestLabCostCostsClientDiagnostics.CreateScope("DevTestLabCostResource.SetTags"); + using DiagnosticScope scope = _costsClientDiagnostics.CreateScope("DevTestLabCostResource.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 = _devTestLabCostCostsRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, null, cancellationToken); - return Response.FromValue(new DevTestLabCostResource(Client, originalResponse.Value), originalResponse.GetRawResponse()); + GetTagResource().CreateOrUpdate(WaitUntil.Completed, originalTags.Value.Data, cancellationToken); + RequestContext context = new RequestContext + { + CancellationToken = cancellationToken + }; + HttpMessage message = _costsRestClient.CreateGetRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, default, context); + Response result = Pipeline.ProcessMessage(message, context); + Response response = Response.FromValue(DevTestLabCostData.FromResponse(result), result); + return Response.FromValue(new DevTestLabCostResource(Client, response.Value), response.GetRawResponse()); } else { - var current = Get(cancellationToken: cancellationToken).Value.Data; + DevTestLabCostData current = Get(cancellationToken: cancellationToken).Value.Data; current.Tags.ReplaceWith(tags); - var result = Update(WaitUntil.Completed, current, cancellationToken: cancellationToken); + ArmOperation result = Update(WaitUntil.Completed, current, cancellationToken: cancellationToken); return Response.FromValue(result.Value, result.GetRawResponse()); } } @@ -493,27 +473,7 @@ public virtual Response SetTags(IDictionary - /// Removes a tag by key from the resource. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/costs/{name} - /// - /// - /// Operation Id - /// Costs_Get - /// - /// - /// Default Api Version - /// 2018-09-15 - /// - /// - /// Resource - /// - /// - /// - /// + /// Removes a tag by key from the resource. /// The key for the tag. /// The cancellation token to use. /// is null. @@ -521,23 +481,29 @@ public virtual async Task> RemoveTagAsync(strin { Argument.AssertNotNull(key, nameof(key)); - using var scope = _devTestLabCostCostsClientDiagnostics.CreateScope("DevTestLabCostResource.RemoveTag"); + using DiagnosticScope scope = _costsClientDiagnostics.CreateScope("DevTestLabCostResource.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 _devTestLabCostCostsRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, null, cancellationToken).ConfigureAwait(false); - return Response.FromValue(new DevTestLabCostResource(Client, originalResponse.Value), originalResponse.GetRawResponse()); + await GetTagResource().CreateOrUpdateAsync(WaitUntil.Completed, originalTags.Value.Data, cancellationToken).ConfigureAwait(false); + RequestContext context = new RequestContext + { + CancellationToken = cancellationToken + }; + HttpMessage message = _costsRestClient.CreateGetRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, default, context); + Response result = await Pipeline.ProcessMessageAsync(message, context).ConfigureAwait(false); + Response response = Response.FromValue(DevTestLabCostData.FromResponse(result), result); + return Response.FromValue(new DevTestLabCostResource(Client, response.Value), response.GetRawResponse()); } else { - var current = (await GetAsync(cancellationToken: cancellationToken).ConfigureAwait(false)).Value.Data; + DevTestLabCostData current = (await GetAsync(cancellationToken: cancellationToken).ConfigureAwait(false)).Value.Data; current.Tags.Remove(key); - var result = await UpdateAsync(WaitUntil.Completed, current, cancellationToken: cancellationToken).ConfigureAwait(false); + ArmOperation result = await UpdateAsync(WaitUntil.Completed, current, cancellationToken: cancellationToken).ConfigureAwait(false); return Response.FromValue(result.Value, result.GetRawResponse()); } } @@ -548,27 +514,7 @@ public virtual async Task> RemoveTagAsync(strin } } - /// - /// Removes a tag by key from the resource. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/costs/{name} - /// - /// - /// Operation Id - /// Costs_Get - /// - /// - /// Default Api Version - /// 2018-09-15 - /// - /// - /// Resource - /// - /// - /// - /// + /// Removes a tag by key from the resource. /// The key for the tag. /// The cancellation token to use. /// is null. @@ -576,23 +522,29 @@ public virtual Response RemoveTag(string key, Cancellati { Argument.AssertNotNull(key, nameof(key)); - using var scope = _devTestLabCostCostsClientDiagnostics.CreateScope("DevTestLabCostResource.RemoveTag"); + using DiagnosticScope scope = _costsClientDiagnostics.CreateScope("DevTestLabCostResource.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 = _devTestLabCostCostsRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, null, cancellationToken); - return Response.FromValue(new DevTestLabCostResource(Client, originalResponse.Value), originalResponse.GetRawResponse()); + GetTagResource().CreateOrUpdate(WaitUntil.Completed, originalTags.Value.Data, cancellationToken); + RequestContext context = new RequestContext + { + CancellationToken = cancellationToken + }; + HttpMessage message = _costsRestClient.CreateGetRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, default, context); + Response result = Pipeline.ProcessMessage(message, context); + Response response = Response.FromValue(DevTestLabCostData.FromResponse(result), result); + return Response.FromValue(new DevTestLabCostResource(Client, response.Value), response.GetRawResponse()); } else { - var current = Get(cancellationToken: cancellationToken).Value.Data; + DevTestLabCostData current = Get(cancellationToken: cancellationToken).Value.Data; current.Tags.Remove(key); - var result = Update(WaitUntil.Completed, current, cancellationToken: cancellationToken); + ArmOperation result = Update(WaitUntil.Completed, current, cancellationToken: cancellationToken); return Response.FromValue(result.Value, result.GetRawResponse()); } } diff --git a/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/DevTestLabCustomImageCollection.cs b/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/DevTestLabCustomImageCollection.cs index 1a2a9f19e4d4..4bb00c3cf3b6 100644 --- a/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/DevTestLabCustomImageCollection.cs +++ b/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/DevTestLabCustomImageCollection.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.DevTestLabs { @@ -24,73 +25,84 @@ namespace Azure.ResourceManager.DevTestLabs /// public partial class DevTestLabCustomImageCollection : ArmCollection, IEnumerable, IAsyncEnumerable { - private readonly ClientDiagnostics _devTestLabCustomImageCustomImagesClientDiagnostics; - private readonly CustomImagesRestOperations _devTestLabCustomImageCustomImagesRestClient; + private readonly ClientDiagnostics _customImagesClientDiagnostics; + private readonly CustomImages _customImagesRestClient; - /// Initializes a new instance of the class for mocking. + /// Initializes a new instance of DevTestLabCustomImageCollection for mocking. protected DevTestLabCustomImageCollection() { } - /// 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 DevTestLabCustomImageCollection(ArmClient client, ResourceIdentifier id) : base(client, id) { - _devTestLabCustomImageCustomImagesClientDiagnostics = new ClientDiagnostics("Azure.ResourceManager.DevTestLabs", DevTestLabCustomImageResource.ResourceType.Namespace, Diagnostics); - TryGetApiVersion(DevTestLabCustomImageResource.ResourceType, out string devTestLabCustomImageCustomImagesApiVersion); - _devTestLabCustomImageCustomImagesRestClient = new CustomImagesRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, devTestLabCustomImageCustomImagesApiVersion); -#if DEBUG - ValidateResourceId(Id); -#endif + TryGetApiVersion(DevTestLabCustomImageResource.ResourceType, out string devTestLabCustomImageApiVersion); + _customImagesClientDiagnostics = new ClientDiagnostics("Azure.ResourceManager.DevTestLabs", DevTestLabCustomImageResource.ResourceType.Namespace, Diagnostics); + _customImagesRestClient = new CustomImages(_customImagesClientDiagnostics, Pipeline, Endpoint, devTestLabCustomImageApiVersion ?? "2018-09-15"); + ValidateResourceId(id); } + /// + [Conditional("DEBUG")] internal static void ValidateResourceId(ResourceIdentifier id) { if (id.ResourceType != DevTestLabResource.ResourceType) - throw new ArgumentException(string.Format(CultureInfo.CurrentCulture, "Invalid resource type {0} expected {1}", id.ResourceType, DevTestLabResource.ResourceType), nameof(id)); + { + throw new ArgumentException(string.Format("Invalid resource type {0} expected {1}", id.ResourceType, DevTestLabResource.ResourceType), id); + } } /// /// Create or replace an existing custom image. This operation can take a while to complete. /// /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/customimages/{name} - /// - /// - /// Operation Id - /// CustomImages_CreateOrUpdate + /// Request Path. + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/customimages/{name}. /// /// - /// Default Api Version - /// 2018-09-15 + /// Operation Id. + /// CustomImages_CreateOrUpdate. /// /// - /// Resource - /// + /// Default Api Version. + /// 2018-09-15. /// /// /// /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. - /// The name of the custom image. + /// The name of the CustomImage. /// A custom image. /// 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 name, DevTestLabCustomImageData data, CancellationToken cancellationToken = default) { Argument.AssertNotNullOrEmpty(name, nameof(name)); Argument.AssertNotNull(data, nameof(data)); - using var scope = _devTestLabCustomImageCustomImagesClientDiagnostics.CreateScope("DevTestLabCustomImageCollection.CreateOrUpdate"); + using DiagnosticScope scope = _customImagesClientDiagnostics.CreateScope("DevTestLabCustomImageCollection.CreateOrUpdate"); scope.Start(); try { - var response = await _devTestLabCustomImageCustomImagesRestClient.CreateOrUpdateAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, name, data, cancellationToken).ConfigureAwait(false); - var operation = new DevTestLabsArmOperation(new DevTestLabCustomImageOperationSource(Client), _devTestLabCustomImageCustomImagesClientDiagnostics, Pipeline, _devTestLabCustomImageCustomImagesRestClient.CreateCreateOrUpdateRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, name, data).Request, response, OperationFinalStateVia.Location); + RequestContext context = new RequestContext + { + CancellationToken = cancellationToken + }; + HttpMessage message = _customImagesRestClient.CreateCreateOrUpdateRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, name, DevTestLabCustomImageData.ToRequestContent(data), context); + Response response = await Pipeline.ProcessMessageAsync(message, context).ConfigureAwait(false); + DevTestLabsArmOperation operation = new DevTestLabsArmOperation( + new DevTestLabCustomImageOperationSource(Client), + _customImagesClientDiagnostics, + Pipeline, + message.Request, + response, + OperationFinalStateVia.Location); if (waitUntil == WaitUntil.Completed) + { await operation.WaitForCompletionAsync(cancellationToken).ConfigureAwait(false); + } return operation; } catch (Exception e) @@ -104,42 +116,51 @@ public virtual async Task> CreateOrU /// Create or replace an existing custom image. This operation can take a while to complete. /// /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/customimages/{name} + /// Request Path. + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/customimages/{name}. /// /// - /// Operation Id - /// CustomImages_CreateOrUpdate + /// Operation Id. + /// CustomImages_CreateOrUpdate. /// /// - /// Default Api Version - /// 2018-09-15 - /// - /// - /// Resource - /// + /// Default Api Version. + /// 2018-09-15. /// /// /// /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. - /// The name of the custom image. + /// The name of the CustomImage. /// A custom image. /// 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 name, DevTestLabCustomImageData data, CancellationToken cancellationToken = default) { Argument.AssertNotNullOrEmpty(name, nameof(name)); Argument.AssertNotNull(data, nameof(data)); - using var scope = _devTestLabCustomImageCustomImagesClientDiagnostics.CreateScope("DevTestLabCustomImageCollection.CreateOrUpdate"); + using DiagnosticScope scope = _customImagesClientDiagnostics.CreateScope("DevTestLabCustomImageCollection.CreateOrUpdate"); scope.Start(); try { - var response = _devTestLabCustomImageCustomImagesRestClient.CreateOrUpdate(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, name, data, cancellationToken); - var operation = new DevTestLabsArmOperation(new DevTestLabCustomImageOperationSource(Client), _devTestLabCustomImageCustomImagesClientDiagnostics, Pipeline, _devTestLabCustomImageCustomImagesRestClient.CreateCreateOrUpdateRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, name, data).Request, response, OperationFinalStateVia.Location); + RequestContext context = new RequestContext + { + CancellationToken = cancellationToken + }; + HttpMessage message = _customImagesRestClient.CreateCreateOrUpdateRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, name, DevTestLabCustomImageData.ToRequestContent(data), context); + Response response = Pipeline.ProcessMessage(message, context); + DevTestLabsArmOperation operation = new DevTestLabsArmOperation( + new DevTestLabCustomImageOperationSource(Client), + _customImagesClientDiagnostics, + Pipeline, + message.Request, + response, + OperationFinalStateVia.Location); if (waitUntil == WaitUntil.Completed) + { operation.WaitForCompletion(cancellationToken); + } return operation; } catch (Exception e) @@ -153,39 +174,43 @@ public virtual ArmOperation CreateOrUpdate(WaitUn /// Get custom image. /// /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/customimages/{name} + /// Request Path. + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/customimages/{name}. /// /// - /// Operation Id - /// CustomImages_Get + /// Operation Id. + /// CustomImages_Get. /// /// - /// Default Api Version - /// 2018-09-15 - /// - /// - /// Resource - /// + /// Default Api Version. + /// 2018-09-15. /// /// /// - /// The name of the custom image. + /// The name of the CustomImage. /// Specify the $expand query. Example: 'properties($select=vm)'. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. - public virtual async Task> GetAsync(string name, string expand = null, CancellationToken cancellationToken = default) + /// is an empty string, and was expected to be non-empty. + public virtual async Task> GetAsync(string name, string expand = default, CancellationToken cancellationToken = default) { Argument.AssertNotNullOrEmpty(name, nameof(name)); - using var scope = _devTestLabCustomImageCustomImagesClientDiagnostics.CreateScope("DevTestLabCustomImageCollection.Get"); + using DiagnosticScope scope = _customImagesClientDiagnostics.CreateScope("DevTestLabCustomImageCollection.Get"); scope.Start(); try { - var response = await _devTestLabCustomImageCustomImagesRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, name, expand, cancellationToken).ConfigureAwait(false); + RequestContext context = new RequestContext + { + CancellationToken = cancellationToken + }; + HttpMessage message = _customImagesRestClient.CreateGetRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, name, expand, context); + Response result = await Pipeline.ProcessMessageAsync(message, context).ConfigureAwait(false); + Response response = Response.FromValue(DevTestLabCustomImageData.FromResponse(result), result); if (response.Value == null) + { throw new RequestFailedException(response.GetRawResponse()); + } return Response.FromValue(new DevTestLabCustomImageResource(Client, response.Value), response.GetRawResponse()); } catch (Exception e) @@ -199,39 +224,43 @@ public virtual async Task> GetAsync(stri /// Get custom image. /// /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/customimages/{name} - /// - /// - /// Operation Id - /// CustomImages_Get + /// Request Path. + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/customimages/{name}. /// /// - /// Default Api Version - /// 2018-09-15 + /// Operation Id. + /// CustomImages_Get. /// /// - /// Resource - /// + /// Default Api Version. + /// 2018-09-15. /// /// /// - /// The name of the custom image. + /// The name of the CustomImage. /// Specify the $expand query. Example: 'properties($select=vm)'. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. - public virtual Response Get(string name, string expand = null, CancellationToken cancellationToken = default) + /// is an empty string, and was expected to be non-empty. + public virtual Response Get(string name, string expand = default, CancellationToken cancellationToken = default) { Argument.AssertNotNullOrEmpty(name, nameof(name)); - using var scope = _devTestLabCustomImageCustomImagesClientDiagnostics.CreateScope("DevTestLabCustomImageCollection.Get"); + using DiagnosticScope scope = _customImagesClientDiagnostics.CreateScope("DevTestLabCustomImageCollection.Get"); scope.Start(); try { - var response = _devTestLabCustomImageCustomImagesRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, name, expand, cancellationToken); + RequestContext context = new RequestContext + { + CancellationToken = cancellationToken + }; + HttpMessage message = _customImagesRestClient.CreateGetRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, name, expand, context); + Response result = Pipeline.ProcessMessage(message, context); + Response response = Response.FromValue(DevTestLabCustomImageData.FromResponse(result), result); if (response.Value == null) + { throw new RequestFailedException(response.GetRawResponse()); + } return Response.FromValue(new DevTestLabCustomImageResource(Client, response.Value), response.GetRawResponse()); } catch (Exception e) @@ -245,20 +274,16 @@ public virtual Response Get(string name, string e /// List custom images in a given lab. /// /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/customimages + /// Request Path. + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/customimages. /// /// - /// Operation Id - /// CustomImages_List + /// Operation Id. + /// CustomImages_List. /// /// - /// Default Api Version - /// 2018-09-15 - /// - /// - /// Resource - /// + /// Default Api Version. + /// 2018-09-15. /// /// /// @@ -267,32 +292,39 @@ public virtual Response Get(string name, string e /// The maximum number of resources to return from the operation. Example: '$top=10'. /// The ordering expression for the results, using OData notation. Example: '$orderby=name desc'. /// The cancellation token to use. - /// An async collection of that may take multiple service requests to iterate over. - public virtual AsyncPageable GetAllAsync(string expand = null, string filter = null, int? top = null, string orderby = null, CancellationToken cancellationToken = default) + /// A collection of that may take multiple service requests to iterate over. + public virtual AsyncPageable GetAllAsync(string expand = default, string filter = default, int? top = default, string @orderby = default, CancellationToken cancellationToken = default) { - HttpMessage FirstPageRequest(int? pageSizeHint) => _devTestLabCustomImageCustomImagesRestClient.CreateListRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, expand, filter, top, orderby); - HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _devTestLabCustomImageCustomImagesRestClient.CreateListNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName, Id.Name, expand, filter, top, orderby); - return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new DevTestLabCustomImageResource(Client, DevTestLabCustomImageData.DeserializeDevTestLabCustomImageData(e)), _devTestLabCustomImageCustomImagesClientDiagnostics, Pipeline, "DevTestLabCustomImageCollection.GetAll", "value", "nextLink", cancellationToken); + RequestContext context = new RequestContext + { + CancellationToken = cancellationToken + }; + return new AsyncPageableWrapper(new CustomImagesGetAllAsyncCollectionResultOfT( + _customImagesRestClient, + Id.SubscriptionId, + Id.ResourceGroupName, + Id.Name, + expand, + filter, + top, + @orderby, + context), data => new DevTestLabCustomImageResource(Client, data)); } /// /// List custom images in a given lab. /// /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/customimages - /// - /// - /// Operation Id - /// CustomImages_List + /// Request Path. + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/customimages. /// /// - /// Default Api Version - /// 2018-09-15 + /// Operation Id. + /// CustomImages_List. /// /// - /// Resource - /// + /// Default Api Version. + /// 2018-09-15. /// /// /// @@ -302,48 +334,73 @@ public virtual AsyncPageable GetAllAsync(string e /// The ordering expression for the results, using OData notation. Example: '$orderby=name desc'. /// The cancellation token to use. /// A collection of that may take multiple service requests to iterate over. - public virtual Pageable GetAll(string expand = null, string filter = null, int? top = null, string orderby = null, CancellationToken cancellationToken = default) + public virtual Pageable GetAll(string expand = default, string filter = default, int? top = default, string @orderby = default, CancellationToken cancellationToken = default) { - HttpMessage FirstPageRequest(int? pageSizeHint) => _devTestLabCustomImageCustomImagesRestClient.CreateListRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, expand, filter, top, orderby); - HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _devTestLabCustomImageCustomImagesRestClient.CreateListNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName, Id.Name, expand, filter, top, orderby); - return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new DevTestLabCustomImageResource(Client, DevTestLabCustomImageData.DeserializeDevTestLabCustomImageData(e)), _devTestLabCustomImageCustomImagesClientDiagnostics, Pipeline, "DevTestLabCustomImageCollection.GetAll", "value", "nextLink", cancellationToken); + RequestContext context = new RequestContext + { + CancellationToken = cancellationToken + }; + return new PageableWrapper(new CustomImagesGetAllCollectionResultOfT( + _customImagesRestClient, + Id.SubscriptionId, + Id.ResourceGroupName, + Id.Name, + expand, + filter, + top, + @orderby, + context), data => new DevTestLabCustomImageResource(Client, data)); } /// /// Checks to see if the resource exists in azure. /// /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/customimages/{name} - /// - /// - /// Operation Id - /// CustomImages_Get + /// Request Path. + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/customimages/{name}. /// /// - /// Default Api Version - /// 2018-09-15 + /// Operation Id. + /// CustomImages_Get. /// /// - /// Resource - /// + /// Default Api Version. + /// 2018-09-15. /// /// /// - /// The name of the custom image. + /// The name of the CustomImage. /// Specify the $expand query. Example: 'properties($select=vm)'. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. - public virtual async Task> ExistsAsync(string name, string expand = null, CancellationToken cancellationToken = default) + /// is an empty string, and was expected to be non-empty. + public virtual async Task> ExistsAsync(string name, string expand = default, CancellationToken cancellationToken = default) { Argument.AssertNotNullOrEmpty(name, nameof(name)); - using var scope = _devTestLabCustomImageCustomImagesClientDiagnostics.CreateScope("DevTestLabCustomImageCollection.Exists"); + using DiagnosticScope scope = _customImagesClientDiagnostics.CreateScope("DevTestLabCustomImageCollection.Exists"); scope.Start(); try { - var response = await _devTestLabCustomImageCustomImagesRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, name, expand, cancellationToken: cancellationToken).ConfigureAwait(false); + RequestContext context = new RequestContext + { + CancellationToken = cancellationToken + }; + HttpMessage message = _customImagesRestClient.CreateGetRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, name, expand, context); + await Pipeline.SendAsync(message, context.CancellationToken).ConfigureAwait(false); + Response result = message.Response; + Response response = default; + switch (result.Status) + { + case 200: + response = Response.FromValue(DevTestLabCustomImageData.FromResponse(result), result); + break; + case 404: + response = Response.FromValue((DevTestLabCustomImageData)null, result); + break; + default: + throw new RequestFailedException(result); + } return Response.FromValue(response.Value != null, response.GetRawResponse()); } catch (Exception e) @@ -357,37 +414,51 @@ public virtual async Task> ExistsAsync(string name, string expand /// Checks to see if the resource exists in azure. /// /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/customimages/{name} + /// Request Path. + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/customimages/{name}. /// /// - /// Operation Id - /// CustomImages_Get + /// Operation Id. + /// CustomImages_Get. /// /// - /// Default Api Version - /// 2018-09-15 - /// - /// - /// Resource - /// + /// Default Api Version. + /// 2018-09-15. /// /// /// - /// The name of the custom image. + /// The name of the CustomImage. /// Specify the $expand query. Example: 'properties($select=vm)'. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. - public virtual Response Exists(string name, string expand = null, CancellationToken cancellationToken = default) + /// is an empty string, and was expected to be non-empty. + public virtual Response Exists(string name, string expand = default, CancellationToken cancellationToken = default) { Argument.AssertNotNullOrEmpty(name, nameof(name)); - using var scope = _devTestLabCustomImageCustomImagesClientDiagnostics.CreateScope("DevTestLabCustomImageCollection.Exists"); + using DiagnosticScope scope = _customImagesClientDiagnostics.CreateScope("DevTestLabCustomImageCollection.Exists"); scope.Start(); try { - var response = _devTestLabCustomImageCustomImagesRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, name, expand, cancellationToken: cancellationToken); + RequestContext context = new RequestContext + { + CancellationToken = cancellationToken + }; + HttpMessage message = _customImagesRestClient.CreateGetRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, name, expand, context); + Pipeline.Send(message, context.CancellationToken); + Response result = message.Response; + Response response = default; + switch (result.Status) + { + case 200: + response = Response.FromValue(DevTestLabCustomImageData.FromResponse(result), result); + break; + case 404: + response = Response.FromValue((DevTestLabCustomImageData)null, result); + break; + default: + throw new RequestFailedException(result); + } return Response.FromValue(response.Value != null, response.GetRawResponse()); } catch (Exception e) @@ -401,39 +472,55 @@ public virtual Response Exists(string name, string expand = null, Cancella /// Tries to get details for this resource from the service. /// /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/customimages/{name} - /// - /// - /// Operation Id - /// CustomImages_Get + /// Request Path. + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/customimages/{name}. /// /// - /// Default Api Version - /// 2018-09-15 + /// Operation Id. + /// CustomImages_Get. /// /// - /// Resource - /// + /// Default Api Version. + /// 2018-09-15. /// /// /// - /// The name of the custom image. + /// The name of the CustomImage. /// Specify the $expand query. Example: 'properties($select=vm)'. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. - public virtual async Task> GetIfExistsAsync(string name, string expand = null, CancellationToken cancellationToken = default) + /// is an empty string, and was expected to be non-empty. + public virtual async Task> GetIfExistsAsync(string name, string expand = default, CancellationToken cancellationToken = default) { Argument.AssertNotNullOrEmpty(name, nameof(name)); - using var scope = _devTestLabCustomImageCustomImagesClientDiagnostics.CreateScope("DevTestLabCustomImageCollection.GetIfExists"); + using DiagnosticScope scope = _customImagesClientDiagnostics.CreateScope("DevTestLabCustomImageCollection.GetIfExists"); scope.Start(); try { - var response = await _devTestLabCustomImageCustomImagesRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, name, expand, cancellationToken: cancellationToken).ConfigureAwait(false); + RequestContext context = new RequestContext + { + CancellationToken = cancellationToken + }; + HttpMessage message = _customImagesRestClient.CreateGetRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, name, expand, context); + await Pipeline.SendAsync(message, context.CancellationToken).ConfigureAwait(false); + Response result = message.Response; + Response response = default; + switch (result.Status) + { + case 200: + response = Response.FromValue(DevTestLabCustomImageData.FromResponse(result), result); + break; + case 404: + response = Response.FromValue((DevTestLabCustomImageData)null, result); + break; + default: + throw new RequestFailedException(result); + } if (response.Value == null) + { return new NoValueResponse(response.GetRawResponse()); + } return Response.FromValue(new DevTestLabCustomImageResource(Client, response.Value), response.GetRawResponse()); } catch (Exception e) @@ -447,39 +534,55 @@ public virtual async Task> GetIf /// Tries to get details for this resource from the service. /// /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/customimages/{name} + /// Request Path. + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/customimages/{name}. /// /// - /// Operation Id - /// CustomImages_Get + /// Operation Id. + /// CustomImages_Get. /// /// - /// Default Api Version - /// 2018-09-15 - /// - /// - /// Resource - /// + /// Default Api Version. + /// 2018-09-15. /// /// /// - /// The name of the custom image. + /// The name of the CustomImage. /// Specify the $expand query. Example: 'properties($select=vm)'. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. - public virtual NullableResponse GetIfExists(string name, string expand = null, CancellationToken cancellationToken = default) + /// is an empty string, and was expected to be non-empty. + public virtual NullableResponse GetIfExists(string name, string expand = default, CancellationToken cancellationToken = default) { Argument.AssertNotNullOrEmpty(name, nameof(name)); - using var scope = _devTestLabCustomImageCustomImagesClientDiagnostics.CreateScope("DevTestLabCustomImageCollection.GetIfExists"); + using DiagnosticScope scope = _customImagesClientDiagnostics.CreateScope("DevTestLabCustomImageCollection.GetIfExists"); scope.Start(); try { - var response = _devTestLabCustomImageCustomImagesRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, name, expand, cancellationToken: cancellationToken); + RequestContext context = new RequestContext + { + CancellationToken = cancellationToken + }; + HttpMessage message = _customImagesRestClient.CreateGetRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, name, expand, context); + Pipeline.Send(message, context.CancellationToken); + Response result = message.Response; + Response response = default; + switch (result.Status) + { + case 200: + response = Response.FromValue(DevTestLabCustomImageData.FromResponse(result), result); + break; + case 404: + response = Response.FromValue((DevTestLabCustomImageData)null, result); + break; + default: + throw new RequestFailedException(result); + } if (response.Value == null) + { return new NoValueResponse(response.GetRawResponse()); + } return Response.FromValue(new DevTestLabCustomImageResource(Client, response.Value), response.GetRawResponse()); } catch (Exception e) @@ -499,6 +602,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/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/DevTestLabCustomImageData.Serialization.cs b/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/DevTestLabCustomImageData.Serialization.cs index d51768ae6b6b..6ff85b77b1c2 100644 --- a/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/DevTestLabCustomImageData.Serialization.cs +++ b/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/DevTestLabCustomImageData.Serialization.cs @@ -10,16 +10,47 @@ using System.Collections.Generic; using System.Text; using System.Text.Json; +using Azure; using Azure.Core; using Azure.ResourceManager.DevTestLabs.Models; using Azure.ResourceManager.Models; namespace Azure.ResourceManager.DevTestLabs { - public partial class DevTestLabCustomImageData : IUtf8JsonSerializable, IJsonModel + /// A custom image. + public partial class DevTestLabCustomImageData : TrackedResourceData, IJsonModel { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + /// Initializes a new instance of for deserialization. + internal DevTestLabCustomImageData() + { + } + + /// 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)) + { + return DeserializeDevTestLabCustomImageData(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(DevTestLabCustomImageData)} does not support reading '{options.Format}' format."); + } + } + /// The to deserialize the from. + internal static DevTestLabCustomImageData FromResponse(Response response) + { + using JsonDocument document = JsonDocument.Parse(response.Content, ModelSerializationExtensions.JsonDocumentOptions); + return DeserializeDevTestLabCustomImageData(document.RootElement, ModelSerializationExtensions.WireOptions); + } + + /// The JSON writer. + /// The client options for reading and writing models. void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) { writer.WriteStartObject(); @@ -31,305 +62,153 @@ 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(DevTestLabCustomImageData)} does not support writing '{format}' format."); } - base.JsonModelWriteCore(writer, options); writer.WritePropertyName("properties"u8); - writer.WriteStartObject(); - if (Optional.IsDefined(Vm)) + writer.WriteObjectValue(Properties, options); + if (Optional.IsCollectionDefined(Tags)) { - writer.WritePropertyName("vm"u8); - writer.WriteObjectValue(Vm, options); - } - if (Optional.IsDefined(Vhd)) - { - writer.WritePropertyName("vhd"u8); - writer.WriteObjectValue(Vhd, options); - } - if (Optional.IsDefined(Description)) - { - writer.WritePropertyName("description"u8); - writer.WriteStringValue(Description); - } - if (Optional.IsDefined(Author)) - { - writer.WritePropertyName("author"u8); - writer.WriteStringValue(Author); - } - if (options.Format != "W" && Optional.IsDefined(CreatedOn)) - { - writer.WritePropertyName("creationDate"u8); - writer.WriteStringValue(CreatedOn.Value, "O"); - } - if (Optional.IsDefined(ManagedImageId)) - { - writer.WritePropertyName("managedImageId"u8); - writer.WriteStringValue(ManagedImageId); - } - if (Optional.IsDefined(ManagedSnapshotId)) - { - writer.WritePropertyName("managedSnapshotId"u8); - writer.WriteStringValue(ManagedSnapshotId); - } - if (Optional.IsCollectionDefined(DataDiskStorageInfo)) - { - writer.WritePropertyName("dataDiskStorageInfo"u8); - writer.WriteStartArray(); - foreach (var item in DataDiskStorageInfo) + writer.WritePropertyName("tags"u8); + writer.WriteStartObject(); + foreach (var item in Tags) { - writer.WriteObjectValue(item, options); + writer.WritePropertyName(item.Key); + if (item.Value == null) + { + writer.WriteNullValue(); + continue; + } + writer.WriteStringValue(item.Value); } - writer.WriteEndArray(); - } - if (Optional.IsDefined(CustomImagePlan)) - { - writer.WritePropertyName("customImagePlan"u8); - writer.WriteObjectValue(CustomImagePlan, options); - } - if (Optional.IsDefined(IsPlanAuthorized)) - { - writer.WritePropertyName("isPlanAuthorized"u8); - writer.WriteBooleanValue(IsPlanAuthorized.Value); + writer.WriteEndObject(); } - if (options.Format != "W" && Optional.IsDefined(ProvisioningState)) - { - writer.WritePropertyName("provisioningState"u8); - writer.WriteStringValue(ProvisioningState); - } - if (options.Format != "W" && Optional.IsDefined(UniqueIdentifier)) - { - writer.WritePropertyName("uniqueIdentifier"u8); - writer.WriteStringValue(UniqueIdentifier.Value); - } - writer.WriteEndObject(); } - DevTestLabCustomImageData IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + /// The JSON reader. + /// The client options for reading and writing models. + DevTestLabCustomImageData IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) => (DevTestLabCustomImageData)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(DevTestLabCustomImageData)} does not support reading '{format}' format."); } - using JsonDocument document = JsonDocument.ParseValue(ref reader); return DeserializeDevTestLabCustomImageData(document.RootElement, options); } - internal static DevTestLabCustomImageData DeserializeDevTestLabCustomImageData(JsonElement element, ModelReaderWriterOptions options = null) + /// The JSON element to deserialize. + /// The client options for reading and writing models. + internal static DevTestLabCustomImageData DeserializeDevTestLabCustomImageData(JsonElement element, ModelReaderWriterOptions options) { - options ??= ModelSerializationExtensions.WireOptions; - if (element.ValueKind == JsonValueKind.Null) { return null; } - IDictionary tags = default; - AzureLocation location = default; ResourceIdentifier id = default; string name = default; - ResourceType type = default; + ResourceType resourceType = default; SystemData systemData = default; - DevTestLabCustomImageVm vm = default; - DevTestLabCustomImageVhd vhd = default; - string description = default; - string author = default; - DateTimeOffset? creationDate = default; - string managedImageId = default; - string managedSnapshotId = default; - IList dataDiskStorageInfo = default; - DevTestLabCustomImagePlan customImagePlan = default; - bool? isPlanAuthorized = default; - string provisioningState = default; - Guid? uniqueIdentifier = default; - IDictionary serializedAdditionalRawData = default; - Dictionary rawDataDictionary = new Dictionary(); - foreach (var property in element.EnumerateObject()) + IDictionary additionalBinaryDataProperties = new ChangeTrackingDictionary(); + AzureLocation location = default; + CustomImageProperties properties = default; + IDictionary tags = default; + foreach (var prop in element.EnumerateObject()) { - if (property.NameEquals("tags"u8)) + if (prop.NameEquals("id"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()) - { - dictionary.Add(property0.Name, property0.Value.GetString()); - } - tags = dictionary; + id = new ResourceIdentifier(prop.Value.GetString()); continue; } - if (property.NameEquals("location"u8)) + if (prop.NameEquals("name"u8)) { - location = new AzureLocation(property.Value.GetString()); + name = prop.Value.GetString(); continue; } - if (property.NameEquals("id"u8)) + if (prop.NameEquals("type"u8)) { - id = new ResourceIdentifier(property.Value.GetString()); + if (prop.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + resourceType = new ResourceType(prop.Value.GetString()); continue; } - if (property.NameEquals("name"u8)) + if (prop.NameEquals("systemData"u8)) { - name = property.Value.GetString(); + if (prop.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + systemData = ModelReaderWriter.Read(new BinaryData(Encoding.UTF8.GetBytes(prop.Value.GetRawText())), ModelSerializationExtensions.WireOptions, AzureResourceManagerDevTestLabsContext.Default); 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) - { - continue; - } - systemData = ModelReaderWriter.Read(new BinaryData(Encoding.UTF8.GetBytes(property.Value.GetRawText())), ModelSerializationExtensions.WireOptions, AzureResourceManagerDevTestLabsContext.Default); + properties = CustomImageProperties.DeserializeCustomImageProperties(prop.Value, options); continue; } - if (property.NameEquals("properties"u8)) + if (prop.NameEquals("tags"u8)) { - if (property.Value.ValueKind == JsonValueKind.Null) + if (prop.Value.ValueKind == JsonValueKind.Null) { - property.ThrowNonNullablePropertyIsNull(); continue; } - foreach (var property0 in property.Value.EnumerateObject()) + Dictionary dictionary = new Dictionary(); + foreach (var prop0 in prop.Value.EnumerateObject()) { - if (property0.NameEquals("vm"u8)) - { - if (property0.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - vm = DevTestLabCustomImageVm.DeserializeDevTestLabCustomImageVm(property0.Value, options); - continue; - } - if (property0.NameEquals("vhd"u8)) - { - if (property0.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - vhd = DevTestLabCustomImageVhd.DeserializeDevTestLabCustomImageVhd(property0.Value, options); - continue; - } - if (property0.NameEquals("description"u8)) - { - description = property0.Value.GetString(); - continue; - } - if (property0.NameEquals("author"u8)) - { - author = property0.Value.GetString(); - continue; - } - if (property0.NameEquals("creationDate"u8)) - { - if (property0.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - creationDate = property0.Value.GetDateTimeOffset("O"); - continue; - } - if (property0.NameEquals("managedImageId"u8)) - { - managedImageId = property0.Value.GetString(); - continue; - } - if (property0.NameEquals("managedSnapshotId"u8)) - { - managedSnapshotId = property0.Value.GetString(); - continue; - } - if (property0.NameEquals("dataDiskStorageInfo"u8)) - { - if (property0.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - List array = new List(); - foreach (var item in property0.Value.EnumerateArray()) - { - array.Add(DevTestLabDataDiskStorageTypeInfo.DeserializeDevTestLabDataDiskStorageTypeInfo(item, options)); - } - dataDiskStorageInfo = array; - continue; - } - if (property0.NameEquals("customImagePlan"u8)) - { - if (property0.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - customImagePlan = DevTestLabCustomImagePlan.DeserializeDevTestLabCustomImagePlan(property0.Value, options); - continue; - } - if (property0.NameEquals("isPlanAuthorized"u8)) - { - if (property0.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - isPlanAuthorized = property0.Value.GetBoolean(); - continue; - } - if (property0.NameEquals("provisioningState"u8)) + if (prop0.Value.ValueKind == JsonValueKind.Null) { - provisioningState = property0.Value.GetString(); - continue; + dictionary.Add(prop0.Name, null); } - if (property0.NameEquals("uniqueIdentifier"u8)) + else { - if (property0.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - uniqueIdentifier = property0.Value.GetGuid(); - continue; + dictionary.Add(prop0.Name, prop0.Value.GetString()); } } + tags = dictionary; 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 DevTestLabCustomImageData( id, name, - type, + resourceType, systemData, - tags ?? new ChangeTrackingDictionary(), + additionalBinaryDataProperties, location, - vm, - vhd, - description, - author, - creationDate, - managedImageId, - managedSnapshotId, - dataDiskStorageInfo ?? new ChangeTrackingList(), - customImagePlan, - isPlanAuthorized, - provisioningState, - uniqueIdentifier, - serializedAdditionalRawData); + properties, + tags ?? new ChangeTrackingDictionary()); } - 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": @@ -339,22 +218,23 @@ BinaryData IPersistableModel.Write(ModelReaderWriterO } } - DevTestLabCustomImageData 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. + DevTestLabCustomImageData IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) => (DevTestLabCustomImageData)PersistableModelCreateCore(data, options); - switch (format) + /// The client options for reading and writing models. + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + + /// The to serialize into . + internal static RequestContent ToRequestContent(DevTestLabCustomImageData devTestLabCustomImageData) + { + if (devTestLabCustomImageData == null) { - case "J": - { - using JsonDocument document = JsonDocument.Parse(data, ModelSerializationExtensions.JsonDocumentOptions); - return DeserializeDevTestLabCustomImageData(document.RootElement, options); - } - default: - throw new FormatException($"The model {nameof(DevTestLabCustomImageData)} does not support reading '{options.Format}' format."); + return null; } + Utf8JsonRequestContent content = new Utf8JsonRequestContent(); + content.JsonWriter.WriteObjectValue(devTestLabCustomImageData, ModelSerializationExtensions.WireOptions); + return content; } - - string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; } } diff --git a/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/DevTestLabCustomImageData.cs b/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/DevTestLabCustomImageData.cs index 94bf95f7688e..ea66ebef20bc 100644 --- a/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/DevTestLabCustomImageData.cs +++ b/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/DevTestLabCustomImageData.cs @@ -13,116 +13,211 @@ namespace Azure.ResourceManager.DevTestLabs { - /// - /// A class representing the DevTestLabCustomImage data model. - /// A custom image. - /// + /// A custom image. public partial class DevTestLabCustomImageData : 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 DevTestLabCustomImageData(AzureLocation location) : base(location) { - DataDiskStorageInfo = new ChangeTrackingList(); + } /// Initializes a new instance of . - /// The id. - /// The name. - /// The resourceType. - /// The systemData. - /// The tags. - /// The location. - /// The virtual machine from which the image is to be created. - /// The VHD from which the image is to be created. - /// The description of the custom image. - /// The author of the custom image. - /// The creation date of the custom image. - /// The Managed Image Id backing the custom image. - /// The Managed Snapshot Id backing the custom image. - /// Storage information about the data disks present in the custom image. - /// Storage information about the plan related to this custom image. - /// Whether or not the custom images underlying offer/plan has been enabled for programmatic deployment. - /// The provisioning status of the resource. - /// The unique immutable identifier of a resource (Guid). - /// Keeps track of any properties unknown to the library. - internal DevTestLabCustomImageData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, IDictionary tags, AzureLocation location, DevTestLabCustomImageVm vm, DevTestLabCustomImageVhd vhd, string description, string author, DateTimeOffset? createdOn, string managedImageId, string managedSnapshotId, IList dataDiskStorageInfo, DevTestLabCustomImagePlan customImagePlan, bool? isPlanAuthorized, string provisioningState, Guid? uniqueIdentifier, IDictionary serializedAdditionalRawData) : base(id, name, resourceType, systemData, tags, 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. + /// The geo-location where the resource lives. + /// The properties of the resource. + /// Resource tags. + internal DevTestLabCustomImageData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, IDictionary additionalBinaryDataProperties, AzureLocation location, CustomImageProperties properties, IDictionary tags) : base(id, name, resourceType, systemData, tags, location) { - Vm = vm; - Vhd = vhd; - Description = description; - Author = author; - CreatedOn = createdOn; - ManagedImageId = managedImageId; - ManagedSnapshotId = managedSnapshotId; - DataDiskStorageInfo = dataDiskStorageInfo; - CustomImagePlan = customImagePlan; - IsPlanAuthorized = isPlanAuthorized; - ProvisioningState = provisioningState; - UniqueIdentifier = uniqueIdentifier; - _serializedAdditionalRawData = serializedAdditionalRawData; + _additionalBinaryDataProperties = additionalBinaryDataProperties; + Properties = properties; } - /// Initializes a new instance of for deserialization. - internal DevTestLabCustomImageData() + /// The properties of the resource. + internal CustomImageProperties Properties { get; set; } + + /// The virtual machine from which the image is to be created. + public DevTestLabCustomImageVm Vm { + get + { + return Properties is null ? default : Properties.Vm; + } + set + { + if (Properties is null) + { + Properties = new CustomImageProperties(); + } + Properties.Vm = value; + } } - /// The virtual machine from which the image is to be created. - public DevTestLabCustomImageVm Vm { get; set; } /// The VHD from which the image is to be created. - public DevTestLabCustomImageVhd Vhd { get; set; } + public DevTestLabCustomImageVhd Vhd + { + get + { + return Properties is null ? default : Properties.Vhd; + } + set + { + if (Properties is null) + { + Properties = new CustomImageProperties(); + } + Properties.Vhd = value; + } + } + /// The description of the custom image. - public string Description { get; set; } + public string Description + { + get + { + return Properties is null ? default : Properties.Description; + } + set + { + if (Properties is null) + { + Properties = new CustomImageProperties(); + } + Properties.Description = value; + } + } + /// The author of the custom image. - public string Author { get; set; } + public string Author + { + get + { + return Properties is null ? default : Properties.Author; + } + set + { + if (Properties is null) + { + Properties = new CustomImageProperties(); + } + Properties.Author = value; + } + } + /// The creation date of the custom image. - public DateTimeOffset? CreatedOn { get; } + public DateTimeOffset? CreatedOn + { + get + { + return Properties is null ? default : Properties.CreatedOn; + } + } + /// The Managed Image Id backing the custom image. - public string ManagedImageId { get; set; } + public string ManagedImageId + { + get + { + return Properties is null ? default : Properties.ManagedImageId; + } + set + { + if (Properties is null) + { + Properties = new CustomImageProperties(); + } + Properties.ManagedImageId = value; + } + } + /// The Managed Snapshot Id backing the custom image. - public string ManagedSnapshotId { get; set; } + public string ManagedSnapshotId + { + get + { + return Properties is null ? default : Properties.ManagedSnapshotId; + } + set + { + if (Properties is null) + { + Properties = new CustomImageProperties(); + } + Properties.ManagedSnapshotId = value; + } + } + /// Storage information about the data disks present in the custom image. - public IList DataDiskStorageInfo { get; } + public IList DataDiskStorageInfo + { + get + { + if (Properties is null) + { + Properties = new CustomImageProperties(); + } + return Properties.DataDiskStorageInfo; + } + } + /// Storage information about the plan related to this custom image. - public DevTestLabCustomImagePlan CustomImagePlan { get; set; } + public DevTestLabCustomImagePlan CustomImagePlan + { + get + { + return Properties is null ? default : Properties.CustomImagePlan; + } + set + { + if (Properties is null) + { + Properties = new CustomImageProperties(); + } + Properties.CustomImagePlan = value; + } + } + /// Whether or not the custom images underlying offer/plan has been enabled for programmatic deployment. - public bool? IsPlanAuthorized { get; set; } + public bool? IsPlanAuthorized + { + get + { + return Properties is null ? default : Properties.IsPlanAuthorized; + } + set + { + if (Properties is null) + { + Properties = new CustomImageProperties(); + } + Properties.IsPlanAuthorized = value.Value; + } + } + /// The provisioning status of the resource. - public string ProvisioningState { get; } + public string ProvisioningState + { + get + { + return Properties is null ? default : Properties.ProvisioningState; + } + } + /// The unique immutable identifier of a resource (Guid). - public Guid? UniqueIdentifier { get; } + public Guid? UniqueIdentifier + { + get + { + return Properties is null ? default : Properties.UniqueIdentifier; + } + } } } diff --git a/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/DevTestLabCustomImageResource.Serialization.cs b/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/DevTestLabCustomImageResource.Serialization.cs index 449622c78530..207ad3f67daf 100644 --- a/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/DevTestLabCustomImageResource.Serialization.cs +++ b/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/DevTestLabCustomImageResource.Serialization.cs @@ -11,19 +11,29 @@ namespace Azure.ResourceManager.DevTestLabs { + /// public partial class DevTestLabCustomImageResource : IJsonModel { - private static DevTestLabCustomImageData s_dataDeserializationInstance; - private static DevTestLabCustomImageData DataDeserializationInstance => s_dataDeserializationInstance ??= new(); + private static IJsonModel s_dataDeserializationInstance; + private static IJsonModel DataDeserializationInstance => s_dataDeserializationInstance ??= new DevTestLabCustomImageData(); + + /// 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); - DevTestLabCustomImageData 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. + DevTestLabCustomImageData 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, AzureResourceManagerDevTestLabsContext.Default); + /// The binary data to be processed. + /// The client options for reading and writing models. DevTestLabCustomImageData IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) => ModelReaderWriter.Read(data, options, AzureResourceManagerDevTestLabsContext.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/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/DevTestLabCustomImageResource.cs b/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/DevTestLabCustomImageResource.cs index 005d8ec1168b..926bb1c9f0d3 100644 --- a/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/DevTestLabCustomImageResource.cs +++ b/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/DevTestLabCustomImageResource.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.DevTestLabs.Models; +using Azure.ResourceManager.Resources; namespace Azure.ResourceManager.DevTestLabs { /// - /// A Class representing a DevTestLabCustomImage 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 GetDevTestLabCustomImageResource method. - /// Otherwise you can get one from its parent resource using the GetDevTestLabCustomImage method. + /// A class representing a DevTestLabCustomImage 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 GetDevTestLabCustomImages method. /// public partial class DevTestLabCustomImageResource : ArmResource { - /// Generate the resource identifier of a instance. - /// The subscriptionId. - /// The resourceGroupName. - /// The labName. - /// The name. - public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string labName, string name) - { - var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/customimages/{name}"; - return new ResourceIdentifier(resourceId); - } - - private readonly ClientDiagnostics _devTestLabCustomImageCustomImagesClientDiagnostics; - private readonly CustomImagesRestOperations _devTestLabCustomImageCustomImagesRestClient; + private readonly ClientDiagnostics _customImagesClientDiagnostics; + private readonly CustomImages _customImagesRestClient; private readonly DevTestLabCustomImageData _data; - /// Gets the resource type for the operations. public static readonly ResourceType ResourceType = "Microsoft.DevTestLab/labs/customimages"; - /// Initializes a new instance of the class for mocking. + /// Initializes a new instance of DevTestLabCustomImageResource for mocking. protected DevTestLabCustomImageResource() { } - /// 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 DevTestLabCustomImageResource(ArmClient client, DevTestLabCustomImageData data) : this(client, data.Id) @@ -56,72 +46,94 @@ internal DevTestLabCustomImageResource(ArmClient client, DevTestLabCustomImageDa _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 DevTestLabCustomImageResource(ArmClient client, ResourceIdentifier id) : base(client, id) { - _devTestLabCustomImageCustomImagesClientDiagnostics = new ClientDiagnostics("Azure.ResourceManager.DevTestLabs", ResourceType.Namespace, Diagnostics); - TryGetApiVersion(ResourceType, out string devTestLabCustomImageCustomImagesApiVersion); - _devTestLabCustomImageCustomImagesRestClient = new CustomImagesRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, devTestLabCustomImageCustomImagesApiVersion); -#if DEBUG - ValidateResourceId(Id); -#endif + TryGetApiVersion(ResourceType, out string devTestLabCustomImageApiVersion); + _customImagesClientDiagnostics = new ClientDiagnostics("Azure.ResourceManager.DevTestLabs", ResourceType.Namespace, Diagnostics); + _customImagesRestClient = new CustomImages(_customImagesClientDiagnostics, Pipeline, Endpoint, devTestLabCustomImageApiVersion ?? "2018-09-15"); + 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 DevTestLabCustomImageData 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 labName. + /// The name. + public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string labName, string name) + { + string resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/customimages/{name}"; + 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 custom image. /// /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/customimages/{name} + /// Request Path. + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/customimages/{name}. /// /// - /// Operation Id - /// CustomImages_Get + /// Operation Id. + /// CustomImages_Get. /// /// - /// Default Api Version - /// 2018-09-15 + /// Default Api Version. + /// 2018-09-15. /// /// - /// Resource - /// + /// Resource. + /// . /// /// /// /// Specify the $expand query. Example: 'properties($select=vm)'. /// The cancellation token to use. - public virtual async Task> GetAsync(string expand = null, CancellationToken cancellationToken = default) + public virtual async Task> GetAsync(string expand = default, CancellationToken cancellationToken = default) { - using var scope = _devTestLabCustomImageCustomImagesClientDiagnostics.CreateScope("DevTestLabCustomImageResource.Get"); + using DiagnosticScope scope = _customImagesClientDiagnostics.CreateScope("DevTestLabCustomImageResource.Get"); scope.Start(); try { - var response = await _devTestLabCustomImageCustomImagesRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, expand, cancellationToken).ConfigureAwait(false); + RequestContext context = new RequestContext + { + CancellationToken = cancellationToken + }; + HttpMessage message = _customImagesRestClient.CreateGetRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, expand, context); + Response result = await Pipeline.ProcessMessageAsync(message, context).ConfigureAwait(false); + Response response = Response.FromValue(DevTestLabCustomImageData.FromResponse(result), result); if (response.Value == null) + { throw new RequestFailedException(response.GetRawResponse()); + } return Response.FromValue(new DevTestLabCustomImageResource(Client, response.Value), response.GetRawResponse()); } catch (Exception e) @@ -135,34 +147,42 @@ public virtual async Task> GetAsync(stri /// Get custom image. /// /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/customimages/{name} + /// Request Path. + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/customimages/{name}. /// /// - /// Operation Id - /// CustomImages_Get + /// Operation Id. + /// CustomImages_Get. /// /// - /// Default Api Version - /// 2018-09-15 + /// Default Api Version. + /// 2018-09-15. /// /// - /// Resource - /// + /// Resource. + /// . /// /// /// /// Specify the $expand query. Example: 'properties($select=vm)'. /// The cancellation token to use. - public virtual Response Get(string expand = null, CancellationToken cancellationToken = default) + public virtual Response Get(string expand = default, CancellationToken cancellationToken = default) { - using var scope = _devTestLabCustomImageCustomImagesClientDiagnostics.CreateScope("DevTestLabCustomImageResource.Get"); + using DiagnosticScope scope = _customImagesClientDiagnostics.CreateScope("DevTestLabCustomImageResource.Get"); scope.Start(); try { - var response = _devTestLabCustomImageCustomImagesRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, expand, cancellationToken); + RequestContext context = new RequestContext + { + CancellationToken = cancellationToken + }; + HttpMessage message = _customImagesRestClient.CreateGetRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, expand, context); + Response result = Pipeline.ProcessMessage(message, context); + Response response = Response.FromValue(DevTestLabCustomImageData.FromResponse(result), result); if (response.Value == null) + { throw new RequestFailedException(response.GetRawResponse()); + } return Response.FromValue(new DevTestLabCustomImageResource(Client, response.Value), response.GetRawResponse()); } catch (Exception e) @@ -173,39 +193,49 @@ public virtual Response Get(string expand = null, } /// - /// Delete custom image. This operation can take a while to complete. + /// Allows modifying tags of custom images. All other properties will be ignored. /// /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/customimages/{name} + /// Request Path. + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/customimages/{name}. /// /// - /// Operation Id - /// CustomImages_Delete + /// Operation Id. + /// CustomImages_Update. /// /// - /// Default Api Version - /// 2018-09-15 + /// Default Api Version. + /// 2018-09-15. /// /// - /// Resource - /// + /// Resource. + /// . /// /// /// - /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. + /// A custom image. /// The cancellation token to use. - public virtual async Task DeleteAsync(WaitUntil waitUntil, CancellationToken cancellationToken = default) + /// is null. + public virtual async Task> UpdateAsync(DevTestLabCustomImagePatch patch, CancellationToken cancellationToken = default) { - using var scope = _devTestLabCustomImageCustomImagesClientDiagnostics.CreateScope("DevTestLabCustomImageResource.Delete"); + Argument.AssertNotNull(patch, nameof(patch)); + + using DiagnosticScope scope = _customImagesClientDiagnostics.CreateScope("DevTestLabCustomImageResource.Update"); scope.Start(); try { - var response = await _devTestLabCustomImageCustomImagesRestClient.DeleteAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, cancellationToken).ConfigureAwait(false); - var operation = new DevTestLabsArmOperation(_devTestLabCustomImageCustomImagesClientDiagnostics, Pipeline, _devTestLabCustomImageCustomImagesRestClient.CreateDeleteRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name).Request, response, OperationFinalStateVia.Location); - if (waitUntil == WaitUntil.Completed) - await operation.WaitForCompletionResponseAsync(cancellationToken).ConfigureAwait(false); - return operation; + RequestContext context = new RequestContext + { + CancellationToken = cancellationToken + }; + HttpMessage message = _customImagesRestClient.CreateUpdateRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, DevTestLabCustomImagePatch.ToRequestContent(patch), context); + Response result = await Pipeline.ProcessMessageAsync(message, context).ConfigureAwait(false); + Response response = Response.FromValue(DevTestLabCustomImageData.FromResponse(result), result); + if (response.Value == null) + { + throw new RequestFailedException(response.GetRawResponse()); + } + return Response.FromValue(new DevTestLabCustomImageResource(Client, response.Value), response.GetRawResponse()); } catch (Exception e) { @@ -215,39 +245,49 @@ public virtual async Task DeleteAsync(WaitUntil waitUntil, Cancell } /// - /// Delete custom image. This operation can take a while to complete. + /// Allows modifying tags of custom images. All other properties will be ignored. /// /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/customimages/{name} + /// Request Path. + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/customimages/{name}. /// /// - /// Operation Id - /// CustomImages_Delete + /// Operation Id. + /// CustomImages_Update. /// /// - /// Default Api Version - /// 2018-09-15 + /// Default Api Version. + /// 2018-09-15. /// /// - /// Resource - /// + /// Resource. + /// . /// /// /// - /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. + /// A custom image. /// The cancellation token to use. - public virtual ArmOperation Delete(WaitUntil waitUntil, CancellationToken cancellationToken = default) + /// is null. + public virtual Response Update(DevTestLabCustomImagePatch patch, CancellationToken cancellationToken = default) { - using var scope = _devTestLabCustomImageCustomImagesClientDiagnostics.CreateScope("DevTestLabCustomImageResource.Delete"); + Argument.AssertNotNull(patch, nameof(patch)); + + using DiagnosticScope scope = _customImagesClientDiagnostics.CreateScope("DevTestLabCustomImageResource.Update"); scope.Start(); try { - var response = _devTestLabCustomImageCustomImagesRestClient.Delete(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, cancellationToken); - var operation = new DevTestLabsArmOperation(_devTestLabCustomImageCustomImagesClientDiagnostics, Pipeline, _devTestLabCustomImageCustomImagesRestClient.CreateDeleteRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name).Request, response, OperationFinalStateVia.Location); - if (waitUntil == WaitUntil.Completed) - operation.WaitForCompletionResponse(cancellationToken); - return operation; + RequestContext context = new RequestContext + { + CancellationToken = cancellationToken + }; + HttpMessage message = _customImagesRestClient.CreateUpdateRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, DevTestLabCustomImagePatch.ToRequestContent(patch), context); + Response result = Pipeline.ProcessMessage(message, context); + Response response = Response.FromValue(DevTestLabCustomImageData.FromResponse(result), result); + if (response.Value == null) + { + throw new RequestFailedException(response.GetRawResponse()); + } + return Response.FromValue(new DevTestLabCustomImageResource(Client, response.Value), response.GetRawResponse()); } catch (Exception e) { @@ -257,39 +297,46 @@ public virtual ArmOperation Delete(WaitUntil waitUntil, CancellationToken cancel } /// - /// Allows modifying tags of custom images. All other properties will be ignored. + /// Delete custom image. This operation can take a while to complete. /// /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/customimages/{name} + /// Request Path. + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/customimages/{name}. /// /// - /// Operation Id - /// CustomImages_Update + /// Operation Id. + /// CustomImages_Delete. /// /// - /// Default Api Version - /// 2018-09-15 + /// Default Api Version. + /// 2018-09-15. /// /// - /// Resource - /// + /// Resource. + /// . /// /// /// - /// A custom image. + /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. /// The cancellation token to use. - /// is null. - public virtual async Task> UpdateAsync(DevTestLabCustomImagePatch patch, CancellationToken cancellationToken = default) + public virtual async Task DeleteAsync(WaitUntil waitUntil, CancellationToken cancellationToken = default) { - Argument.AssertNotNull(patch, nameof(patch)); - - using var scope = _devTestLabCustomImageCustomImagesClientDiagnostics.CreateScope("DevTestLabCustomImageResource.Update"); + using DiagnosticScope scope = _customImagesClientDiagnostics.CreateScope("DevTestLabCustomImageResource.Delete"); scope.Start(); try { - var response = await _devTestLabCustomImageCustomImagesRestClient.UpdateAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, patch, cancellationToken).ConfigureAwait(false); - return Response.FromValue(new DevTestLabCustomImageResource(Client, response.Value), response.GetRawResponse()); + RequestContext context = new RequestContext + { + CancellationToken = cancellationToken + }; + HttpMessage message = _customImagesRestClient.CreateDeleteRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, context); + Response response = await Pipeline.ProcessMessageAsync(message, context).ConfigureAwait(false); + DevTestLabsArmOperation operation = new DevTestLabsArmOperation(_customImagesClientDiagnostics, Pipeline, message.Request, response, OperationFinalStateVia.Location); + if (waitUntil == WaitUntil.Completed) + { + await operation.WaitForCompletionResponseAsync(cancellationToken).ConfigureAwait(false); + } + return operation; } catch (Exception e) { @@ -299,39 +346,46 @@ public virtual async Task> UpdateAsync(D } /// - /// Allows modifying tags of custom images. All other properties will be ignored. + /// Delete custom image. This operation can take a while to complete. /// /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/customimages/{name} + /// Request Path. + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/customimages/{name}. /// /// - /// Operation Id - /// CustomImages_Update + /// Operation Id. + /// CustomImages_Delete. /// /// - /// Default Api Version - /// 2018-09-15 + /// Default Api Version. + /// 2018-09-15. /// /// - /// Resource - /// + /// Resource. + /// . /// /// /// - /// A custom image. + /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. /// The cancellation token to use. - /// is null. - public virtual Response Update(DevTestLabCustomImagePatch patch, CancellationToken cancellationToken = default) + public virtual ArmOperation Delete(WaitUntil waitUntil, CancellationToken cancellationToken = default) { - Argument.AssertNotNull(patch, nameof(patch)); - - using var scope = _devTestLabCustomImageCustomImagesClientDiagnostics.CreateScope("DevTestLabCustomImageResource.Update"); + using DiagnosticScope scope = _customImagesClientDiagnostics.CreateScope("DevTestLabCustomImageResource.Delete"); scope.Start(); try { - var response = _devTestLabCustomImageCustomImagesRestClient.Update(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, patch, cancellationToken); - return Response.FromValue(new DevTestLabCustomImageResource(Client, response.Value), response.GetRawResponse()); + RequestContext context = new RequestContext + { + CancellationToken = cancellationToken + }; + HttpMessage message = _customImagesRestClient.CreateDeleteRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, context); + Response response = Pipeline.ProcessMessage(message, context); + DevTestLabsArmOperation operation = new DevTestLabsArmOperation(_customImagesClientDiagnostics, Pipeline, message.Request, response, OperationFinalStateVia.Location); + if (waitUntil == WaitUntil.Completed) + { + operation.WaitForCompletionResponse(cancellationToken); + } + return operation; } catch (Exception e) { @@ -340,27 +394,7 @@ public virtual Response Update(DevTestLabCustomIm } } - /// - /// Add a tag to the current resource. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/customimages/{name} - /// - /// - /// Operation Id - /// CustomImages_Get - /// - /// - /// Default Api Version - /// 2018-09-15 - /// - /// - /// Resource - /// - /// - /// - /// + /// Add a tag to the current resource. /// The key for the tag. /// The value for the tag. /// The cancellation token to use. @@ -370,29 +404,35 @@ public virtual async Task> AddTagAsync(s Argument.AssertNotNull(key, nameof(key)); Argument.AssertNotNull(value, nameof(value)); - using var scope = _devTestLabCustomImageCustomImagesClientDiagnostics.CreateScope("DevTestLabCustomImageResource.AddTag"); + using DiagnosticScope scope = _customImagesClientDiagnostics.CreateScope("DevTestLabCustomImageResource.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 _devTestLabCustomImageCustomImagesRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, null, cancellationToken).ConfigureAwait(false); - return Response.FromValue(new DevTestLabCustomImageResource(Client, originalResponse.Value), originalResponse.GetRawResponse()); + await GetTagResource().CreateOrUpdateAsync(WaitUntil.Completed, originalTags.Value.Data, cancellationToken).ConfigureAwait(false); + RequestContext context = new RequestContext + { + CancellationToken = cancellationToken + }; + HttpMessage message = _customImagesRestClient.CreateGetRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, default, context); + Response result = await Pipeline.ProcessMessageAsync(message, context).ConfigureAwait(false); + Response response = Response.FromValue(DevTestLabCustomImageData.FromResponse(result), result); + return Response.FromValue(new DevTestLabCustomImageResource(Client, response.Value), response.GetRawResponse()); } else { - var current = (await GetAsync(cancellationToken: cancellationToken).ConfigureAwait(false)).Value.Data; - var patch = new DevTestLabCustomImagePatch(); - foreach (var tag in current.Tags) + DevTestLabCustomImageData current = (await GetAsync(cancellationToken: cancellationToken).ConfigureAwait(false)).Value.Data; + DevTestLabCustomImagePatch patch = new DevTestLabCustomImagePatch(); + 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) @@ -402,27 +442,7 @@ public virtual async Task> AddTagAsync(s } } - /// - /// Add a tag to the current resource. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/customimages/{name} - /// - /// - /// Operation Id - /// CustomImages_Get - /// - /// - /// Default Api Version - /// 2018-09-15 - /// - /// - /// Resource - /// - /// - /// - /// + /// Add a tag to the current resource. /// The key for the tag. /// The value for the tag. /// The cancellation token to use. @@ -432,29 +452,35 @@ public virtual Response AddTag(string key, string Argument.AssertNotNull(key, nameof(key)); Argument.AssertNotNull(value, nameof(value)); - using var scope = _devTestLabCustomImageCustomImagesClientDiagnostics.CreateScope("DevTestLabCustomImageResource.AddTag"); + using DiagnosticScope scope = _customImagesClientDiagnostics.CreateScope("DevTestLabCustomImageResource.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 = _devTestLabCustomImageCustomImagesRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, null, cancellationToken); - return Response.FromValue(new DevTestLabCustomImageResource(Client, originalResponse.Value), originalResponse.GetRawResponse()); + GetTagResource().CreateOrUpdate(WaitUntil.Completed, originalTags.Value.Data, cancellationToken); + RequestContext context = new RequestContext + { + CancellationToken = cancellationToken + }; + HttpMessage message = _customImagesRestClient.CreateGetRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, default, context); + Response result = Pipeline.ProcessMessage(message, context); + Response response = Response.FromValue(DevTestLabCustomImageData.FromResponse(result), result); + return Response.FromValue(new DevTestLabCustomImageResource(Client, response.Value), response.GetRawResponse()); } else { - var current = Get(cancellationToken: cancellationToken).Value.Data; - var patch = new DevTestLabCustomImagePatch(); - foreach (var tag in current.Tags) + DevTestLabCustomImageData current = Get(cancellationToken: cancellationToken).Value.Data; + DevTestLabCustomImagePatch patch = new DevTestLabCustomImagePatch(); + 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) @@ -464,54 +490,40 @@ public virtual Response AddTag(string key, string } } - /// - /// Replace the tags on the resource with the given set. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/customimages/{name} - /// - /// - /// Operation Id - /// CustomImages_Get - /// - /// - /// Default Api Version - /// 2018-09-15 - /// - /// - /// 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 = _devTestLabCustomImageCustomImagesClientDiagnostics.CreateScope("DevTestLabCustomImageResource.SetTags"); + using DiagnosticScope scope = _customImagesClientDiagnostics.CreateScope("DevTestLabCustomImageResource.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 _devTestLabCustomImageCustomImagesRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, null, cancellationToken).ConfigureAwait(false); - return Response.FromValue(new DevTestLabCustomImageResource(Client, originalResponse.Value), originalResponse.GetRawResponse()); + await GetTagResource().CreateOrUpdateAsync(WaitUntil.Completed, originalTags.Value.Data, cancellationToken).ConfigureAwait(false); + RequestContext context = new RequestContext + { + CancellationToken = cancellationToken + }; + HttpMessage message = _customImagesRestClient.CreateGetRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, default, context); + Response result = await Pipeline.ProcessMessageAsync(message, context).ConfigureAwait(false); + Response response = Response.FromValue(DevTestLabCustomImageData.FromResponse(result), result); + return Response.FromValue(new DevTestLabCustomImageResource(Client, response.Value), response.GetRawResponse()); } else { - var current = (await GetAsync(cancellationToken: cancellationToken).ConfigureAwait(false)).Value.Data; - var patch = new DevTestLabCustomImagePatch(); + DevTestLabCustomImageData current = (await GetAsync(cancellationToken: cancellationToken).ConfigureAwait(false)).Value.Data; + DevTestLabCustomImagePatch patch = new DevTestLabCustomImagePatch(); 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) @@ -521,54 +533,40 @@ public virtual async Task> SetTagsAsync( } } - /// - /// Replace the tags on the resource with the given set. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/customimages/{name} - /// - /// - /// Operation Id - /// CustomImages_Get - /// - /// - /// Default Api Version - /// 2018-09-15 - /// - /// - /// 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 = _devTestLabCustomImageCustomImagesClientDiagnostics.CreateScope("DevTestLabCustomImageResource.SetTags"); + using DiagnosticScope scope = _customImagesClientDiagnostics.CreateScope("DevTestLabCustomImageResource.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 = _devTestLabCustomImageCustomImagesRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, null, cancellationToken); - return Response.FromValue(new DevTestLabCustomImageResource(Client, originalResponse.Value), originalResponse.GetRawResponse()); + GetTagResource().CreateOrUpdate(WaitUntil.Completed, originalTags.Value.Data, cancellationToken); + RequestContext context = new RequestContext + { + CancellationToken = cancellationToken + }; + HttpMessage message = _customImagesRestClient.CreateGetRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, default, context); + Response result = Pipeline.ProcessMessage(message, context); + Response response = Response.FromValue(DevTestLabCustomImageData.FromResponse(result), result); + return Response.FromValue(new DevTestLabCustomImageResource(Client, response.Value), response.GetRawResponse()); } else { - var current = Get(cancellationToken: cancellationToken).Value.Data; - var patch = new DevTestLabCustomImagePatch(); + DevTestLabCustomImageData current = Get(cancellationToken: cancellationToken).Value.Data; + DevTestLabCustomImagePatch patch = new DevTestLabCustomImagePatch(); 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) @@ -578,27 +576,7 @@ public virtual Response SetTags(IDictionary - /// Removes a tag by key from the resource. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/customimages/{name} - /// - /// - /// Operation Id - /// CustomImages_Get - /// - /// - /// Default Api Version - /// 2018-09-15 - /// - /// - /// Resource - /// - /// - /// - /// + /// Removes a tag by key from the resource. /// The key for the tag. /// The cancellation token to use. /// is null. @@ -606,29 +584,35 @@ public virtual async Task> RemoveTagAsyn { Argument.AssertNotNull(key, nameof(key)); - using var scope = _devTestLabCustomImageCustomImagesClientDiagnostics.CreateScope("DevTestLabCustomImageResource.RemoveTag"); + using DiagnosticScope scope = _customImagesClientDiagnostics.CreateScope("DevTestLabCustomImageResource.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 _devTestLabCustomImageCustomImagesRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, null, cancellationToken).ConfigureAwait(false); - return Response.FromValue(new DevTestLabCustomImageResource(Client, originalResponse.Value), originalResponse.GetRawResponse()); + await GetTagResource().CreateOrUpdateAsync(WaitUntil.Completed, originalTags.Value.Data, cancellationToken).ConfigureAwait(false); + RequestContext context = new RequestContext + { + CancellationToken = cancellationToken + }; + HttpMessage message = _customImagesRestClient.CreateGetRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, default, context); + Response result = await Pipeline.ProcessMessageAsync(message, context).ConfigureAwait(false); + Response response = Response.FromValue(DevTestLabCustomImageData.FromResponse(result), result); + return Response.FromValue(new DevTestLabCustomImageResource(Client, response.Value), response.GetRawResponse()); } else { - var current = (await GetAsync(cancellationToken: cancellationToken).ConfigureAwait(false)).Value.Data; - var patch = new DevTestLabCustomImagePatch(); - foreach (var tag in current.Tags) + DevTestLabCustomImageData current = (await GetAsync(cancellationToken: cancellationToken).ConfigureAwait(false)).Value.Data; + DevTestLabCustomImagePatch patch = new DevTestLabCustomImagePatch(); + 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) @@ -638,27 +622,7 @@ public virtual async Task> RemoveTagAsyn } } - /// - /// Removes a tag by key from the resource. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/customimages/{name} - /// - /// - /// Operation Id - /// CustomImages_Get - /// - /// - /// Default Api Version - /// 2018-09-15 - /// - /// - /// Resource - /// - /// - /// - /// + /// Removes a tag by key from the resource. /// The key for the tag. /// The cancellation token to use. /// is null. @@ -666,29 +630,35 @@ public virtual Response RemoveTag(string key, Can { Argument.AssertNotNull(key, nameof(key)); - using var scope = _devTestLabCustomImageCustomImagesClientDiagnostics.CreateScope("DevTestLabCustomImageResource.RemoveTag"); + using DiagnosticScope scope = _customImagesClientDiagnostics.CreateScope("DevTestLabCustomImageResource.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 = _devTestLabCustomImageCustomImagesRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, null, cancellationToken); - return Response.FromValue(new DevTestLabCustomImageResource(Client, originalResponse.Value), originalResponse.GetRawResponse()); + GetTagResource().CreateOrUpdate(WaitUntil.Completed, originalTags.Value.Data, cancellationToken); + RequestContext context = new RequestContext + { + CancellationToken = cancellationToken + }; + HttpMessage message = _customImagesRestClient.CreateGetRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, default, context); + Response result = Pipeline.ProcessMessage(message, context); + Response response = Response.FromValue(DevTestLabCustomImageData.FromResponse(result), result); + return Response.FromValue(new DevTestLabCustomImageResource(Client, response.Value), response.GetRawResponse()); } else { - var current = Get(cancellationToken: cancellationToken).Value.Data; - var patch = new DevTestLabCustomImagePatch(); - foreach (var tag in current.Tags) + DevTestLabCustomImageData current = Get(cancellationToken: cancellationToken).Value.Data; + DevTestLabCustomImagePatch patch = new DevTestLabCustomImagePatch(); + 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) diff --git a/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/DevTestLabData.Serialization.cs b/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/DevTestLabData.Serialization.cs index 12b92c65c693..3ff9620cec9a 100644 --- a/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/DevTestLabData.Serialization.cs +++ b/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/DevTestLabData.Serialization.cs @@ -10,16 +10,47 @@ using System.Collections.Generic; using System.Text; using System.Text.Json; +using Azure; using Azure.Core; using Azure.ResourceManager.DevTestLabs.Models; using Azure.ResourceManager.Models; namespace Azure.ResourceManager.DevTestLabs { - public partial class DevTestLabData : IUtf8JsonSerializable, IJsonModel + /// A lab. + public partial class DevTestLabData : TrackedResourceData, IJsonModel { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + /// Initializes a new instance of for deserialization. + internal DevTestLabData() + { + } + /// 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)) + { + return DeserializeDevTestLabData(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(DevTestLabData)} does not support reading '{options.Format}' format."); + } + } + + /// The to deserialize the from. + internal static DevTestLabData FromResponse(Response response) + { + using JsonDocument document = JsonDocument.Parse(response.Content, ModelSerializationExtensions.JsonDocumentOptions); + return DeserializeDevTestLabData(document.RootElement, ModelSerializationExtensions.WireOptions); + } + + /// The JSON writer. + /// The client options for reading and writing models. void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) { writer.WriteStartObject(); @@ -31,434 +62,153 @@ void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOp /// 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(DevTestLabData)} does not support writing '{format}' format."); } - base.JsonModelWriteCore(writer, options); writer.WritePropertyName("properties"u8); - writer.WriteStartObject(); - if (options.Format != "W" && Optional.IsDefined(DefaultStorageAccount)) - { - writer.WritePropertyName("defaultStorageAccount"u8); - writer.WriteStringValue(DefaultStorageAccount); - } - if (options.Format != "W" && Optional.IsDefined(DefaultPremiumStorageAccount)) - { - writer.WritePropertyName("defaultPremiumStorageAccount"u8); - writer.WriteStringValue(DefaultPremiumStorageAccount); - } - if (options.Format != "W" && Optional.IsDefined(ArtifactsStorageAccount)) - { - writer.WritePropertyName("artifactsStorageAccount"u8); - writer.WriteStringValue(ArtifactsStorageAccount); - } - if (options.Format != "W" && Optional.IsDefined(PremiumDataDiskStorageAccount)) - { - writer.WritePropertyName("premiumDataDiskStorageAccount"u8); - writer.WriteStringValue(PremiumDataDiskStorageAccount); - } - if (options.Format != "W" && Optional.IsDefined(VaultName)) - { - writer.WritePropertyName("vaultName"u8); - writer.WriteStringValue(VaultName); - } - if (Optional.IsDefined(LabStorageType)) - { - writer.WritePropertyName("labStorageType"u8); - writer.WriteStringValue(LabStorageType.Value.ToString()); - } - if (Optional.IsCollectionDefined(MandatoryArtifactsResourceIdsLinux)) - { - writer.WritePropertyName("mandatoryArtifactsResourceIdsLinux"u8); - writer.WriteStartArray(); - foreach (var item in MandatoryArtifactsResourceIdsLinux) - { - writer.WriteStringValue(item); - } - writer.WriteEndArray(); - } - if (Optional.IsCollectionDefined(MandatoryArtifactsResourceIdsWindows)) + writer.WriteObjectValue(Properties, options); + if (Optional.IsCollectionDefined(Tags)) { - writer.WritePropertyName("mandatoryArtifactsResourceIdsWindows"u8); - writer.WriteStartArray(); - foreach (var item in MandatoryArtifactsResourceIdsWindows) - { - writer.WriteStringValue(item); - } - writer.WriteEndArray(); - } - if (options.Format != "W" && Optional.IsDefined(CreatedOn)) - { - writer.WritePropertyName("createdDate"u8); - writer.WriteStringValue(CreatedOn.Value, "O"); - } - if (Optional.IsDefined(PremiumDataDisks)) - { - writer.WritePropertyName("premiumDataDisks"u8); - writer.WriteStringValue(PremiumDataDisks.Value.ToString()); - } - if (Optional.IsDefined(EnvironmentPermission)) - { - writer.WritePropertyName("environmentPermission"u8); - writer.WriteStringValue(EnvironmentPermission.Value.ToString()); - } - if (Optional.IsDefined(Announcement)) - { - writer.WritePropertyName("announcement"u8); - writer.WriteObjectValue(Announcement, options); - } - if (Optional.IsDefined(Support)) - { - writer.WritePropertyName("support"u8); - writer.WriteObjectValue(Support, options); - } - if (options.Format != "W" && Optional.IsDefined(VmCreationResourceGroup)) - { - writer.WritePropertyName("vmCreationResourceGroup"u8); - writer.WriteStringValue(VmCreationResourceGroup); - } - if (options.Format != "W" && Optional.IsDefined(PublicIPId)) - { - writer.WritePropertyName("publicIpId"u8); - writer.WriteStringValue(PublicIPId); - } - if (options.Format != "W" && Optional.IsDefined(LoadBalancerId)) - { - writer.WritePropertyName("loadBalancerId"u8); - writer.WriteStringValue(LoadBalancerId); - } - if (options.Format != "W" && Optional.IsDefined(NetworkSecurityGroupId)) - { - writer.WritePropertyName("networkSecurityGroupId"u8); - writer.WriteStringValue(NetworkSecurityGroupId); - } - if (Optional.IsCollectionDefined(ExtendedProperties)) - { - writer.WritePropertyName("extendedProperties"u8); + writer.WritePropertyName("tags"u8); writer.WriteStartObject(); - foreach (var item in ExtendedProperties) + foreach (var item in Tags) { writer.WritePropertyName(item.Key); + if (item.Value == null) + { + writer.WriteNullValue(); + continue; + } writer.WriteStringValue(item.Value); } writer.WriteEndObject(); } - if (options.Format != "W" && Optional.IsDefined(ProvisioningState)) - { - writer.WritePropertyName("provisioningState"u8); - writer.WriteStringValue(ProvisioningState); - } - if (options.Format != "W" && Optional.IsDefined(UniqueIdentifier)) - { - writer.WritePropertyName("uniqueIdentifier"u8); - writer.WriteStringValue(UniqueIdentifier.Value); - } - writer.WriteEndObject(); } - DevTestLabData IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + /// The JSON reader. + /// The client options for reading and writing models. + DevTestLabData IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) => (DevTestLabData)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(DevTestLabData)} does not support reading '{format}' format."); } - using JsonDocument document = JsonDocument.ParseValue(ref reader); return DeserializeDevTestLabData(document.RootElement, options); } - internal static DevTestLabData DeserializeDevTestLabData(JsonElement element, ModelReaderWriterOptions options = null) + /// The JSON element to deserialize. + /// The client options for reading and writing models. + internal static DevTestLabData DeserializeDevTestLabData(JsonElement element, ModelReaderWriterOptions options) { - options ??= ModelSerializationExtensions.WireOptions; - if (element.ValueKind == JsonValueKind.Null) { return null; } - IDictionary tags = default; - AzureLocation location = default; ResourceIdentifier id = default; string name = default; - ResourceType type = default; + ResourceType resourceType = default; SystemData systemData = default; - string defaultStorageAccount = default; - string defaultPremiumStorageAccount = default; - string artifactsStorageAccount = default; - string premiumDataDiskStorageAccount = default; - string vaultName = default; - DevTestLabStorageType? labStorageType = default; - IList mandatoryArtifactsResourceIdsLinux = default; - IList mandatoryArtifactsResourceIdsWindows = default; - DateTimeOffset? createdDate = default; - DevTestLabPremiumDataDisk? premiumDataDisks = default; - DevTestLabEnvironmentPermission? environmentPermission = default; - DevTestLabAnnouncement announcement = default; - DevTestLabSupport support = default; - string vmCreationResourceGroup = default; - string publicIPId = default; - string loadBalancerId = default; - string networkSecurityGroupId = default; - IDictionary extendedProperties = default; - string provisioningState = default; - Guid? uniqueIdentifier = default; - IDictionary serializedAdditionalRawData = default; - Dictionary rawDataDictionary = new Dictionary(); - foreach (var property in element.EnumerateObject()) + IDictionary additionalBinaryDataProperties = new ChangeTrackingDictionary(); + AzureLocation location = default; + LabProperties properties = default; + IDictionary tags = default; + foreach (var prop in element.EnumerateObject()) { - if (property.NameEquals("tags"u8)) + if (prop.NameEquals("id"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()) - { - dictionary.Add(property0.Name, property0.Value.GetString()); - } - tags = dictionary; + id = new ResourceIdentifier(prop.Value.GetString()); continue; } - if (property.NameEquals("location"u8)) + if (prop.NameEquals("name"u8)) { - location = new AzureLocation(property.Value.GetString()); + name = prop.Value.GetString(); continue; } - if (property.NameEquals("id"u8)) + if (prop.NameEquals("type"u8)) { - id = new ResourceIdentifier(property.Value.GetString()); + if (prop.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + resourceType = new ResourceType(prop.Value.GetString()); continue; } - if (property.NameEquals("name"u8)) + if (prop.NameEquals("systemData"u8)) { - name = property.Value.GetString(); + if (prop.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + systemData = ModelReaderWriter.Read(new BinaryData(Encoding.UTF8.GetBytes(prop.Value.GetRawText())), ModelSerializationExtensions.WireOptions, AzureResourceManagerDevTestLabsContext.Default); 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) - { - continue; - } - systemData = ModelReaderWriter.Read(new BinaryData(Encoding.UTF8.GetBytes(property.Value.GetRawText())), ModelSerializationExtensions.WireOptions, AzureResourceManagerDevTestLabsContext.Default); + properties = LabProperties.DeserializeLabProperties(prop.Value, options); continue; } - if (property.NameEquals("properties"u8)) + if (prop.NameEquals("tags"u8)) { - if (property.Value.ValueKind == JsonValueKind.Null) + if (prop.Value.ValueKind == JsonValueKind.Null) { - property.ThrowNonNullablePropertyIsNull(); continue; } - foreach (var property0 in property.Value.EnumerateObject()) + Dictionary dictionary = new Dictionary(); + foreach (var prop0 in prop.Value.EnumerateObject()) { - if (property0.NameEquals("defaultStorageAccount"u8)) - { - defaultStorageAccount = property0.Value.GetString(); - continue; - } - if (property0.NameEquals("defaultPremiumStorageAccount"u8)) - { - defaultPremiumStorageAccount = property0.Value.GetString(); - continue; - } - if (property0.NameEquals("artifactsStorageAccount"u8)) - { - artifactsStorageAccount = property0.Value.GetString(); - continue; - } - if (property0.NameEquals("premiumDataDiskStorageAccount"u8)) - { - premiumDataDiskStorageAccount = property0.Value.GetString(); - continue; - } - if (property0.NameEquals("vaultName"u8)) - { - vaultName = property0.Value.GetString(); - continue; - } - if (property0.NameEquals("labStorageType"u8)) - { - if (property0.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - labStorageType = new DevTestLabStorageType(property0.Value.GetString()); - continue; - } - if (property0.NameEquals("mandatoryArtifactsResourceIdsLinux"u8)) - { - if (property0.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - List array = new List(); - foreach (var item in property0.Value.EnumerateArray()) - { - array.Add(item.GetString()); - } - mandatoryArtifactsResourceIdsLinux = array; - continue; - } - if (property0.NameEquals("mandatoryArtifactsResourceIdsWindows"u8)) - { - if (property0.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - List array = new List(); - foreach (var item in property0.Value.EnumerateArray()) - { - array.Add(item.GetString()); - } - mandatoryArtifactsResourceIdsWindows = array; - continue; - } - if (property0.NameEquals("createdDate"u8)) - { - if (property0.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - createdDate = property0.Value.GetDateTimeOffset("O"); - continue; - } - if (property0.NameEquals("premiumDataDisks"u8)) - { - if (property0.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - premiumDataDisks = new DevTestLabPremiumDataDisk(property0.Value.GetString()); - continue; - } - if (property0.NameEquals("environmentPermission"u8)) + if (prop0.Value.ValueKind == JsonValueKind.Null) { - if (property0.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - environmentPermission = new DevTestLabEnvironmentPermission(property0.Value.GetString()); - continue; + dictionary.Add(prop0.Name, null); } - if (property0.NameEquals("announcement"u8)) + else { - if (property0.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - announcement = DevTestLabAnnouncement.DeserializeDevTestLabAnnouncement(property0.Value, options); - continue; - } - if (property0.NameEquals("support"u8)) - { - if (property0.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - support = DevTestLabSupport.DeserializeDevTestLabSupport(property0.Value, options); - continue; - } - if (property0.NameEquals("vmCreationResourceGroup"u8)) - { - vmCreationResourceGroup = property0.Value.GetString(); - continue; - } - if (property0.NameEquals("publicIpId"u8)) - { - publicIPId = property0.Value.GetString(); - continue; - } - if (property0.NameEquals("loadBalancerId"u8)) - { - loadBalancerId = property0.Value.GetString(); - continue; - } - if (property0.NameEquals("networkSecurityGroupId"u8)) - { - networkSecurityGroupId = property0.Value.GetString(); - continue; - } - if (property0.NameEquals("extendedProperties"u8)) - { - if (property0.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - Dictionary dictionary = new Dictionary(); - foreach (var property1 in property0.Value.EnumerateObject()) - { - dictionary.Add(property1.Name, property1.Value.GetString()); - } - extendedProperties = dictionary; - continue; - } - if (property0.NameEquals("provisioningState"u8)) - { - provisioningState = property0.Value.GetString(); - continue; - } - if (property0.NameEquals("uniqueIdentifier"u8)) - { - if (property0.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - uniqueIdentifier = property0.Value.GetGuid(); - continue; + dictionary.Add(prop0.Name, prop0.Value.GetString()); } } + tags = dictionary; 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 DevTestLabData( id, name, - type, + resourceType, systemData, - tags ?? new ChangeTrackingDictionary(), + additionalBinaryDataProperties, location, - defaultStorageAccount, - defaultPremiumStorageAccount, - artifactsStorageAccount, - premiumDataDiskStorageAccount, - vaultName, - labStorageType, - mandatoryArtifactsResourceIdsLinux ?? new ChangeTrackingList(), - mandatoryArtifactsResourceIdsWindows ?? new ChangeTrackingList(), - createdDate, - premiumDataDisks, - environmentPermission, - announcement, - support, - vmCreationResourceGroup, - publicIPId, - loadBalancerId, - networkSecurityGroupId, - extendedProperties ?? new ChangeTrackingDictionary(), - provisioningState, - uniqueIdentifier, - serializedAdditionalRawData); + properties, + tags ?? new ChangeTrackingDictionary()); } - 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": @@ -468,22 +218,23 @@ BinaryData IPersistableModel.Write(ModelReaderWriterOptions opti } } - DevTestLabData 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. + DevTestLabData IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) => (DevTestLabData)PersistableModelCreateCore(data, options); - switch (format) + /// The client options for reading and writing models. + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + + /// The to serialize into . + internal static RequestContent ToRequestContent(DevTestLabData devTestLabData) + { + if (devTestLabData == null) { - case "J": - { - using JsonDocument document = JsonDocument.Parse(data, ModelSerializationExtensions.JsonDocumentOptions); - return DeserializeDevTestLabData(document.RootElement, options); - } - default: - throw new FormatException($"The model {nameof(DevTestLabData)} does not support reading '{options.Format}' format."); + return null; } + Utf8JsonRequestContent content = new Utf8JsonRequestContent(); + content.JsonWriter.WriteObjectValue(devTestLabData, ModelSerializationExtensions.WireOptions); + return content; } - - string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; } } diff --git a/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/DevTestLabData.cs b/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/DevTestLabData.cs index 71cdd7b0e5b9..1aae7809443b 100644 --- a/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/DevTestLabData.cs +++ b/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/DevTestLabData.cs @@ -13,158 +13,271 @@ namespace Azure.ResourceManager.DevTestLabs { - /// - /// A class representing the DevTestLab data model. - /// A lab. - /// + /// A lab. public partial class DevTestLabData : 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 DevTestLabData(AzureLocation location) : base(location) { - MandatoryArtifactsResourceIdsLinux = new ChangeTrackingList(); - MandatoryArtifactsResourceIdsWindows = new ChangeTrackingList(); - ExtendedProperties = new ChangeTrackingDictionary(); + } /// Initializes a new instance of . - /// The id. - /// The name. - /// The resourceType. - /// The systemData. - /// The tags. - /// The location. - /// The lab's default storage account. - /// The lab's default premium storage account. - /// The lab's artifact storage account. - /// The lab's premium data disk storage account. - /// The lab's Key vault. - /// Type of storage used by the lab. It can be either Premium or Standard. Default is Premium. - /// The ordered list of artifact resource IDs that should be applied on all Linux VM creations by default, prior to the artifacts specified by the user. - /// The ordered list of artifact resource IDs that should be applied on all Windows VM creations by default, prior to the artifacts specified by the user. - /// The creation date of the lab. - /// - /// The setting to enable usage of premium data disks. - /// When its value is 'Enabled', creation of standard or premium data disks is allowed. - /// When its value is 'Disabled', only creation of standard data disks is allowed. - /// - /// The access rights to be granted to the user when provisioning an environment. - /// The properties of any lab announcement associated with this lab. - /// The properties of any lab support message associated with this lab. - /// The resource group in which all new lab virtual machines will be created. To let DevTest Labs manage resource group creation, set this value to null. - /// The public IP address for the lab's load balancer. - /// The load balancer used to for lab VMs that use shared IP address. - /// The Network Security Group attached to the lab VMs Network interfaces to restrict open ports. - /// Extended properties of the lab used for experimental features. - /// The provisioning status of the resource. - /// The unique immutable identifier of a resource (Guid). - /// Keeps track of any properties unknown to the library. - internal DevTestLabData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, IDictionary tags, AzureLocation location, string defaultStorageAccount, string defaultPremiumStorageAccount, string artifactsStorageAccount, string premiumDataDiskStorageAccount, string vaultName, DevTestLabStorageType? labStorageType, IList mandatoryArtifactsResourceIdsLinux, IList mandatoryArtifactsResourceIdsWindows, DateTimeOffset? createdOn, DevTestLabPremiumDataDisk? premiumDataDisks, DevTestLabEnvironmentPermission? environmentPermission, DevTestLabAnnouncement announcement, DevTestLabSupport support, string vmCreationResourceGroup, string publicIPId, string loadBalancerId, string networkSecurityGroupId, IDictionary extendedProperties, string provisioningState, Guid? uniqueIdentifier, IDictionary serializedAdditionalRawData) : base(id, name, resourceType, systemData, tags, location) - { - DefaultStorageAccount = defaultStorageAccount; - DefaultPremiumStorageAccount = defaultPremiumStorageAccount; - ArtifactsStorageAccount = artifactsStorageAccount; - PremiumDataDiskStorageAccount = premiumDataDiskStorageAccount; - VaultName = vaultName; - LabStorageType = labStorageType; - MandatoryArtifactsResourceIdsLinux = mandatoryArtifactsResourceIdsLinux; - MandatoryArtifactsResourceIdsWindows = mandatoryArtifactsResourceIdsWindows; - CreatedOn = createdOn; - PremiumDataDisks = premiumDataDisks; - EnvironmentPermission = environmentPermission; - Announcement = announcement; - Support = support; - VmCreationResourceGroup = vmCreationResourceGroup; - PublicIPId = publicIPId; - LoadBalancerId = loadBalancerId; - NetworkSecurityGroupId = networkSecurityGroupId; - ExtendedProperties = extendedProperties; - ProvisioningState = provisioningState; - UniqueIdentifier = uniqueIdentifier; - _serializedAdditionalRawData = serializedAdditionalRawData; - } - - /// Initializes a new instance of for deserialization. - internal DevTestLabData() + /// 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 geo-location where the resource lives. + /// The properties of the resource. + /// Resource tags. + internal DevTestLabData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, IDictionary additionalBinaryDataProperties, AzureLocation location, LabProperties properties, IDictionary tags) : base(id, name, resourceType, systemData, tags, location) { + _additionalBinaryDataProperties = additionalBinaryDataProperties; + Properties = properties; } + /// The properties of the resource. + internal LabProperties Properties { get; set; } + /// The lab's default storage account. - public string DefaultStorageAccount { get; } + public string DefaultStorageAccount + { + get + { + return Properties is null ? default : Properties.DefaultStorageAccount; + } + } + /// The lab's default premium storage account. - public string DefaultPremiumStorageAccount { get; } + public string DefaultPremiumStorageAccount + { + get + { + return Properties is null ? default : Properties.DefaultPremiumStorageAccount; + } + } + /// The lab's artifact storage account. - public string ArtifactsStorageAccount { get; } + public string ArtifactsStorageAccount + { + get + { + return Properties is null ? default : Properties.ArtifactsStorageAccount; + } + } + /// The lab's premium data disk storage account. - public string PremiumDataDiskStorageAccount { get; } + public string PremiumDataDiskStorageAccount + { + get + { + return Properties is null ? default : Properties.PremiumDataDiskStorageAccount; + } + } + /// The lab's Key vault. - public string VaultName { get; } + public string VaultName + { + get + { + return Properties is null ? default : Properties.VaultName; + } + } + /// Type of storage used by the lab. It can be either Premium or Standard. Default is Premium. - public DevTestLabStorageType? LabStorageType { get; set; } + public DevTestLabStorageType? LabStorageType + { + get + { + return Properties is null ? default : Properties.LabStorageType; + } + set + { + if (Properties is null) + { + Properties = new LabProperties(); + } + Properties.LabStorageType = value.Value; + } + } + /// The ordered list of artifact resource IDs that should be applied on all Linux VM creations by default, prior to the artifacts specified by the user. - public IList MandatoryArtifactsResourceIdsLinux { get; } + public IList MandatoryArtifactsResourceIdsLinux + { + get + { + if (Properties is null) + { + Properties = new LabProperties(); + } + return Properties.MandatoryArtifactsResourceIdsLinux; + } + } + /// The ordered list of artifact resource IDs that should be applied on all Windows VM creations by default, prior to the artifacts specified by the user. - public IList MandatoryArtifactsResourceIdsWindows { get; } + public IList MandatoryArtifactsResourceIdsWindows + { + get + { + if (Properties is null) + { + Properties = new LabProperties(); + } + return Properties.MandatoryArtifactsResourceIdsWindows; + } + } + /// The creation date of the lab. - public DateTimeOffset? CreatedOn { get; } + public DateTimeOffset? CreatedOn + { + get + { + return Properties is null ? default : Properties.CreatedOn; + } + } + /// /// The setting to enable usage of premium data disks. /// When its value is 'Enabled', creation of standard or premium data disks is allowed. /// When its value is 'Disabled', only creation of standard data disks is allowed. /// - public DevTestLabPremiumDataDisk? PremiumDataDisks { get; set; } + public DevTestLabPremiumDataDisk? PremiumDataDisks + { + get + { + return Properties is null ? default : Properties.PremiumDataDisks; + } + set + { + if (Properties is null) + { + Properties = new LabProperties(); + } + Properties.PremiumDataDisks = value.Value; + } + } + /// The access rights to be granted to the user when provisioning an environment. - public DevTestLabEnvironmentPermission? EnvironmentPermission { get; set; } + public DevTestLabEnvironmentPermission? EnvironmentPermission + { + get + { + return Properties is null ? default : Properties.EnvironmentPermission; + } + set + { + if (Properties is null) + { + Properties = new LabProperties(); + } + Properties.EnvironmentPermission = value.Value; + } + } + /// The properties of any lab announcement associated with this lab. - public DevTestLabAnnouncement Announcement { get; set; } + public DevTestLabAnnouncement Announcement + { + get + { + return Properties is null ? default : Properties.Announcement; + } + set + { + if (Properties is null) + { + Properties = new LabProperties(); + } + Properties.Announcement = value; + } + } + /// The properties of any lab support message associated with this lab. - public DevTestLabSupport Support { get; set; } + public DevTestLabSupport Support + { + get + { + return Properties is null ? default : Properties.Support; + } + set + { + if (Properties is null) + { + Properties = new LabProperties(); + } + Properties.Support = value; + } + } + /// The resource group in which all new lab virtual machines will be created. To let DevTest Labs manage resource group creation, set this value to null. - public string VmCreationResourceGroup { get; } + public string VmCreationResourceGroup + { + get + { + return Properties is null ? default : Properties.VmCreationResourceGroup; + } + } + /// The public IP address for the lab's load balancer. - public string PublicIPId { get; } + public string PublicIPId + { + get + { + return Properties is null ? default : Properties.PublicIPId; + } + } + /// The load balancer used to for lab VMs that use shared IP address. - public string LoadBalancerId { get; } + public string LoadBalancerId + { + get + { + return Properties is null ? default : Properties.LoadBalancerId; + } + } + /// The Network Security Group attached to the lab VMs Network interfaces to restrict open ports. - public string NetworkSecurityGroupId { get; } + public string NetworkSecurityGroupId + { + get + { + return Properties is null ? default : Properties.NetworkSecurityGroupId; + } + } + /// Extended properties of the lab used for experimental features. - public IDictionary ExtendedProperties { get; } + public IDictionary ExtendedProperties + { + get + { + if (Properties is null) + { + Properties = new LabProperties(); + } + return Properties.ExtendedProperties; + } + } + /// The provisioning status of the resource. - public string ProvisioningState { get; } + public string ProvisioningState + { + get + { + return Properties is null ? default : Properties.ProvisioningState; + } + } + /// The unique immutable identifier of a resource (Guid). - public Guid? UniqueIdentifier { get; } + public Guid? UniqueIdentifier + { + get + { + return Properties is null ? default : Properties.UniqueIdentifier; + } + } } } diff --git a/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/DevTestLabDiskCollection.cs b/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/DevTestLabDiskCollection.cs index 0c99a0b3ca48..36430ebcc337 100644 --- a/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/DevTestLabDiskCollection.cs +++ b/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/DevTestLabDiskCollection.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.DevTestLabs { @@ -24,51 +25,49 @@ namespace Azure.ResourceManager.DevTestLabs /// public partial class DevTestLabDiskCollection : ArmCollection, IEnumerable, IAsyncEnumerable { - private readonly ClientDiagnostics _devTestLabDiskDisksClientDiagnostics; - private readonly DisksRestOperations _devTestLabDiskDisksRestClient; + private readonly ClientDiagnostics _disksClientDiagnostics; + private readonly Disks _disksRestClient; - /// Initializes a new instance of the class for mocking. + /// Initializes a new instance of DevTestLabDiskCollection for mocking. protected DevTestLabDiskCollection() { } - /// 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 DevTestLabDiskCollection(ArmClient client, ResourceIdentifier id) : base(client, id) { - _devTestLabDiskDisksClientDiagnostics = new ClientDiagnostics("Azure.ResourceManager.DevTestLabs", DevTestLabDiskResource.ResourceType.Namespace, Diagnostics); - TryGetApiVersion(DevTestLabDiskResource.ResourceType, out string devTestLabDiskDisksApiVersion); - _devTestLabDiskDisksRestClient = new DisksRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, devTestLabDiskDisksApiVersion); -#if DEBUG - ValidateResourceId(Id); -#endif + TryGetApiVersion(DevTestLabDiskResource.ResourceType, out string devTestLabDiskApiVersion); + _disksClientDiagnostics = new ClientDiagnostics("Azure.ResourceManager.DevTestLabs", DevTestLabDiskResource.ResourceType.Namespace, Diagnostics); + _disksRestClient = new Disks(_disksClientDiagnostics, Pipeline, Endpoint, devTestLabDiskApiVersion ?? "2018-09-15"); + ValidateResourceId(id); } + /// + [Conditional("DEBUG")] internal static void ValidateResourceId(ResourceIdentifier id) { if (id.ResourceType != DevTestLabUserResource.ResourceType) - throw new ArgumentException(string.Format(CultureInfo.CurrentCulture, "Invalid resource type {0} expected {1}", id.ResourceType, DevTestLabUserResource.ResourceType), nameof(id)); + { + throw new ArgumentException(string.Format("Invalid resource type {0} expected {1}", id.ResourceType, DevTestLabUserResource.ResourceType), id); + } } /// /// Create or replace an existing disk. This operation can take a while to complete. /// /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/users/{userName}/disks/{name} - /// - /// - /// Operation Id - /// Disks_CreateOrUpdate + /// Request Path. + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/users/{userName}/disks/{name}. /// /// - /// Default Api Version - /// 2018-09-15 + /// Operation Id. + /// Disks_CreateOrUpdate. /// /// - /// Resource - /// + /// Default Api Version. + /// 2018-09-15. /// /// /// @@ -76,21 +75,34 @@ internal static void ValidateResourceId(ResourceIdentifier id) /// The name of the disk. /// A Disk. /// 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 name, DevTestLabDiskData data, CancellationToken cancellationToken = default) { Argument.AssertNotNullOrEmpty(name, nameof(name)); Argument.AssertNotNull(data, nameof(data)); - using var scope = _devTestLabDiskDisksClientDiagnostics.CreateScope("DevTestLabDiskCollection.CreateOrUpdate"); + using DiagnosticScope scope = _disksClientDiagnostics.CreateScope("DevTestLabDiskCollection.CreateOrUpdate"); scope.Start(); try { - var response = await _devTestLabDiskDisksRestClient.CreateOrUpdateAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, name, data, cancellationToken).ConfigureAwait(false); - var operation = new DevTestLabsArmOperation(new DevTestLabDiskOperationSource(Client), _devTestLabDiskDisksClientDiagnostics, Pipeline, _devTestLabDiskDisksRestClient.CreateCreateOrUpdateRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, name, data).Request, response, OperationFinalStateVia.Location); + RequestContext context = new RequestContext + { + CancellationToken = cancellationToken + }; + HttpMessage message = _disksRestClient.CreateCreateOrUpdateRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, name, DevTestLabDiskData.ToRequestContent(data), context); + Response response = await Pipeline.ProcessMessageAsync(message, context).ConfigureAwait(false); + DevTestLabsArmOperation operation = new DevTestLabsArmOperation( + new DevTestLabDiskOperationSource(Client), + _disksClientDiagnostics, + Pipeline, + message.Request, + response, + OperationFinalStateVia.Location); if (waitUntil == WaitUntil.Completed) + { await operation.WaitForCompletionAsync(cancellationToken).ConfigureAwait(false); + } return operation; } catch (Exception e) @@ -104,20 +116,16 @@ public virtual async Task> CreateOrUpdateAs /// Create or replace an existing disk. This operation can take a while to complete. /// /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/users/{userName}/disks/{name} + /// Request Path. + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/users/{userName}/disks/{name}. /// /// - /// Operation Id - /// Disks_CreateOrUpdate + /// Operation Id. + /// Disks_CreateOrUpdate. /// /// - /// Default Api Version - /// 2018-09-15 - /// - /// - /// Resource - /// + /// Default Api Version. + /// 2018-09-15. /// /// /// @@ -125,21 +133,34 @@ public virtual async Task> CreateOrUpdateAs /// The name of the disk. /// A Disk. /// 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 name, DevTestLabDiskData data, CancellationToken cancellationToken = default) { Argument.AssertNotNullOrEmpty(name, nameof(name)); Argument.AssertNotNull(data, nameof(data)); - using var scope = _devTestLabDiskDisksClientDiagnostics.CreateScope("DevTestLabDiskCollection.CreateOrUpdate"); + using DiagnosticScope scope = _disksClientDiagnostics.CreateScope("DevTestLabDiskCollection.CreateOrUpdate"); scope.Start(); try { - var response = _devTestLabDiskDisksRestClient.CreateOrUpdate(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, name, data, cancellationToken); - var operation = new DevTestLabsArmOperation(new DevTestLabDiskOperationSource(Client), _devTestLabDiskDisksClientDiagnostics, Pipeline, _devTestLabDiskDisksRestClient.CreateCreateOrUpdateRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, name, data).Request, response, OperationFinalStateVia.Location); + RequestContext context = new RequestContext + { + CancellationToken = cancellationToken + }; + HttpMessage message = _disksRestClient.CreateCreateOrUpdateRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, name, DevTestLabDiskData.ToRequestContent(data), context); + Response response = Pipeline.ProcessMessage(message, context); + DevTestLabsArmOperation operation = new DevTestLabsArmOperation( + new DevTestLabDiskOperationSource(Client), + _disksClientDiagnostics, + Pipeline, + message.Request, + response, + OperationFinalStateVia.Location); if (waitUntil == WaitUntil.Completed) + { operation.WaitForCompletion(cancellationToken); + } return operation; } catch (Exception e) @@ -153,39 +174,43 @@ public virtual ArmOperation CreateOrUpdate(WaitUntil wai /// Get disk. /// /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/users/{userName}/disks/{name} + /// Request Path. + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/users/{userName}/disks/{name}. /// /// - /// Operation Id - /// Disks_Get + /// Operation Id. + /// Disks_Get. /// /// - /// Default Api Version - /// 2018-09-15 - /// - /// - /// Resource - /// + /// Default Api Version. + /// 2018-09-15. /// /// /// /// The name of the disk. /// Specify the $expand query. Example: 'properties($select=diskType)'. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. - public virtual async Task> GetAsync(string name, string expand = null, CancellationToken cancellationToken = default) + /// is an empty string, and was expected to be non-empty. + public virtual async Task> GetAsync(string name, string expand = default, CancellationToken cancellationToken = default) { Argument.AssertNotNullOrEmpty(name, nameof(name)); - using var scope = _devTestLabDiskDisksClientDiagnostics.CreateScope("DevTestLabDiskCollection.Get"); + using DiagnosticScope scope = _disksClientDiagnostics.CreateScope("DevTestLabDiskCollection.Get"); scope.Start(); try { - var response = await _devTestLabDiskDisksRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, name, expand, cancellationToken).ConfigureAwait(false); + RequestContext context = new RequestContext + { + CancellationToken = cancellationToken + }; + HttpMessage message = _disksRestClient.CreateGetRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, name, expand, context); + Response result = await Pipeline.ProcessMessageAsync(message, context).ConfigureAwait(false); + Response response = Response.FromValue(DevTestLabDiskData.FromResponse(result), result); if (response.Value == null) + { throw new RequestFailedException(response.GetRawResponse()); + } return Response.FromValue(new DevTestLabDiskResource(Client, response.Value), response.GetRawResponse()); } catch (Exception e) @@ -199,39 +224,43 @@ public virtual async Task> GetAsync(string name /// Get disk. /// /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/users/{userName}/disks/{name} - /// - /// - /// Operation Id - /// Disks_Get + /// Request Path. + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/users/{userName}/disks/{name}. /// /// - /// Default Api Version - /// 2018-09-15 + /// Operation Id. + /// Disks_Get. /// /// - /// Resource - /// + /// Default Api Version. + /// 2018-09-15. /// /// /// /// The name of the disk. /// Specify the $expand query. Example: 'properties($select=diskType)'. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. - public virtual Response Get(string name, string expand = null, CancellationToken cancellationToken = default) + /// is an empty string, and was expected to be non-empty. + public virtual Response Get(string name, string expand = default, CancellationToken cancellationToken = default) { Argument.AssertNotNullOrEmpty(name, nameof(name)); - using var scope = _devTestLabDiskDisksClientDiagnostics.CreateScope("DevTestLabDiskCollection.Get"); + using DiagnosticScope scope = _disksClientDiagnostics.CreateScope("DevTestLabDiskCollection.Get"); scope.Start(); try { - var response = _devTestLabDiskDisksRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, name, expand, cancellationToken); + RequestContext context = new RequestContext + { + CancellationToken = cancellationToken + }; + HttpMessage message = _disksRestClient.CreateGetRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, name, expand, context); + Response result = Pipeline.ProcessMessage(message, context); + Response response = Response.FromValue(DevTestLabDiskData.FromResponse(result), result); if (response.Value == null) + { throw new RequestFailedException(response.GetRawResponse()); + } return Response.FromValue(new DevTestLabDiskResource(Client, response.Value), response.GetRawResponse()); } catch (Exception e) @@ -245,20 +274,16 @@ public virtual Response Get(string name, string expand = /// List disks in a given user profile. /// /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/users/{userName}/disks + /// Request Path. + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/users/{userName}/disks. /// /// - /// Operation Id - /// Disks_List + /// Operation Id. + /// Disks_List. /// /// - /// Default Api Version - /// 2018-09-15 - /// - /// - /// Resource - /// + /// Default Api Version. + /// 2018-09-15. /// /// /// @@ -267,32 +292,40 @@ public virtual Response Get(string name, string expand = /// The maximum number of resources to return from the operation. Example: '$top=10'. /// The ordering expression for the results, using OData notation. Example: '$orderby=name desc'. /// The cancellation token to use. - /// An async collection of that may take multiple service requests to iterate over. - public virtual AsyncPageable GetAllAsync(string expand = null, string filter = null, int? top = null, string orderby = null, CancellationToken cancellationToken = default) + /// A collection of that may take multiple service requests to iterate over. + public virtual AsyncPageable GetAllAsync(string expand = default, string filter = default, int? top = default, string @orderby = default, CancellationToken cancellationToken = default) { - HttpMessage FirstPageRequest(int? pageSizeHint) => _devTestLabDiskDisksRestClient.CreateListRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, expand, filter, top, orderby); - HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _devTestLabDiskDisksRestClient.CreateListNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, expand, filter, top, orderby); - return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new DevTestLabDiskResource(Client, DevTestLabDiskData.DeserializeDevTestLabDiskData(e)), _devTestLabDiskDisksClientDiagnostics, Pipeline, "DevTestLabDiskCollection.GetAll", "value", "nextLink", cancellationToken); + RequestContext context = new RequestContext + { + CancellationToken = cancellationToken + }; + return new AsyncPageableWrapper(new DisksGetAllAsyncCollectionResultOfT( + _disksRestClient, + Id.SubscriptionId, + Id.ResourceGroupName, + Id.Parent.Name, + Id.Name, + expand, + filter, + top, + @orderby, + context), data => new DevTestLabDiskResource(Client, data)); } /// /// List disks in a given user profile. /// /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/users/{userName}/disks - /// - /// - /// Operation Id - /// Disks_List + /// Request Path. + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/users/{userName}/disks. /// /// - /// Default Api Version - /// 2018-09-15 + /// Operation Id. + /// Disks_List. /// /// - /// Resource - /// + /// Default Api Version. + /// 2018-09-15. /// /// /// @@ -302,48 +335,74 @@ public virtual AsyncPageable GetAllAsync(string expand = /// The ordering expression for the results, using OData notation. Example: '$orderby=name desc'. /// The cancellation token to use. /// A collection of that may take multiple service requests to iterate over. - public virtual Pageable GetAll(string expand = null, string filter = null, int? top = null, string orderby = null, CancellationToken cancellationToken = default) + public virtual Pageable GetAll(string expand = default, string filter = default, int? top = default, string @orderby = default, CancellationToken cancellationToken = default) { - HttpMessage FirstPageRequest(int? pageSizeHint) => _devTestLabDiskDisksRestClient.CreateListRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, expand, filter, top, orderby); - HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _devTestLabDiskDisksRestClient.CreateListNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, expand, filter, top, orderby); - return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new DevTestLabDiskResource(Client, DevTestLabDiskData.DeserializeDevTestLabDiskData(e)), _devTestLabDiskDisksClientDiagnostics, Pipeline, "DevTestLabDiskCollection.GetAll", "value", "nextLink", cancellationToken); + RequestContext context = new RequestContext + { + CancellationToken = cancellationToken + }; + return new PageableWrapper(new DisksGetAllCollectionResultOfT( + _disksRestClient, + Id.SubscriptionId, + Id.ResourceGroupName, + Id.Parent.Name, + Id.Name, + expand, + filter, + top, + @orderby, + context), data => new DevTestLabDiskResource(Client, data)); } /// /// Checks to see if the resource exists in azure. /// /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/users/{userName}/disks/{name} - /// - /// - /// Operation Id - /// Disks_Get + /// Request Path. + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/users/{userName}/disks/{name}. /// /// - /// Default Api Version - /// 2018-09-15 + /// Operation Id. + /// Disks_Get. /// /// - /// Resource - /// + /// Default Api Version. + /// 2018-09-15. /// /// /// /// The name of the disk. /// Specify the $expand query. Example: 'properties($select=diskType)'. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. - public virtual async Task> ExistsAsync(string name, string expand = null, CancellationToken cancellationToken = default) + /// is an empty string, and was expected to be non-empty. + public virtual async Task> ExistsAsync(string name, string expand = default, CancellationToken cancellationToken = default) { Argument.AssertNotNullOrEmpty(name, nameof(name)); - using var scope = _devTestLabDiskDisksClientDiagnostics.CreateScope("DevTestLabDiskCollection.Exists"); + using DiagnosticScope scope = _disksClientDiagnostics.CreateScope("DevTestLabDiskCollection.Exists"); scope.Start(); try { - var response = await _devTestLabDiskDisksRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, name, expand, cancellationToken: cancellationToken).ConfigureAwait(false); + RequestContext context = new RequestContext + { + CancellationToken = cancellationToken + }; + HttpMessage message = _disksRestClient.CreateGetRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, name, expand, context); + await Pipeline.SendAsync(message, context.CancellationToken).ConfigureAwait(false); + Response result = message.Response; + Response response = default; + switch (result.Status) + { + case 200: + response = Response.FromValue(DevTestLabDiskData.FromResponse(result), result); + break; + case 404: + response = Response.FromValue((DevTestLabDiskData)null, result); + break; + default: + throw new RequestFailedException(result); + } return Response.FromValue(response.Value != null, response.GetRawResponse()); } catch (Exception e) @@ -357,37 +416,51 @@ public virtual async Task> ExistsAsync(string name, string expand /// Checks to see if the resource exists in azure. /// /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/users/{userName}/disks/{name} + /// Request Path. + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/users/{userName}/disks/{name}. /// /// - /// Operation Id - /// Disks_Get + /// Operation Id. + /// Disks_Get. /// /// - /// Default Api Version - /// 2018-09-15 - /// - /// - /// Resource - /// + /// Default Api Version. + /// 2018-09-15. /// /// /// /// The name of the disk. /// Specify the $expand query. Example: 'properties($select=diskType)'. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. - public virtual Response Exists(string name, string expand = null, CancellationToken cancellationToken = default) + /// is an empty string, and was expected to be non-empty. + public virtual Response Exists(string name, string expand = default, CancellationToken cancellationToken = default) { Argument.AssertNotNullOrEmpty(name, nameof(name)); - using var scope = _devTestLabDiskDisksClientDiagnostics.CreateScope("DevTestLabDiskCollection.Exists"); + using DiagnosticScope scope = _disksClientDiagnostics.CreateScope("DevTestLabDiskCollection.Exists"); scope.Start(); try { - var response = _devTestLabDiskDisksRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, name, expand, cancellationToken: cancellationToken); + RequestContext context = new RequestContext + { + CancellationToken = cancellationToken + }; + HttpMessage message = _disksRestClient.CreateGetRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, name, expand, context); + Pipeline.Send(message, context.CancellationToken); + Response result = message.Response; + Response response = default; + switch (result.Status) + { + case 200: + response = Response.FromValue(DevTestLabDiskData.FromResponse(result), result); + break; + case 404: + response = Response.FromValue((DevTestLabDiskData)null, result); + break; + default: + throw new RequestFailedException(result); + } return Response.FromValue(response.Value != null, response.GetRawResponse()); } catch (Exception e) @@ -401,39 +474,55 @@ public virtual Response Exists(string name, string expand = null, Cancella /// Tries to get details for this resource from the service. /// /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/users/{userName}/disks/{name} - /// - /// - /// Operation Id - /// Disks_Get + /// Request Path. + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/users/{userName}/disks/{name}. /// /// - /// Default Api Version - /// 2018-09-15 + /// Operation Id. + /// Disks_Get. /// /// - /// Resource - /// + /// Default Api Version. + /// 2018-09-15. /// /// /// /// The name of the disk. /// Specify the $expand query. Example: 'properties($select=diskType)'. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. - public virtual async Task> GetIfExistsAsync(string name, string expand = null, CancellationToken cancellationToken = default) + /// is an empty string, and was expected to be non-empty. + public virtual async Task> GetIfExistsAsync(string name, string expand = default, CancellationToken cancellationToken = default) { Argument.AssertNotNullOrEmpty(name, nameof(name)); - using var scope = _devTestLabDiskDisksClientDiagnostics.CreateScope("DevTestLabDiskCollection.GetIfExists"); + using DiagnosticScope scope = _disksClientDiagnostics.CreateScope("DevTestLabDiskCollection.GetIfExists"); scope.Start(); try { - var response = await _devTestLabDiskDisksRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, name, expand, cancellationToken: cancellationToken).ConfigureAwait(false); + RequestContext context = new RequestContext + { + CancellationToken = cancellationToken + }; + HttpMessage message = _disksRestClient.CreateGetRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, name, expand, context); + await Pipeline.SendAsync(message, context.CancellationToken).ConfigureAwait(false); + Response result = message.Response; + Response response = default; + switch (result.Status) + { + case 200: + response = Response.FromValue(DevTestLabDiskData.FromResponse(result), result); + break; + case 404: + response = Response.FromValue((DevTestLabDiskData)null, result); + break; + default: + throw new RequestFailedException(result); + } if (response.Value == null) + { return new NoValueResponse(response.GetRawResponse()); + } return Response.FromValue(new DevTestLabDiskResource(Client, response.Value), response.GetRawResponse()); } catch (Exception e) @@ -447,39 +536,55 @@ public virtual async Task> GetIfExistsA /// Tries to get details for this resource from the service. /// /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/users/{userName}/disks/{name} + /// Request Path. + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/users/{userName}/disks/{name}. /// /// - /// Operation Id - /// Disks_Get + /// Operation Id. + /// Disks_Get. /// /// - /// Default Api Version - /// 2018-09-15 - /// - /// - /// Resource - /// + /// Default Api Version. + /// 2018-09-15. /// /// /// /// The name of the disk. /// Specify the $expand query. Example: 'properties($select=diskType)'. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. - public virtual NullableResponse GetIfExists(string name, string expand = null, CancellationToken cancellationToken = default) + /// is an empty string, and was expected to be non-empty. + public virtual NullableResponse GetIfExists(string name, string expand = default, CancellationToken cancellationToken = default) { Argument.AssertNotNullOrEmpty(name, nameof(name)); - using var scope = _devTestLabDiskDisksClientDiagnostics.CreateScope("DevTestLabDiskCollection.GetIfExists"); + using DiagnosticScope scope = _disksClientDiagnostics.CreateScope("DevTestLabDiskCollection.GetIfExists"); scope.Start(); try { - var response = _devTestLabDiskDisksRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, name, expand, cancellationToken: cancellationToken); + RequestContext context = new RequestContext + { + CancellationToken = cancellationToken + }; + HttpMessage message = _disksRestClient.CreateGetRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, name, expand, context); + Pipeline.Send(message, context.CancellationToken); + Response result = message.Response; + Response response = default; + switch (result.Status) + { + case 200: + response = Response.FromValue(DevTestLabDiskData.FromResponse(result), result); + break; + case 404: + response = Response.FromValue((DevTestLabDiskData)null, result); + break; + default: + throw new RequestFailedException(result); + } if (response.Value == null) + { return new NoValueResponse(response.GetRawResponse()); + } return Response.FromValue(new DevTestLabDiskResource(Client, response.Value), response.GetRawResponse()); } catch (Exception e) @@ -499,6 +604,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/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/DevTestLabDiskData.Serialization.cs b/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/DevTestLabDiskData.Serialization.cs index 5ececcfb6740..c60d1b11d519 100644 --- a/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/DevTestLabDiskData.Serialization.cs +++ b/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/DevTestLabDiskData.Serialization.cs @@ -10,16 +10,47 @@ using System.Collections.Generic; using System.Text; using System.Text.Json; +using Azure; using Azure.Core; using Azure.ResourceManager.DevTestLabs.Models; using Azure.ResourceManager.Models; namespace Azure.ResourceManager.DevTestLabs { - public partial class DevTestLabDiskData : IUtf8JsonSerializable, IJsonModel + /// A Disk. + public partial class DevTestLabDiskData : TrackedResourceData, IJsonModel { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + /// Initializes a new instance of for deserialization. + internal DevTestLabDiskData() + { + } + + /// 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)) + { + return DeserializeDevTestLabDiskData(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(DevTestLabDiskData)} does not support reading '{options.Format}' format."); + } + } + + /// The to deserialize the from. + internal static DevTestLabDiskData FromResponse(Response response) + { + using JsonDocument document = JsonDocument.Parse(response.Content, ModelSerializationExtensions.JsonDocumentOptions); + return DeserializeDevTestLabDiskData(document.RootElement, ModelSerializationExtensions.WireOptions); + } + /// The JSON writer. + /// The client options for reading and writing models. void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) { writer.WriteStartObject(); @@ -31,283 +62,153 @@ void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWrit /// 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(DevTestLabDiskData)} does not support writing '{format}' format."); } - base.JsonModelWriteCore(writer, options); writer.WritePropertyName("properties"u8); - writer.WriteStartObject(); - if (Optional.IsDefined(DiskType)) - { - writer.WritePropertyName("diskType"u8); - writer.WriteStringValue(DiskType.Value.ToString()); - } - if (Optional.IsDefined(DiskSizeGiB)) - { - writer.WritePropertyName("diskSizeGiB"u8); - writer.WriteNumberValue(DiskSizeGiB.Value); - } - if (Optional.IsDefined(LeasedByLabVmId)) - { - writer.WritePropertyName("leasedByLabVmId"u8); - writer.WriteStringValue(LeasedByLabVmId); - } - if (Optional.IsDefined(DiskBlobName)) + writer.WriteObjectValue(Properties, options); + if (Optional.IsCollectionDefined(Tags)) { - writer.WritePropertyName("diskBlobName"u8); - writer.WriteStringValue(DiskBlobName); - } - if (Optional.IsDefined(DiskUri)) - { - writer.WritePropertyName("diskUri"u8); - writer.WriteStringValue(DiskUri.AbsoluteUri); - } - if (Optional.IsDefined(StorageAccountId)) - { - writer.WritePropertyName("storageAccountId"u8); - writer.WriteStringValue(StorageAccountId); - } - if (options.Format != "W" && Optional.IsDefined(CreatedOn)) - { - writer.WritePropertyName("createdDate"u8); - writer.WriteStringValue(CreatedOn.Value, "O"); - } - if (Optional.IsDefined(HostCaching)) - { - writer.WritePropertyName("hostCaching"u8); - writer.WriteStringValue(HostCaching); - } - if (Optional.IsDefined(ManagedDiskId)) - { - writer.WritePropertyName("managedDiskId"u8); - writer.WriteStringValue(ManagedDiskId); - } - if (options.Format != "W" && Optional.IsDefined(ProvisioningState)) - { - writer.WritePropertyName("provisioningState"u8); - writer.WriteStringValue(ProvisioningState); - } - if (options.Format != "W" && Optional.IsDefined(UniqueIdentifier)) - { - writer.WritePropertyName("uniqueIdentifier"u8); - writer.WriteStringValue(UniqueIdentifier.Value); + writer.WritePropertyName("tags"u8); + writer.WriteStartObject(); + foreach (var item in Tags) + { + writer.WritePropertyName(item.Key); + if (item.Value == null) + { + writer.WriteNullValue(); + continue; + } + writer.WriteStringValue(item.Value); + } + writer.WriteEndObject(); } - writer.WriteEndObject(); } - DevTestLabDiskData IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + /// The JSON reader. + /// The client options for reading and writing models. + DevTestLabDiskData IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) => (DevTestLabDiskData)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(DevTestLabDiskData)} does not support reading '{format}' format."); } - using JsonDocument document = JsonDocument.ParseValue(ref reader); return DeserializeDevTestLabDiskData(document.RootElement, options); } - internal static DevTestLabDiskData DeserializeDevTestLabDiskData(JsonElement element, ModelReaderWriterOptions options = null) + /// The JSON element to deserialize. + /// The client options for reading and writing models. + internal static DevTestLabDiskData DeserializeDevTestLabDiskData(JsonElement element, ModelReaderWriterOptions options) { - options ??= ModelSerializationExtensions.WireOptions; - if (element.ValueKind == JsonValueKind.Null) { return null; } - IDictionary tags = default; - AzureLocation location = default; ResourceIdentifier id = default; string name = default; - ResourceType type = default; + ResourceType resourceType = default; SystemData systemData = default; - DevTestLabStorageType? diskType = default; - int? diskSizeGiB = default; - ResourceIdentifier leasedByLabVmId = default; - string diskBlobName = default; - Uri diskUri = default; - string storageAccountId = default; - DateTimeOffset? createdDate = default; - string hostCaching = default; - ResourceIdentifier managedDiskId = default; - string provisioningState = default; - Guid? uniqueIdentifier = default; - IDictionary serializedAdditionalRawData = default; - Dictionary rawDataDictionary = new Dictionary(); - foreach (var property in element.EnumerateObject()) + IDictionary additionalBinaryDataProperties = new ChangeTrackingDictionary(); + AzureLocation location = default; + DiskProperties properties = default; + IDictionary tags = default; + foreach (var prop in element.EnumerateObject()) { - if (property.NameEquals("tags"u8)) + if (prop.NameEquals("id"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()) - { - dictionary.Add(property0.Name, property0.Value.GetString()); - } - tags = dictionary; + id = new ResourceIdentifier(prop.Value.GetString()); continue; } - if (property.NameEquals("location"u8)) + if (prop.NameEquals("name"u8)) { - location = new AzureLocation(property.Value.GetString()); + name = prop.Value.GetString(); continue; } - if (property.NameEquals("id"u8)) + if (prop.NameEquals("type"u8)) { - id = new ResourceIdentifier(property.Value.GetString()); + if (prop.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + resourceType = new ResourceType(prop.Value.GetString()); continue; } - if (property.NameEquals("name"u8)) + if (prop.NameEquals("systemData"u8)) { - name = property.Value.GetString(); + if (prop.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + systemData = ModelReaderWriter.Read(new BinaryData(Encoding.UTF8.GetBytes(prop.Value.GetRawText())), ModelSerializationExtensions.WireOptions, AzureResourceManagerDevTestLabsContext.Default); 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) - { - continue; - } - systemData = ModelReaderWriter.Read(new BinaryData(Encoding.UTF8.GetBytes(property.Value.GetRawText())), ModelSerializationExtensions.WireOptions, AzureResourceManagerDevTestLabsContext.Default); + properties = DiskProperties.DeserializeDiskProperties(prop.Value, options); continue; } - if (property.NameEquals("properties"u8)) + if (prop.NameEquals("tags"u8)) { - if (property.Value.ValueKind == JsonValueKind.Null) + if (prop.Value.ValueKind == JsonValueKind.Null) { - property.ThrowNonNullablePropertyIsNull(); continue; } - foreach (var property0 in property.Value.EnumerateObject()) + Dictionary dictionary = new Dictionary(); + foreach (var prop0 in prop.Value.EnumerateObject()) { - if (property0.NameEquals("diskType"u8)) - { - if (property0.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - diskType = new DevTestLabStorageType(property0.Value.GetString()); - continue; - } - if (property0.NameEquals("diskSizeGiB"u8)) - { - if (property0.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - diskSizeGiB = property0.Value.GetInt32(); - continue; - } - if (property0.NameEquals("leasedByLabVmId"u8)) - { - if (property0.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - leasedByLabVmId = new ResourceIdentifier(property0.Value.GetString()); - continue; - } - if (property0.NameEquals("diskBlobName"u8)) - { - diskBlobName = property0.Value.GetString(); - continue; - } - if (property0.NameEquals("diskUri"u8)) - { - if (property0.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - diskUri = new Uri(property0.Value.GetString()); - continue; - } - if (property0.NameEquals("storageAccountId"u8)) - { - storageAccountId = property0.Value.GetString(); - continue; - } - if (property0.NameEquals("createdDate"u8)) + if (prop0.Value.ValueKind == JsonValueKind.Null) { - if (property0.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - createdDate = property0.Value.GetDateTimeOffset("O"); - continue; + dictionary.Add(prop0.Name, null); } - if (property0.NameEquals("hostCaching"u8)) + else { - hostCaching = property0.Value.GetString(); - continue; - } - if (property0.NameEquals("managedDiskId"u8)) - { - if (property0.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - managedDiskId = new ResourceIdentifier(property0.Value.GetString()); - continue; - } - if (property0.NameEquals("provisioningState"u8)) - { - provisioningState = property0.Value.GetString(); - continue; - } - if (property0.NameEquals("uniqueIdentifier"u8)) - { - if (property0.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - uniqueIdentifier = property0.Value.GetGuid(); - continue; + dictionary.Add(prop0.Name, prop0.Value.GetString()); } } + tags = dictionary; 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 DevTestLabDiskData( id, name, - type, + resourceType, systemData, - tags ?? new ChangeTrackingDictionary(), + additionalBinaryDataProperties, location, - diskType, - diskSizeGiB, - leasedByLabVmId, - diskBlobName, - diskUri, - storageAccountId, - createdDate, - hostCaching, - managedDiskId, - provisioningState, - uniqueIdentifier, - serializedAdditionalRawData); + properties, + tags ?? new ChangeTrackingDictionary()); } - 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": @@ -317,22 +218,23 @@ BinaryData IPersistableModel.Write(ModelReaderWriterOptions } } - DevTestLabDiskData 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. + DevTestLabDiskData IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) => (DevTestLabDiskData)PersistableModelCreateCore(data, options); - switch (format) + /// The client options for reading and writing models. + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + + /// The to serialize into . + internal static RequestContent ToRequestContent(DevTestLabDiskData devTestLabDiskData) + { + if (devTestLabDiskData == null) { - case "J": - { - using JsonDocument document = JsonDocument.Parse(data, ModelSerializationExtensions.JsonDocumentOptions); - return DeserializeDevTestLabDiskData(document.RootElement, options); - } - default: - throw new FormatException($"The model {nameof(DevTestLabDiskData)} does not support reading '{options.Format}' format."); + return null; } + Utf8JsonRequestContent content = new Utf8JsonRequestContent(); + content.JsonWriter.WriteObjectValue(devTestLabDiskData, ModelSerializationExtensions.WireOptions); + return content; } - - string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; } } diff --git a/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/DevTestLabDiskData.cs b/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/DevTestLabDiskData.cs index 841d46edb3e0..c895935777e5 100644 --- a/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/DevTestLabDiskData.cs +++ b/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/DevTestLabDiskData.cs @@ -13,111 +13,198 @@ namespace Azure.ResourceManager.DevTestLabs { - /// - /// A class representing the DevTestLabDisk data model. - /// A Disk. - /// + /// A Disk. public partial class DevTestLabDiskData : 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 DevTestLabDiskData(AzureLocation location) : base(location) { + } /// Initializes a new instance of . - /// The id. - /// The name. - /// The resourceType. - /// The systemData. - /// The tags. - /// The location. - /// The storage type for the disk (i.e. Standard, Premium). - /// The size of the disk in Gibibytes. - /// The resource ID of the VM to which this disk is leased. - /// When backed by a blob, the name of the VHD blob without extension. - /// When backed by a blob, the URI of underlying blob. - /// When backed by a blob, the storage account where the blob is. - /// The creation date of the disk. - /// The host caching policy of the disk (i.e. None, ReadOnly, ReadWrite). - /// When backed by managed disk, this is the ID of the compute disk resource. - /// The provisioning status of the resource. - /// The unique immutable identifier of a resource (Guid). - /// Keeps track of any properties unknown to the library. - internal DevTestLabDiskData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, IDictionary tags, AzureLocation location, DevTestLabStorageType? diskType, int? diskSizeGiB, ResourceIdentifier leasedByLabVmId, string diskBlobName, Uri diskUri, string storageAccountId, DateTimeOffset? createdOn, string hostCaching, ResourceIdentifier managedDiskId, string provisioningState, Guid? uniqueIdentifier, IDictionary serializedAdditionalRawData) : base(id, name, resourceType, systemData, tags, 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. + /// The geo-location where the resource lives. + /// The properties of the disk. + /// Resource tags. + internal DevTestLabDiskData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, IDictionary additionalBinaryDataProperties, AzureLocation location, DiskProperties properties, IDictionary tags) : base(id, name, resourceType, systemData, tags, location) { - DiskType = diskType; - DiskSizeGiB = diskSizeGiB; - LeasedByLabVmId = leasedByLabVmId; - DiskBlobName = diskBlobName; - DiskUri = diskUri; - StorageAccountId = storageAccountId; - CreatedOn = createdOn; - HostCaching = hostCaching; - ManagedDiskId = managedDiskId; - ProvisioningState = provisioningState; - UniqueIdentifier = uniqueIdentifier; - _serializedAdditionalRawData = serializedAdditionalRawData; + _additionalBinaryDataProperties = additionalBinaryDataProperties; + Properties = properties; } - /// Initializes a new instance of for deserialization. - internal DevTestLabDiskData() + /// The properties of the disk. + internal DiskProperties Properties { get; set; } + + /// The storage type for the disk (i.e. Standard, Premium). + public DevTestLabStorageType? DiskType { + get + { + return Properties is null ? default : Properties.DiskType; + } + set + { + if (Properties is null) + { + Properties = new DiskProperties(); + } + Properties.DiskType = value.Value; + } } - /// The storage type for the disk (i.e. Standard, Premium). - public DevTestLabStorageType? DiskType { get; set; } /// The size of the disk in Gibibytes. - public int? DiskSizeGiB { get; set; } + public int? DiskSizeGiB + { + get + { + return Properties is null ? default : Properties.DiskSizeGiB; + } + set + { + if (Properties is null) + { + Properties = new DiskProperties(); + } + Properties.DiskSizeGiB = value.Value; + } + } + /// The resource ID of the VM to which this disk is leased. - public ResourceIdentifier LeasedByLabVmId { get; set; } + public ResourceIdentifier LeasedByLabVmId + { + get + { + return Properties is null ? default : Properties.LeasedByLabVmId; + } + set + { + if (Properties is null) + { + Properties = new DiskProperties(); + } + Properties.LeasedByLabVmId = value; + } + } + /// When backed by a blob, the name of the VHD blob without extension. - public string DiskBlobName { get; set; } + public string DiskBlobName + { + get + { + return Properties is null ? default : Properties.DiskBlobName; + } + set + { + if (Properties is null) + { + Properties = new DiskProperties(); + } + Properties.DiskBlobName = value; + } + } + /// When backed by a blob, the URI of underlying blob. - public Uri DiskUri { get; set; } + public Uri DiskUri + { + get + { + return Properties is null ? default : Properties.DiskUri; + } + set + { + if (Properties is null) + { + Properties = new DiskProperties(); + } + Properties.DiskUri = value; + } + } + /// When backed by a blob, the storage account where the blob is. - public string StorageAccountId { get; set; } + public string StorageAccountId + { + get + { + return Properties is null ? default : Properties.StorageAccountId; + } + set + { + if (Properties is null) + { + Properties = new DiskProperties(); + } + Properties.StorageAccountId = value; + } + } + /// The creation date of the disk. - public DateTimeOffset? CreatedOn { get; } + public DateTimeOffset? CreatedOn + { + get + { + return Properties is null ? default : Properties.CreatedOn; + } + } + /// The host caching policy of the disk (i.e. None, ReadOnly, ReadWrite). - public string HostCaching { get; set; } + public string HostCaching + { + get + { + return Properties is null ? default : Properties.HostCaching; + } + set + { + if (Properties is null) + { + Properties = new DiskProperties(); + } + Properties.HostCaching = value; + } + } + /// When backed by managed disk, this is the ID of the compute disk resource. - public ResourceIdentifier ManagedDiskId { get; set; } + public ResourceIdentifier ManagedDiskId + { + get + { + return Properties is null ? default : Properties.ManagedDiskId; + } + set + { + if (Properties is null) + { + Properties = new DiskProperties(); + } + Properties.ManagedDiskId = value; + } + } + /// The provisioning status of the resource. - public string ProvisioningState { get; } + public string ProvisioningState + { + get + { + return Properties is null ? default : Properties.ProvisioningState; + } + } + /// The unique immutable identifier of a resource (Guid). - public Guid? UniqueIdentifier { get; } + public Guid? UniqueIdentifier + { + get + { + return Properties is null ? default : Properties.UniqueIdentifier; + } + } } } diff --git a/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/DevTestLabDiskResource.Serialization.cs b/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/DevTestLabDiskResource.Serialization.cs index e800febe9b7b..648d40948cdd 100644 --- a/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/DevTestLabDiskResource.Serialization.cs +++ b/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/DevTestLabDiskResource.Serialization.cs @@ -11,19 +11,29 @@ namespace Azure.ResourceManager.DevTestLabs { + /// public partial class DevTestLabDiskResource : IJsonModel { - private static DevTestLabDiskData s_dataDeserializationInstance; - private static DevTestLabDiskData DataDeserializationInstance => s_dataDeserializationInstance ??= new(); + private static IJsonModel s_dataDeserializationInstance; + private static IJsonModel DataDeserializationInstance => s_dataDeserializationInstance ??= new DevTestLabDiskData(); + + /// 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); - DevTestLabDiskData 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. + DevTestLabDiskData 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, AzureResourceManagerDevTestLabsContext.Default); + /// The binary data to be processed. + /// The client options for reading and writing models. DevTestLabDiskData IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) => ModelReaderWriter.Read(data, options, AzureResourceManagerDevTestLabsContext.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/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/DevTestLabDiskResource.cs b/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/DevTestLabDiskResource.cs index bdd5a230e64b..467f6cfd0bc1 100644 --- a/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/DevTestLabDiskResource.cs +++ b/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/DevTestLabDiskResource.cs @@ -7,48 +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.DevTestLabs.Models; +using Azure.ResourceManager.Resources; namespace Azure.ResourceManager.DevTestLabs { /// - /// A Class representing a DevTestLabDisk 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 GetDevTestLabDiskResource method. - /// Otherwise you can get one from its parent resource using the GetDevTestLabDisk method. + /// A class representing a DevTestLabDisk 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 GetDevTestLabDisks method. /// public partial class DevTestLabDiskResource : ArmResource { - /// Generate the resource identifier of a instance. - /// The subscriptionId. - /// The resourceGroupName. - /// The labName. - /// The userName. - /// The name. - public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string labName, string userName, string name) - { - var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/users/{userName}/disks/{name}"; - return new ResourceIdentifier(resourceId); - } - - private readonly ClientDiagnostics _devTestLabDiskDisksClientDiagnostics; - private readonly DisksRestOperations _devTestLabDiskDisksRestClient; + private readonly ClientDiagnostics _disksClientDiagnostics; + private readonly Disks _disksRestClient; private readonly DevTestLabDiskData _data; - /// Gets the resource type for the operations. public static readonly ResourceType ResourceType = "Microsoft.DevTestLab/labs/users/disks"; - /// Initializes a new instance of the class for mocking. + /// Initializes a new instance of DevTestLabDiskResource for mocking. protected DevTestLabDiskResource() { } - /// 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 DevTestLabDiskResource(ArmClient client, DevTestLabDiskData data) : this(client, data.Id) @@ -57,72 +46,95 @@ internal DevTestLabDiskResource(ArmClient client, DevTestLabDiskData data) : thi _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 DevTestLabDiskResource(ArmClient client, ResourceIdentifier id) : base(client, id) { - _devTestLabDiskDisksClientDiagnostics = new ClientDiagnostics("Azure.ResourceManager.DevTestLabs", ResourceType.Namespace, Diagnostics); - TryGetApiVersion(ResourceType, out string devTestLabDiskDisksApiVersion); - _devTestLabDiskDisksRestClient = new DisksRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, devTestLabDiskDisksApiVersion); -#if DEBUG - ValidateResourceId(Id); -#endif + TryGetApiVersion(ResourceType, out string devTestLabDiskApiVersion); + _disksClientDiagnostics = new ClientDiagnostics("Azure.ResourceManager.DevTestLabs", ResourceType.Namespace, Diagnostics); + _disksRestClient = new Disks(_disksClientDiagnostics, Pipeline, Endpoint, devTestLabDiskApiVersion ?? "2018-09-15"); + 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 DevTestLabDiskData 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 labName. + /// The userName. + /// The name. + public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string labName, string userName, string name) + { + string resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/users/{userName}/disks/{name}"; + 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 disk. /// /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/users/{userName}/disks/{name} + /// Request Path. + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/users/{userName}/disks/{name}. /// /// - /// Operation Id - /// Disks_Get + /// Operation Id. + /// Disks_Get. /// /// - /// Default Api Version - /// 2018-09-15 + /// Default Api Version. + /// 2018-09-15. /// /// - /// Resource - /// + /// Resource. + /// . /// /// /// /// Specify the $expand query. Example: 'properties($select=diskType)'. /// The cancellation token to use. - public virtual async Task> GetAsync(string expand = null, CancellationToken cancellationToken = default) + public virtual async Task> GetAsync(string expand = default, CancellationToken cancellationToken = default) { - using var scope = _devTestLabDiskDisksClientDiagnostics.CreateScope("DevTestLabDiskResource.Get"); + using DiagnosticScope scope = _disksClientDiagnostics.CreateScope("DevTestLabDiskResource.Get"); scope.Start(); try { - var response = await _devTestLabDiskDisksRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, expand, cancellationToken).ConfigureAwait(false); + RequestContext context = new RequestContext + { + CancellationToken = cancellationToken + }; + HttpMessage message = _disksRestClient.CreateGetRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, expand, context); + Response result = await Pipeline.ProcessMessageAsync(message, context).ConfigureAwait(false); + Response response = Response.FromValue(DevTestLabDiskData.FromResponse(result), result); if (response.Value == null) + { throw new RequestFailedException(response.GetRawResponse()); + } return Response.FromValue(new DevTestLabDiskResource(Client, response.Value), response.GetRawResponse()); } catch (Exception e) @@ -136,34 +148,42 @@ public virtual async Task> GetAsync(string expa /// Get disk. /// /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/users/{userName}/disks/{name} + /// Request Path. + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/users/{userName}/disks/{name}. /// /// - /// Operation Id - /// Disks_Get + /// Operation Id. + /// Disks_Get. /// /// - /// Default Api Version - /// 2018-09-15 + /// Default Api Version. + /// 2018-09-15. /// /// - /// Resource - /// + /// Resource. + /// . /// /// /// /// Specify the $expand query. Example: 'properties($select=diskType)'. /// The cancellation token to use. - public virtual Response Get(string expand = null, CancellationToken cancellationToken = default) + public virtual Response Get(string expand = default, CancellationToken cancellationToken = default) { - using var scope = _devTestLabDiskDisksClientDiagnostics.CreateScope("DevTestLabDiskResource.Get"); + using DiagnosticScope scope = _disksClientDiagnostics.CreateScope("DevTestLabDiskResource.Get"); scope.Start(); try { - var response = _devTestLabDiskDisksRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, expand, cancellationToken); + RequestContext context = new RequestContext + { + CancellationToken = cancellationToken + }; + HttpMessage message = _disksRestClient.CreateGetRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, expand, context); + Response result = Pipeline.ProcessMessage(message, context); + Response response = Response.FromValue(DevTestLabDiskData.FromResponse(result), result); if (response.Value == null) + { throw new RequestFailedException(response.GetRawResponse()); + } return Response.FromValue(new DevTestLabDiskResource(Client, response.Value), response.GetRawResponse()); } catch (Exception e) @@ -174,39 +194,49 @@ public virtual Response Get(string expand = null, Cancel } /// - /// Delete disk. This operation can take a while to complete. + /// Allows modifying tags of disks. All other properties will be ignored. /// /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/users/{userName}/disks/{name} + /// Request Path. + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/users/{userName}/disks/{name}. /// /// - /// Operation Id - /// Disks_Delete + /// Operation Id. + /// Disks_Update. /// /// - /// Default Api Version - /// 2018-09-15 + /// Default Api Version. + /// 2018-09-15. /// /// - /// Resource - /// + /// Resource. + /// . /// /// /// - /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. + /// A Disk. /// The cancellation token to use. - public virtual async Task DeleteAsync(WaitUntil waitUntil, CancellationToken cancellationToken = default) + /// is null. + public virtual async Task> UpdateAsync(DevTestLabDiskPatch patch, CancellationToken cancellationToken = default) { - using var scope = _devTestLabDiskDisksClientDiagnostics.CreateScope("DevTestLabDiskResource.Delete"); + Argument.AssertNotNull(patch, nameof(patch)); + + using DiagnosticScope scope = _disksClientDiagnostics.CreateScope("DevTestLabDiskResource.Update"); scope.Start(); try { - var response = await _devTestLabDiskDisksRestClient.DeleteAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, cancellationToken).ConfigureAwait(false); - var operation = new DevTestLabsArmOperation(_devTestLabDiskDisksClientDiagnostics, Pipeline, _devTestLabDiskDisksRestClient.CreateDeleteRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name).Request, response, OperationFinalStateVia.Location); - if (waitUntil == WaitUntil.Completed) - await operation.WaitForCompletionResponseAsync(cancellationToken).ConfigureAwait(false); - return operation; + RequestContext context = new RequestContext + { + CancellationToken = cancellationToken + }; + HttpMessage message = _disksRestClient.CreateUpdateRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, DevTestLabDiskPatch.ToRequestContent(patch), context); + Response result = await Pipeline.ProcessMessageAsync(message, context).ConfigureAwait(false); + Response response = Response.FromValue(DevTestLabDiskData.FromResponse(result), result); + if (response.Value == null) + { + throw new RequestFailedException(response.GetRawResponse()); + } + return Response.FromValue(new DevTestLabDiskResource(Client, response.Value), response.GetRawResponse()); } catch (Exception e) { @@ -216,39 +246,49 @@ public virtual async Task DeleteAsync(WaitUntil waitUntil, Cancell } /// - /// Delete disk. This operation can take a while to complete. + /// Allows modifying tags of disks. All other properties will be ignored. /// /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/users/{userName}/disks/{name} + /// Request Path. + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/users/{userName}/disks/{name}. /// /// - /// Operation Id - /// Disks_Delete + /// Operation Id. + /// Disks_Update. /// /// - /// Default Api Version - /// 2018-09-15 + /// Default Api Version. + /// 2018-09-15. /// /// - /// Resource - /// + /// Resource. + /// . /// /// /// - /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. + /// A Disk. /// The cancellation token to use. - public virtual ArmOperation Delete(WaitUntil waitUntil, CancellationToken cancellationToken = default) + /// is null. + public virtual Response Update(DevTestLabDiskPatch patch, CancellationToken cancellationToken = default) { - using var scope = _devTestLabDiskDisksClientDiagnostics.CreateScope("DevTestLabDiskResource.Delete"); + Argument.AssertNotNull(patch, nameof(patch)); + + using DiagnosticScope scope = _disksClientDiagnostics.CreateScope("DevTestLabDiskResource.Update"); scope.Start(); try { - var response = _devTestLabDiskDisksRestClient.Delete(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, cancellationToken); - var operation = new DevTestLabsArmOperation(_devTestLabDiskDisksClientDiagnostics, Pipeline, _devTestLabDiskDisksRestClient.CreateDeleteRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name).Request, response, OperationFinalStateVia.Location); - if (waitUntil == WaitUntil.Completed) - operation.WaitForCompletionResponse(cancellationToken); - return operation; + RequestContext context = new RequestContext + { + CancellationToken = cancellationToken + }; + HttpMessage message = _disksRestClient.CreateUpdateRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, DevTestLabDiskPatch.ToRequestContent(patch), context); + Response result = Pipeline.ProcessMessage(message, context); + Response response = Response.FromValue(DevTestLabDiskData.FromResponse(result), result); + if (response.Value == null) + { + throw new RequestFailedException(response.GetRawResponse()); + } + return Response.FromValue(new DevTestLabDiskResource(Client, response.Value), response.GetRawResponse()); } catch (Exception e) { @@ -258,39 +298,46 @@ public virtual ArmOperation Delete(WaitUntil waitUntil, CancellationToken cancel } /// - /// Allows modifying tags of disks. All other properties will be ignored. + /// Delete disk. This operation can take a while to complete. /// /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/users/{userName}/disks/{name} + /// Request Path. + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/users/{userName}/disks/{name}. /// /// - /// Operation Id - /// Disks_Update + /// Operation Id. + /// Disks_Delete. /// /// - /// Default Api Version - /// 2018-09-15 + /// Default Api Version. + /// 2018-09-15. /// /// - /// Resource - /// + /// Resource. + /// . /// /// /// - /// A Disk. + /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. /// The cancellation token to use. - /// is null. - public virtual async Task> UpdateAsync(DevTestLabDiskPatch patch, CancellationToken cancellationToken = default) + public virtual async Task DeleteAsync(WaitUntil waitUntil, CancellationToken cancellationToken = default) { - Argument.AssertNotNull(patch, nameof(patch)); - - using var scope = _devTestLabDiskDisksClientDiagnostics.CreateScope("DevTestLabDiskResource.Update"); + using DiagnosticScope scope = _disksClientDiagnostics.CreateScope("DevTestLabDiskResource.Delete"); scope.Start(); try { - var response = await _devTestLabDiskDisksRestClient.UpdateAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, patch, cancellationToken).ConfigureAwait(false); - return Response.FromValue(new DevTestLabDiskResource(Client, response.Value), response.GetRawResponse()); + RequestContext context = new RequestContext + { + CancellationToken = cancellationToken + }; + HttpMessage message = _disksRestClient.CreateDeleteRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, context); + Response response = await Pipeline.ProcessMessageAsync(message, context).ConfigureAwait(false); + DevTestLabsArmOperation operation = new DevTestLabsArmOperation(_disksClientDiagnostics, Pipeline, message.Request, response, OperationFinalStateVia.Location); + if (waitUntil == WaitUntil.Completed) + { + await operation.WaitForCompletionResponseAsync(cancellationToken).ConfigureAwait(false); + } + return operation; } catch (Exception e) { @@ -300,39 +347,46 @@ public virtual async Task> UpdateAsync(DevTestL } /// - /// Allows modifying tags of disks. All other properties will be ignored. + /// Delete disk. This operation can take a while to complete. /// /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/users/{userName}/disks/{name} + /// Request Path. + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/users/{userName}/disks/{name}. /// /// - /// Operation Id - /// Disks_Update + /// Operation Id. + /// Disks_Delete. /// /// - /// Default Api Version - /// 2018-09-15 + /// Default Api Version. + /// 2018-09-15. /// /// - /// Resource - /// + /// Resource. + /// . /// /// /// - /// A Disk. + /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. /// The cancellation token to use. - /// is null. - public virtual Response Update(DevTestLabDiskPatch patch, CancellationToken cancellationToken = default) + public virtual ArmOperation Delete(WaitUntil waitUntil, CancellationToken cancellationToken = default) { - Argument.AssertNotNull(patch, nameof(patch)); - - using var scope = _devTestLabDiskDisksClientDiagnostics.CreateScope("DevTestLabDiskResource.Update"); + using DiagnosticScope scope = _disksClientDiagnostics.CreateScope("DevTestLabDiskResource.Delete"); scope.Start(); try { - var response = _devTestLabDiskDisksRestClient.Update(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, patch, cancellationToken); - return Response.FromValue(new DevTestLabDiskResource(Client, response.Value), response.GetRawResponse()); + RequestContext context = new RequestContext + { + CancellationToken = cancellationToken + }; + HttpMessage message = _disksRestClient.CreateDeleteRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, context); + Response response = Pipeline.ProcessMessage(message, context); + DevTestLabsArmOperation operation = new DevTestLabsArmOperation(_disksClientDiagnostics, Pipeline, message.Request, response, OperationFinalStateVia.Location); + if (waitUntil == WaitUntil.Completed) + { + operation.WaitForCompletionResponse(cancellationToken); + } + return operation; } catch (Exception e) { @@ -345,20 +399,20 @@ public virtual Response Update(DevTestLabDiskPatch patch /// Attach and create the lease of the disk to the virtual machine. This operation can take a while to complete. /// /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/users/{userName}/disks/{name}/attach + /// Request Path. + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/users/{userName}/disks/{name}/attach. /// /// - /// Operation Id - /// Disks_Attach + /// Operation Id. + /// Disks_Attach. /// /// - /// Default Api Version - /// 2018-09-15 + /// Default Api Version. + /// 2018-09-15. /// /// - /// Resource - /// + /// Resource. + /// . /// /// /// @@ -370,14 +424,21 @@ public virtual async Task AttachAsync(WaitUntil waitUntil, DevTest { Argument.AssertNotNull(content, nameof(content)); - using var scope = _devTestLabDiskDisksClientDiagnostics.CreateScope("DevTestLabDiskResource.Attach"); + using DiagnosticScope scope = _disksClientDiagnostics.CreateScope("DevTestLabDiskResource.Attach"); scope.Start(); try { - var response = await _devTestLabDiskDisksRestClient.AttachAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, content, cancellationToken).ConfigureAwait(false); - var operation = new DevTestLabsArmOperation(_devTestLabDiskDisksClientDiagnostics, Pipeline, _devTestLabDiskDisksRestClient.CreateAttachRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, content).Request, response, OperationFinalStateVia.Location); + RequestContext context = new RequestContext + { + CancellationToken = cancellationToken + }; + HttpMessage message = _disksRestClient.CreateAttachRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, DevTestLabDiskAttachContent.ToRequestContent(content), context); + Response response = await Pipeline.ProcessMessageAsync(message, context).ConfigureAwait(false); + DevTestLabsArmOperation operation = new DevTestLabsArmOperation(_disksClientDiagnostics, Pipeline, message.Request, response, OperationFinalStateVia.Location); if (waitUntil == WaitUntil.Completed) + { await operation.WaitForCompletionResponseAsync(cancellationToken).ConfigureAwait(false); + } return operation; } catch (Exception e) @@ -391,20 +452,20 @@ public virtual async Task AttachAsync(WaitUntil waitUntil, DevTest /// Attach and create the lease of the disk to the virtual machine. This operation can take a while to complete. /// /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/users/{userName}/disks/{name}/attach + /// Request Path. + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/users/{userName}/disks/{name}/attach. /// /// - /// Operation Id - /// Disks_Attach + /// Operation Id. + /// Disks_Attach. /// /// - /// Default Api Version - /// 2018-09-15 + /// Default Api Version. + /// 2018-09-15. /// /// - /// Resource - /// + /// Resource. + /// . /// /// /// @@ -416,14 +477,21 @@ public virtual ArmOperation Attach(WaitUntil waitUntil, DevTestLabDiskAttachCont { Argument.AssertNotNull(content, nameof(content)); - using var scope = _devTestLabDiskDisksClientDiagnostics.CreateScope("DevTestLabDiskResource.Attach"); + using DiagnosticScope scope = _disksClientDiagnostics.CreateScope("DevTestLabDiskResource.Attach"); scope.Start(); try { - var response = _devTestLabDiskDisksRestClient.Attach(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, content, cancellationToken); - var operation = new DevTestLabsArmOperation(_devTestLabDiskDisksClientDiagnostics, Pipeline, _devTestLabDiskDisksRestClient.CreateAttachRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, content).Request, response, OperationFinalStateVia.Location); + RequestContext context = new RequestContext + { + CancellationToken = cancellationToken + }; + HttpMessage message = _disksRestClient.CreateAttachRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, DevTestLabDiskAttachContent.ToRequestContent(content), context); + Response response = Pipeline.ProcessMessage(message, context); + DevTestLabsArmOperation operation = new DevTestLabsArmOperation(_disksClientDiagnostics, Pipeline, message.Request, response, OperationFinalStateVia.Location); if (waitUntil == WaitUntil.Completed) + { operation.WaitForCompletionResponse(cancellationToken); + } return operation; } catch (Exception e) @@ -437,20 +505,20 @@ public virtual ArmOperation Attach(WaitUntil waitUntil, DevTestLabDiskAttachCont /// Detach and break the lease of the disk attached to the virtual machine. This operation can take a while to complete. /// /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/users/{userName}/disks/{name}/detach + /// Request Path. + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/users/{userName}/disks/{name}/detach. /// /// - /// Operation Id - /// Disks_Detach + /// Operation Id. + /// Disks_Detach. /// /// - /// Default Api Version - /// 2018-09-15 + /// Default Api Version. + /// 2018-09-15. /// /// - /// Resource - /// + /// Resource. + /// . /// /// /// @@ -462,14 +530,21 @@ public virtual async Task DetachAsync(WaitUntil waitUntil, DevTest { Argument.AssertNotNull(content, nameof(content)); - using var scope = _devTestLabDiskDisksClientDiagnostics.CreateScope("DevTestLabDiskResource.Detach"); + using DiagnosticScope scope = _disksClientDiagnostics.CreateScope("DevTestLabDiskResource.Detach"); scope.Start(); try { - var response = await _devTestLabDiskDisksRestClient.DetachAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, content, cancellationToken).ConfigureAwait(false); - var operation = new DevTestLabsArmOperation(_devTestLabDiskDisksClientDiagnostics, Pipeline, _devTestLabDiskDisksRestClient.CreateDetachRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, content).Request, response, OperationFinalStateVia.Location); + RequestContext context = new RequestContext + { + CancellationToken = cancellationToken + }; + HttpMessage message = _disksRestClient.CreateDetachRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, DevTestLabDiskDetachContent.ToRequestContent(content), context); + Response response = await Pipeline.ProcessMessageAsync(message, context).ConfigureAwait(false); + DevTestLabsArmOperation operation = new DevTestLabsArmOperation(_disksClientDiagnostics, Pipeline, message.Request, response, OperationFinalStateVia.Location); if (waitUntil == WaitUntil.Completed) + { await operation.WaitForCompletionResponseAsync(cancellationToken).ConfigureAwait(false); + } return operation; } catch (Exception e) @@ -483,20 +558,20 @@ public virtual async Task DetachAsync(WaitUntil waitUntil, DevTest /// Detach and break the lease of the disk attached to the virtual machine. This operation can take a while to complete. /// /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/users/{userName}/disks/{name}/detach + /// Request Path. + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/users/{userName}/disks/{name}/detach. /// /// - /// Operation Id - /// Disks_Detach + /// Operation Id. + /// Disks_Detach. /// /// - /// Default Api Version - /// 2018-09-15 + /// Default Api Version. + /// 2018-09-15. /// /// - /// Resource - /// + /// Resource. + /// . /// /// /// @@ -508,14 +583,21 @@ public virtual ArmOperation Detach(WaitUntil waitUntil, DevTestLabDiskDetachCont { Argument.AssertNotNull(content, nameof(content)); - using var scope = _devTestLabDiskDisksClientDiagnostics.CreateScope("DevTestLabDiskResource.Detach"); + using DiagnosticScope scope = _disksClientDiagnostics.CreateScope("DevTestLabDiskResource.Detach"); scope.Start(); try { - var response = _devTestLabDiskDisksRestClient.Detach(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, content, cancellationToken); - var operation = new DevTestLabsArmOperation(_devTestLabDiskDisksClientDiagnostics, Pipeline, _devTestLabDiskDisksRestClient.CreateDetachRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, content).Request, response, OperationFinalStateVia.Location); + RequestContext context = new RequestContext + { + CancellationToken = cancellationToken + }; + HttpMessage message = _disksRestClient.CreateDetachRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, DevTestLabDiskDetachContent.ToRequestContent(content), context); + Response response = Pipeline.ProcessMessage(message, context); + DevTestLabsArmOperation operation = new DevTestLabsArmOperation(_disksClientDiagnostics, Pipeline, message.Request, response, OperationFinalStateVia.Location); if (waitUntil == WaitUntil.Completed) + { operation.WaitForCompletionResponse(cancellationToken); + } return operation; } catch (Exception e) @@ -525,27 +607,7 @@ public virtual ArmOperation Detach(WaitUntil waitUntil, DevTestLabDiskDetachCont } } - /// - /// Add a tag to the current resource. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/users/{userName}/disks/{name} - /// - /// - /// Operation Id - /// Disks_Get - /// - /// - /// Default Api Version - /// 2018-09-15 - /// - /// - /// Resource - /// - /// - /// - /// + /// Add a tag to the current resource. /// The key for the tag. /// The value for the tag. /// The cancellation token to use. @@ -555,29 +617,35 @@ public virtual async Task> AddTagAsync(string k Argument.AssertNotNull(key, nameof(key)); Argument.AssertNotNull(value, nameof(value)); - using var scope = _devTestLabDiskDisksClientDiagnostics.CreateScope("DevTestLabDiskResource.AddTag"); + using DiagnosticScope scope = _disksClientDiagnostics.CreateScope("DevTestLabDiskResource.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 _devTestLabDiskDisksRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, null, cancellationToken).ConfigureAwait(false); - return Response.FromValue(new DevTestLabDiskResource(Client, originalResponse.Value), originalResponse.GetRawResponse()); + await GetTagResource().CreateOrUpdateAsync(WaitUntil.Completed, originalTags.Value.Data, cancellationToken).ConfigureAwait(false); + RequestContext context = new RequestContext + { + CancellationToken = cancellationToken + }; + HttpMessage message = _disksRestClient.CreateGetRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, default, context); + Response result = await Pipeline.ProcessMessageAsync(message, context).ConfigureAwait(false); + Response response = Response.FromValue(DevTestLabDiskData.FromResponse(result), result); + return Response.FromValue(new DevTestLabDiskResource(Client, response.Value), response.GetRawResponse()); } else { - var current = (await GetAsync(cancellationToken: cancellationToken).ConfigureAwait(false)).Value.Data; - var patch = new DevTestLabDiskPatch(); - foreach (var tag in current.Tags) + DevTestLabDiskData current = (await GetAsync(cancellationToken: cancellationToken).ConfigureAwait(false)).Value.Data; + DevTestLabDiskPatch patch = new DevTestLabDiskPatch(); + 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) @@ -587,27 +655,7 @@ public virtual async Task> AddTagAsync(string k } } - /// - /// Add a tag to the current resource. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/users/{userName}/disks/{name} - /// - /// - /// Operation Id - /// Disks_Get - /// - /// - /// Default Api Version - /// 2018-09-15 - /// - /// - /// Resource - /// - /// - /// - /// + /// Add a tag to the current resource. /// The key for the tag. /// The value for the tag. /// The cancellation token to use. @@ -617,29 +665,35 @@ public virtual Response AddTag(string key, string value, Argument.AssertNotNull(key, nameof(key)); Argument.AssertNotNull(value, nameof(value)); - using var scope = _devTestLabDiskDisksClientDiagnostics.CreateScope("DevTestLabDiskResource.AddTag"); + using DiagnosticScope scope = _disksClientDiagnostics.CreateScope("DevTestLabDiskResource.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 = _devTestLabDiskDisksRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, null, cancellationToken); - return Response.FromValue(new DevTestLabDiskResource(Client, originalResponse.Value), originalResponse.GetRawResponse()); + GetTagResource().CreateOrUpdate(WaitUntil.Completed, originalTags.Value.Data, cancellationToken); + RequestContext context = new RequestContext + { + CancellationToken = cancellationToken + }; + HttpMessage message = _disksRestClient.CreateGetRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, default, context); + Response result = Pipeline.ProcessMessage(message, context); + Response response = Response.FromValue(DevTestLabDiskData.FromResponse(result), result); + return Response.FromValue(new DevTestLabDiskResource(Client, response.Value), response.GetRawResponse()); } else { - var current = Get(cancellationToken: cancellationToken).Value.Data; - var patch = new DevTestLabDiskPatch(); - foreach (var tag in current.Tags) + DevTestLabDiskData current = Get(cancellationToken: cancellationToken).Value.Data; + DevTestLabDiskPatch patch = new DevTestLabDiskPatch(); + 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) @@ -649,54 +703,40 @@ public virtual Response AddTag(string key, string value, } } - /// - /// Replace the tags on the resource with the given set. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/users/{userName}/disks/{name} - /// - /// - /// Operation Id - /// Disks_Get - /// - /// - /// Default Api Version - /// 2018-09-15 - /// - /// - /// 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 = _devTestLabDiskDisksClientDiagnostics.CreateScope("DevTestLabDiskResource.SetTags"); + using DiagnosticScope scope = _disksClientDiagnostics.CreateScope("DevTestLabDiskResource.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 _devTestLabDiskDisksRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, null, cancellationToken).ConfigureAwait(false); - return Response.FromValue(new DevTestLabDiskResource(Client, originalResponse.Value), originalResponse.GetRawResponse()); + await GetTagResource().CreateOrUpdateAsync(WaitUntil.Completed, originalTags.Value.Data, cancellationToken).ConfigureAwait(false); + RequestContext context = new RequestContext + { + CancellationToken = cancellationToken + }; + HttpMessage message = _disksRestClient.CreateGetRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, default, context); + Response result = await Pipeline.ProcessMessageAsync(message, context).ConfigureAwait(false); + Response response = Response.FromValue(DevTestLabDiskData.FromResponse(result), result); + return Response.FromValue(new DevTestLabDiskResource(Client, response.Value), response.GetRawResponse()); } else { - var current = (await GetAsync(cancellationToken: cancellationToken).ConfigureAwait(false)).Value.Data; - var patch = new DevTestLabDiskPatch(); + DevTestLabDiskData current = (await GetAsync(cancellationToken: cancellationToken).ConfigureAwait(false)).Value.Data; + DevTestLabDiskPatch patch = new DevTestLabDiskPatch(); 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) @@ -706,54 +746,40 @@ public virtual async Task> SetTagsAsync(IDictio } } - /// - /// Replace the tags on the resource with the given set. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/users/{userName}/disks/{name} - /// - /// - /// Operation Id - /// Disks_Get - /// - /// - /// Default Api Version - /// 2018-09-15 - /// - /// - /// 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 = _devTestLabDiskDisksClientDiagnostics.CreateScope("DevTestLabDiskResource.SetTags"); + using DiagnosticScope scope = _disksClientDiagnostics.CreateScope("DevTestLabDiskResource.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 = _devTestLabDiskDisksRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, null, cancellationToken); - return Response.FromValue(new DevTestLabDiskResource(Client, originalResponse.Value), originalResponse.GetRawResponse()); + GetTagResource().CreateOrUpdate(WaitUntil.Completed, originalTags.Value.Data, cancellationToken); + RequestContext context = new RequestContext + { + CancellationToken = cancellationToken + }; + HttpMessage message = _disksRestClient.CreateGetRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, default, context); + Response result = Pipeline.ProcessMessage(message, context); + Response response = Response.FromValue(DevTestLabDiskData.FromResponse(result), result); + return Response.FromValue(new DevTestLabDiskResource(Client, response.Value), response.GetRawResponse()); } else { - var current = Get(cancellationToken: cancellationToken).Value.Data; - var patch = new DevTestLabDiskPatch(); + DevTestLabDiskData current = Get(cancellationToken: cancellationToken).Value.Data; + DevTestLabDiskPatch patch = new DevTestLabDiskPatch(); 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) @@ -763,27 +789,7 @@ public virtual Response SetTags(IDictionary - /// Removes a tag by key from the resource. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/users/{userName}/disks/{name} - /// - /// - /// Operation Id - /// Disks_Get - /// - /// - /// Default Api Version - /// 2018-09-15 - /// - /// - /// Resource - /// - /// - /// - /// + /// Removes a tag by key from the resource. /// The key for the tag. /// The cancellation token to use. /// is null. @@ -791,29 +797,35 @@ public virtual async Task> RemoveTagAsync(strin { Argument.AssertNotNull(key, nameof(key)); - using var scope = _devTestLabDiskDisksClientDiagnostics.CreateScope("DevTestLabDiskResource.RemoveTag"); + using DiagnosticScope scope = _disksClientDiagnostics.CreateScope("DevTestLabDiskResource.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 _devTestLabDiskDisksRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, null, cancellationToken).ConfigureAwait(false); - return Response.FromValue(new DevTestLabDiskResource(Client, originalResponse.Value), originalResponse.GetRawResponse()); + await GetTagResource().CreateOrUpdateAsync(WaitUntil.Completed, originalTags.Value.Data, cancellationToken).ConfigureAwait(false); + RequestContext context = new RequestContext + { + CancellationToken = cancellationToken + }; + HttpMessage message = _disksRestClient.CreateGetRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, default, context); + Response result = await Pipeline.ProcessMessageAsync(message, context).ConfigureAwait(false); + Response response = Response.FromValue(DevTestLabDiskData.FromResponse(result), result); + return Response.FromValue(new DevTestLabDiskResource(Client, response.Value), response.GetRawResponse()); } else { - var current = (await GetAsync(cancellationToken: cancellationToken).ConfigureAwait(false)).Value.Data; - var patch = new DevTestLabDiskPatch(); - foreach (var tag in current.Tags) + DevTestLabDiskData current = (await GetAsync(cancellationToken: cancellationToken).ConfigureAwait(false)).Value.Data; + DevTestLabDiskPatch patch = new DevTestLabDiskPatch(); + 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) @@ -823,27 +835,7 @@ public virtual async Task> RemoveTagAsync(strin } } - /// - /// Removes a tag by key from the resource. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/users/{userName}/disks/{name} - /// - /// - /// Operation Id - /// Disks_Get - /// - /// - /// Default Api Version - /// 2018-09-15 - /// - /// - /// Resource - /// - /// - /// - /// + /// Removes a tag by key from the resource. /// The key for the tag. /// The cancellation token to use. /// is null. @@ -851,29 +843,35 @@ public virtual Response RemoveTag(string key, Cancellati { Argument.AssertNotNull(key, nameof(key)); - using var scope = _devTestLabDiskDisksClientDiagnostics.CreateScope("DevTestLabDiskResource.RemoveTag"); + using DiagnosticScope scope = _disksClientDiagnostics.CreateScope("DevTestLabDiskResource.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 = _devTestLabDiskDisksRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, null, cancellationToken); - return Response.FromValue(new DevTestLabDiskResource(Client, originalResponse.Value), originalResponse.GetRawResponse()); + GetTagResource().CreateOrUpdate(WaitUntil.Completed, originalTags.Value.Data, cancellationToken); + RequestContext context = new RequestContext + { + CancellationToken = cancellationToken + }; + HttpMessage message = _disksRestClient.CreateGetRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, default, context); + Response result = Pipeline.ProcessMessage(message, context); + Response response = Response.FromValue(DevTestLabDiskData.FromResponse(result), result); + return Response.FromValue(new DevTestLabDiskResource(Client, response.Value), response.GetRawResponse()); } else { - var current = Get(cancellationToken: cancellationToken).Value.Data; - var patch = new DevTestLabDiskPatch(); - foreach (var tag in current.Tags) + DevTestLabDiskData current = Get(cancellationToken: cancellationToken).Value.Data; + DevTestLabDiskPatch patch = new DevTestLabDiskPatch(); + 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) diff --git a/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/DevTestLabEnvironmentCollection.cs b/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/DevTestLabEnvironmentCollection.cs index b13238466771..09bf0711c895 100644 --- a/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/DevTestLabEnvironmentCollection.cs +++ b/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/DevTestLabEnvironmentCollection.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.DevTestLabs { @@ -24,51 +25,49 @@ namespace Azure.ResourceManager.DevTestLabs /// public partial class DevTestLabEnvironmentCollection : ArmCollection, IEnumerable, IAsyncEnumerable { - private readonly ClientDiagnostics _devTestLabEnvironmentEnvironmentsClientDiagnostics; - private readonly EnvironmentsRestOperations _devTestLabEnvironmentEnvironmentsRestClient; + private readonly ClientDiagnostics _environmentsClientDiagnostics; + private readonly Environments _environmentsRestClient; - /// Initializes a new instance of the class for mocking. + /// Initializes a new instance of DevTestLabEnvironmentCollection for mocking. protected DevTestLabEnvironmentCollection() { } - /// 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 DevTestLabEnvironmentCollection(ArmClient client, ResourceIdentifier id) : base(client, id) { - _devTestLabEnvironmentEnvironmentsClientDiagnostics = new ClientDiagnostics("Azure.ResourceManager.DevTestLabs", DevTestLabEnvironmentResource.ResourceType.Namespace, Diagnostics); - TryGetApiVersion(DevTestLabEnvironmentResource.ResourceType, out string devTestLabEnvironmentEnvironmentsApiVersion); - _devTestLabEnvironmentEnvironmentsRestClient = new EnvironmentsRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, devTestLabEnvironmentEnvironmentsApiVersion); -#if DEBUG - ValidateResourceId(Id); -#endif + TryGetApiVersion(DevTestLabEnvironmentResource.ResourceType, out string devTestLabEnvironmentApiVersion); + _environmentsClientDiagnostics = new ClientDiagnostics("Azure.ResourceManager.DevTestLabs", DevTestLabEnvironmentResource.ResourceType.Namespace, Diagnostics); + _environmentsRestClient = new Environments(_environmentsClientDiagnostics, Pipeline, Endpoint, devTestLabEnvironmentApiVersion ?? "2018-09-15"); + ValidateResourceId(id); } + /// + [Conditional("DEBUG")] internal static void ValidateResourceId(ResourceIdentifier id) { if (id.ResourceType != DevTestLabUserResource.ResourceType) - throw new ArgumentException(string.Format(CultureInfo.CurrentCulture, "Invalid resource type {0} expected {1}", id.ResourceType, DevTestLabUserResource.ResourceType), nameof(id)); + { + throw new ArgumentException(string.Format("Invalid resource type {0} expected {1}", id.ResourceType, DevTestLabUserResource.ResourceType), id); + } } /// /// Create or replace an existing environment. This operation can take a while to complete. /// /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/users/{userName}/environments/{name} - /// - /// - /// Operation Id - /// Environments_CreateOrUpdate + /// Request Path. + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/users/{userName}/environments/{name}. /// /// - /// Default Api Version - /// 2018-09-15 + /// Operation Id. + /// Environments_CreateOrUpdate. /// /// - /// Resource - /// + /// Default Api Version. + /// 2018-09-15. /// /// /// @@ -76,21 +75,34 @@ internal static void ValidateResourceId(ResourceIdentifier id) /// The name of the environment. /// An environment, which is essentially an ARM template deployment. /// 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 name, DevTestLabEnvironmentData data, CancellationToken cancellationToken = default) { Argument.AssertNotNullOrEmpty(name, nameof(name)); Argument.AssertNotNull(data, nameof(data)); - using var scope = _devTestLabEnvironmentEnvironmentsClientDiagnostics.CreateScope("DevTestLabEnvironmentCollection.CreateOrUpdate"); + using DiagnosticScope scope = _environmentsClientDiagnostics.CreateScope("DevTestLabEnvironmentCollection.CreateOrUpdate"); scope.Start(); try { - var response = await _devTestLabEnvironmentEnvironmentsRestClient.CreateOrUpdateAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, name, data, cancellationToken).ConfigureAwait(false); - var operation = new DevTestLabsArmOperation(new DevTestLabEnvironmentOperationSource(Client), _devTestLabEnvironmentEnvironmentsClientDiagnostics, Pipeline, _devTestLabEnvironmentEnvironmentsRestClient.CreateCreateOrUpdateRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, name, data).Request, response, OperationFinalStateVia.Location); + RequestContext context = new RequestContext + { + CancellationToken = cancellationToken + }; + HttpMessage message = _environmentsRestClient.CreateCreateOrUpdateRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, name, DevTestLabEnvironmentData.ToRequestContent(data), context); + Response response = await Pipeline.ProcessMessageAsync(message, context).ConfigureAwait(false); + DevTestLabsArmOperation operation = new DevTestLabsArmOperation( + new DevTestLabEnvironmentOperationSource(Client), + _environmentsClientDiagnostics, + Pipeline, + message.Request, + response, + OperationFinalStateVia.Location); if (waitUntil == WaitUntil.Completed) + { await operation.WaitForCompletionAsync(cancellationToken).ConfigureAwait(false); + } return operation; } catch (Exception e) @@ -104,20 +116,16 @@ public virtual async Task> CreateOrU /// Create or replace an existing environment. This operation can take a while to complete. /// /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/users/{userName}/environments/{name} + /// Request Path. + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/users/{userName}/environments/{name}. /// /// - /// Operation Id - /// Environments_CreateOrUpdate + /// Operation Id. + /// Environments_CreateOrUpdate. /// /// - /// Default Api Version - /// 2018-09-15 - /// - /// - /// Resource - /// + /// Default Api Version. + /// 2018-09-15. /// /// /// @@ -125,21 +133,34 @@ public virtual async Task> CreateOrU /// The name of the environment. /// An environment, which is essentially an ARM template deployment. /// 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 name, DevTestLabEnvironmentData data, CancellationToken cancellationToken = default) { Argument.AssertNotNullOrEmpty(name, nameof(name)); Argument.AssertNotNull(data, nameof(data)); - using var scope = _devTestLabEnvironmentEnvironmentsClientDiagnostics.CreateScope("DevTestLabEnvironmentCollection.CreateOrUpdate"); + using DiagnosticScope scope = _environmentsClientDiagnostics.CreateScope("DevTestLabEnvironmentCollection.CreateOrUpdate"); scope.Start(); try { - var response = _devTestLabEnvironmentEnvironmentsRestClient.CreateOrUpdate(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, name, data, cancellationToken); - var operation = new DevTestLabsArmOperation(new DevTestLabEnvironmentOperationSource(Client), _devTestLabEnvironmentEnvironmentsClientDiagnostics, Pipeline, _devTestLabEnvironmentEnvironmentsRestClient.CreateCreateOrUpdateRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, name, data).Request, response, OperationFinalStateVia.Location); + RequestContext context = new RequestContext + { + CancellationToken = cancellationToken + }; + HttpMessage message = _environmentsRestClient.CreateCreateOrUpdateRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, name, DevTestLabEnvironmentData.ToRequestContent(data), context); + Response response = Pipeline.ProcessMessage(message, context); + DevTestLabsArmOperation operation = new DevTestLabsArmOperation( + new DevTestLabEnvironmentOperationSource(Client), + _environmentsClientDiagnostics, + Pipeline, + message.Request, + response, + OperationFinalStateVia.Location); if (waitUntil == WaitUntil.Completed) + { operation.WaitForCompletion(cancellationToken); + } return operation; } catch (Exception e) @@ -153,39 +174,43 @@ public virtual ArmOperation CreateOrUpdate(WaitUn /// Get environment. /// /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/users/{userName}/environments/{name} + /// Request Path. + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/users/{userName}/environments/{name}. /// /// - /// Operation Id - /// Environments_Get + /// Operation Id. + /// Environments_Get. /// /// - /// Default Api Version - /// 2018-09-15 - /// - /// - /// Resource - /// + /// Default Api Version. + /// 2018-09-15. /// /// /// /// The name of the environment. /// Specify the $expand query. Example: 'properties($select=deploymentProperties)'. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. - public virtual async Task> GetAsync(string name, string expand = null, CancellationToken cancellationToken = default) + /// is an empty string, and was expected to be non-empty. + public virtual async Task> GetAsync(string name, string expand = default, CancellationToken cancellationToken = default) { Argument.AssertNotNullOrEmpty(name, nameof(name)); - using var scope = _devTestLabEnvironmentEnvironmentsClientDiagnostics.CreateScope("DevTestLabEnvironmentCollection.Get"); + using DiagnosticScope scope = _environmentsClientDiagnostics.CreateScope("DevTestLabEnvironmentCollection.Get"); scope.Start(); try { - var response = await _devTestLabEnvironmentEnvironmentsRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, name, expand, cancellationToken).ConfigureAwait(false); + RequestContext context = new RequestContext + { + CancellationToken = cancellationToken + }; + HttpMessage message = _environmentsRestClient.CreateGetRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, name, expand, context); + Response result = await Pipeline.ProcessMessageAsync(message, context).ConfigureAwait(false); + Response response = Response.FromValue(DevTestLabEnvironmentData.FromResponse(result), result); if (response.Value == null) + { throw new RequestFailedException(response.GetRawResponse()); + } return Response.FromValue(new DevTestLabEnvironmentResource(Client, response.Value), response.GetRawResponse()); } catch (Exception e) @@ -199,39 +224,43 @@ public virtual async Task> GetAsync(stri /// Get environment. /// /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/users/{userName}/environments/{name} - /// - /// - /// Operation Id - /// Environments_Get + /// Request Path. + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/users/{userName}/environments/{name}. /// /// - /// Default Api Version - /// 2018-09-15 + /// Operation Id. + /// Environments_Get. /// /// - /// Resource - /// + /// Default Api Version. + /// 2018-09-15. /// /// /// /// The name of the environment. /// Specify the $expand query. Example: 'properties($select=deploymentProperties)'. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. - public virtual Response Get(string name, string expand = null, CancellationToken cancellationToken = default) + /// is an empty string, and was expected to be non-empty. + public virtual Response Get(string name, string expand = default, CancellationToken cancellationToken = default) { Argument.AssertNotNullOrEmpty(name, nameof(name)); - using var scope = _devTestLabEnvironmentEnvironmentsClientDiagnostics.CreateScope("DevTestLabEnvironmentCollection.Get"); + using DiagnosticScope scope = _environmentsClientDiagnostics.CreateScope("DevTestLabEnvironmentCollection.Get"); scope.Start(); try { - var response = _devTestLabEnvironmentEnvironmentsRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, name, expand, cancellationToken); + RequestContext context = new RequestContext + { + CancellationToken = cancellationToken + }; + HttpMessage message = _environmentsRestClient.CreateGetRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, name, expand, context); + Response result = Pipeline.ProcessMessage(message, context); + Response response = Response.FromValue(DevTestLabEnvironmentData.FromResponse(result), result); if (response.Value == null) + { throw new RequestFailedException(response.GetRawResponse()); + } return Response.FromValue(new DevTestLabEnvironmentResource(Client, response.Value), response.GetRawResponse()); } catch (Exception e) @@ -245,20 +274,16 @@ public virtual Response Get(string name, string e /// List environments in a given user profile. /// /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/users/{userName}/environments + /// Request Path. + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/users/{userName}/environments. /// /// - /// Operation Id - /// Environments_List + /// Operation Id. + /// Environments_List. /// /// - /// Default Api Version - /// 2018-09-15 - /// - /// - /// Resource - /// + /// Default Api Version. + /// 2018-09-15. /// /// /// @@ -267,32 +292,40 @@ public virtual Response Get(string name, string e /// The maximum number of resources to return from the operation. Example: '$top=10'. /// The ordering expression for the results, using OData notation. Example: '$orderby=name desc'. /// The cancellation token to use. - /// An async collection of that may take multiple service requests to iterate over. - public virtual AsyncPageable GetAllAsync(string expand = null, string filter = null, int? top = null, string orderby = null, CancellationToken cancellationToken = default) + /// A collection of that may take multiple service requests to iterate over. + public virtual AsyncPageable GetAllAsync(string expand = default, string filter = default, int? top = default, string @orderby = default, CancellationToken cancellationToken = default) { - HttpMessage FirstPageRequest(int? pageSizeHint) => _devTestLabEnvironmentEnvironmentsRestClient.CreateListRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, expand, filter, top, orderby); - HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _devTestLabEnvironmentEnvironmentsRestClient.CreateListNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, expand, filter, top, orderby); - return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new DevTestLabEnvironmentResource(Client, DevTestLabEnvironmentData.DeserializeDevTestLabEnvironmentData(e)), _devTestLabEnvironmentEnvironmentsClientDiagnostics, Pipeline, "DevTestLabEnvironmentCollection.GetAll", "value", "nextLink", cancellationToken); + RequestContext context = new RequestContext + { + CancellationToken = cancellationToken + }; + return new AsyncPageableWrapper(new EnvironmentsGetAllAsyncCollectionResultOfT( + _environmentsRestClient, + Id.SubscriptionId, + Id.ResourceGroupName, + Id.Parent.Name, + Id.Name, + expand, + filter, + top, + @orderby, + context), data => new DevTestLabEnvironmentResource(Client, data)); } /// /// List environments in a given user profile. /// /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/users/{userName}/environments - /// - /// - /// Operation Id - /// Environments_List + /// Request Path. + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/users/{userName}/environments. /// /// - /// Default Api Version - /// 2018-09-15 + /// Operation Id. + /// Environments_List. /// /// - /// Resource - /// + /// Default Api Version. + /// 2018-09-15. /// /// /// @@ -302,48 +335,74 @@ public virtual AsyncPageable GetAllAsync(string e /// The ordering expression for the results, using OData notation. Example: '$orderby=name desc'. /// The cancellation token to use. /// A collection of that may take multiple service requests to iterate over. - public virtual Pageable GetAll(string expand = null, string filter = null, int? top = null, string orderby = null, CancellationToken cancellationToken = default) + public virtual Pageable GetAll(string expand = default, string filter = default, int? top = default, string @orderby = default, CancellationToken cancellationToken = default) { - HttpMessage FirstPageRequest(int? pageSizeHint) => _devTestLabEnvironmentEnvironmentsRestClient.CreateListRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, expand, filter, top, orderby); - HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _devTestLabEnvironmentEnvironmentsRestClient.CreateListNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, expand, filter, top, orderby); - return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new DevTestLabEnvironmentResource(Client, DevTestLabEnvironmentData.DeserializeDevTestLabEnvironmentData(e)), _devTestLabEnvironmentEnvironmentsClientDiagnostics, Pipeline, "DevTestLabEnvironmentCollection.GetAll", "value", "nextLink", cancellationToken); + RequestContext context = new RequestContext + { + CancellationToken = cancellationToken + }; + return new PageableWrapper(new EnvironmentsGetAllCollectionResultOfT( + _environmentsRestClient, + Id.SubscriptionId, + Id.ResourceGroupName, + Id.Parent.Name, + Id.Name, + expand, + filter, + top, + @orderby, + context), data => new DevTestLabEnvironmentResource(Client, data)); } /// /// Checks to see if the resource exists in azure. /// /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/users/{userName}/environments/{name} - /// - /// - /// Operation Id - /// Environments_Get + /// Request Path. + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/users/{userName}/environments/{name}. /// /// - /// Default Api Version - /// 2018-09-15 + /// Operation Id. + /// Environments_Get. /// /// - /// Resource - /// + /// Default Api Version. + /// 2018-09-15. /// /// /// /// The name of the environment. /// Specify the $expand query. Example: 'properties($select=deploymentProperties)'. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. - public virtual async Task> ExistsAsync(string name, string expand = null, CancellationToken cancellationToken = default) + /// is an empty string, and was expected to be non-empty. + public virtual async Task> ExistsAsync(string name, string expand = default, CancellationToken cancellationToken = default) { Argument.AssertNotNullOrEmpty(name, nameof(name)); - using var scope = _devTestLabEnvironmentEnvironmentsClientDiagnostics.CreateScope("DevTestLabEnvironmentCollection.Exists"); + using DiagnosticScope scope = _environmentsClientDiagnostics.CreateScope("DevTestLabEnvironmentCollection.Exists"); scope.Start(); try { - var response = await _devTestLabEnvironmentEnvironmentsRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, name, expand, cancellationToken: cancellationToken).ConfigureAwait(false); + RequestContext context = new RequestContext + { + CancellationToken = cancellationToken + }; + HttpMessage message = _environmentsRestClient.CreateGetRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, name, expand, context); + await Pipeline.SendAsync(message, context.CancellationToken).ConfigureAwait(false); + Response result = message.Response; + Response response = default; + switch (result.Status) + { + case 200: + response = Response.FromValue(DevTestLabEnvironmentData.FromResponse(result), result); + break; + case 404: + response = Response.FromValue((DevTestLabEnvironmentData)null, result); + break; + default: + throw new RequestFailedException(result); + } return Response.FromValue(response.Value != null, response.GetRawResponse()); } catch (Exception e) @@ -357,37 +416,51 @@ public virtual async Task> ExistsAsync(string name, string expand /// Checks to see if the resource exists in azure. /// /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/users/{userName}/environments/{name} + /// Request Path. + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/users/{userName}/environments/{name}. /// /// - /// Operation Id - /// Environments_Get + /// Operation Id. + /// Environments_Get. /// /// - /// Default Api Version - /// 2018-09-15 - /// - /// - /// Resource - /// + /// Default Api Version. + /// 2018-09-15. /// /// /// /// The name of the environment. /// Specify the $expand query. Example: 'properties($select=deploymentProperties)'. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. - public virtual Response Exists(string name, string expand = null, CancellationToken cancellationToken = default) + /// is an empty string, and was expected to be non-empty. + public virtual Response Exists(string name, string expand = default, CancellationToken cancellationToken = default) { Argument.AssertNotNullOrEmpty(name, nameof(name)); - using var scope = _devTestLabEnvironmentEnvironmentsClientDiagnostics.CreateScope("DevTestLabEnvironmentCollection.Exists"); + using DiagnosticScope scope = _environmentsClientDiagnostics.CreateScope("DevTestLabEnvironmentCollection.Exists"); scope.Start(); try { - var response = _devTestLabEnvironmentEnvironmentsRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, name, expand, cancellationToken: cancellationToken); + RequestContext context = new RequestContext + { + CancellationToken = cancellationToken + }; + HttpMessage message = _environmentsRestClient.CreateGetRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, name, expand, context); + Pipeline.Send(message, context.CancellationToken); + Response result = message.Response; + Response response = default; + switch (result.Status) + { + case 200: + response = Response.FromValue(DevTestLabEnvironmentData.FromResponse(result), result); + break; + case 404: + response = Response.FromValue((DevTestLabEnvironmentData)null, result); + break; + default: + throw new RequestFailedException(result); + } return Response.FromValue(response.Value != null, response.GetRawResponse()); } catch (Exception e) @@ -401,39 +474,55 @@ public virtual Response Exists(string name, string expand = null, Cancella /// Tries to get details for this resource from the service. /// /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/users/{userName}/environments/{name} - /// - /// - /// Operation Id - /// Environments_Get + /// Request Path. + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/users/{userName}/environments/{name}. /// /// - /// Default Api Version - /// 2018-09-15 + /// Operation Id. + /// Environments_Get. /// /// - /// Resource - /// + /// Default Api Version. + /// 2018-09-15. /// /// /// /// The name of the environment. /// Specify the $expand query. Example: 'properties($select=deploymentProperties)'. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. - public virtual async Task> GetIfExistsAsync(string name, string expand = null, CancellationToken cancellationToken = default) + /// is an empty string, and was expected to be non-empty. + public virtual async Task> GetIfExistsAsync(string name, string expand = default, CancellationToken cancellationToken = default) { Argument.AssertNotNullOrEmpty(name, nameof(name)); - using var scope = _devTestLabEnvironmentEnvironmentsClientDiagnostics.CreateScope("DevTestLabEnvironmentCollection.GetIfExists"); + using DiagnosticScope scope = _environmentsClientDiagnostics.CreateScope("DevTestLabEnvironmentCollection.GetIfExists"); scope.Start(); try { - var response = await _devTestLabEnvironmentEnvironmentsRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, name, expand, cancellationToken: cancellationToken).ConfigureAwait(false); + RequestContext context = new RequestContext + { + CancellationToken = cancellationToken + }; + HttpMessage message = _environmentsRestClient.CreateGetRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, name, expand, context); + await Pipeline.SendAsync(message, context.CancellationToken).ConfigureAwait(false); + Response result = message.Response; + Response response = default; + switch (result.Status) + { + case 200: + response = Response.FromValue(DevTestLabEnvironmentData.FromResponse(result), result); + break; + case 404: + response = Response.FromValue((DevTestLabEnvironmentData)null, result); + break; + default: + throw new RequestFailedException(result); + } if (response.Value == null) + { return new NoValueResponse(response.GetRawResponse()); + } return Response.FromValue(new DevTestLabEnvironmentResource(Client, response.Value), response.GetRawResponse()); } catch (Exception e) @@ -447,39 +536,55 @@ public virtual async Task> GetIf /// Tries to get details for this resource from the service. /// /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/users/{userName}/environments/{name} + /// Request Path. + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/users/{userName}/environments/{name}. /// /// - /// Operation Id - /// Environments_Get + /// Operation Id. + /// Environments_Get. /// /// - /// Default Api Version - /// 2018-09-15 - /// - /// - /// Resource - /// + /// Default Api Version. + /// 2018-09-15. /// /// /// /// The name of the environment. /// Specify the $expand query. Example: 'properties($select=deploymentProperties)'. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. - public virtual NullableResponse GetIfExists(string name, string expand = null, CancellationToken cancellationToken = default) + /// is an empty string, and was expected to be non-empty. + public virtual NullableResponse GetIfExists(string name, string expand = default, CancellationToken cancellationToken = default) { Argument.AssertNotNullOrEmpty(name, nameof(name)); - using var scope = _devTestLabEnvironmentEnvironmentsClientDiagnostics.CreateScope("DevTestLabEnvironmentCollection.GetIfExists"); + using DiagnosticScope scope = _environmentsClientDiagnostics.CreateScope("DevTestLabEnvironmentCollection.GetIfExists"); scope.Start(); try { - var response = _devTestLabEnvironmentEnvironmentsRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, name, expand, cancellationToken: cancellationToken); + RequestContext context = new RequestContext + { + CancellationToken = cancellationToken + }; + HttpMessage message = _environmentsRestClient.CreateGetRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, name, expand, context); + Pipeline.Send(message, context.CancellationToken); + Response result = message.Response; + Response response = default; + switch (result.Status) + { + case 200: + response = Response.FromValue(DevTestLabEnvironmentData.FromResponse(result), result); + break; + case 404: + response = Response.FromValue((DevTestLabEnvironmentData)null, result); + break; + default: + throw new RequestFailedException(result); + } if (response.Value == null) + { return new NoValueResponse(response.GetRawResponse()); + } return Response.FromValue(new DevTestLabEnvironmentResource(Client, response.Value), response.GetRawResponse()); } catch (Exception e) @@ -499,6 +604,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/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/DevTestLabEnvironmentData.Serialization.cs b/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/DevTestLabEnvironmentData.Serialization.cs index 35a734dd8340..2c52f960e8ce 100644 --- a/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/DevTestLabEnvironmentData.Serialization.cs +++ b/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/DevTestLabEnvironmentData.Serialization.cs @@ -10,16 +10,47 @@ using System.Collections.Generic; using System.Text; using System.Text.Json; +using Azure; using Azure.Core; using Azure.ResourceManager.DevTestLabs.Models; using Azure.ResourceManager.Models; namespace Azure.ResourceManager.DevTestLabs { - public partial class DevTestLabEnvironmentData : IUtf8JsonSerializable, IJsonModel + /// An environment, which is essentially an ARM template deployment. + public partial class DevTestLabEnvironmentData : TrackedResourceData, IJsonModel { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + /// Initializes a new instance of for deserialization. + internal DevTestLabEnvironmentData() + { + } + /// 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)) + { + return DeserializeDevTestLabEnvironmentData(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(DevTestLabEnvironmentData)} does not support reading '{options.Format}' format."); + } + } + + /// The to deserialize the from. + internal static DevTestLabEnvironmentData FromResponse(Response response) + { + using JsonDocument document = JsonDocument.Parse(response.Content, ModelSerializationExtensions.JsonDocumentOptions); + return DeserializeDevTestLabEnvironmentData(document.RootElement, ModelSerializationExtensions.WireOptions); + } + + /// The JSON writer. + /// The client options for reading and writing models. void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) { writer.WriteStartObject(); @@ -31,203 +62,153 @@ 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(DevTestLabEnvironmentData)} does not support writing '{format}' format."); } - base.JsonModelWriteCore(writer, options); writer.WritePropertyName("properties"u8); - writer.WriteStartObject(); - if (Optional.IsDefined(DeploymentProperties)) - { - writer.WritePropertyName("deploymentProperties"u8); - writer.WriteObjectValue(DeploymentProperties, options); - } - if (Optional.IsDefined(ArmTemplateDisplayName)) - { - writer.WritePropertyName("armTemplateDisplayName"u8); - writer.WriteStringValue(ArmTemplateDisplayName); - } - if (options.Format != "W" && Optional.IsDefined(ResourceGroupId)) - { - writer.WritePropertyName("resourceGroupId"u8); - writer.WriteStringValue(ResourceGroupId); - } - if (options.Format != "W" && Optional.IsDefined(CreatedByUser)) - { - writer.WritePropertyName("createdByUser"u8); - writer.WriteStringValue(CreatedByUser); - } - if (options.Format != "W" && Optional.IsDefined(ProvisioningState)) - { - writer.WritePropertyName("provisioningState"u8); - writer.WriteStringValue(ProvisioningState); - } - if (options.Format != "W" && Optional.IsDefined(UniqueIdentifier)) + writer.WriteObjectValue(Properties, options); + if (Optional.IsCollectionDefined(Tags)) { - writer.WritePropertyName("uniqueIdentifier"u8); - writer.WriteStringValue(UniqueIdentifier.Value); + writer.WritePropertyName("tags"u8); + writer.WriteStartObject(); + foreach (var item in Tags) + { + writer.WritePropertyName(item.Key); + if (item.Value == null) + { + writer.WriteNullValue(); + continue; + } + writer.WriteStringValue(item.Value); + } + writer.WriteEndObject(); } - writer.WriteEndObject(); } - DevTestLabEnvironmentData IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + /// The JSON reader. + /// The client options for reading and writing models. + DevTestLabEnvironmentData IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) => (DevTestLabEnvironmentData)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(DevTestLabEnvironmentData)} does not support reading '{format}' format."); } - using JsonDocument document = JsonDocument.ParseValue(ref reader); return DeserializeDevTestLabEnvironmentData(document.RootElement, options); } - internal static DevTestLabEnvironmentData DeserializeDevTestLabEnvironmentData(JsonElement element, ModelReaderWriterOptions options = null) + /// The JSON element to deserialize. + /// The client options for reading and writing models. + internal static DevTestLabEnvironmentData DeserializeDevTestLabEnvironmentData(JsonElement element, ModelReaderWriterOptions options) { - options ??= ModelSerializationExtensions.WireOptions; - if (element.ValueKind == JsonValueKind.Null) { return null; } - IDictionary tags = default; - AzureLocation location = default; ResourceIdentifier id = default; string name = default; - ResourceType type = default; + ResourceType resourceType = default; SystemData systemData = default; - DevTestLabEnvironmentDeployment deploymentProperties = default; - string armTemplateDisplayName = default; - string resourceGroupId = default; - string createdByUser = default; - string provisioningState = default; - Guid? uniqueIdentifier = default; - IDictionary serializedAdditionalRawData = default; - Dictionary rawDataDictionary = new Dictionary(); - foreach (var property in element.EnumerateObject()) + IDictionary additionalBinaryDataProperties = new ChangeTrackingDictionary(); + AzureLocation location = default; + EnvironmentProperties properties = default; + IDictionary tags = default; + foreach (var prop in element.EnumerateObject()) { - if (property.NameEquals("tags"u8)) + if (prop.NameEquals("id"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()) - { - dictionary.Add(property0.Name, property0.Value.GetString()); - } - tags = dictionary; + id = new ResourceIdentifier(prop.Value.GetString()); continue; } - if (property.NameEquals("location"u8)) + if (prop.NameEquals("name"u8)) { - location = new AzureLocation(property.Value.GetString()); + name = prop.Value.GetString(); continue; } - if (property.NameEquals("id"u8)) + if (prop.NameEquals("type"u8)) { - id = new ResourceIdentifier(property.Value.GetString()); + if (prop.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + resourceType = new ResourceType(prop.Value.GetString()); continue; } - if (property.NameEquals("name"u8)) + if (prop.NameEquals("systemData"u8)) { - name = property.Value.GetString(); + if (prop.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + systemData = ModelReaderWriter.Read(new BinaryData(Encoding.UTF8.GetBytes(prop.Value.GetRawText())), ModelSerializationExtensions.WireOptions, AzureResourceManagerDevTestLabsContext.Default); 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) - { - continue; - } - systemData = ModelReaderWriter.Read(new BinaryData(Encoding.UTF8.GetBytes(property.Value.GetRawText())), ModelSerializationExtensions.WireOptions, AzureResourceManagerDevTestLabsContext.Default); + properties = EnvironmentProperties.DeserializeEnvironmentProperties(prop.Value, options); continue; } - if (property.NameEquals("properties"u8)) + if (prop.NameEquals("tags"u8)) { - if (property.Value.ValueKind == JsonValueKind.Null) + if (prop.Value.ValueKind == JsonValueKind.Null) { - property.ThrowNonNullablePropertyIsNull(); continue; } - foreach (var property0 in property.Value.EnumerateObject()) + Dictionary dictionary = new Dictionary(); + foreach (var prop0 in prop.Value.EnumerateObject()) { - if (property0.NameEquals("deploymentProperties"u8)) - { - if (property0.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - deploymentProperties = DevTestLabEnvironmentDeployment.DeserializeDevTestLabEnvironmentDeployment(property0.Value, options); - continue; - } - if (property0.NameEquals("armTemplateDisplayName"u8)) + if (prop0.Value.ValueKind == JsonValueKind.Null) { - armTemplateDisplayName = property0.Value.GetString(); - continue; + dictionary.Add(prop0.Name, null); } - if (property0.NameEquals("resourceGroupId"u8)) + else { - resourceGroupId = property0.Value.GetString(); - continue; - } - if (property0.NameEquals("createdByUser"u8)) - { - createdByUser = property0.Value.GetString(); - continue; - } - if (property0.NameEquals("provisioningState"u8)) - { - provisioningState = property0.Value.GetString(); - continue; - } - if (property0.NameEquals("uniqueIdentifier"u8)) - { - if (property0.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - uniqueIdentifier = property0.Value.GetGuid(); - continue; + dictionary.Add(prop0.Name, prop0.Value.GetString()); } } + tags = dictionary; 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 DevTestLabEnvironmentData( id, name, - type, + resourceType, systemData, - tags ?? new ChangeTrackingDictionary(), + additionalBinaryDataProperties, location, - deploymentProperties, - armTemplateDisplayName, - resourceGroupId, - createdByUser, - provisioningState, - uniqueIdentifier, - serializedAdditionalRawData); + properties, + tags ?? new ChangeTrackingDictionary()); } - 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": @@ -237,22 +218,23 @@ BinaryData IPersistableModel.Write(ModelReaderWriterO } } - DevTestLabEnvironmentData 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. + DevTestLabEnvironmentData IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) => (DevTestLabEnvironmentData)PersistableModelCreateCore(data, options); - switch (format) + /// The client options for reading and writing models. + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + + /// The to serialize into . + internal static RequestContent ToRequestContent(DevTestLabEnvironmentData devTestLabEnvironmentData) + { + if (devTestLabEnvironmentData == null) { - case "J": - { - using JsonDocument document = JsonDocument.Parse(data, ModelSerializationExtensions.JsonDocumentOptions); - return DeserializeDevTestLabEnvironmentData(document.RootElement, options); - } - default: - throw new FormatException($"The model {nameof(DevTestLabEnvironmentData)} does not support reading '{options.Format}' format."); + return null; } + Utf8JsonRequestContent content = new Utf8JsonRequestContent(); + content.JsonWriter.WriteObjectValue(devTestLabEnvironmentData, ModelSerializationExtensions.WireOptions); + return content; } - - string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; } } diff --git a/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/DevTestLabEnvironmentData.cs b/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/DevTestLabEnvironmentData.cs index b81d225a479e..104120d4acc6 100644 --- a/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/DevTestLabEnvironmentData.cs +++ b/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/DevTestLabEnvironmentData.cs @@ -13,91 +13,105 @@ namespace Azure.ResourceManager.DevTestLabs { - /// - /// A class representing the DevTestLabEnvironment data model. - /// An environment, which is essentially an ARM template deployment. - /// + /// An environment, which is essentially an ARM template deployment. public partial class DevTestLabEnvironmentData : 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 DevTestLabEnvironmentData(AzureLocation location) : base(location) { + } /// Initializes a new instance of . - /// The id. - /// The name. - /// The resourceType. - /// The systemData. - /// The tags. - /// The location. - /// The deployment properties of the environment. - /// The display name of the Azure Resource Manager template that produced the environment. - /// The identifier of the resource group containing the environment's resources. - /// The creator of the environment. - /// The provisioning status of the resource. - /// The unique immutable identifier of a resource (Guid). - /// Keeps track of any properties unknown to the library. - internal DevTestLabEnvironmentData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, IDictionary tags, AzureLocation location, DevTestLabEnvironmentDeployment deploymentProperties, string armTemplateDisplayName, string resourceGroupId, string createdByUser, string provisioningState, Guid? uniqueIdentifier, IDictionary serializedAdditionalRawData) : base(id, name, resourceType, systemData, tags, 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. + /// The geo-location where the resource lives. + /// The properties of the environment. + /// Resource tags. + internal DevTestLabEnvironmentData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, IDictionary additionalBinaryDataProperties, AzureLocation location, EnvironmentProperties properties, IDictionary tags) : base(id, name, resourceType, systemData, tags, location) { - DeploymentProperties = deploymentProperties; - ArmTemplateDisplayName = armTemplateDisplayName; - ResourceGroupId = resourceGroupId; - CreatedByUser = createdByUser; - ProvisioningState = provisioningState; - UniqueIdentifier = uniqueIdentifier; - _serializedAdditionalRawData = serializedAdditionalRawData; + _additionalBinaryDataProperties = additionalBinaryDataProperties; + Properties = properties; } - /// Initializes a new instance of for deserialization. - internal DevTestLabEnvironmentData() + /// The properties of the environment. + internal EnvironmentProperties Properties { get; set; } + + /// The deployment properties of the environment. + public DevTestLabEnvironmentDeployment DeploymentProperties { + get + { + return Properties is null ? default : Properties.DeploymentProperties; + } + set + { + if (Properties is null) + { + Properties = new EnvironmentProperties(); + } + Properties.DeploymentProperties = value; + } } - /// The deployment properties of the environment. - public DevTestLabEnvironmentDeployment DeploymentProperties { get; set; } /// The display name of the Azure Resource Manager template that produced the environment. - public string ArmTemplateDisplayName { get; set; } + public string ArmTemplateDisplayName + { + get + { + return Properties is null ? default : Properties.ArmTemplateDisplayName; + } + set + { + if (Properties is null) + { + Properties = new EnvironmentProperties(); + } + Properties.ArmTemplateDisplayName = value; + } + } + /// The identifier of the resource group containing the environment's resources. - public string ResourceGroupId { get; } + public string ResourceGroupId + { + get + { + return Properties is null ? default : Properties.ResourceGroupId; + } + } + /// The creator of the environment. - public string CreatedByUser { get; } + public string CreatedByUser + { + get + { + return Properties is null ? default : Properties.CreatedByUser; + } + } + /// The provisioning status of the resource. - public string ProvisioningState { get; } + public string ProvisioningState + { + get + { + return Properties is null ? default : Properties.ProvisioningState; + } + } + /// The unique immutable identifier of a resource (Guid). - public Guid? UniqueIdentifier { get; } + public Guid? UniqueIdentifier + { + get + { + return Properties is null ? default : Properties.UniqueIdentifier; + } + } } } diff --git a/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/DevTestLabEnvironmentResource.Serialization.cs b/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/DevTestLabEnvironmentResource.Serialization.cs index 424841a9d939..8fe5b4b12589 100644 --- a/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/DevTestLabEnvironmentResource.Serialization.cs +++ b/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/DevTestLabEnvironmentResource.Serialization.cs @@ -11,19 +11,29 @@ namespace Azure.ResourceManager.DevTestLabs { + /// public partial class DevTestLabEnvironmentResource : IJsonModel { - private static DevTestLabEnvironmentData s_dataDeserializationInstance; - private static DevTestLabEnvironmentData DataDeserializationInstance => s_dataDeserializationInstance ??= new(); + private static IJsonModel s_dataDeserializationInstance; + private static IJsonModel DataDeserializationInstance => s_dataDeserializationInstance ??= new DevTestLabEnvironmentData(); + + /// 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); - DevTestLabEnvironmentData 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. + DevTestLabEnvironmentData 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, AzureResourceManagerDevTestLabsContext.Default); + /// The binary data to be processed. + /// The client options for reading and writing models. DevTestLabEnvironmentData IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) => ModelReaderWriter.Read(data, options, AzureResourceManagerDevTestLabsContext.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/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/DevTestLabEnvironmentResource.cs b/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/DevTestLabEnvironmentResource.cs index 21b8388dfddb..1e5d3ebbfbc0 100644 --- a/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/DevTestLabEnvironmentResource.cs +++ b/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/DevTestLabEnvironmentResource.cs @@ -7,48 +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.DevTestLabs.Models; +using Azure.ResourceManager.Resources; namespace Azure.ResourceManager.DevTestLabs { /// - /// A Class representing a DevTestLabEnvironment 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 GetDevTestLabEnvironmentResource method. - /// Otherwise you can get one from its parent resource using the GetDevTestLabEnvironment method. + /// A class representing a DevTestLabEnvironment 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 GetDevTestLabEnvironments method. /// public partial class DevTestLabEnvironmentResource : ArmResource { - /// Generate the resource identifier of a instance. - /// The subscriptionId. - /// The resourceGroupName. - /// The labName. - /// The userName. - /// The name. - public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string labName, string userName, string name) - { - var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/users/{userName}/environments/{name}"; - return new ResourceIdentifier(resourceId); - } - - private readonly ClientDiagnostics _devTestLabEnvironmentEnvironmentsClientDiagnostics; - private readonly EnvironmentsRestOperations _devTestLabEnvironmentEnvironmentsRestClient; + private readonly ClientDiagnostics _environmentsClientDiagnostics; + private readonly Environments _environmentsRestClient; private readonly DevTestLabEnvironmentData _data; - /// Gets the resource type for the operations. public static readonly ResourceType ResourceType = "Microsoft.DevTestLab/labs/users/environments"; - /// Initializes a new instance of the class for mocking. + /// Initializes a new instance of DevTestLabEnvironmentResource for mocking. protected DevTestLabEnvironmentResource() { } - /// 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 DevTestLabEnvironmentResource(ArmClient client, DevTestLabEnvironmentData data) : this(client, data.Id) @@ -57,72 +46,95 @@ internal DevTestLabEnvironmentResource(ArmClient client, DevTestLabEnvironmentDa _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 DevTestLabEnvironmentResource(ArmClient client, ResourceIdentifier id) : base(client, id) { - _devTestLabEnvironmentEnvironmentsClientDiagnostics = new ClientDiagnostics("Azure.ResourceManager.DevTestLabs", ResourceType.Namespace, Diagnostics); - TryGetApiVersion(ResourceType, out string devTestLabEnvironmentEnvironmentsApiVersion); - _devTestLabEnvironmentEnvironmentsRestClient = new EnvironmentsRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, devTestLabEnvironmentEnvironmentsApiVersion); -#if DEBUG - ValidateResourceId(Id); -#endif + TryGetApiVersion(ResourceType, out string devTestLabEnvironmentApiVersion); + _environmentsClientDiagnostics = new ClientDiagnostics("Azure.ResourceManager.DevTestLabs", ResourceType.Namespace, Diagnostics); + _environmentsRestClient = new Environments(_environmentsClientDiagnostics, Pipeline, Endpoint, devTestLabEnvironmentApiVersion ?? "2018-09-15"); + 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 DevTestLabEnvironmentData 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 labName. + /// The userName. + /// The name. + public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string labName, string userName, string name) + { + string resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/users/{userName}/environments/{name}"; + 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 environment. /// /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/users/{userName}/environments/{name} + /// Request Path. + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/users/{userName}/environments/{name}. /// /// - /// Operation Id - /// Environments_Get + /// Operation Id. + /// Environments_Get. /// /// - /// Default Api Version - /// 2018-09-15 + /// Default Api Version. + /// 2018-09-15. /// /// - /// Resource - /// + /// Resource. + /// . /// /// /// /// Specify the $expand query. Example: 'properties($select=deploymentProperties)'. /// The cancellation token to use. - public virtual async Task> GetAsync(string expand = null, CancellationToken cancellationToken = default) + public virtual async Task> GetAsync(string expand = default, CancellationToken cancellationToken = default) { - using var scope = _devTestLabEnvironmentEnvironmentsClientDiagnostics.CreateScope("DevTestLabEnvironmentResource.Get"); + using DiagnosticScope scope = _environmentsClientDiagnostics.CreateScope("DevTestLabEnvironmentResource.Get"); scope.Start(); try { - var response = await _devTestLabEnvironmentEnvironmentsRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, expand, cancellationToken).ConfigureAwait(false); + RequestContext context = new RequestContext + { + CancellationToken = cancellationToken + }; + HttpMessage message = _environmentsRestClient.CreateGetRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, expand, context); + Response result = await Pipeline.ProcessMessageAsync(message, context).ConfigureAwait(false); + Response response = Response.FromValue(DevTestLabEnvironmentData.FromResponse(result), result); if (response.Value == null) + { throw new RequestFailedException(response.GetRawResponse()); + } return Response.FromValue(new DevTestLabEnvironmentResource(Client, response.Value), response.GetRawResponse()); } catch (Exception e) @@ -136,34 +148,42 @@ public virtual async Task> GetAsync(stri /// Get environment. /// /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/users/{userName}/environments/{name} + /// Request Path. + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/users/{userName}/environments/{name}. /// /// - /// Operation Id - /// Environments_Get + /// Operation Id. + /// Environments_Get. /// /// - /// Default Api Version - /// 2018-09-15 + /// Default Api Version. + /// 2018-09-15. /// /// - /// Resource - /// + /// Resource. + /// . /// /// /// /// Specify the $expand query. Example: 'properties($select=deploymentProperties)'. /// The cancellation token to use. - public virtual Response Get(string expand = null, CancellationToken cancellationToken = default) + public virtual Response Get(string expand = default, CancellationToken cancellationToken = default) { - using var scope = _devTestLabEnvironmentEnvironmentsClientDiagnostics.CreateScope("DevTestLabEnvironmentResource.Get"); + using DiagnosticScope scope = _environmentsClientDiagnostics.CreateScope("DevTestLabEnvironmentResource.Get"); scope.Start(); try { - var response = _devTestLabEnvironmentEnvironmentsRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, expand, cancellationToken); + RequestContext context = new RequestContext + { + CancellationToken = cancellationToken + }; + HttpMessage message = _environmentsRestClient.CreateGetRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, expand, context); + Response result = Pipeline.ProcessMessage(message, context); + Response response = Response.FromValue(DevTestLabEnvironmentData.FromResponse(result), result); if (response.Value == null) + { throw new RequestFailedException(response.GetRawResponse()); + } return Response.FromValue(new DevTestLabEnvironmentResource(Client, response.Value), response.GetRawResponse()); } catch (Exception e) @@ -174,39 +194,49 @@ public virtual Response Get(string expand = null, } /// - /// Delete environment. This operation can take a while to complete. + /// Allows modifying tags of environments. All other properties will be ignored. /// /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/users/{userName}/environments/{name} + /// Request Path. + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/users/{userName}/environments/{name}. /// /// - /// Operation Id - /// Environments_Delete + /// Operation Id. + /// Environments_Update. /// /// - /// Default Api Version - /// 2018-09-15 + /// Default Api Version. + /// 2018-09-15. /// /// - /// Resource - /// + /// Resource. + /// . /// /// /// - /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. + /// An environment, which is essentially an ARM template deployment. /// The cancellation token to use. - public virtual async Task DeleteAsync(WaitUntil waitUntil, CancellationToken cancellationToken = default) + /// is null. + public virtual async Task> UpdateAsync(DevTestLabEnvironmentPatch patch, CancellationToken cancellationToken = default) { - using var scope = _devTestLabEnvironmentEnvironmentsClientDiagnostics.CreateScope("DevTestLabEnvironmentResource.Delete"); + Argument.AssertNotNull(patch, nameof(patch)); + + using DiagnosticScope scope = _environmentsClientDiagnostics.CreateScope("DevTestLabEnvironmentResource.Update"); scope.Start(); try { - var response = await _devTestLabEnvironmentEnvironmentsRestClient.DeleteAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, cancellationToken).ConfigureAwait(false); - var operation = new DevTestLabsArmOperation(_devTestLabEnvironmentEnvironmentsClientDiagnostics, Pipeline, _devTestLabEnvironmentEnvironmentsRestClient.CreateDeleteRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name).Request, response, OperationFinalStateVia.Location); - if (waitUntil == WaitUntil.Completed) - await operation.WaitForCompletionResponseAsync(cancellationToken).ConfigureAwait(false); - return operation; + RequestContext context = new RequestContext + { + CancellationToken = cancellationToken + }; + HttpMessage message = _environmentsRestClient.CreateUpdateRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, DevTestLabEnvironmentPatch.ToRequestContent(patch), context); + Response result = await Pipeline.ProcessMessageAsync(message, context).ConfigureAwait(false); + Response response = Response.FromValue(DevTestLabEnvironmentData.FromResponse(result), result); + if (response.Value == null) + { + throw new RequestFailedException(response.GetRawResponse()); + } + return Response.FromValue(new DevTestLabEnvironmentResource(Client, response.Value), response.GetRawResponse()); } catch (Exception e) { @@ -216,39 +246,49 @@ public virtual async Task DeleteAsync(WaitUntil waitUntil, Cancell } /// - /// Delete environment. This operation can take a while to complete. + /// Allows modifying tags of environments. All other properties will be ignored. /// /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/users/{userName}/environments/{name} + /// Request Path. + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/users/{userName}/environments/{name}. /// /// - /// Operation Id - /// Environments_Delete + /// Operation Id. + /// Environments_Update. /// /// - /// Default Api Version - /// 2018-09-15 + /// Default Api Version. + /// 2018-09-15. /// /// - /// Resource - /// + /// Resource. + /// . /// /// /// - /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. + /// An environment, which is essentially an ARM template deployment. /// The cancellation token to use. - public virtual ArmOperation Delete(WaitUntil waitUntil, CancellationToken cancellationToken = default) + /// is null. + public virtual Response Update(DevTestLabEnvironmentPatch patch, CancellationToken cancellationToken = default) { - using var scope = _devTestLabEnvironmentEnvironmentsClientDiagnostics.CreateScope("DevTestLabEnvironmentResource.Delete"); + Argument.AssertNotNull(patch, nameof(patch)); + + using DiagnosticScope scope = _environmentsClientDiagnostics.CreateScope("DevTestLabEnvironmentResource.Update"); scope.Start(); try { - var response = _devTestLabEnvironmentEnvironmentsRestClient.Delete(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, cancellationToken); - var operation = new DevTestLabsArmOperation(_devTestLabEnvironmentEnvironmentsClientDiagnostics, Pipeline, _devTestLabEnvironmentEnvironmentsRestClient.CreateDeleteRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name).Request, response, OperationFinalStateVia.Location); - if (waitUntil == WaitUntil.Completed) - operation.WaitForCompletionResponse(cancellationToken); - return operation; + RequestContext context = new RequestContext + { + CancellationToken = cancellationToken + }; + HttpMessage message = _environmentsRestClient.CreateUpdateRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, DevTestLabEnvironmentPatch.ToRequestContent(patch), context); + Response result = Pipeline.ProcessMessage(message, context); + Response response = Response.FromValue(DevTestLabEnvironmentData.FromResponse(result), result); + if (response.Value == null) + { + throw new RequestFailedException(response.GetRawResponse()); + } + return Response.FromValue(new DevTestLabEnvironmentResource(Client, response.Value), response.GetRawResponse()); } catch (Exception e) { @@ -258,39 +298,46 @@ public virtual ArmOperation Delete(WaitUntil waitUntil, CancellationToken cancel } /// - /// Allows modifying tags of environments. All other properties will be ignored. + /// Delete environment. This operation can take a while to complete. /// /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/users/{userName}/environments/{name} + /// Request Path. + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/users/{userName}/environments/{name}. /// /// - /// Operation Id - /// Environments_Update + /// Operation Id. + /// Environments_Delete. /// /// - /// Default Api Version - /// 2018-09-15 + /// Default Api Version. + /// 2018-09-15. /// /// - /// Resource - /// + /// Resource. + /// . /// /// /// - /// An environment, which is essentially an ARM template deployment. + /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. /// The cancellation token to use. - /// is null. - public virtual async Task> UpdateAsync(DevTestLabEnvironmentPatch patch, CancellationToken cancellationToken = default) + public virtual async Task DeleteAsync(WaitUntil waitUntil, CancellationToken cancellationToken = default) { - Argument.AssertNotNull(patch, nameof(patch)); - - using var scope = _devTestLabEnvironmentEnvironmentsClientDiagnostics.CreateScope("DevTestLabEnvironmentResource.Update"); + using DiagnosticScope scope = _environmentsClientDiagnostics.CreateScope("DevTestLabEnvironmentResource.Delete"); scope.Start(); try { - var response = await _devTestLabEnvironmentEnvironmentsRestClient.UpdateAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, patch, cancellationToken).ConfigureAwait(false); - return Response.FromValue(new DevTestLabEnvironmentResource(Client, response.Value), response.GetRawResponse()); + RequestContext context = new RequestContext + { + CancellationToken = cancellationToken + }; + HttpMessage message = _environmentsRestClient.CreateDeleteRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, context); + Response response = await Pipeline.ProcessMessageAsync(message, context).ConfigureAwait(false); + DevTestLabsArmOperation operation = new DevTestLabsArmOperation(_environmentsClientDiagnostics, Pipeline, message.Request, response, OperationFinalStateVia.Location); + if (waitUntil == WaitUntil.Completed) + { + await operation.WaitForCompletionResponseAsync(cancellationToken).ConfigureAwait(false); + } + return operation; } catch (Exception e) { @@ -300,39 +347,46 @@ public virtual async Task> UpdateAsync(D } /// - /// Allows modifying tags of environments. All other properties will be ignored. + /// Delete environment. This operation can take a while to complete. /// /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/users/{userName}/environments/{name} + /// Request Path. + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/users/{userName}/environments/{name}. /// /// - /// Operation Id - /// Environments_Update + /// Operation Id. + /// Environments_Delete. /// /// - /// Default Api Version - /// 2018-09-15 + /// Default Api Version. + /// 2018-09-15. /// /// - /// Resource - /// + /// Resource. + /// . /// /// /// - /// An environment, which is essentially an ARM template deployment. + /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. /// The cancellation token to use. - /// is null. - public virtual Response Update(DevTestLabEnvironmentPatch patch, CancellationToken cancellationToken = default) + public virtual ArmOperation Delete(WaitUntil waitUntil, CancellationToken cancellationToken = default) { - Argument.AssertNotNull(patch, nameof(patch)); - - using var scope = _devTestLabEnvironmentEnvironmentsClientDiagnostics.CreateScope("DevTestLabEnvironmentResource.Update"); + using DiagnosticScope scope = _environmentsClientDiagnostics.CreateScope("DevTestLabEnvironmentResource.Delete"); scope.Start(); try { - var response = _devTestLabEnvironmentEnvironmentsRestClient.Update(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, patch, cancellationToken); - return Response.FromValue(new DevTestLabEnvironmentResource(Client, response.Value), response.GetRawResponse()); + RequestContext context = new RequestContext + { + CancellationToken = cancellationToken + }; + HttpMessage message = _environmentsRestClient.CreateDeleteRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, context); + Response response = Pipeline.ProcessMessage(message, context); + DevTestLabsArmOperation operation = new DevTestLabsArmOperation(_environmentsClientDiagnostics, Pipeline, message.Request, response, OperationFinalStateVia.Location); + if (waitUntil == WaitUntil.Completed) + { + operation.WaitForCompletionResponse(cancellationToken); + } + return operation; } catch (Exception e) { @@ -341,27 +395,7 @@ public virtual Response Update(DevTestLabEnvironm } } - /// - /// Add a tag to the current resource. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/users/{userName}/environments/{name} - /// - /// - /// Operation Id - /// Environments_Get - /// - /// - /// Default Api Version - /// 2018-09-15 - /// - /// - /// Resource - /// - /// - /// - /// + /// Add a tag to the current resource. /// The key for the tag. /// The value for the tag. /// The cancellation token to use. @@ -371,29 +405,35 @@ public virtual async Task> AddTagAsync(s Argument.AssertNotNull(key, nameof(key)); Argument.AssertNotNull(value, nameof(value)); - using var scope = _devTestLabEnvironmentEnvironmentsClientDiagnostics.CreateScope("DevTestLabEnvironmentResource.AddTag"); + using DiagnosticScope scope = _environmentsClientDiagnostics.CreateScope("DevTestLabEnvironmentResource.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 _devTestLabEnvironmentEnvironmentsRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, null, cancellationToken).ConfigureAwait(false); - return Response.FromValue(new DevTestLabEnvironmentResource(Client, originalResponse.Value), originalResponse.GetRawResponse()); + await GetTagResource().CreateOrUpdateAsync(WaitUntil.Completed, originalTags.Value.Data, cancellationToken).ConfigureAwait(false); + RequestContext context = new RequestContext + { + CancellationToken = cancellationToken + }; + HttpMessage message = _environmentsRestClient.CreateGetRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, default, context); + Response result = await Pipeline.ProcessMessageAsync(message, context).ConfigureAwait(false); + Response response = Response.FromValue(DevTestLabEnvironmentData.FromResponse(result), result); + return Response.FromValue(new DevTestLabEnvironmentResource(Client, response.Value), response.GetRawResponse()); } else { - var current = (await GetAsync(cancellationToken: cancellationToken).ConfigureAwait(false)).Value.Data; - var patch = new DevTestLabEnvironmentPatch(); - foreach (var tag in current.Tags) + DevTestLabEnvironmentData current = (await GetAsync(cancellationToken: cancellationToken).ConfigureAwait(false)).Value.Data; + DevTestLabEnvironmentPatch patch = new DevTestLabEnvironmentPatch(); + 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) @@ -403,27 +443,7 @@ public virtual async Task> AddTagAsync(s } } - /// - /// Add a tag to the current resource. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/users/{userName}/environments/{name} - /// - /// - /// Operation Id - /// Environments_Get - /// - /// - /// Default Api Version - /// 2018-09-15 - /// - /// - /// Resource - /// - /// - /// - /// + /// Add a tag to the current resource. /// The key for the tag. /// The value for the tag. /// The cancellation token to use. @@ -433,29 +453,35 @@ public virtual Response AddTag(string key, string Argument.AssertNotNull(key, nameof(key)); Argument.AssertNotNull(value, nameof(value)); - using var scope = _devTestLabEnvironmentEnvironmentsClientDiagnostics.CreateScope("DevTestLabEnvironmentResource.AddTag"); + using DiagnosticScope scope = _environmentsClientDiagnostics.CreateScope("DevTestLabEnvironmentResource.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 = _devTestLabEnvironmentEnvironmentsRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, null, cancellationToken); - return Response.FromValue(new DevTestLabEnvironmentResource(Client, originalResponse.Value), originalResponse.GetRawResponse()); + GetTagResource().CreateOrUpdate(WaitUntil.Completed, originalTags.Value.Data, cancellationToken); + RequestContext context = new RequestContext + { + CancellationToken = cancellationToken + }; + HttpMessage message = _environmentsRestClient.CreateGetRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, default, context); + Response result = Pipeline.ProcessMessage(message, context); + Response response = Response.FromValue(DevTestLabEnvironmentData.FromResponse(result), result); + return Response.FromValue(new DevTestLabEnvironmentResource(Client, response.Value), response.GetRawResponse()); } else { - var current = Get(cancellationToken: cancellationToken).Value.Data; - var patch = new DevTestLabEnvironmentPatch(); - foreach (var tag in current.Tags) + DevTestLabEnvironmentData current = Get(cancellationToken: cancellationToken).Value.Data; + DevTestLabEnvironmentPatch patch = new DevTestLabEnvironmentPatch(); + 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) @@ -465,54 +491,40 @@ public virtual Response AddTag(string key, string } } - /// - /// Replace the tags on the resource with the given set. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/users/{userName}/environments/{name} - /// - /// - /// Operation Id - /// Environments_Get - /// - /// - /// Default Api Version - /// 2018-09-15 - /// - /// - /// 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 = _devTestLabEnvironmentEnvironmentsClientDiagnostics.CreateScope("DevTestLabEnvironmentResource.SetTags"); + using DiagnosticScope scope = _environmentsClientDiagnostics.CreateScope("DevTestLabEnvironmentResource.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 _devTestLabEnvironmentEnvironmentsRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, null, cancellationToken).ConfigureAwait(false); - return Response.FromValue(new DevTestLabEnvironmentResource(Client, originalResponse.Value), originalResponse.GetRawResponse()); + await GetTagResource().CreateOrUpdateAsync(WaitUntil.Completed, originalTags.Value.Data, cancellationToken).ConfigureAwait(false); + RequestContext context = new RequestContext + { + CancellationToken = cancellationToken + }; + HttpMessage message = _environmentsRestClient.CreateGetRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, default, context); + Response result = await Pipeline.ProcessMessageAsync(message, context).ConfigureAwait(false); + Response response = Response.FromValue(DevTestLabEnvironmentData.FromResponse(result), result); + return Response.FromValue(new DevTestLabEnvironmentResource(Client, response.Value), response.GetRawResponse()); } else { - var current = (await GetAsync(cancellationToken: cancellationToken).ConfigureAwait(false)).Value.Data; - var patch = new DevTestLabEnvironmentPatch(); + DevTestLabEnvironmentData current = (await GetAsync(cancellationToken: cancellationToken).ConfigureAwait(false)).Value.Data; + DevTestLabEnvironmentPatch patch = new DevTestLabEnvironmentPatch(); 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) @@ -522,54 +534,40 @@ public virtual async Task> SetTagsAsync( } } - /// - /// Replace the tags on the resource with the given set. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/users/{userName}/environments/{name} - /// - /// - /// Operation Id - /// Environments_Get - /// - /// - /// Default Api Version - /// 2018-09-15 - /// - /// - /// 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 = _devTestLabEnvironmentEnvironmentsClientDiagnostics.CreateScope("DevTestLabEnvironmentResource.SetTags"); + using DiagnosticScope scope = _environmentsClientDiagnostics.CreateScope("DevTestLabEnvironmentResource.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 = _devTestLabEnvironmentEnvironmentsRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, null, cancellationToken); - return Response.FromValue(new DevTestLabEnvironmentResource(Client, originalResponse.Value), originalResponse.GetRawResponse()); + GetTagResource().CreateOrUpdate(WaitUntil.Completed, originalTags.Value.Data, cancellationToken); + RequestContext context = new RequestContext + { + CancellationToken = cancellationToken + }; + HttpMessage message = _environmentsRestClient.CreateGetRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, default, context); + Response result = Pipeline.ProcessMessage(message, context); + Response response = Response.FromValue(DevTestLabEnvironmentData.FromResponse(result), result); + return Response.FromValue(new DevTestLabEnvironmentResource(Client, response.Value), response.GetRawResponse()); } else { - var current = Get(cancellationToken: cancellationToken).Value.Data; - var patch = new DevTestLabEnvironmentPatch(); + DevTestLabEnvironmentData current = Get(cancellationToken: cancellationToken).Value.Data; + DevTestLabEnvironmentPatch patch = new DevTestLabEnvironmentPatch(); 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) @@ -579,27 +577,7 @@ public virtual Response SetTags(IDictionary - /// Removes a tag by key from the resource. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/users/{userName}/environments/{name} - /// - /// - /// Operation Id - /// Environments_Get - /// - /// - /// Default Api Version - /// 2018-09-15 - /// - /// - /// Resource - /// - /// - /// - /// + /// Removes a tag by key from the resource. /// The key for the tag. /// The cancellation token to use. /// is null. @@ -607,29 +585,35 @@ public virtual async Task> RemoveTagAsyn { Argument.AssertNotNull(key, nameof(key)); - using var scope = _devTestLabEnvironmentEnvironmentsClientDiagnostics.CreateScope("DevTestLabEnvironmentResource.RemoveTag"); + using DiagnosticScope scope = _environmentsClientDiagnostics.CreateScope("DevTestLabEnvironmentResource.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 _devTestLabEnvironmentEnvironmentsRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, null, cancellationToken).ConfigureAwait(false); - return Response.FromValue(new DevTestLabEnvironmentResource(Client, originalResponse.Value), originalResponse.GetRawResponse()); + await GetTagResource().CreateOrUpdateAsync(WaitUntil.Completed, originalTags.Value.Data, cancellationToken).ConfigureAwait(false); + RequestContext context = new RequestContext + { + CancellationToken = cancellationToken + }; + HttpMessage message = _environmentsRestClient.CreateGetRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, default, context); + Response result = await Pipeline.ProcessMessageAsync(message, context).ConfigureAwait(false); + Response response = Response.FromValue(DevTestLabEnvironmentData.FromResponse(result), result); + return Response.FromValue(new DevTestLabEnvironmentResource(Client, response.Value), response.GetRawResponse()); } else { - var current = (await GetAsync(cancellationToken: cancellationToken).ConfigureAwait(false)).Value.Data; - var patch = new DevTestLabEnvironmentPatch(); - foreach (var tag in current.Tags) + DevTestLabEnvironmentData current = (await GetAsync(cancellationToken: cancellationToken).ConfigureAwait(false)).Value.Data; + DevTestLabEnvironmentPatch patch = new DevTestLabEnvironmentPatch(); + 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) @@ -639,27 +623,7 @@ public virtual async Task> RemoveTagAsyn } } - /// - /// Removes a tag by key from the resource. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/users/{userName}/environments/{name} - /// - /// - /// Operation Id - /// Environments_Get - /// - /// - /// Default Api Version - /// 2018-09-15 - /// - /// - /// Resource - /// - /// - /// - /// + /// Removes a tag by key from the resource. /// The key for the tag. /// The cancellation token to use. /// is null. @@ -667,29 +631,35 @@ public virtual Response RemoveTag(string key, Can { Argument.AssertNotNull(key, nameof(key)); - using var scope = _devTestLabEnvironmentEnvironmentsClientDiagnostics.CreateScope("DevTestLabEnvironmentResource.RemoveTag"); + using DiagnosticScope scope = _environmentsClientDiagnostics.CreateScope("DevTestLabEnvironmentResource.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 = _devTestLabEnvironmentEnvironmentsRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, null, cancellationToken); - return Response.FromValue(new DevTestLabEnvironmentResource(Client, originalResponse.Value), originalResponse.GetRawResponse()); + GetTagResource().CreateOrUpdate(WaitUntil.Completed, originalTags.Value.Data, cancellationToken); + RequestContext context = new RequestContext + { + CancellationToken = cancellationToken + }; + HttpMessage message = _environmentsRestClient.CreateGetRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, default, context); + Response result = Pipeline.ProcessMessage(message, context); + Response response = Response.FromValue(DevTestLabEnvironmentData.FromResponse(result), result); + return Response.FromValue(new DevTestLabEnvironmentResource(Client, response.Value), response.GetRawResponse()); } else { - var current = Get(cancellationToken: cancellationToken).Value.Data; - var patch = new DevTestLabEnvironmentPatch(); - foreach (var tag in current.Tags) + DevTestLabEnvironmentData current = Get(cancellationToken: cancellationToken).Value.Data; + DevTestLabEnvironmentPatch patch = new DevTestLabEnvironmentPatch(); + 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) diff --git a/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/DevTestLabFormulaCollection.cs b/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/DevTestLabFormulaCollection.cs index 9913b6e3078d..3e7976b66864 100644 --- a/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/DevTestLabFormulaCollection.cs +++ b/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/DevTestLabFormulaCollection.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.DevTestLabs { @@ -24,51 +25,49 @@ namespace Azure.ResourceManager.DevTestLabs /// public partial class DevTestLabFormulaCollection : ArmCollection, IEnumerable, IAsyncEnumerable { - private readonly ClientDiagnostics _devTestLabFormulaFormulasClientDiagnostics; - private readonly FormulasRestOperations _devTestLabFormulaFormulasRestClient; + private readonly ClientDiagnostics _formulasClientDiagnostics; + private readonly Formulas _formulasRestClient; - /// Initializes a new instance of the class for mocking. + /// Initializes a new instance of DevTestLabFormulaCollection for mocking. protected DevTestLabFormulaCollection() { } - /// 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 DevTestLabFormulaCollection(ArmClient client, ResourceIdentifier id) : base(client, id) { - _devTestLabFormulaFormulasClientDiagnostics = new ClientDiagnostics("Azure.ResourceManager.DevTestLabs", DevTestLabFormulaResource.ResourceType.Namespace, Diagnostics); - TryGetApiVersion(DevTestLabFormulaResource.ResourceType, out string devTestLabFormulaFormulasApiVersion); - _devTestLabFormulaFormulasRestClient = new FormulasRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, devTestLabFormulaFormulasApiVersion); -#if DEBUG - ValidateResourceId(Id); -#endif + TryGetApiVersion(DevTestLabFormulaResource.ResourceType, out string devTestLabFormulaApiVersion); + _formulasClientDiagnostics = new ClientDiagnostics("Azure.ResourceManager.DevTestLabs", DevTestLabFormulaResource.ResourceType.Namespace, Diagnostics); + _formulasRestClient = new Formulas(_formulasClientDiagnostics, Pipeline, Endpoint, devTestLabFormulaApiVersion ?? "2018-09-15"); + ValidateResourceId(id); } + /// + [Conditional("DEBUG")] internal static void ValidateResourceId(ResourceIdentifier id) { if (id.ResourceType != DevTestLabResource.ResourceType) - throw new ArgumentException(string.Format(CultureInfo.CurrentCulture, "Invalid resource type {0} expected {1}", id.ResourceType, DevTestLabResource.ResourceType), nameof(id)); + { + throw new ArgumentException(string.Format("Invalid resource type {0} expected {1}", id.ResourceType, DevTestLabResource.ResourceType), id); + } } /// /// Create or replace an existing formula. This operation can take a while to complete. /// /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/formulas/{name} - /// - /// - /// Operation Id - /// Formulas_CreateOrUpdate + /// Request Path. + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/formulas/{name}. /// /// - /// Default Api Version - /// 2018-09-15 + /// Operation Id. + /// Formulas_CreateOrUpdate. /// /// - /// Resource - /// + /// Default Api Version. + /// 2018-09-15. /// /// /// @@ -76,21 +75,34 @@ internal static void ValidateResourceId(ResourceIdentifier id) /// The name of the formula. /// A formula for creating a VM, specifying an image base and other 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 name, DevTestLabFormulaData data, CancellationToken cancellationToken = default) { Argument.AssertNotNullOrEmpty(name, nameof(name)); Argument.AssertNotNull(data, nameof(data)); - using var scope = _devTestLabFormulaFormulasClientDiagnostics.CreateScope("DevTestLabFormulaCollection.CreateOrUpdate"); + using DiagnosticScope scope = _formulasClientDiagnostics.CreateScope("DevTestLabFormulaCollection.CreateOrUpdate"); scope.Start(); try { - var response = await _devTestLabFormulaFormulasRestClient.CreateOrUpdateAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, name, data, cancellationToken).ConfigureAwait(false); - var operation = new DevTestLabsArmOperation(new DevTestLabFormulaOperationSource(Client), _devTestLabFormulaFormulasClientDiagnostics, Pipeline, _devTestLabFormulaFormulasRestClient.CreateCreateOrUpdateRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, name, data).Request, response, OperationFinalStateVia.Location); + RequestContext context = new RequestContext + { + CancellationToken = cancellationToken + }; + HttpMessage message = _formulasRestClient.CreateCreateOrUpdateRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, name, DevTestLabFormulaData.ToRequestContent(data), context); + Response response = await Pipeline.ProcessMessageAsync(message, context).ConfigureAwait(false); + DevTestLabsArmOperation operation = new DevTestLabsArmOperation( + new DevTestLabFormulaOperationSource(Client), + _formulasClientDiagnostics, + Pipeline, + message.Request, + response, + OperationFinalStateVia.Location); if (waitUntil == WaitUntil.Completed) + { await operation.WaitForCompletionAsync(cancellationToken).ConfigureAwait(false); + } return operation; } catch (Exception e) @@ -104,20 +116,16 @@ public virtual async Task> CreateOrUpdat /// Create or replace an existing formula. This operation can take a while to complete. /// /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/formulas/{name} + /// Request Path. + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/formulas/{name}. /// /// - /// Operation Id - /// Formulas_CreateOrUpdate + /// Operation Id. + /// Formulas_CreateOrUpdate. /// /// - /// Default Api Version - /// 2018-09-15 - /// - /// - /// Resource - /// + /// Default Api Version. + /// 2018-09-15. /// /// /// @@ -125,21 +133,34 @@ public virtual async Task> CreateOrUpdat /// The name of the formula. /// A formula for creating a VM, specifying an image base and other 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 name, DevTestLabFormulaData data, CancellationToken cancellationToken = default) { Argument.AssertNotNullOrEmpty(name, nameof(name)); Argument.AssertNotNull(data, nameof(data)); - using var scope = _devTestLabFormulaFormulasClientDiagnostics.CreateScope("DevTestLabFormulaCollection.CreateOrUpdate"); + using DiagnosticScope scope = _formulasClientDiagnostics.CreateScope("DevTestLabFormulaCollection.CreateOrUpdate"); scope.Start(); try { - var response = _devTestLabFormulaFormulasRestClient.CreateOrUpdate(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, name, data, cancellationToken); - var operation = new DevTestLabsArmOperation(new DevTestLabFormulaOperationSource(Client), _devTestLabFormulaFormulasClientDiagnostics, Pipeline, _devTestLabFormulaFormulasRestClient.CreateCreateOrUpdateRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, name, data).Request, response, OperationFinalStateVia.Location); + RequestContext context = new RequestContext + { + CancellationToken = cancellationToken + }; + HttpMessage message = _formulasRestClient.CreateCreateOrUpdateRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, name, DevTestLabFormulaData.ToRequestContent(data), context); + Response response = Pipeline.ProcessMessage(message, context); + DevTestLabsArmOperation operation = new DevTestLabsArmOperation( + new DevTestLabFormulaOperationSource(Client), + _formulasClientDiagnostics, + Pipeline, + message.Request, + response, + OperationFinalStateVia.Location); if (waitUntil == WaitUntil.Completed) + { operation.WaitForCompletion(cancellationToken); + } return operation; } catch (Exception e) @@ -153,39 +174,43 @@ public virtual ArmOperation CreateOrUpdate(WaitUntil /// Get formula. /// /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/formulas/{name} + /// Request Path. + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/formulas/{name}. /// /// - /// Operation Id - /// Formulas_Get + /// Operation Id. + /// Formulas_Get. /// /// - /// Default Api Version - /// 2018-09-15 - /// - /// - /// Resource - /// + /// Default Api Version. + /// 2018-09-15. /// /// /// /// The name of the formula. /// Specify the $expand query. Example: 'properties($select=description)'. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. - public virtual async Task> GetAsync(string name, string expand = null, CancellationToken cancellationToken = default) + /// is an empty string, and was expected to be non-empty. + public virtual async Task> GetAsync(string name, string expand = default, CancellationToken cancellationToken = default) { Argument.AssertNotNullOrEmpty(name, nameof(name)); - using var scope = _devTestLabFormulaFormulasClientDiagnostics.CreateScope("DevTestLabFormulaCollection.Get"); + using DiagnosticScope scope = _formulasClientDiagnostics.CreateScope("DevTestLabFormulaCollection.Get"); scope.Start(); try { - var response = await _devTestLabFormulaFormulasRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, name, expand, cancellationToken).ConfigureAwait(false); + RequestContext context = new RequestContext + { + CancellationToken = cancellationToken + }; + HttpMessage message = _formulasRestClient.CreateGetRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, name, expand, context); + Response result = await Pipeline.ProcessMessageAsync(message, context).ConfigureAwait(false); + Response response = Response.FromValue(DevTestLabFormulaData.FromResponse(result), result); if (response.Value == null) + { throw new RequestFailedException(response.GetRawResponse()); + } return Response.FromValue(new DevTestLabFormulaResource(Client, response.Value), response.GetRawResponse()); } catch (Exception e) @@ -199,39 +224,43 @@ public virtual async Task> GetAsync(string n /// Get formula. /// /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/formulas/{name} - /// - /// - /// Operation Id - /// Formulas_Get + /// Request Path. + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/formulas/{name}. /// /// - /// Default Api Version - /// 2018-09-15 + /// Operation Id. + /// Formulas_Get. /// /// - /// Resource - /// + /// Default Api Version. + /// 2018-09-15. /// /// /// /// The name of the formula. /// Specify the $expand query. Example: 'properties($select=description)'. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. - public virtual Response Get(string name, string expand = null, CancellationToken cancellationToken = default) + /// is an empty string, and was expected to be non-empty. + public virtual Response Get(string name, string expand = default, CancellationToken cancellationToken = default) { Argument.AssertNotNullOrEmpty(name, nameof(name)); - using var scope = _devTestLabFormulaFormulasClientDiagnostics.CreateScope("DevTestLabFormulaCollection.Get"); + using DiagnosticScope scope = _formulasClientDiagnostics.CreateScope("DevTestLabFormulaCollection.Get"); scope.Start(); try { - var response = _devTestLabFormulaFormulasRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, name, expand, cancellationToken); + RequestContext context = new RequestContext + { + CancellationToken = cancellationToken + }; + HttpMessage message = _formulasRestClient.CreateGetRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, name, expand, context); + Response result = Pipeline.ProcessMessage(message, context); + Response response = Response.FromValue(DevTestLabFormulaData.FromResponse(result), result); if (response.Value == null) + { throw new RequestFailedException(response.GetRawResponse()); + } return Response.FromValue(new DevTestLabFormulaResource(Client, response.Value), response.GetRawResponse()); } catch (Exception e) @@ -245,20 +274,16 @@ public virtual Response Get(string name, string expan /// List formulas in a given lab. /// /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/formulas + /// Request Path. + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/formulas. /// /// - /// Operation Id - /// Formulas_List + /// Operation Id. + /// Formulas_List. /// /// - /// Default Api Version - /// 2018-09-15 - /// - /// - /// Resource - /// + /// Default Api Version. + /// 2018-09-15. /// /// /// @@ -267,32 +292,39 @@ public virtual Response Get(string name, string expan /// The maximum number of resources to return from the operation. Example: '$top=10'. /// The ordering expression for the results, using OData notation. Example: '$orderby=name desc'. /// The cancellation token to use. - /// An async collection of that may take multiple service requests to iterate over. - public virtual AsyncPageable GetAllAsync(string expand = null, string filter = null, int? top = null, string orderby = null, CancellationToken cancellationToken = default) + /// A collection of that may take multiple service requests to iterate over. + public virtual AsyncPageable GetAllAsync(string expand = default, string filter = default, int? top = default, string @orderby = default, CancellationToken cancellationToken = default) { - HttpMessage FirstPageRequest(int? pageSizeHint) => _devTestLabFormulaFormulasRestClient.CreateListRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, expand, filter, top, orderby); - HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _devTestLabFormulaFormulasRestClient.CreateListNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName, Id.Name, expand, filter, top, orderby); - return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new DevTestLabFormulaResource(Client, DevTestLabFormulaData.DeserializeDevTestLabFormulaData(e)), _devTestLabFormulaFormulasClientDiagnostics, Pipeline, "DevTestLabFormulaCollection.GetAll", "value", "nextLink", cancellationToken); + RequestContext context = new RequestContext + { + CancellationToken = cancellationToken + }; + return new AsyncPageableWrapper(new FormulasGetAllAsyncCollectionResultOfT( + _formulasRestClient, + Id.SubscriptionId, + Id.ResourceGroupName, + Id.Name, + expand, + filter, + top, + @orderby, + context), data => new DevTestLabFormulaResource(Client, data)); } /// /// List formulas in a given lab. /// /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/formulas - /// - /// - /// Operation Id - /// Formulas_List + /// Request Path. + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/formulas. /// /// - /// Default Api Version - /// 2018-09-15 + /// Operation Id. + /// Formulas_List. /// /// - /// Resource - /// + /// Default Api Version. + /// 2018-09-15. /// /// /// @@ -302,48 +334,73 @@ public virtual AsyncPageable GetAllAsync(string expan /// The ordering expression for the results, using OData notation. Example: '$orderby=name desc'. /// The cancellation token to use. /// A collection of that may take multiple service requests to iterate over. - public virtual Pageable GetAll(string expand = null, string filter = null, int? top = null, string orderby = null, CancellationToken cancellationToken = default) + public virtual Pageable GetAll(string expand = default, string filter = default, int? top = default, string @orderby = default, CancellationToken cancellationToken = default) { - HttpMessage FirstPageRequest(int? pageSizeHint) => _devTestLabFormulaFormulasRestClient.CreateListRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, expand, filter, top, orderby); - HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _devTestLabFormulaFormulasRestClient.CreateListNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName, Id.Name, expand, filter, top, orderby); - return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new DevTestLabFormulaResource(Client, DevTestLabFormulaData.DeserializeDevTestLabFormulaData(e)), _devTestLabFormulaFormulasClientDiagnostics, Pipeline, "DevTestLabFormulaCollection.GetAll", "value", "nextLink", cancellationToken); + RequestContext context = new RequestContext + { + CancellationToken = cancellationToken + }; + return new PageableWrapper(new FormulasGetAllCollectionResultOfT( + _formulasRestClient, + Id.SubscriptionId, + Id.ResourceGroupName, + Id.Name, + expand, + filter, + top, + @orderby, + context), data => new DevTestLabFormulaResource(Client, data)); } /// /// Checks to see if the resource exists in azure. /// /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/formulas/{name} - /// - /// - /// Operation Id - /// Formulas_Get + /// Request Path. + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/formulas/{name}. /// /// - /// Default Api Version - /// 2018-09-15 + /// Operation Id. + /// Formulas_Get. /// /// - /// Resource - /// + /// Default Api Version. + /// 2018-09-15. /// /// /// /// The name of the formula. /// Specify the $expand query. Example: 'properties($select=description)'. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. - public virtual async Task> ExistsAsync(string name, string expand = null, CancellationToken cancellationToken = default) + /// is an empty string, and was expected to be non-empty. + public virtual async Task> ExistsAsync(string name, string expand = default, CancellationToken cancellationToken = default) { Argument.AssertNotNullOrEmpty(name, nameof(name)); - using var scope = _devTestLabFormulaFormulasClientDiagnostics.CreateScope("DevTestLabFormulaCollection.Exists"); + using DiagnosticScope scope = _formulasClientDiagnostics.CreateScope("DevTestLabFormulaCollection.Exists"); scope.Start(); try { - var response = await _devTestLabFormulaFormulasRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, name, expand, cancellationToken: cancellationToken).ConfigureAwait(false); + RequestContext context = new RequestContext + { + CancellationToken = cancellationToken + }; + HttpMessage message = _formulasRestClient.CreateGetRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, name, expand, context); + await Pipeline.SendAsync(message, context.CancellationToken).ConfigureAwait(false); + Response result = message.Response; + Response response = default; + switch (result.Status) + { + case 200: + response = Response.FromValue(DevTestLabFormulaData.FromResponse(result), result); + break; + case 404: + response = Response.FromValue((DevTestLabFormulaData)null, result); + break; + default: + throw new RequestFailedException(result); + } return Response.FromValue(response.Value != null, response.GetRawResponse()); } catch (Exception e) @@ -357,37 +414,51 @@ public virtual async Task> ExistsAsync(string name, string expand /// Checks to see if the resource exists in azure. /// /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/formulas/{name} + /// Request Path. + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/formulas/{name}. /// /// - /// Operation Id - /// Formulas_Get + /// Operation Id. + /// Formulas_Get. /// /// - /// Default Api Version - /// 2018-09-15 - /// - /// - /// Resource - /// + /// Default Api Version. + /// 2018-09-15. /// /// /// /// The name of the formula. /// Specify the $expand query. Example: 'properties($select=description)'. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. - public virtual Response Exists(string name, string expand = null, CancellationToken cancellationToken = default) + /// is an empty string, and was expected to be non-empty. + public virtual Response Exists(string name, string expand = default, CancellationToken cancellationToken = default) { Argument.AssertNotNullOrEmpty(name, nameof(name)); - using var scope = _devTestLabFormulaFormulasClientDiagnostics.CreateScope("DevTestLabFormulaCollection.Exists"); + using DiagnosticScope scope = _formulasClientDiagnostics.CreateScope("DevTestLabFormulaCollection.Exists"); scope.Start(); try { - var response = _devTestLabFormulaFormulasRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, name, expand, cancellationToken: cancellationToken); + RequestContext context = new RequestContext + { + CancellationToken = cancellationToken + }; + HttpMessage message = _formulasRestClient.CreateGetRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, name, expand, context); + Pipeline.Send(message, context.CancellationToken); + Response result = message.Response; + Response response = default; + switch (result.Status) + { + case 200: + response = Response.FromValue(DevTestLabFormulaData.FromResponse(result), result); + break; + case 404: + response = Response.FromValue((DevTestLabFormulaData)null, result); + break; + default: + throw new RequestFailedException(result); + } return Response.FromValue(response.Value != null, response.GetRawResponse()); } catch (Exception e) @@ -401,39 +472,55 @@ public virtual Response Exists(string name, string expand = null, Cancella /// Tries to get details for this resource from the service. /// /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/formulas/{name} - /// - /// - /// Operation Id - /// Formulas_Get + /// Request Path. + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/formulas/{name}. /// /// - /// Default Api Version - /// 2018-09-15 + /// Operation Id. + /// Formulas_Get. /// /// - /// Resource - /// + /// Default Api Version. + /// 2018-09-15. /// /// /// /// The name of the formula. /// Specify the $expand query. Example: 'properties($select=description)'. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. - public virtual async Task> GetIfExistsAsync(string name, string expand = null, CancellationToken cancellationToken = default) + /// is an empty string, and was expected to be non-empty. + public virtual async Task> GetIfExistsAsync(string name, string expand = default, CancellationToken cancellationToken = default) { Argument.AssertNotNullOrEmpty(name, nameof(name)); - using var scope = _devTestLabFormulaFormulasClientDiagnostics.CreateScope("DevTestLabFormulaCollection.GetIfExists"); + using DiagnosticScope scope = _formulasClientDiagnostics.CreateScope("DevTestLabFormulaCollection.GetIfExists"); scope.Start(); try { - var response = await _devTestLabFormulaFormulasRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, name, expand, cancellationToken: cancellationToken).ConfigureAwait(false); + RequestContext context = new RequestContext + { + CancellationToken = cancellationToken + }; + HttpMessage message = _formulasRestClient.CreateGetRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, name, expand, context); + await Pipeline.SendAsync(message, context.CancellationToken).ConfigureAwait(false); + Response result = message.Response; + Response response = default; + switch (result.Status) + { + case 200: + response = Response.FromValue(DevTestLabFormulaData.FromResponse(result), result); + break; + case 404: + response = Response.FromValue((DevTestLabFormulaData)null, result); + break; + default: + throw new RequestFailedException(result); + } if (response.Value == null) + { return new NoValueResponse(response.GetRawResponse()); + } return Response.FromValue(new DevTestLabFormulaResource(Client, response.Value), response.GetRawResponse()); } catch (Exception e) @@ -447,39 +534,55 @@ public virtual async Task> GetIfExis /// Tries to get details for this resource from the service. /// /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/formulas/{name} + /// Request Path. + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/formulas/{name}. /// /// - /// Operation Id - /// Formulas_Get + /// Operation Id. + /// Formulas_Get. /// /// - /// Default Api Version - /// 2018-09-15 - /// - /// - /// Resource - /// + /// Default Api Version. + /// 2018-09-15. /// /// /// /// The name of the formula. /// Specify the $expand query. Example: 'properties($select=description)'. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. - public virtual NullableResponse GetIfExists(string name, string expand = null, CancellationToken cancellationToken = default) + /// is an empty string, and was expected to be non-empty. + public virtual NullableResponse GetIfExists(string name, string expand = default, CancellationToken cancellationToken = default) { Argument.AssertNotNullOrEmpty(name, nameof(name)); - using var scope = _devTestLabFormulaFormulasClientDiagnostics.CreateScope("DevTestLabFormulaCollection.GetIfExists"); + using DiagnosticScope scope = _formulasClientDiagnostics.CreateScope("DevTestLabFormulaCollection.GetIfExists"); scope.Start(); try { - var response = _devTestLabFormulaFormulasRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, name, expand, cancellationToken: cancellationToken); + RequestContext context = new RequestContext + { + CancellationToken = cancellationToken + }; + HttpMessage message = _formulasRestClient.CreateGetRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, name, expand, context); + Pipeline.Send(message, context.CancellationToken); + Response result = message.Response; + Response response = default; + switch (result.Status) + { + case 200: + response = Response.FromValue(DevTestLabFormulaData.FromResponse(result), result); + break; + case 404: + response = Response.FromValue((DevTestLabFormulaData)null, result); + break; + default: + throw new RequestFailedException(result); + } if (response.Value == null) + { return new NoValueResponse(response.GetRawResponse()); + } return Response.FromValue(new DevTestLabFormulaResource(Client, response.Value), response.GetRawResponse()); } catch (Exception e) @@ -499,6 +602,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/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/DevTestLabFormulaData.Serialization.cs b/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/DevTestLabFormulaData.Serialization.cs index 193ec6ea1cf3..b88fabb92046 100644 --- a/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/DevTestLabFormulaData.Serialization.cs +++ b/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/DevTestLabFormulaData.Serialization.cs @@ -10,16 +10,47 @@ using System.Collections.Generic; using System.Text; using System.Text.Json; +using Azure; using Azure.Core; using Azure.ResourceManager.DevTestLabs.Models; using Azure.ResourceManager.Models; namespace Azure.ResourceManager.DevTestLabs { - public partial class DevTestLabFormulaData : IUtf8JsonSerializable, IJsonModel + /// A formula for creating a VM, specifying an image base and other parameters. + public partial class DevTestLabFormulaData : TrackedResourceData, IJsonModel { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + /// Initializes a new instance of for deserialization. + internal DevTestLabFormulaData() + { + } + /// 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)) + { + return DeserializeDevTestLabFormulaData(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(DevTestLabFormulaData)} does not support reading '{options.Format}' format."); + } + } + + /// The to deserialize the from. + internal static DevTestLabFormulaData FromResponse(Response response) + { + using JsonDocument document = JsonDocument.Parse(response.Content, ModelSerializationExtensions.JsonDocumentOptions); + return DeserializeDevTestLabFormulaData(document.RootElement, ModelSerializationExtensions.WireOptions); + } + + /// The JSON writer. + /// The client options for reading and writing models. void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) { writer.WriteStartObject(); @@ -31,235 +62,153 @@ void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderW /// 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(DevTestLabFormulaData)} does not support writing '{format}' format."); } - base.JsonModelWriteCore(writer, options); writer.WritePropertyName("properties"u8); - writer.WriteStartObject(); - if (Optional.IsDefined(Description)) - { - writer.WritePropertyName("description"u8); - writer.WriteStringValue(Description); - } - if (options.Format != "W" && Optional.IsDefined(Author)) - { - writer.WritePropertyName("author"u8); - writer.WriteStringValue(Author); - } - if (Optional.IsDefined(OSType)) - { - writer.WritePropertyName("osType"u8); - writer.WriteStringValue(OSType); - } - if (options.Format != "W" && Optional.IsDefined(CreatedOn)) - { - writer.WritePropertyName("creationDate"u8); - writer.WriteStringValue(CreatedOn.Value, "O"); - } - if (Optional.IsDefined(FormulaContent)) - { - writer.WritePropertyName("formulaContent"u8); - writer.WriteObjectValue(FormulaContent, options); - } - if (Optional.IsDefined(Vm)) + writer.WriteObjectValue(Properties, options); + if (Optional.IsCollectionDefined(Tags)) { - writer.WritePropertyName("vm"u8); - writer.WriteObjectValue(Vm, options); - } - if (options.Format != "W" && Optional.IsDefined(ProvisioningState)) - { - writer.WritePropertyName("provisioningState"u8); - writer.WriteStringValue(ProvisioningState); - } - if (options.Format != "W" && Optional.IsDefined(UniqueIdentifier)) - { - writer.WritePropertyName("uniqueIdentifier"u8); - writer.WriteStringValue(UniqueIdentifier.Value); + writer.WritePropertyName("tags"u8); + writer.WriteStartObject(); + foreach (var item in Tags) + { + writer.WritePropertyName(item.Key); + if (item.Value == null) + { + writer.WriteNullValue(); + continue; + } + writer.WriteStringValue(item.Value); + } + writer.WriteEndObject(); } - writer.WriteEndObject(); } - DevTestLabFormulaData IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + /// The JSON reader. + /// The client options for reading and writing models. + DevTestLabFormulaData IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) => (DevTestLabFormulaData)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(DevTestLabFormulaData)} does not support reading '{format}' format."); } - using JsonDocument document = JsonDocument.ParseValue(ref reader); return DeserializeDevTestLabFormulaData(document.RootElement, options); } - internal static DevTestLabFormulaData DeserializeDevTestLabFormulaData(JsonElement element, ModelReaderWriterOptions options = null) + /// The JSON element to deserialize. + /// The client options for reading and writing models. + internal static DevTestLabFormulaData DeserializeDevTestLabFormulaData(JsonElement element, ModelReaderWriterOptions options) { - options ??= ModelSerializationExtensions.WireOptions; - if (element.ValueKind == JsonValueKind.Null) { return null; } - IDictionary tags = default; - AzureLocation location = default; ResourceIdentifier id = default; string name = default; - ResourceType type = default; + ResourceType resourceType = default; SystemData systemData = default; - string description = default; - string author = default; - string osType = default; - DateTimeOffset? creationDate = default; - DevTestLabVmCreationContent formulaContent = default; - FormulaPropertiesFromVm vm = default; - string provisioningState = default; - Guid? uniqueIdentifier = default; - IDictionary serializedAdditionalRawData = default; - Dictionary rawDataDictionary = new Dictionary(); - foreach (var property in element.EnumerateObject()) + IDictionary additionalBinaryDataProperties = new ChangeTrackingDictionary(); + AzureLocation location = default; + FormulaProperties properties = default; + IDictionary tags = default; + foreach (var prop in element.EnumerateObject()) { - if (property.NameEquals("tags"u8)) + if (prop.NameEquals("id"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()) - { - dictionary.Add(property0.Name, property0.Value.GetString()); - } - tags = dictionary; + id = new ResourceIdentifier(prop.Value.GetString()); continue; } - if (property.NameEquals("location"u8)) + if (prop.NameEquals("name"u8)) { - location = new AzureLocation(property.Value.GetString()); + name = prop.Value.GetString(); continue; } - if (property.NameEquals("id"u8)) + if (prop.NameEquals("type"u8)) { - id = new ResourceIdentifier(property.Value.GetString()); + if (prop.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + resourceType = new ResourceType(prop.Value.GetString()); continue; } - if (property.NameEquals("name"u8)) + if (prop.NameEquals("systemData"u8)) { - name = property.Value.GetString(); + if (prop.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + systemData = ModelReaderWriter.Read(new BinaryData(Encoding.UTF8.GetBytes(prop.Value.GetRawText())), ModelSerializationExtensions.WireOptions, AzureResourceManagerDevTestLabsContext.Default); 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) - { - continue; - } - systemData = ModelReaderWriter.Read(new BinaryData(Encoding.UTF8.GetBytes(property.Value.GetRawText())), ModelSerializationExtensions.WireOptions, AzureResourceManagerDevTestLabsContext.Default); + properties = FormulaProperties.DeserializeFormulaProperties(prop.Value, options); continue; } - if (property.NameEquals("properties"u8)) + if (prop.NameEquals("tags"u8)) { - if (property.Value.ValueKind == JsonValueKind.Null) + if (prop.Value.ValueKind == JsonValueKind.Null) { - property.ThrowNonNullablePropertyIsNull(); continue; } - foreach (var property0 in property.Value.EnumerateObject()) + Dictionary dictionary = new Dictionary(); + foreach (var prop0 in prop.Value.EnumerateObject()) { - if (property0.NameEquals("description"u8)) - { - description = property0.Value.GetString(); - continue; - } - if (property0.NameEquals("author"u8)) - { - author = property0.Value.GetString(); - continue; - } - if (property0.NameEquals("osType"u8)) - { - osType = property0.Value.GetString(); - continue; - } - if (property0.NameEquals("creationDate"u8)) + if (prop0.Value.ValueKind == JsonValueKind.Null) { - if (property0.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - creationDate = property0.Value.GetDateTimeOffset("O"); - continue; + dictionary.Add(prop0.Name, null); } - if (property0.NameEquals("formulaContent"u8)) + else { - if (property0.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - formulaContent = DevTestLabVmCreationContent.DeserializeDevTestLabVmCreationContent(property0.Value, options); - continue; - } - if (property0.NameEquals("vm"u8)) - { - if (property0.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - vm = FormulaPropertiesFromVm.DeserializeFormulaPropertiesFromVm(property0.Value, options); - continue; - } - if (property0.NameEquals("provisioningState"u8)) - { - provisioningState = property0.Value.GetString(); - continue; - } - if (property0.NameEquals("uniqueIdentifier"u8)) - { - if (property0.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - uniqueIdentifier = property0.Value.GetGuid(); - continue; + dictionary.Add(prop0.Name, prop0.Value.GetString()); } } + tags = dictionary; 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 DevTestLabFormulaData( id, name, - type, + resourceType, systemData, - tags ?? new ChangeTrackingDictionary(), + additionalBinaryDataProperties, location, - description, - author, - osType, - creationDate, - formulaContent, - vm, - provisioningState, - uniqueIdentifier, - serializedAdditionalRawData); + properties, + tags ?? new ChangeTrackingDictionary()); } - 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": @@ -269,22 +218,23 @@ BinaryData IPersistableModel.Write(ModelReaderWriterOptio } } - DevTestLabFormulaData 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. + DevTestLabFormulaData IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) => (DevTestLabFormulaData)PersistableModelCreateCore(data, options); - switch (format) + /// The client options for reading and writing models. + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + + /// The to serialize into . + internal static RequestContent ToRequestContent(DevTestLabFormulaData devTestLabFormulaData) + { + if (devTestLabFormulaData == null) { - case "J": - { - using JsonDocument document = JsonDocument.Parse(data, ModelSerializationExtensions.JsonDocumentOptions); - return DeserializeDevTestLabFormulaData(document.RootElement, options); - } - default: - throw new FormatException($"The model {nameof(DevTestLabFormulaData)} does not support reading '{options.Format}' format."); + return null; } + Utf8JsonRequestContent content = new Utf8JsonRequestContent(); + content.JsonWriter.WriteObjectValue(devTestLabFormulaData, ModelSerializationExtensions.WireOptions); + return content; } - - string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; } } diff --git a/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/DevTestLabFormulaData.cs b/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/DevTestLabFormulaData.cs index 9d8857766b4a..f1835372bc5f 100644 --- a/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/DevTestLabFormulaData.cs +++ b/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/DevTestLabFormulaData.cs @@ -13,111 +13,139 @@ namespace Azure.ResourceManager.DevTestLabs { - /// - /// A class representing the DevTestLabFormula data model. - /// A formula for creating a VM, specifying an image base and other parameters - /// + /// A formula for creating a VM, specifying an image base and other parameters. public partial class DevTestLabFormulaData : 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 DevTestLabFormulaData(AzureLocation location) : base(location) { + } /// Initializes a new instance of . - /// The id. - /// The name. - /// The resourceType. - /// The systemData. - /// The tags. - /// The location. - /// The description of the formula. - /// The author of the formula. - /// The OS type of the formula. - /// The creation date of the formula. - /// The content of the formula. - /// Information about a VM from which a formula is to be created. - /// The provisioning status of the resource. - /// The unique immutable identifier of a resource (Guid). - /// Keeps track of any properties unknown to the library. - internal DevTestLabFormulaData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, IDictionary tags, AzureLocation location, string description, string author, string osType, DateTimeOffset? createdOn, DevTestLabVmCreationContent formulaContent, FormulaPropertiesFromVm vm, string provisioningState, Guid? uniqueIdentifier, IDictionary serializedAdditionalRawData) : base(id, name, resourceType, systemData, tags, 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. + /// The geo-location where the resource lives. + /// The properties of the formula. + /// Resource tags. + internal DevTestLabFormulaData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, IDictionary additionalBinaryDataProperties, AzureLocation location, FormulaProperties properties, IDictionary tags) : base(id, name, resourceType, systemData, tags, location) { - Description = description; - Author = author; - OSType = osType; - CreatedOn = createdOn; - FormulaContent = formulaContent; - Vm = vm; - ProvisioningState = provisioningState; - UniqueIdentifier = uniqueIdentifier; - _serializedAdditionalRawData = serializedAdditionalRawData; + _additionalBinaryDataProperties = additionalBinaryDataProperties; + Properties = properties; } - /// Initializes a new instance of for deserialization. - internal DevTestLabFormulaData() + /// The properties of the formula. + internal FormulaProperties Properties { get; set; } + + /// The description of the formula. + public string Description { + get + { + return Properties is null ? default : Properties.Description; + } + set + { + if (Properties is null) + { + Properties = new FormulaProperties(); + } + Properties.Description = value; + } } - /// The description of the formula. - public string Description { get; set; } /// The author of the formula. - public string Author { get; } + public string Author + { + get + { + return Properties is null ? default : Properties.Author; + } + } + /// The OS type of the formula. - public string OSType { get; set; } + public string OSType + { + get + { + return Properties is null ? default : Properties.OSType; + } + set + { + if (Properties is null) + { + Properties = new FormulaProperties(); + } + Properties.OSType = value; + } + } + /// The creation date of the formula. - public DateTimeOffset? CreatedOn { get; } + public DateTimeOffset? CreatedOn + { + get + { + return Properties is null ? default : Properties.CreatedOn; + } + } + /// The content of the formula. - public DevTestLabVmCreationContent FormulaContent { get; set; } - /// Information about a VM from which a formula is to be created. - internal FormulaPropertiesFromVm Vm { get; set; } - /// The identifier of the VM from which a formula is to be created. - public string LabVmId + public DevTestLabVmCreationContent FormulaContent { - get => Vm is null ? default : Vm.LabVmId; + get + { + return Properties is null ? default : Properties.FormulaContent; + } set { - if (Vm is null) - Vm = new FormulaPropertiesFromVm(); - Vm.LabVmId = value; + if (Properties is null) + { + Properties = new FormulaProperties(); + } + Properties.FormulaContent = value; } } /// The provisioning status of the resource. - public string ProvisioningState { get; } + public string ProvisioningState + { + get + { + return Properties is null ? default : Properties.ProvisioningState; + } + } + /// The unique immutable identifier of a resource (Guid). - public Guid? UniqueIdentifier { get; } + public Guid? UniqueIdentifier + { + get + { + return Properties is null ? default : Properties.UniqueIdentifier; + } + } + + /// The identifier of the VM from which a formula is to be created. + public string LabVmId + { + get + { + return Properties is null ? default : Properties.LabVmId; + } + set + { + if (Properties is null) + { + Properties = new FormulaProperties(); + } + Properties.LabVmId = value; + } + } } } diff --git a/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/DevTestLabFormulaResource.Serialization.cs b/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/DevTestLabFormulaResource.Serialization.cs index ffc9a4f831ef..95759e4aa9e3 100644 --- a/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/DevTestLabFormulaResource.Serialization.cs +++ b/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/DevTestLabFormulaResource.Serialization.cs @@ -11,19 +11,29 @@ namespace Azure.ResourceManager.DevTestLabs { + /// public partial class DevTestLabFormulaResource : IJsonModel { - private static DevTestLabFormulaData s_dataDeserializationInstance; - private static DevTestLabFormulaData DataDeserializationInstance => s_dataDeserializationInstance ??= new(); + private static IJsonModel s_dataDeserializationInstance; + private static IJsonModel DataDeserializationInstance => s_dataDeserializationInstance ??= new DevTestLabFormulaData(); + + /// 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); - DevTestLabFormulaData 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. + DevTestLabFormulaData 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, AzureResourceManagerDevTestLabsContext.Default); + /// The binary data to be processed. + /// The client options for reading and writing models. DevTestLabFormulaData IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) => ModelReaderWriter.Read(data, options, AzureResourceManagerDevTestLabsContext.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/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/DevTestLabFormulaResource.cs b/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/DevTestLabFormulaResource.cs index 3b57c389f604..7f334cc23771 100644 --- a/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/DevTestLabFormulaResource.cs +++ b/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/DevTestLabFormulaResource.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.DevTestLabs.Models; +using Azure.ResourceManager.Resources; namespace Azure.ResourceManager.DevTestLabs { /// - /// A Class representing a DevTestLabFormula 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 GetDevTestLabFormulaResource method. - /// Otherwise you can get one from its parent resource using the GetDevTestLabFormula method. + /// A class representing a DevTestLabFormula 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 GetDevTestLabFormulas method. /// public partial class DevTestLabFormulaResource : ArmResource { - /// Generate the resource identifier of a instance. - /// The subscriptionId. - /// The resourceGroupName. - /// The labName. - /// The name. - public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string labName, string name) - { - var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/formulas/{name}"; - return new ResourceIdentifier(resourceId); - } - - private readonly ClientDiagnostics _devTestLabFormulaFormulasClientDiagnostics; - private readonly FormulasRestOperations _devTestLabFormulaFormulasRestClient; + private readonly ClientDiagnostics _formulasClientDiagnostics; + private readonly Formulas _formulasRestClient; private readonly DevTestLabFormulaData _data; - /// Gets the resource type for the operations. public static readonly ResourceType ResourceType = "Microsoft.DevTestLab/labs/formulas"; - /// Initializes a new instance of the class for mocking. + /// Initializes a new instance of DevTestLabFormulaResource for mocking. protected DevTestLabFormulaResource() { } - /// 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 DevTestLabFormulaResource(ArmClient client, DevTestLabFormulaData data) : this(client, data.Id) @@ -56,72 +46,94 @@ internal DevTestLabFormulaResource(ArmClient client, DevTestLabFormulaData data) _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 DevTestLabFormulaResource(ArmClient client, ResourceIdentifier id) : base(client, id) { - _devTestLabFormulaFormulasClientDiagnostics = new ClientDiagnostics("Azure.ResourceManager.DevTestLabs", ResourceType.Namespace, Diagnostics); - TryGetApiVersion(ResourceType, out string devTestLabFormulaFormulasApiVersion); - _devTestLabFormulaFormulasRestClient = new FormulasRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, devTestLabFormulaFormulasApiVersion); -#if DEBUG - ValidateResourceId(Id); -#endif + TryGetApiVersion(ResourceType, out string devTestLabFormulaApiVersion); + _formulasClientDiagnostics = new ClientDiagnostics("Azure.ResourceManager.DevTestLabs", ResourceType.Namespace, Diagnostics); + _formulasRestClient = new Formulas(_formulasClientDiagnostics, Pipeline, Endpoint, devTestLabFormulaApiVersion ?? "2018-09-15"); + 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 DevTestLabFormulaData 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 labName. + /// The name. + public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string labName, string name) + { + string resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/formulas/{name}"; + 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 formula. /// /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/formulas/{name} + /// Request Path. + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/formulas/{name}. /// /// - /// Operation Id - /// Formulas_Get + /// Operation Id. + /// Formulas_Get. /// /// - /// Default Api Version - /// 2018-09-15 + /// Default Api Version. + /// 2018-09-15. /// /// - /// Resource - /// + /// Resource. + /// . /// /// /// /// Specify the $expand query. Example: 'properties($select=description)'. /// The cancellation token to use. - public virtual async Task> GetAsync(string expand = null, CancellationToken cancellationToken = default) + public virtual async Task> GetAsync(string expand = default, CancellationToken cancellationToken = default) { - using var scope = _devTestLabFormulaFormulasClientDiagnostics.CreateScope("DevTestLabFormulaResource.Get"); + using DiagnosticScope scope = _formulasClientDiagnostics.CreateScope("DevTestLabFormulaResource.Get"); scope.Start(); try { - var response = await _devTestLabFormulaFormulasRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, expand, cancellationToken).ConfigureAwait(false); + RequestContext context = new RequestContext + { + CancellationToken = cancellationToken + }; + HttpMessage message = _formulasRestClient.CreateGetRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, expand, context); + Response result = await Pipeline.ProcessMessageAsync(message, context).ConfigureAwait(false); + Response response = Response.FromValue(DevTestLabFormulaData.FromResponse(result), result); if (response.Value == null) + { throw new RequestFailedException(response.GetRawResponse()); + } return Response.FromValue(new DevTestLabFormulaResource(Client, response.Value), response.GetRawResponse()); } catch (Exception e) @@ -135,34 +147,42 @@ public virtual async Task> GetAsync(string e /// Get formula. /// /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/formulas/{name} + /// Request Path. + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/formulas/{name}. /// /// - /// Operation Id - /// Formulas_Get + /// Operation Id. + /// Formulas_Get. /// /// - /// Default Api Version - /// 2018-09-15 + /// Default Api Version. + /// 2018-09-15. /// /// - /// Resource - /// + /// Resource. + /// . /// /// /// /// Specify the $expand query. Example: 'properties($select=description)'. /// The cancellation token to use. - public virtual Response Get(string expand = null, CancellationToken cancellationToken = default) + public virtual Response Get(string expand = default, CancellationToken cancellationToken = default) { - using var scope = _devTestLabFormulaFormulasClientDiagnostics.CreateScope("DevTestLabFormulaResource.Get"); + using DiagnosticScope scope = _formulasClientDiagnostics.CreateScope("DevTestLabFormulaResource.Get"); scope.Start(); try { - var response = _devTestLabFormulaFormulasRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, expand, cancellationToken); + RequestContext context = new RequestContext + { + CancellationToken = cancellationToken + }; + HttpMessage message = _formulasRestClient.CreateGetRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, expand, context); + Response result = Pipeline.ProcessMessage(message, context); + Response response = Response.FromValue(DevTestLabFormulaData.FromResponse(result), result); if (response.Value == null) + { throw new RequestFailedException(response.GetRawResponse()); + } return Response.FromValue(new DevTestLabFormulaResource(Client, response.Value), response.GetRawResponse()); } catch (Exception e) @@ -173,41 +193,49 @@ public virtual Response Get(string expand = null, Can } /// - /// Delete formula. + /// Allows modifying tags of formulas. All other properties will be ignored. /// /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/formulas/{name} + /// Request Path. + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/formulas/{name}. /// /// - /// Operation Id - /// Formulas_Delete + /// Operation Id. + /// Formulas_Update. /// /// - /// Default Api Version - /// 2018-09-15 + /// Default Api Version. + /// 2018-09-15. /// /// - /// Resource - /// + /// Resource. + /// . /// /// /// - /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. + /// A formula for creating a VM, specifying an image base and other parameters. /// The cancellation token to use. - public virtual async Task DeleteAsync(WaitUntil waitUntil, CancellationToken cancellationToken = default) + /// is null. + public virtual async Task> UpdateAsync(DevTestLabFormulaPatch patch, CancellationToken cancellationToken = default) { - using var scope = _devTestLabFormulaFormulasClientDiagnostics.CreateScope("DevTestLabFormulaResource.Delete"); + Argument.AssertNotNull(patch, nameof(patch)); + + using DiagnosticScope scope = _formulasClientDiagnostics.CreateScope("DevTestLabFormulaResource.Update"); scope.Start(); try { - var response = await _devTestLabFormulaFormulasRestClient.DeleteAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, cancellationToken).ConfigureAwait(false); - var uri = _devTestLabFormulaFormulasRestClient.CreateDeleteRequestUri(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name); - var rehydrationToken = NextLinkOperationImplementation.GetRehydrationToken(RequestMethod.Delete, uri.ToUri(), uri.ToString(), "None", null, OperationFinalStateVia.OriginalUri.ToString()); - var operation = new DevTestLabsArmOperation(response, rehydrationToken); - if (waitUntil == WaitUntil.Completed) - await operation.WaitForCompletionResponseAsync(cancellationToken).ConfigureAwait(false); - return operation; + RequestContext context = new RequestContext + { + CancellationToken = cancellationToken + }; + HttpMessage message = _formulasRestClient.CreateUpdateRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, DevTestLabFormulaPatch.ToRequestContent(patch), context); + Response result = await Pipeline.ProcessMessageAsync(message, context).ConfigureAwait(false); + Response response = Response.FromValue(DevTestLabFormulaData.FromResponse(result), result); + if (response.Value == null) + { + throw new RequestFailedException(response.GetRawResponse()); + } + return Response.FromValue(new DevTestLabFormulaResource(Client, response.Value), response.GetRawResponse()); } catch (Exception e) { @@ -217,41 +245,49 @@ public virtual async Task DeleteAsync(WaitUntil waitUntil, Cancell } /// - /// Delete formula. + /// Allows modifying tags of formulas. All other properties will be ignored. /// /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/formulas/{name} + /// Request Path. + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/formulas/{name}. /// /// - /// Operation Id - /// Formulas_Delete + /// Operation Id. + /// Formulas_Update. /// /// - /// Default Api Version - /// 2018-09-15 + /// Default Api Version. + /// 2018-09-15. /// /// - /// Resource - /// + /// Resource. + /// . /// /// /// - /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. + /// A formula for creating a VM, specifying an image base and other parameters. /// The cancellation token to use. - public virtual ArmOperation Delete(WaitUntil waitUntil, CancellationToken cancellationToken = default) + /// is null. + public virtual Response Update(DevTestLabFormulaPatch patch, CancellationToken cancellationToken = default) { - using var scope = _devTestLabFormulaFormulasClientDiagnostics.CreateScope("DevTestLabFormulaResource.Delete"); + Argument.AssertNotNull(patch, nameof(patch)); + + using DiagnosticScope scope = _formulasClientDiagnostics.CreateScope("DevTestLabFormulaResource.Update"); scope.Start(); try { - var response = _devTestLabFormulaFormulasRestClient.Delete(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, cancellationToken); - var uri = _devTestLabFormulaFormulasRestClient.CreateDeleteRequestUri(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name); - var rehydrationToken = NextLinkOperationImplementation.GetRehydrationToken(RequestMethod.Delete, uri.ToUri(), uri.ToString(), "None", null, OperationFinalStateVia.OriginalUri.ToString()); - var operation = new DevTestLabsArmOperation(response, rehydrationToken); - if (waitUntil == WaitUntil.Completed) - operation.WaitForCompletionResponse(cancellationToken); - return operation; + RequestContext context = new RequestContext + { + CancellationToken = cancellationToken + }; + HttpMessage message = _formulasRestClient.CreateUpdateRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, DevTestLabFormulaPatch.ToRequestContent(patch), context); + Response result = Pipeline.ProcessMessage(message, context); + Response response = Response.FromValue(DevTestLabFormulaData.FromResponse(result), result); + if (response.Value == null) + { + throw new RequestFailedException(response.GetRawResponse()); + } + return Response.FromValue(new DevTestLabFormulaResource(Client, response.Value), response.GetRawResponse()); } catch (Exception e) { @@ -261,39 +297,48 @@ public virtual ArmOperation Delete(WaitUntil waitUntil, CancellationToken cancel } /// - /// Allows modifying tags of formulas. All other properties will be ignored. + /// Delete formula. /// /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/formulas/{name} + /// Request Path. + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/formulas/{name}. /// /// - /// Operation Id - /// Formulas_Update + /// Operation Id. + /// Formulas_Delete. /// /// - /// Default Api Version - /// 2018-09-15 + /// Default Api Version. + /// 2018-09-15. /// /// - /// Resource - /// + /// Resource. + /// . /// /// /// - /// A formula for creating a VM, specifying an image base and other parameters. + /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. /// The cancellation token to use. - /// is null. - public virtual async Task> UpdateAsync(DevTestLabFormulaPatch patch, CancellationToken cancellationToken = default) + public virtual async Task DeleteAsync(WaitUntil waitUntil, CancellationToken cancellationToken = default) { - Argument.AssertNotNull(patch, nameof(patch)); - - using var scope = _devTestLabFormulaFormulasClientDiagnostics.CreateScope("DevTestLabFormulaResource.Update"); + using DiagnosticScope scope = _formulasClientDiagnostics.CreateScope("DevTestLabFormulaResource.Delete"); scope.Start(); try { - var response = await _devTestLabFormulaFormulasRestClient.UpdateAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, patch, cancellationToken).ConfigureAwait(false); - return Response.FromValue(new DevTestLabFormulaResource(Client, response.Value), response.GetRawResponse()); + RequestContext context = new RequestContext + { + CancellationToken = cancellationToken + }; + HttpMessage message = _formulasRestClient.CreateDeleteRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, context); + Response response = await Pipeline.ProcessMessageAsync(message, context).ConfigureAwait(false); + RequestUriBuilder uri = message.Request.Uri; + RehydrationToken rehydrationToken = NextLinkOperationImplementation.GetRehydrationToken(RequestMethod.Delete, uri.ToUri(), uri.ToString(), "None", null, OperationFinalStateVia.OriginalUri.ToString()); + DevTestLabsArmOperation operation = new DevTestLabsArmOperation(response, rehydrationToken); + if (waitUntil == WaitUntil.Completed) + { + await operation.WaitForCompletionResponseAsync(cancellationToken).ConfigureAwait(false); + } + return operation; } catch (Exception e) { @@ -303,39 +348,48 @@ public virtual async Task> UpdateAsync(DevTe } /// - /// Allows modifying tags of formulas. All other properties will be ignored. + /// Delete formula. /// /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/formulas/{name} + /// Request Path. + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/formulas/{name}. /// /// - /// Operation Id - /// Formulas_Update + /// Operation Id. + /// Formulas_Delete. /// /// - /// Default Api Version - /// 2018-09-15 + /// Default Api Version. + /// 2018-09-15. /// /// - /// Resource - /// + /// Resource. + /// . /// /// /// - /// A formula for creating a VM, specifying an image base and other parameters. + /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. /// The cancellation token to use. - /// is null. - public virtual Response Update(DevTestLabFormulaPatch patch, CancellationToken cancellationToken = default) + public virtual ArmOperation Delete(WaitUntil waitUntil, CancellationToken cancellationToken = default) { - Argument.AssertNotNull(patch, nameof(patch)); - - using var scope = _devTestLabFormulaFormulasClientDiagnostics.CreateScope("DevTestLabFormulaResource.Update"); + using DiagnosticScope scope = _formulasClientDiagnostics.CreateScope("DevTestLabFormulaResource.Delete"); scope.Start(); try { - var response = _devTestLabFormulaFormulasRestClient.Update(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, patch, cancellationToken); - return Response.FromValue(new DevTestLabFormulaResource(Client, response.Value), response.GetRawResponse()); + RequestContext context = new RequestContext + { + CancellationToken = cancellationToken + }; + HttpMessage message = _formulasRestClient.CreateDeleteRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, context); + Response response = Pipeline.ProcessMessage(message, context); + RequestUriBuilder uri = message.Request.Uri; + RehydrationToken rehydrationToken = NextLinkOperationImplementation.GetRehydrationToken(RequestMethod.Delete, uri.ToUri(), uri.ToString(), "None", null, OperationFinalStateVia.OriginalUri.ToString()); + DevTestLabsArmOperation operation = new DevTestLabsArmOperation(response, rehydrationToken); + if (waitUntil == WaitUntil.Completed) + { + operation.WaitForCompletionResponse(cancellationToken); + } + return operation; } catch (Exception e) { @@ -344,27 +398,7 @@ public virtual Response Update(DevTestLabFormulaPatch } } - /// - /// Add a tag to the current resource. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/formulas/{name} - /// - /// - /// Operation Id - /// Formulas_Get - /// - /// - /// Default Api Version - /// 2018-09-15 - /// - /// - /// Resource - /// - /// - /// - /// + /// Add a tag to the current resource. /// The key for the tag. /// The value for the tag. /// The cancellation token to use. @@ -374,29 +408,35 @@ public virtual async Task> AddTagAsync(strin Argument.AssertNotNull(key, nameof(key)); Argument.AssertNotNull(value, nameof(value)); - using var scope = _devTestLabFormulaFormulasClientDiagnostics.CreateScope("DevTestLabFormulaResource.AddTag"); + using DiagnosticScope scope = _formulasClientDiagnostics.CreateScope("DevTestLabFormulaResource.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 _devTestLabFormulaFormulasRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, null, cancellationToken).ConfigureAwait(false); - return Response.FromValue(new DevTestLabFormulaResource(Client, originalResponse.Value), originalResponse.GetRawResponse()); + await GetTagResource().CreateOrUpdateAsync(WaitUntil.Completed, originalTags.Value.Data, cancellationToken).ConfigureAwait(false); + RequestContext context = new RequestContext + { + CancellationToken = cancellationToken + }; + HttpMessage message = _formulasRestClient.CreateGetRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, default, context); + Response result = await Pipeline.ProcessMessageAsync(message, context).ConfigureAwait(false); + Response response = Response.FromValue(DevTestLabFormulaData.FromResponse(result), result); + return Response.FromValue(new DevTestLabFormulaResource(Client, response.Value), response.GetRawResponse()); } else { - var current = (await GetAsync(cancellationToken: cancellationToken).ConfigureAwait(false)).Value.Data; - var patch = new DevTestLabFormulaPatch(); - foreach (var tag in current.Tags) + DevTestLabFormulaData current = (await GetAsync(cancellationToken: cancellationToken).ConfigureAwait(false)).Value.Data; + DevTestLabFormulaPatch patch = new DevTestLabFormulaPatch(); + 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) @@ -406,27 +446,7 @@ public virtual async Task> AddTagAsync(strin } } - /// - /// Add a tag to the current resource. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/formulas/{name} - /// - /// - /// Operation Id - /// Formulas_Get - /// - /// - /// Default Api Version - /// 2018-09-15 - /// - /// - /// Resource - /// - /// - /// - /// + /// Add a tag to the current resource. /// The key for the tag. /// The value for the tag. /// The cancellation token to use. @@ -436,29 +456,35 @@ public virtual Response AddTag(string key, string val Argument.AssertNotNull(key, nameof(key)); Argument.AssertNotNull(value, nameof(value)); - using var scope = _devTestLabFormulaFormulasClientDiagnostics.CreateScope("DevTestLabFormulaResource.AddTag"); + using DiagnosticScope scope = _formulasClientDiagnostics.CreateScope("DevTestLabFormulaResource.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 = _devTestLabFormulaFormulasRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, null, cancellationToken); - return Response.FromValue(new DevTestLabFormulaResource(Client, originalResponse.Value), originalResponse.GetRawResponse()); + GetTagResource().CreateOrUpdate(WaitUntil.Completed, originalTags.Value.Data, cancellationToken); + RequestContext context = new RequestContext + { + CancellationToken = cancellationToken + }; + HttpMessage message = _formulasRestClient.CreateGetRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, default, context); + Response result = Pipeline.ProcessMessage(message, context); + Response response = Response.FromValue(DevTestLabFormulaData.FromResponse(result), result); + return Response.FromValue(new DevTestLabFormulaResource(Client, response.Value), response.GetRawResponse()); } else { - var current = Get(cancellationToken: cancellationToken).Value.Data; - var patch = new DevTestLabFormulaPatch(); - foreach (var tag in current.Tags) + DevTestLabFormulaData current = Get(cancellationToken: cancellationToken).Value.Data; + DevTestLabFormulaPatch patch = new DevTestLabFormulaPatch(); + 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) @@ -468,54 +494,40 @@ public virtual Response AddTag(string key, string val } } - /// - /// Replace the tags on the resource with the given set. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/formulas/{name} - /// - /// - /// Operation Id - /// Formulas_Get - /// - /// - /// Default Api Version - /// 2018-09-15 - /// - /// - /// 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 = _devTestLabFormulaFormulasClientDiagnostics.CreateScope("DevTestLabFormulaResource.SetTags"); + using DiagnosticScope scope = _formulasClientDiagnostics.CreateScope("DevTestLabFormulaResource.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 _devTestLabFormulaFormulasRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, null, cancellationToken).ConfigureAwait(false); - return Response.FromValue(new DevTestLabFormulaResource(Client, originalResponse.Value), originalResponse.GetRawResponse()); + await GetTagResource().CreateOrUpdateAsync(WaitUntil.Completed, originalTags.Value.Data, cancellationToken).ConfigureAwait(false); + RequestContext context = new RequestContext + { + CancellationToken = cancellationToken + }; + HttpMessage message = _formulasRestClient.CreateGetRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, default, context); + Response result = await Pipeline.ProcessMessageAsync(message, context).ConfigureAwait(false); + Response response = Response.FromValue(DevTestLabFormulaData.FromResponse(result), result); + return Response.FromValue(new DevTestLabFormulaResource(Client, response.Value), response.GetRawResponse()); } else { - var current = (await GetAsync(cancellationToken: cancellationToken).ConfigureAwait(false)).Value.Data; - var patch = new DevTestLabFormulaPatch(); + DevTestLabFormulaData current = (await GetAsync(cancellationToken: cancellationToken).ConfigureAwait(false)).Value.Data; + DevTestLabFormulaPatch patch = new DevTestLabFormulaPatch(); 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) @@ -525,54 +537,40 @@ public virtual async Task> SetTagsAsync(IDic } } - /// - /// Replace the tags on the resource with the given set. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/formulas/{name} - /// - /// - /// Operation Id - /// Formulas_Get - /// - /// - /// Default Api Version - /// 2018-09-15 - /// - /// - /// 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 = _devTestLabFormulaFormulasClientDiagnostics.CreateScope("DevTestLabFormulaResource.SetTags"); + using DiagnosticScope scope = _formulasClientDiagnostics.CreateScope("DevTestLabFormulaResource.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 = _devTestLabFormulaFormulasRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, null, cancellationToken); - return Response.FromValue(new DevTestLabFormulaResource(Client, originalResponse.Value), originalResponse.GetRawResponse()); + GetTagResource().CreateOrUpdate(WaitUntil.Completed, originalTags.Value.Data, cancellationToken); + RequestContext context = new RequestContext + { + CancellationToken = cancellationToken + }; + HttpMessage message = _formulasRestClient.CreateGetRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, default, context); + Response result = Pipeline.ProcessMessage(message, context); + Response response = Response.FromValue(DevTestLabFormulaData.FromResponse(result), result); + return Response.FromValue(new DevTestLabFormulaResource(Client, response.Value), response.GetRawResponse()); } else { - var current = Get(cancellationToken: cancellationToken).Value.Data; - var patch = new DevTestLabFormulaPatch(); + DevTestLabFormulaData current = Get(cancellationToken: cancellationToken).Value.Data; + DevTestLabFormulaPatch patch = new DevTestLabFormulaPatch(); 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) @@ -582,27 +580,7 @@ public virtual Response SetTags(IDictionary - /// Removes a tag by key from the resource. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/formulas/{name} - /// - /// - /// Operation Id - /// Formulas_Get - /// - /// - /// Default Api Version - /// 2018-09-15 - /// - /// - /// Resource - /// - /// - /// - /// + /// Removes a tag by key from the resource. /// The key for the tag. /// The cancellation token to use. /// is null. @@ -610,29 +588,35 @@ public virtual async Task> RemoveTagAsync(st { Argument.AssertNotNull(key, nameof(key)); - using var scope = _devTestLabFormulaFormulasClientDiagnostics.CreateScope("DevTestLabFormulaResource.RemoveTag"); + using DiagnosticScope scope = _formulasClientDiagnostics.CreateScope("DevTestLabFormulaResource.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 _devTestLabFormulaFormulasRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, null, cancellationToken).ConfigureAwait(false); - return Response.FromValue(new DevTestLabFormulaResource(Client, originalResponse.Value), originalResponse.GetRawResponse()); + await GetTagResource().CreateOrUpdateAsync(WaitUntil.Completed, originalTags.Value.Data, cancellationToken).ConfigureAwait(false); + RequestContext context = new RequestContext + { + CancellationToken = cancellationToken + }; + HttpMessage message = _formulasRestClient.CreateGetRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, default, context); + Response result = await Pipeline.ProcessMessageAsync(message, context).ConfigureAwait(false); + Response response = Response.FromValue(DevTestLabFormulaData.FromResponse(result), result); + return Response.FromValue(new DevTestLabFormulaResource(Client, response.Value), response.GetRawResponse()); } else { - var current = (await GetAsync(cancellationToken: cancellationToken).ConfigureAwait(false)).Value.Data; - var patch = new DevTestLabFormulaPatch(); - foreach (var tag in current.Tags) + DevTestLabFormulaData current = (await GetAsync(cancellationToken: cancellationToken).ConfigureAwait(false)).Value.Data; + DevTestLabFormulaPatch patch = new DevTestLabFormulaPatch(); + 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) @@ -642,27 +626,7 @@ public virtual async Task> RemoveTagAsync(st } } - /// - /// Removes a tag by key from the resource. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/formulas/{name} - /// - /// - /// Operation Id - /// Formulas_Get - /// - /// - /// Default Api Version - /// 2018-09-15 - /// - /// - /// Resource - /// - /// - /// - /// + /// Removes a tag by key from the resource. /// The key for the tag. /// The cancellation token to use. /// is null. @@ -670,29 +634,35 @@ public virtual Response RemoveTag(string key, Cancell { Argument.AssertNotNull(key, nameof(key)); - using var scope = _devTestLabFormulaFormulasClientDiagnostics.CreateScope("DevTestLabFormulaResource.RemoveTag"); + using DiagnosticScope scope = _formulasClientDiagnostics.CreateScope("DevTestLabFormulaResource.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 = _devTestLabFormulaFormulasRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, null, cancellationToken); - return Response.FromValue(new DevTestLabFormulaResource(Client, originalResponse.Value), originalResponse.GetRawResponse()); + GetTagResource().CreateOrUpdate(WaitUntil.Completed, originalTags.Value.Data, cancellationToken); + RequestContext context = new RequestContext + { + CancellationToken = cancellationToken + }; + HttpMessage message = _formulasRestClient.CreateGetRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, default, context); + Response result = Pipeline.ProcessMessage(message, context); + Response response = Response.FromValue(DevTestLabFormulaData.FromResponse(result), result); + return Response.FromValue(new DevTestLabFormulaResource(Client, response.Value), response.GetRawResponse()); } else { - var current = Get(cancellationToken: cancellationToken).Value.Data; - var patch = new DevTestLabFormulaPatch(); - foreach (var tag in current.Tags) + DevTestLabFormulaData current = Get(cancellationToken: cancellationToken).Value.Data; + DevTestLabFormulaPatch patch = new DevTestLabFormulaPatch(); + 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) diff --git a/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/DevTestLabGlobalScheduleCollection.cs b/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/DevTestLabGlobalScheduleCollection.cs index 767adc2a912b..2d67ef459bdd 100644 --- a/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/DevTestLabGlobalScheduleCollection.cs +++ b/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/DevTestLabGlobalScheduleCollection.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.DevTestLabs @@ -25,75 +26,81 @@ namespace Azure.ResourceManager.DevTestLabs /// public partial class DevTestLabGlobalScheduleCollection : ArmCollection, IEnumerable, IAsyncEnumerable { - private readonly ClientDiagnostics _devTestLabGlobalScheduleGlobalSchedulesClientDiagnostics; - private readonly GlobalSchedulesRestOperations _devTestLabGlobalScheduleGlobalSchedulesRestClient; + private readonly ClientDiagnostics _devTestLabGlobalSchedulesClientDiagnostics; + private readonly DevTestLabGlobalSchedules _devTestLabGlobalSchedulesRestClient; - /// Initializes a new instance of the class for mocking. + /// Initializes a new instance of DevTestLabGlobalScheduleCollection for mocking. protected DevTestLabGlobalScheduleCollection() { } - /// 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 DevTestLabGlobalScheduleCollection(ArmClient client, ResourceIdentifier id) : base(client, id) { - _devTestLabGlobalScheduleGlobalSchedulesClientDiagnostics = new ClientDiagnostics("Azure.ResourceManager.DevTestLabs", DevTestLabGlobalScheduleResource.ResourceType.Namespace, Diagnostics); - TryGetApiVersion(DevTestLabGlobalScheduleResource.ResourceType, out string devTestLabGlobalScheduleGlobalSchedulesApiVersion); - _devTestLabGlobalScheduleGlobalSchedulesRestClient = new GlobalSchedulesRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, devTestLabGlobalScheduleGlobalSchedulesApiVersion); -#if DEBUG - ValidateResourceId(Id); -#endif + TryGetApiVersion(DevTestLabGlobalScheduleResource.ResourceType, out string devTestLabGlobalScheduleApiVersion); + _devTestLabGlobalSchedulesClientDiagnostics = new ClientDiagnostics("Azure.ResourceManager.DevTestLabs", DevTestLabGlobalScheduleResource.ResourceType.Namespace, Diagnostics); + _devTestLabGlobalSchedulesRestClient = new DevTestLabGlobalSchedules(_devTestLabGlobalSchedulesClientDiagnostics, Pipeline, Endpoint, devTestLabGlobalScheduleApiVersion ?? "2018-09-15"); + 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 or replace an existing schedule. /// /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/schedules/{name} - /// - /// - /// Operation Id - /// GlobalSchedules_CreateOrUpdate + /// Request Path. + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/schedules/{name}. /// /// - /// Default Api Version - /// 2018-09-15 + /// Operation Id. + /// GlobalSchedules_CreateOrUpdate. /// /// - /// Resource - /// + /// Default Api Version. + /// 2018-09-15. /// /// /// /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. - /// The name of the schedule. + /// The name of the Schedule. /// A schedule. /// 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 name, DevTestLabScheduleData data, CancellationToken cancellationToken = default) { Argument.AssertNotNullOrEmpty(name, nameof(name)); Argument.AssertNotNull(data, nameof(data)); - using var scope = _devTestLabGlobalScheduleGlobalSchedulesClientDiagnostics.CreateScope("DevTestLabGlobalScheduleCollection.CreateOrUpdate"); + using DiagnosticScope scope = _devTestLabGlobalSchedulesClientDiagnostics.CreateScope("DevTestLabGlobalScheduleCollection.CreateOrUpdate"); scope.Start(); try { - var response = await _devTestLabGlobalScheduleGlobalSchedulesRestClient.CreateOrUpdateAsync(Id.SubscriptionId, Id.ResourceGroupName, name, data, cancellationToken).ConfigureAwait(false); - var uri = _devTestLabGlobalScheduleGlobalSchedulesRestClient.CreateCreateOrUpdateRequestUri(Id.SubscriptionId, Id.ResourceGroupName, name, data); - var rehydrationToken = NextLinkOperationImplementation.GetRehydrationToken(RequestMethod.Put, uri.ToUri(), uri.ToString(), "None", null, OperationFinalStateVia.OriginalUri.ToString()); - var operation = new DevTestLabsArmOperation(Response.FromValue(new DevTestLabGlobalScheduleResource(Client, response), response.GetRawResponse()), rehydrationToken); + RequestContext context = new RequestContext + { + CancellationToken = cancellationToken + }; + HttpMessage message = _devTestLabGlobalSchedulesRestClient.CreateCreateOrUpdateRequest(Id.SubscriptionId, Id.ResourceGroupName, name, DevTestLabScheduleData.ToRequestContent(data), context); + Response result = await Pipeline.ProcessMessageAsync(message, context).ConfigureAwait(false); + Response response = Response.FromValue(DevTestLabScheduleData.FromResponse(result), result); + RequestUriBuilder uri = message.Request.Uri; + RehydrationToken rehydrationToken = NextLinkOperationImplementation.GetRehydrationToken(RequestMethod.Put, uri.ToUri(), uri.ToString(), "None", null, OperationFinalStateVia.OriginalUri.ToString()); + DevTestLabsArmOperation operation = new DevTestLabsArmOperation(Response.FromValue(new DevTestLabGlobalScheduleResource(Client, response.Value), response.GetRawResponse()), rehydrationToken); if (waitUntil == WaitUntil.Completed) + { await operation.WaitForCompletionAsync(cancellationToken).ConfigureAwait(false); + } return operation; } catch (Exception e) @@ -107,44 +114,48 @@ public virtual async Task> Create /// Create or replace an existing schedule. /// /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/schedules/{name} + /// Request Path. + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/schedules/{name}. /// /// - /// Operation Id - /// GlobalSchedules_CreateOrUpdate + /// Operation Id. + /// GlobalSchedules_CreateOrUpdate. /// /// - /// Default Api Version - /// 2018-09-15 - /// - /// - /// Resource - /// + /// Default Api Version. + /// 2018-09-15. /// /// /// /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. - /// The name of the schedule. + /// The name of the Schedule. /// A schedule. /// 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 name, DevTestLabScheduleData data, CancellationToken cancellationToken = default) { Argument.AssertNotNullOrEmpty(name, nameof(name)); Argument.AssertNotNull(data, nameof(data)); - using var scope = _devTestLabGlobalScheduleGlobalSchedulesClientDiagnostics.CreateScope("DevTestLabGlobalScheduleCollection.CreateOrUpdate"); + using DiagnosticScope scope = _devTestLabGlobalSchedulesClientDiagnostics.CreateScope("DevTestLabGlobalScheduleCollection.CreateOrUpdate"); scope.Start(); try { - var response = _devTestLabGlobalScheduleGlobalSchedulesRestClient.CreateOrUpdate(Id.SubscriptionId, Id.ResourceGroupName, name, data, cancellationToken); - var uri = _devTestLabGlobalScheduleGlobalSchedulesRestClient.CreateCreateOrUpdateRequestUri(Id.SubscriptionId, Id.ResourceGroupName, name, data); - var rehydrationToken = NextLinkOperationImplementation.GetRehydrationToken(RequestMethod.Put, uri.ToUri(), uri.ToString(), "None", null, OperationFinalStateVia.OriginalUri.ToString()); - var operation = new DevTestLabsArmOperation(Response.FromValue(new DevTestLabGlobalScheduleResource(Client, response), response.GetRawResponse()), rehydrationToken); + RequestContext context = new RequestContext + { + CancellationToken = cancellationToken + }; + HttpMessage message = _devTestLabGlobalSchedulesRestClient.CreateCreateOrUpdateRequest(Id.SubscriptionId, Id.ResourceGroupName, name, DevTestLabScheduleData.ToRequestContent(data), context); + Response result = Pipeline.ProcessMessage(message, context); + Response response = Response.FromValue(DevTestLabScheduleData.FromResponse(result), result); + RequestUriBuilder uri = message.Request.Uri; + RehydrationToken rehydrationToken = NextLinkOperationImplementation.GetRehydrationToken(RequestMethod.Put, uri.ToUri(), uri.ToString(), "None", null, OperationFinalStateVia.OriginalUri.ToString()); + DevTestLabsArmOperation operation = new DevTestLabsArmOperation(Response.FromValue(new DevTestLabGlobalScheduleResource(Client, response.Value), response.GetRawResponse()), rehydrationToken); if (waitUntil == WaitUntil.Completed) + { operation.WaitForCompletion(cancellationToken); + } return operation; } catch (Exception e) @@ -158,39 +169,43 @@ public virtual ArmOperation CreateOrUpdate(Wai /// Get schedule. /// /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/schedules/{name} + /// Request Path. + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/schedules/{name}. /// /// - /// Operation Id - /// GlobalSchedules_Get + /// Operation Id. + /// GlobalSchedules_Get. /// /// - /// Default Api Version - /// 2018-09-15 - /// - /// - /// Resource - /// + /// Default Api Version. + /// 2018-09-15. /// /// /// - /// The name of the schedule. + /// The name of the Schedule. /// Specify the $expand query. Example: 'properties($select=status)'. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. - public virtual async Task> GetAsync(string name, string expand = null, CancellationToken cancellationToken = default) + /// is an empty string, and was expected to be non-empty. + public virtual async Task> GetAsync(string name, string expand = default, CancellationToken cancellationToken = default) { Argument.AssertNotNullOrEmpty(name, nameof(name)); - using var scope = _devTestLabGlobalScheduleGlobalSchedulesClientDiagnostics.CreateScope("DevTestLabGlobalScheduleCollection.Get"); + using DiagnosticScope scope = _devTestLabGlobalSchedulesClientDiagnostics.CreateScope("DevTestLabGlobalScheduleCollection.Get"); scope.Start(); try { - var response = await _devTestLabGlobalScheduleGlobalSchedulesRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, name, expand, cancellationToken).ConfigureAwait(false); + RequestContext context = new RequestContext + { + CancellationToken = cancellationToken + }; + HttpMessage message = _devTestLabGlobalSchedulesRestClient.CreateGetRequest(Id.SubscriptionId, Id.ResourceGroupName, name, expand, context); + Response result = await Pipeline.ProcessMessageAsync(message, context).ConfigureAwait(false); + Response response = Response.FromValue(DevTestLabScheduleData.FromResponse(result), result); if (response.Value == null) + { throw new RequestFailedException(response.GetRawResponse()); + } return Response.FromValue(new DevTestLabGlobalScheduleResource(Client, response.Value), response.GetRawResponse()); } catch (Exception e) @@ -204,39 +219,43 @@ public virtual async Task> GetAsync(s /// Get schedule. /// /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/schedules/{name} - /// - /// - /// Operation Id - /// GlobalSchedules_Get + /// Request Path. + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/schedules/{name}. /// /// - /// Default Api Version - /// 2018-09-15 + /// Operation Id. + /// GlobalSchedules_Get. /// /// - /// Resource - /// + /// Default Api Version. + /// 2018-09-15. /// /// /// - /// The name of the schedule. + /// The name of the Schedule. /// Specify the $expand query. Example: 'properties($select=status)'. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. - public virtual Response Get(string name, string expand = null, CancellationToken cancellationToken = default) + /// is an empty string, and was expected to be non-empty. + public virtual Response Get(string name, string expand = default, CancellationToken cancellationToken = default) { Argument.AssertNotNullOrEmpty(name, nameof(name)); - using var scope = _devTestLabGlobalScheduleGlobalSchedulesClientDiagnostics.CreateScope("DevTestLabGlobalScheduleCollection.Get"); + using DiagnosticScope scope = _devTestLabGlobalSchedulesClientDiagnostics.CreateScope("DevTestLabGlobalScheduleCollection.Get"); scope.Start(); try { - var response = _devTestLabGlobalScheduleGlobalSchedulesRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, name, expand, cancellationToken); + RequestContext context = new RequestContext + { + CancellationToken = cancellationToken + }; + HttpMessage message = _devTestLabGlobalSchedulesRestClient.CreateGetRequest(Id.SubscriptionId, Id.ResourceGroupName, name, expand, context); + Response result = Pipeline.ProcessMessage(message, context); + Response response = Response.FromValue(DevTestLabScheduleData.FromResponse(result), result); if (response.Value == null) + { throw new RequestFailedException(response.GetRawResponse()); + } return Response.FromValue(new DevTestLabGlobalScheduleResource(Client, response.Value), response.GetRawResponse()); } catch (Exception e) @@ -250,20 +269,16 @@ public virtual Response Get(string name, strin /// List schedules in a resource group. /// /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/schedules + /// Request Path. + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/schedules. /// /// - /// Operation Id - /// GlobalSchedules_ListByResourceGroup + /// Operation Id. + /// GlobalSchedules_ListByResourceGroup. /// /// - /// Default Api Version - /// 2018-09-15 - /// - /// - /// Resource - /// + /// Default Api Version. + /// 2018-09-15. /// /// /// @@ -272,32 +287,38 @@ public virtual Response Get(string name, strin /// The maximum number of resources to return from the operation. Example: '$top=10'. /// The ordering expression for the results, using OData notation. Example: '$orderby=name desc'. /// The cancellation token to use. - /// An async collection of that may take multiple service requests to iterate over. - public virtual AsyncPageable GetAllAsync(string expand = null, string filter = null, int? top = null, string orderby = null, CancellationToken cancellationToken = default) + /// A collection of that may take multiple service requests to iterate over. + public virtual AsyncPageable GetAllAsync(string expand = default, string filter = default, int? top = default, string @orderby = default, CancellationToken cancellationToken = default) { - HttpMessage FirstPageRequest(int? pageSizeHint) => _devTestLabGlobalScheduleGlobalSchedulesRestClient.CreateListByResourceGroupRequest(Id.SubscriptionId, Id.ResourceGroupName, expand, filter, top, orderby); - HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _devTestLabGlobalScheduleGlobalSchedulesRestClient.CreateListByResourceGroupNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName, expand, filter, top, orderby); - return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new DevTestLabGlobalScheduleResource(Client, DevTestLabScheduleData.DeserializeDevTestLabScheduleData(e)), _devTestLabGlobalScheduleGlobalSchedulesClientDiagnostics, Pipeline, "DevTestLabGlobalScheduleCollection.GetAll", "value", "nextLink", cancellationToken); + RequestContext context = new RequestContext + { + CancellationToken = cancellationToken + }; + return new AsyncPageableWrapper(new DevTestLabGlobalSchedulesGetByResourceGroupAsyncCollectionResultOfT( + _devTestLabGlobalSchedulesRestClient, + Id.SubscriptionId, + Id.ResourceGroupName, + expand, + filter, + top, + @orderby, + context), data => new DevTestLabGlobalScheduleResource(Client, data)); } /// /// List schedules in a resource group. /// /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/schedules - /// - /// - /// Operation Id - /// GlobalSchedules_ListByResourceGroup + /// Request Path. + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/schedules. /// /// - /// Default Api Version - /// 2018-09-15 + /// Operation Id. + /// GlobalSchedules_ListByResourceGroup. /// /// - /// Resource - /// + /// Default Api Version. + /// 2018-09-15. /// /// /// @@ -307,48 +328,72 @@ public virtual AsyncPageable GetAllAsync(strin /// The ordering expression for the results, using OData notation. Example: '$orderby=name desc'. /// The cancellation token to use. /// A collection of that may take multiple service requests to iterate over. - public virtual Pageable GetAll(string expand = null, string filter = null, int? top = null, string orderby = null, CancellationToken cancellationToken = default) + public virtual Pageable GetAll(string expand = default, string filter = default, int? top = default, string @orderby = default, CancellationToken cancellationToken = default) { - HttpMessage FirstPageRequest(int? pageSizeHint) => _devTestLabGlobalScheduleGlobalSchedulesRestClient.CreateListByResourceGroupRequest(Id.SubscriptionId, Id.ResourceGroupName, expand, filter, top, orderby); - HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _devTestLabGlobalScheduleGlobalSchedulesRestClient.CreateListByResourceGroupNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName, expand, filter, top, orderby); - return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new DevTestLabGlobalScheduleResource(Client, DevTestLabScheduleData.DeserializeDevTestLabScheduleData(e)), _devTestLabGlobalScheduleGlobalSchedulesClientDiagnostics, Pipeline, "DevTestLabGlobalScheduleCollection.GetAll", "value", "nextLink", cancellationToken); + RequestContext context = new RequestContext + { + CancellationToken = cancellationToken + }; + return new PageableWrapper(new DevTestLabGlobalSchedulesGetByResourceGroupCollectionResultOfT( + _devTestLabGlobalSchedulesRestClient, + Id.SubscriptionId, + Id.ResourceGroupName, + expand, + filter, + top, + @orderby, + context), data => new DevTestLabGlobalScheduleResource(Client, data)); } /// /// Checks to see if the resource exists in azure. /// /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/schedules/{name} - /// - /// - /// Operation Id - /// GlobalSchedules_Get + /// Request Path. + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/schedules/{name}. /// /// - /// Default Api Version - /// 2018-09-15 + /// Operation Id. + /// GlobalSchedules_Get. /// /// - /// Resource - /// + /// Default Api Version. + /// 2018-09-15. /// /// /// - /// The name of the schedule. + /// The name of the Schedule. /// Specify the $expand query. Example: 'properties($select=status)'. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. - public virtual async Task> ExistsAsync(string name, string expand = null, CancellationToken cancellationToken = default) + /// is an empty string, and was expected to be non-empty. + public virtual async Task> ExistsAsync(string name, string expand = default, CancellationToken cancellationToken = default) { Argument.AssertNotNullOrEmpty(name, nameof(name)); - using var scope = _devTestLabGlobalScheduleGlobalSchedulesClientDiagnostics.CreateScope("DevTestLabGlobalScheduleCollection.Exists"); + using DiagnosticScope scope = _devTestLabGlobalSchedulesClientDiagnostics.CreateScope("DevTestLabGlobalScheduleCollection.Exists"); scope.Start(); try { - var response = await _devTestLabGlobalScheduleGlobalSchedulesRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, name, expand, cancellationToken: cancellationToken).ConfigureAwait(false); + RequestContext context = new RequestContext + { + CancellationToken = cancellationToken + }; + HttpMessage message = _devTestLabGlobalSchedulesRestClient.CreateGetRequest(Id.SubscriptionId, Id.ResourceGroupName, name, expand, context); + await Pipeline.SendAsync(message, context.CancellationToken).ConfigureAwait(false); + Response result = message.Response; + Response response = default; + switch (result.Status) + { + case 200: + response = Response.FromValue(DevTestLabScheduleData.FromResponse(result), result); + break; + case 404: + response = Response.FromValue((DevTestLabScheduleData)null, result); + break; + default: + throw new RequestFailedException(result); + } return Response.FromValue(response.Value != null, response.GetRawResponse()); } catch (Exception e) @@ -362,37 +407,51 @@ public virtual async Task> ExistsAsync(string name, string expand /// Checks to see if the resource exists in azure. /// /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/schedules/{name} + /// Request Path. + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/schedules/{name}. /// /// - /// Operation Id - /// GlobalSchedules_Get + /// Operation Id. + /// GlobalSchedules_Get. /// /// - /// Default Api Version - /// 2018-09-15 - /// - /// - /// Resource - /// + /// Default Api Version. + /// 2018-09-15. /// /// /// - /// The name of the schedule. + /// The name of the Schedule. /// Specify the $expand query. Example: 'properties($select=status)'. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. - public virtual Response Exists(string name, string expand = null, CancellationToken cancellationToken = default) + /// is an empty string, and was expected to be non-empty. + public virtual Response Exists(string name, string expand = default, CancellationToken cancellationToken = default) { Argument.AssertNotNullOrEmpty(name, nameof(name)); - using var scope = _devTestLabGlobalScheduleGlobalSchedulesClientDiagnostics.CreateScope("DevTestLabGlobalScheduleCollection.Exists"); + using DiagnosticScope scope = _devTestLabGlobalSchedulesClientDiagnostics.CreateScope("DevTestLabGlobalScheduleCollection.Exists"); scope.Start(); try { - var response = _devTestLabGlobalScheduleGlobalSchedulesRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, name, expand, cancellationToken: cancellationToken); + RequestContext context = new RequestContext + { + CancellationToken = cancellationToken + }; + HttpMessage message = _devTestLabGlobalSchedulesRestClient.CreateGetRequest(Id.SubscriptionId, Id.ResourceGroupName, name, expand, context); + Pipeline.Send(message, context.CancellationToken); + Response result = message.Response; + Response response = default; + switch (result.Status) + { + case 200: + response = Response.FromValue(DevTestLabScheduleData.FromResponse(result), result); + break; + case 404: + response = Response.FromValue((DevTestLabScheduleData)null, result); + break; + default: + throw new RequestFailedException(result); + } return Response.FromValue(response.Value != null, response.GetRawResponse()); } catch (Exception e) @@ -406,39 +465,55 @@ public virtual Response Exists(string name, string expand = null, Cancella /// Tries to get details for this resource from the service. /// /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/schedules/{name} - /// - /// - /// Operation Id - /// GlobalSchedules_Get + /// Request Path. + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/schedules/{name}. /// /// - /// Default Api Version - /// 2018-09-15 + /// Operation Id. + /// GlobalSchedules_Get. /// /// - /// Resource - /// + /// Default Api Version. + /// 2018-09-15. /// /// /// - /// The name of the schedule. + /// The name of the Schedule. /// Specify the $expand query. Example: 'properties($select=status)'. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. - public virtual async Task> GetIfExistsAsync(string name, string expand = null, CancellationToken cancellationToken = default) + /// is an empty string, and was expected to be non-empty. + public virtual async Task> GetIfExistsAsync(string name, string expand = default, CancellationToken cancellationToken = default) { Argument.AssertNotNullOrEmpty(name, nameof(name)); - using var scope = _devTestLabGlobalScheduleGlobalSchedulesClientDiagnostics.CreateScope("DevTestLabGlobalScheduleCollection.GetIfExists"); + using DiagnosticScope scope = _devTestLabGlobalSchedulesClientDiagnostics.CreateScope("DevTestLabGlobalScheduleCollection.GetIfExists"); scope.Start(); try { - var response = await _devTestLabGlobalScheduleGlobalSchedulesRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, name, expand, cancellationToken: cancellationToken).ConfigureAwait(false); + RequestContext context = new RequestContext + { + CancellationToken = cancellationToken + }; + HttpMessage message = _devTestLabGlobalSchedulesRestClient.CreateGetRequest(Id.SubscriptionId, Id.ResourceGroupName, name, expand, context); + await Pipeline.SendAsync(message, context.CancellationToken).ConfigureAwait(false); + Response result = message.Response; + Response response = default; + switch (result.Status) + { + case 200: + response = Response.FromValue(DevTestLabScheduleData.FromResponse(result), result); + break; + case 404: + response = Response.FromValue((DevTestLabScheduleData)null, result); + break; + default: + throw new RequestFailedException(result); + } if (response.Value == null) + { return new NoValueResponse(response.GetRawResponse()); + } return Response.FromValue(new DevTestLabGlobalScheduleResource(Client, response.Value), response.GetRawResponse()); } catch (Exception e) @@ -452,39 +527,55 @@ public virtual async Task> Ge /// Tries to get details for this resource from the service. /// /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/schedules/{name} + /// Request Path. + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/schedules/{name}. /// /// - /// Operation Id - /// GlobalSchedules_Get + /// Operation Id. + /// GlobalSchedules_Get. /// /// - /// Default Api Version - /// 2018-09-15 - /// - /// - /// Resource - /// + /// Default Api Version. + /// 2018-09-15. /// /// /// - /// The name of the schedule. + /// The name of the Schedule. /// Specify the $expand query. Example: 'properties($select=status)'. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. - public virtual NullableResponse GetIfExists(string name, string expand = null, CancellationToken cancellationToken = default) + /// is an empty string, and was expected to be non-empty. + public virtual NullableResponse GetIfExists(string name, string expand = default, CancellationToken cancellationToken = default) { Argument.AssertNotNullOrEmpty(name, nameof(name)); - using var scope = _devTestLabGlobalScheduleGlobalSchedulesClientDiagnostics.CreateScope("DevTestLabGlobalScheduleCollection.GetIfExists"); + using DiagnosticScope scope = _devTestLabGlobalSchedulesClientDiagnostics.CreateScope("DevTestLabGlobalScheduleCollection.GetIfExists"); scope.Start(); try { - var response = _devTestLabGlobalScheduleGlobalSchedulesRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, name, expand, cancellationToken: cancellationToken); + RequestContext context = new RequestContext + { + CancellationToken = cancellationToken + }; + HttpMessage message = _devTestLabGlobalSchedulesRestClient.CreateGetRequest(Id.SubscriptionId, Id.ResourceGroupName, name, expand, context); + Pipeline.Send(message, context.CancellationToken); + Response result = message.Response; + Response response = default; + switch (result.Status) + { + case 200: + response = Response.FromValue(DevTestLabScheduleData.FromResponse(result), result); + break; + case 404: + response = Response.FromValue((DevTestLabScheduleData)null, result); + break; + default: + throw new RequestFailedException(result); + } if (response.Value == null) + { return new NoValueResponse(response.GetRawResponse()); + } return Response.FromValue(new DevTestLabGlobalScheduleResource(Client, response.Value), response.GetRawResponse()); } catch (Exception e) @@ -504,6 +595,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/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/DevTestLabGlobalScheduleResource.Serialization.cs b/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/DevTestLabGlobalScheduleResource.Serialization.cs index 27e51fc46562..e3541f1b10fd 100644 --- a/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/DevTestLabGlobalScheduleResource.Serialization.cs +++ b/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/DevTestLabGlobalScheduleResource.Serialization.cs @@ -11,19 +11,29 @@ namespace Azure.ResourceManager.DevTestLabs { + /// public partial class DevTestLabGlobalScheduleResource : IJsonModel { - private static DevTestLabScheduleData s_dataDeserializationInstance; - private static DevTestLabScheduleData DataDeserializationInstance => s_dataDeserializationInstance ??= new(); + private static IJsonModel s_dataDeserializationInstance; + private static IJsonModel DataDeserializationInstance => s_dataDeserializationInstance ??= new DevTestLabScheduleData(); + + /// 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); - DevTestLabScheduleData 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. + DevTestLabScheduleData 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, AzureResourceManagerDevTestLabsContext.Default); + /// The binary data to be processed. + /// The client options for reading and writing models. DevTestLabScheduleData IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) => ModelReaderWriter.Read(data, options, AzureResourceManagerDevTestLabsContext.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/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/DevTestLabGlobalScheduleResource.cs b/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/DevTestLabGlobalScheduleResource.cs index 84ef59ae01d3..89f1700dd502 100644 --- a/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/DevTestLabGlobalScheduleResource.cs +++ b/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/DevTestLabGlobalScheduleResource.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.DevTestLabs.Models; using Azure.ResourceManager.Resources; namespace Azure.ResourceManager.DevTestLabs { /// - /// A Class representing a DevTestLabGlobalSchedule 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 GetDevTestLabGlobalScheduleResource method. - /// Otherwise you can get one from its parent resource using the GetDevTestLabGlobalSchedule method. + /// A class representing a DevTestLabGlobalSchedule 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 GetDevTestLabGlobalSchedules method. /// public partial class DevTestLabGlobalScheduleResource : ArmResource { - /// Generate the resource identifier of a instance. - /// The subscriptionId. - /// The resourceGroupName. - /// The name. - public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string name) - { - var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/schedules/{name}"; - return new ResourceIdentifier(resourceId); - } - - private readonly ClientDiagnostics _devTestLabGlobalScheduleGlobalSchedulesClientDiagnostics; - private readonly GlobalSchedulesRestOperations _devTestLabGlobalScheduleGlobalSchedulesRestClient; + private readonly ClientDiagnostics _devTestLabGlobalSchedulesClientDiagnostics; + private readonly DevTestLabGlobalSchedules _devTestLabGlobalSchedulesRestClient; private readonly DevTestLabScheduleData _data; - /// Gets the resource type for the operations. public static readonly ResourceType ResourceType = "Microsoft.DevTestLab/schedules"; - /// Initializes a new instance of the class for mocking. + /// Initializes a new instance of DevTestLabGlobalScheduleResource for mocking. protected DevTestLabGlobalScheduleResource() { } - /// 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 DevTestLabGlobalScheduleResource(ArmClient client, DevTestLabScheduleData data) : this(client, data.Id) @@ -56,72 +46,93 @@ internal DevTestLabGlobalScheduleResource(ArmClient client, DevTestLabScheduleDa _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 DevTestLabGlobalScheduleResource(ArmClient client, ResourceIdentifier id) : base(client, id) { - _devTestLabGlobalScheduleGlobalSchedulesClientDiagnostics = new ClientDiagnostics("Azure.ResourceManager.DevTestLabs", ResourceType.Namespace, Diagnostics); - TryGetApiVersion(ResourceType, out string devTestLabGlobalScheduleGlobalSchedulesApiVersion); - _devTestLabGlobalScheduleGlobalSchedulesRestClient = new GlobalSchedulesRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, devTestLabGlobalScheduleGlobalSchedulesApiVersion); -#if DEBUG - ValidateResourceId(Id); -#endif + TryGetApiVersion(ResourceType, out string devTestLabGlobalScheduleApiVersion); + _devTestLabGlobalSchedulesClientDiagnostics = new ClientDiagnostics("Azure.ResourceManager.DevTestLabs", ResourceType.Namespace, Diagnostics); + _devTestLabGlobalSchedulesRestClient = new DevTestLabGlobalSchedules(_devTestLabGlobalSchedulesClientDiagnostics, Pipeline, Endpoint, devTestLabGlobalScheduleApiVersion ?? "2018-09-15"); + 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 DevTestLabScheduleData 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 name. + public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string name) + { + string resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/schedules/{name}"; + 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 schedule. /// /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/schedules/{name} + /// Request Path. + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/schedules/{name}. /// /// - /// Operation Id - /// GlobalSchedules_Get + /// Operation Id. + /// GlobalSchedules_Get. /// /// - /// Default Api Version - /// 2018-09-15 + /// Default Api Version. + /// 2018-09-15. /// /// - /// Resource - /// + /// Resource. + /// . /// /// /// /// Specify the $expand query. Example: 'properties($select=status)'. /// The cancellation token to use. - public virtual async Task> GetAsync(string expand = null, CancellationToken cancellationToken = default) + public virtual async Task> GetAsync(string expand = default, CancellationToken cancellationToken = default) { - using var scope = _devTestLabGlobalScheduleGlobalSchedulesClientDiagnostics.CreateScope("DevTestLabGlobalScheduleResource.Get"); + using DiagnosticScope scope = _devTestLabGlobalSchedulesClientDiagnostics.CreateScope("DevTestLabGlobalScheduleResource.Get"); scope.Start(); try { - var response = await _devTestLabGlobalScheduleGlobalSchedulesRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, expand, cancellationToken).ConfigureAwait(false); + RequestContext context = new RequestContext + { + CancellationToken = cancellationToken + }; + HttpMessage message = _devTestLabGlobalSchedulesRestClient.CreateGetRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, expand, context); + Response result = await Pipeline.ProcessMessageAsync(message, context).ConfigureAwait(false); + Response response = Response.FromValue(DevTestLabScheduleData.FromResponse(result), result); if (response.Value == null) + { throw new RequestFailedException(response.GetRawResponse()); + } return Response.FromValue(new DevTestLabGlobalScheduleResource(Client, response.Value), response.GetRawResponse()); } catch (Exception e) @@ -135,34 +146,42 @@ public virtual async Task> GetAsync(s /// Get schedule. /// /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/schedules/{name} + /// Request Path. + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/schedules/{name}. /// /// - /// Operation Id - /// GlobalSchedules_Get + /// Operation Id. + /// GlobalSchedules_Get. /// /// - /// Default Api Version - /// 2018-09-15 + /// Default Api Version. + /// 2018-09-15. /// /// - /// Resource - /// + /// Resource. + /// . /// /// /// /// Specify the $expand query. Example: 'properties($select=status)'. /// The cancellation token to use. - public virtual Response Get(string expand = null, CancellationToken cancellationToken = default) + public virtual Response Get(string expand = default, CancellationToken cancellationToken = default) { - using var scope = _devTestLabGlobalScheduleGlobalSchedulesClientDiagnostics.CreateScope("DevTestLabGlobalScheduleResource.Get"); + using DiagnosticScope scope = _devTestLabGlobalSchedulesClientDiagnostics.CreateScope("DevTestLabGlobalScheduleResource.Get"); scope.Start(); try { - var response = _devTestLabGlobalScheduleGlobalSchedulesRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, expand, cancellationToken); + RequestContext context = new RequestContext + { + CancellationToken = cancellationToken + }; + HttpMessage message = _devTestLabGlobalSchedulesRestClient.CreateGetRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, expand, context); + Response result = Pipeline.ProcessMessage(message, context); + Response response = Response.FromValue(DevTestLabScheduleData.FromResponse(result), result); if (response.Value == null) + { throw new RequestFailedException(response.GetRawResponse()); + } return Response.FromValue(new DevTestLabGlobalScheduleResource(Client, response.Value), response.GetRawResponse()); } catch (Exception e) @@ -173,41 +192,49 @@ public virtual Response Get(string expand = nu } /// - /// Delete schedule. + /// Allows modifying tags of schedules. All other properties will be ignored. /// /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/schedules/{name} + /// Request Path. + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/schedules/{name}. /// /// - /// Operation Id - /// GlobalSchedules_Delete + /// Operation Id. + /// GlobalSchedules_Update. /// /// - /// Default Api Version - /// 2018-09-15 + /// Default Api Version. + /// 2018-09-15. /// /// - /// Resource - /// + /// Resource. + /// . /// /// /// - /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. + /// A schedule. /// The cancellation token to use. - public virtual async Task DeleteAsync(WaitUntil waitUntil, CancellationToken cancellationToken = default) + /// is null. + public virtual async Task> UpdateAsync(DevTestLabSchedulePatch patch, CancellationToken cancellationToken = default) { - using var scope = _devTestLabGlobalScheduleGlobalSchedulesClientDiagnostics.CreateScope("DevTestLabGlobalScheduleResource.Delete"); + Argument.AssertNotNull(patch, nameof(patch)); + + using DiagnosticScope scope = _devTestLabGlobalSchedulesClientDiagnostics.CreateScope("DevTestLabGlobalScheduleResource.Update"); scope.Start(); try { - var response = await _devTestLabGlobalScheduleGlobalSchedulesRestClient.DeleteAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, cancellationToken).ConfigureAwait(false); - var uri = _devTestLabGlobalScheduleGlobalSchedulesRestClient.CreateDeleteRequestUri(Id.SubscriptionId, Id.ResourceGroupName, Id.Name); - var rehydrationToken = NextLinkOperationImplementation.GetRehydrationToken(RequestMethod.Delete, uri.ToUri(), uri.ToString(), "None", null, OperationFinalStateVia.OriginalUri.ToString()); - var operation = new DevTestLabsArmOperation(response, rehydrationToken); - if (waitUntil == WaitUntil.Completed) - await operation.WaitForCompletionResponseAsync(cancellationToken).ConfigureAwait(false); - return operation; + RequestContext context = new RequestContext + { + CancellationToken = cancellationToken + }; + HttpMessage message = _devTestLabGlobalSchedulesRestClient.CreateUpdateRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, DevTestLabSchedulePatch.ToRequestContent(patch), context); + Response result = await Pipeline.ProcessMessageAsync(message, context).ConfigureAwait(false); + Response response = Response.FromValue(DevTestLabScheduleData.FromResponse(result), result); + if (response.Value == null) + { + throw new RequestFailedException(response.GetRawResponse()); + } + return Response.FromValue(new DevTestLabGlobalScheduleResource(Client, response.Value), response.GetRawResponse()); } catch (Exception e) { @@ -217,41 +244,49 @@ public virtual async Task DeleteAsync(WaitUntil waitUntil, Cancell } /// - /// Delete schedule. + /// Allows modifying tags of schedules. All other properties will be ignored. /// /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/schedules/{name} + /// Request Path. + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/schedules/{name}. /// /// - /// Operation Id - /// GlobalSchedules_Delete + /// Operation Id. + /// GlobalSchedules_Update. /// /// - /// Default Api Version - /// 2018-09-15 + /// Default Api Version. + /// 2018-09-15. /// /// - /// Resource - /// + /// Resource. + /// . /// /// /// - /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. + /// A schedule. /// The cancellation token to use. - public virtual ArmOperation Delete(WaitUntil waitUntil, CancellationToken cancellationToken = default) + /// is null. + public virtual Response Update(DevTestLabSchedulePatch patch, CancellationToken cancellationToken = default) { - using var scope = _devTestLabGlobalScheduleGlobalSchedulesClientDiagnostics.CreateScope("DevTestLabGlobalScheduleResource.Delete"); + Argument.AssertNotNull(patch, nameof(patch)); + + using DiagnosticScope scope = _devTestLabGlobalSchedulesClientDiagnostics.CreateScope("DevTestLabGlobalScheduleResource.Update"); scope.Start(); try { - var response = _devTestLabGlobalScheduleGlobalSchedulesRestClient.Delete(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, cancellationToken); - var uri = _devTestLabGlobalScheduleGlobalSchedulesRestClient.CreateDeleteRequestUri(Id.SubscriptionId, Id.ResourceGroupName, Id.Name); - var rehydrationToken = NextLinkOperationImplementation.GetRehydrationToken(RequestMethod.Delete, uri.ToUri(), uri.ToString(), "None", null, OperationFinalStateVia.OriginalUri.ToString()); - var operation = new DevTestLabsArmOperation(response, rehydrationToken); - if (waitUntil == WaitUntil.Completed) - operation.WaitForCompletionResponse(cancellationToken); - return operation; + RequestContext context = new RequestContext + { + CancellationToken = cancellationToken + }; + HttpMessage message = _devTestLabGlobalSchedulesRestClient.CreateUpdateRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, DevTestLabSchedulePatch.ToRequestContent(patch), context); + Response result = Pipeline.ProcessMessage(message, context); + Response response = Response.FromValue(DevTestLabScheduleData.FromResponse(result), result); + if (response.Value == null) + { + throw new RequestFailedException(response.GetRawResponse()); + } + return Response.FromValue(new DevTestLabGlobalScheduleResource(Client, response.Value), response.GetRawResponse()); } catch (Exception e) { @@ -261,39 +296,48 @@ public virtual ArmOperation Delete(WaitUntil waitUntil, CancellationToken cancel } /// - /// Allows modifying tags of schedules. All other properties will be ignored. + /// Delete schedule. /// /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/schedules/{name} + /// Request Path. + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/schedules/{name}. /// /// - /// Operation Id - /// GlobalSchedules_Update + /// Operation Id. + /// GlobalSchedules_Delete. /// /// - /// Default Api Version - /// 2018-09-15 + /// Default Api Version. + /// 2018-09-15. /// /// - /// Resource - /// + /// Resource. + /// . /// /// /// - /// A schedule. + /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. /// The cancellation token to use. - /// is null. - public virtual async Task> UpdateAsync(DevTestLabSchedulePatch patch, CancellationToken cancellationToken = default) + public virtual async Task DeleteAsync(WaitUntil waitUntil, CancellationToken cancellationToken = default) { - Argument.AssertNotNull(patch, nameof(patch)); - - using var scope = _devTestLabGlobalScheduleGlobalSchedulesClientDiagnostics.CreateScope("DevTestLabGlobalScheduleResource.Update"); + using DiagnosticScope scope = _devTestLabGlobalSchedulesClientDiagnostics.CreateScope("DevTestLabGlobalScheduleResource.Delete"); scope.Start(); try { - var response = await _devTestLabGlobalScheduleGlobalSchedulesRestClient.UpdateAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, patch, cancellationToken).ConfigureAwait(false); - return Response.FromValue(new DevTestLabGlobalScheduleResource(Client, response.Value), response.GetRawResponse()); + RequestContext context = new RequestContext + { + CancellationToken = cancellationToken + }; + HttpMessage message = _devTestLabGlobalSchedulesRestClient.CreateDeleteRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, context); + Response response = await Pipeline.ProcessMessageAsync(message, context).ConfigureAwait(false); + RequestUriBuilder uri = message.Request.Uri; + RehydrationToken rehydrationToken = NextLinkOperationImplementation.GetRehydrationToken(RequestMethod.Delete, uri.ToUri(), uri.ToString(), "None", null, OperationFinalStateVia.OriginalUri.ToString()); + DevTestLabsArmOperation operation = new DevTestLabsArmOperation(response, rehydrationToken); + if (waitUntil == WaitUntil.Completed) + { + await operation.WaitForCompletionResponseAsync(cancellationToken).ConfigureAwait(false); + } + return operation; } catch (Exception e) { @@ -303,39 +347,48 @@ public virtual async Task> UpdateAsyn } /// - /// Allows modifying tags of schedules. All other properties will be ignored. + /// Delete schedule. /// /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/schedules/{name} + /// Request Path. + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/schedules/{name}. /// /// - /// Operation Id - /// GlobalSchedules_Update + /// Operation Id. + /// GlobalSchedules_Delete. /// /// - /// Default Api Version - /// 2018-09-15 + /// Default Api Version. + /// 2018-09-15. /// /// - /// Resource - /// + /// Resource. + /// . /// /// /// - /// A schedule. + /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. /// The cancellation token to use. - /// is null. - public virtual Response Update(DevTestLabSchedulePatch patch, CancellationToken cancellationToken = default) + public virtual ArmOperation Delete(WaitUntil waitUntil, CancellationToken cancellationToken = default) { - Argument.AssertNotNull(patch, nameof(patch)); - - using var scope = _devTestLabGlobalScheduleGlobalSchedulesClientDiagnostics.CreateScope("DevTestLabGlobalScheduleResource.Update"); + using DiagnosticScope scope = _devTestLabGlobalSchedulesClientDiagnostics.CreateScope("DevTestLabGlobalScheduleResource.Delete"); scope.Start(); try { - var response = _devTestLabGlobalScheduleGlobalSchedulesRestClient.Update(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, patch, cancellationToken); - return Response.FromValue(new DevTestLabGlobalScheduleResource(Client, response.Value), response.GetRawResponse()); + RequestContext context = new RequestContext + { + CancellationToken = cancellationToken + }; + HttpMessage message = _devTestLabGlobalSchedulesRestClient.CreateDeleteRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, context); + Response response = Pipeline.ProcessMessage(message, context); + RequestUriBuilder uri = message.Request.Uri; + RehydrationToken rehydrationToken = NextLinkOperationImplementation.GetRehydrationToken(RequestMethod.Delete, uri.ToUri(), uri.ToString(), "None", null, OperationFinalStateVia.OriginalUri.ToString()); + DevTestLabsArmOperation operation = new DevTestLabsArmOperation(response, rehydrationToken); + if (waitUntil == WaitUntil.Completed) + { + operation.WaitForCompletionResponse(cancellationToken); + } + return operation; } catch (Exception e) { @@ -348,20 +401,20 @@ public virtual Response Update(DevTestLabSched /// Execute a schedule. This operation can take a while to complete. /// /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/schedules/{name}/execute + /// Request Path. + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/schedules/{name}/execute. /// /// - /// Operation Id - /// GlobalSchedules_Execute + /// Operation Id. + /// GlobalSchedules_Execute. /// /// - /// Default Api Version - /// 2018-09-15 + /// Default Api Version. + /// 2018-09-15. /// /// - /// Resource - /// + /// Resource. + /// . /// /// /// @@ -369,14 +422,21 @@ public virtual Response Update(DevTestLabSched /// The cancellation token to use. public virtual async Task ExecuteAsync(WaitUntil waitUntil, CancellationToken cancellationToken = default) { - using var scope = _devTestLabGlobalScheduleGlobalSchedulesClientDiagnostics.CreateScope("DevTestLabGlobalScheduleResource.Execute"); + using DiagnosticScope scope = _devTestLabGlobalSchedulesClientDiagnostics.CreateScope("DevTestLabGlobalScheduleResource.Execute"); scope.Start(); try { - var response = await _devTestLabGlobalScheduleGlobalSchedulesRestClient.ExecuteAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, cancellationToken).ConfigureAwait(false); - var operation = new DevTestLabsArmOperation(_devTestLabGlobalScheduleGlobalSchedulesClientDiagnostics, Pipeline, _devTestLabGlobalScheduleGlobalSchedulesRestClient.CreateExecuteRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name).Request, response, OperationFinalStateVia.Location); + RequestContext context = new RequestContext + { + CancellationToken = cancellationToken + }; + HttpMessage message = _devTestLabGlobalSchedulesRestClient.CreateExecuteRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, context); + Response response = await Pipeline.ProcessMessageAsync(message, context).ConfigureAwait(false); + DevTestLabsArmOperation operation = new DevTestLabsArmOperation(_devTestLabGlobalSchedulesClientDiagnostics, Pipeline, message.Request, response, OperationFinalStateVia.Location); if (waitUntil == WaitUntil.Completed) + { await operation.WaitForCompletionResponseAsync(cancellationToken).ConfigureAwait(false); + } return operation; } catch (Exception e) @@ -390,20 +450,20 @@ public virtual async Task ExecuteAsync(WaitUntil waitUntil, Cancel /// Execute a schedule. This operation can take a while to complete. /// /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/schedules/{name}/execute + /// Request Path. + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/schedules/{name}/execute. /// /// - /// Operation Id - /// GlobalSchedules_Execute + /// Operation Id. + /// GlobalSchedules_Execute. /// /// - /// Default Api Version - /// 2018-09-15 + /// Default Api Version. + /// 2018-09-15. /// /// - /// Resource - /// + /// Resource. + /// . /// /// /// @@ -411,14 +471,21 @@ public virtual async Task ExecuteAsync(WaitUntil waitUntil, Cancel /// The cancellation token to use. public virtual ArmOperation Execute(WaitUntil waitUntil, CancellationToken cancellationToken = default) { - using var scope = _devTestLabGlobalScheduleGlobalSchedulesClientDiagnostics.CreateScope("DevTestLabGlobalScheduleResource.Execute"); + using DiagnosticScope scope = _devTestLabGlobalSchedulesClientDiagnostics.CreateScope("DevTestLabGlobalScheduleResource.Execute"); scope.Start(); try { - var response = _devTestLabGlobalScheduleGlobalSchedulesRestClient.Execute(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, cancellationToken); - var operation = new DevTestLabsArmOperation(_devTestLabGlobalScheduleGlobalSchedulesClientDiagnostics, Pipeline, _devTestLabGlobalScheduleGlobalSchedulesRestClient.CreateExecuteRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name).Request, response, OperationFinalStateVia.Location); + RequestContext context = new RequestContext + { + CancellationToken = cancellationToken + }; + HttpMessage message = _devTestLabGlobalSchedulesRestClient.CreateExecuteRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, context); + Response response = Pipeline.ProcessMessage(message, context); + DevTestLabsArmOperation operation = new DevTestLabsArmOperation(_devTestLabGlobalSchedulesClientDiagnostics, Pipeline, message.Request, response, OperationFinalStateVia.Location); if (waitUntil == WaitUntil.Completed) + { operation.WaitForCompletionResponse(cancellationToken); + } return operation; } catch (Exception e) @@ -432,20 +499,20 @@ public virtual ArmOperation Execute(WaitUntil waitUntil, CancellationToken cance /// Updates a schedule's target resource Id. This operation can take a while to complete. /// /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/schedules/{name}/retarget + /// Request Path. + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/schedules/{name}/retarget. /// /// - /// Operation Id - /// GlobalSchedules_Retarget + /// Operation Id. + /// GlobalSchedules_Retarget. /// /// - /// Default Api Version - /// 2018-09-15 + /// Default Api Version. + /// 2018-09-15. /// /// - /// Resource - /// + /// Resource. + /// . /// /// /// @@ -457,14 +524,21 @@ public virtual async Task RetargetAsync(WaitUntil waitUntil, DevTe { Argument.AssertNotNull(content, nameof(content)); - using var scope = _devTestLabGlobalScheduleGlobalSchedulesClientDiagnostics.CreateScope("DevTestLabGlobalScheduleResource.Retarget"); + using DiagnosticScope scope = _devTestLabGlobalSchedulesClientDiagnostics.CreateScope("DevTestLabGlobalScheduleResource.Retarget"); scope.Start(); try { - var response = await _devTestLabGlobalScheduleGlobalSchedulesRestClient.RetargetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, content, cancellationToken).ConfigureAwait(false); - var operation = new DevTestLabsArmOperation(_devTestLabGlobalScheduleGlobalSchedulesClientDiagnostics, Pipeline, _devTestLabGlobalScheduleGlobalSchedulesRestClient.CreateRetargetRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, content).Request, response, OperationFinalStateVia.Location); + RequestContext context = new RequestContext + { + CancellationToken = cancellationToken + }; + HttpMessage message = _devTestLabGlobalSchedulesRestClient.CreateRetargetRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, DevTestLabGlobalScheduleRetargetContent.ToRequestContent(content), context); + Response response = await Pipeline.ProcessMessageAsync(message, context).ConfigureAwait(false); + DevTestLabsArmOperation operation = new DevTestLabsArmOperation(_devTestLabGlobalSchedulesClientDiagnostics, Pipeline, message.Request, response, OperationFinalStateVia.Location); if (waitUntil == WaitUntil.Completed) + { await operation.WaitForCompletionResponseAsync(cancellationToken).ConfigureAwait(false); + } return operation; } catch (Exception e) @@ -478,20 +552,20 @@ public virtual async Task RetargetAsync(WaitUntil waitUntil, DevTe /// Updates a schedule's target resource Id. This operation can take a while to complete. /// /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/schedules/{name}/retarget + /// Request Path. + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/schedules/{name}/retarget. /// /// - /// Operation Id - /// GlobalSchedules_Retarget + /// Operation Id. + /// GlobalSchedules_Retarget. /// /// - /// Default Api Version - /// 2018-09-15 + /// Default Api Version. + /// 2018-09-15. /// /// - /// Resource - /// + /// Resource. + /// . /// /// /// @@ -503,14 +577,21 @@ public virtual ArmOperation Retarget(WaitUntil waitUntil, DevTestLabGlobalSchedu { Argument.AssertNotNull(content, nameof(content)); - using var scope = _devTestLabGlobalScheduleGlobalSchedulesClientDiagnostics.CreateScope("DevTestLabGlobalScheduleResource.Retarget"); + using DiagnosticScope scope = _devTestLabGlobalSchedulesClientDiagnostics.CreateScope("DevTestLabGlobalScheduleResource.Retarget"); scope.Start(); try { - var response = _devTestLabGlobalScheduleGlobalSchedulesRestClient.Retarget(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, content, cancellationToken); - var operation = new DevTestLabsArmOperation(_devTestLabGlobalScheduleGlobalSchedulesClientDiagnostics, Pipeline, _devTestLabGlobalScheduleGlobalSchedulesRestClient.CreateRetargetRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, content).Request, response, OperationFinalStateVia.Location); + RequestContext context = new RequestContext + { + CancellationToken = cancellationToken + }; + HttpMessage message = _devTestLabGlobalSchedulesRestClient.CreateRetargetRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, DevTestLabGlobalScheduleRetargetContent.ToRequestContent(content), context); + Response response = Pipeline.ProcessMessage(message, context); + DevTestLabsArmOperation operation = new DevTestLabsArmOperation(_devTestLabGlobalSchedulesClientDiagnostics, Pipeline, message.Request, response, OperationFinalStateVia.Location); if (waitUntil == WaitUntil.Completed) + { operation.WaitForCompletionResponse(cancellationToken); + } return operation; } catch (Exception e) @@ -520,27 +601,7 @@ public virtual ArmOperation Retarget(WaitUntil waitUntil, DevTestLabGlobalSchedu } } - /// - /// Add a tag to the current resource. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/schedules/{name} - /// - /// - /// Operation Id - /// GlobalSchedules_Get - /// - /// - /// Default Api Version - /// 2018-09-15 - /// - /// - /// Resource - /// - /// - /// - /// + /// Add a tag to the current resource. /// The key for the tag. /// The value for the tag. /// The cancellation token to use. @@ -550,29 +611,35 @@ public virtual async Task> AddTagAsyn Argument.AssertNotNull(key, nameof(key)); Argument.AssertNotNull(value, nameof(value)); - using var scope = _devTestLabGlobalScheduleGlobalSchedulesClientDiagnostics.CreateScope("DevTestLabGlobalScheduleResource.AddTag"); + using DiagnosticScope scope = _devTestLabGlobalSchedulesClientDiagnostics.CreateScope("DevTestLabGlobalScheduleResource.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 _devTestLabGlobalScheduleGlobalSchedulesRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, null, cancellationToken).ConfigureAwait(false); - return Response.FromValue(new DevTestLabGlobalScheduleResource(Client, originalResponse.Value), originalResponse.GetRawResponse()); + await GetTagResource().CreateOrUpdateAsync(WaitUntil.Completed, originalTags.Value.Data, cancellationToken).ConfigureAwait(false); + RequestContext context = new RequestContext + { + CancellationToken = cancellationToken + }; + HttpMessage message = _devTestLabGlobalSchedulesRestClient.CreateGetRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, default, context); + Response result = await Pipeline.ProcessMessageAsync(message, context).ConfigureAwait(false); + Response response = Response.FromValue(DevTestLabScheduleData.FromResponse(result), result); + return Response.FromValue(new DevTestLabGlobalScheduleResource(Client, response.Value), response.GetRawResponse()); } else { - var current = (await GetAsync(cancellationToken: cancellationToken).ConfigureAwait(false)).Value.Data; - var patch = new DevTestLabSchedulePatch(); - foreach (var tag in current.Tags) + DevTestLabScheduleData current = (await GetAsync(cancellationToken: cancellationToken).ConfigureAwait(false)).Value.Data; + DevTestLabSchedulePatch patch = new DevTestLabSchedulePatch(); + 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) @@ -582,27 +649,7 @@ public virtual async Task> AddTagAsyn } } - /// - /// Add a tag to the current resource. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/schedules/{name} - /// - /// - /// Operation Id - /// GlobalSchedules_Get - /// - /// - /// Default Api Version - /// 2018-09-15 - /// - /// - /// Resource - /// - /// - /// - /// + /// Add a tag to the current resource. /// The key for the tag. /// The value for the tag. /// The cancellation token to use. @@ -612,29 +659,35 @@ public virtual Response AddTag(string key, str Argument.AssertNotNull(key, nameof(key)); Argument.AssertNotNull(value, nameof(value)); - using var scope = _devTestLabGlobalScheduleGlobalSchedulesClientDiagnostics.CreateScope("DevTestLabGlobalScheduleResource.AddTag"); + using DiagnosticScope scope = _devTestLabGlobalSchedulesClientDiagnostics.CreateScope("DevTestLabGlobalScheduleResource.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 = _devTestLabGlobalScheduleGlobalSchedulesRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, null, cancellationToken); - return Response.FromValue(new DevTestLabGlobalScheduleResource(Client, originalResponse.Value), originalResponse.GetRawResponse()); + GetTagResource().CreateOrUpdate(WaitUntil.Completed, originalTags.Value.Data, cancellationToken); + RequestContext context = new RequestContext + { + CancellationToken = cancellationToken + }; + HttpMessage message = _devTestLabGlobalSchedulesRestClient.CreateGetRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, default, context); + Response result = Pipeline.ProcessMessage(message, context); + Response response = Response.FromValue(DevTestLabScheduleData.FromResponse(result), result); + return Response.FromValue(new DevTestLabGlobalScheduleResource(Client, response.Value), response.GetRawResponse()); } else { - var current = Get(cancellationToken: cancellationToken).Value.Data; - var patch = new DevTestLabSchedulePatch(); - foreach (var tag in current.Tags) + DevTestLabScheduleData current = Get(cancellationToken: cancellationToken).Value.Data; + DevTestLabSchedulePatch patch = new DevTestLabSchedulePatch(); + 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) @@ -644,54 +697,40 @@ public virtual Response AddTag(string key, str } } - /// - /// Replace the tags on the resource with the given set. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/schedules/{name} - /// - /// - /// Operation Id - /// GlobalSchedules_Get - /// - /// - /// Default Api Version - /// 2018-09-15 - /// - /// - /// 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 = _devTestLabGlobalScheduleGlobalSchedulesClientDiagnostics.CreateScope("DevTestLabGlobalScheduleResource.SetTags"); + using DiagnosticScope scope = _devTestLabGlobalSchedulesClientDiagnostics.CreateScope("DevTestLabGlobalScheduleResource.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 _devTestLabGlobalScheduleGlobalSchedulesRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, null, cancellationToken).ConfigureAwait(false); - return Response.FromValue(new DevTestLabGlobalScheduleResource(Client, originalResponse.Value), originalResponse.GetRawResponse()); + await GetTagResource().CreateOrUpdateAsync(WaitUntil.Completed, originalTags.Value.Data, cancellationToken).ConfigureAwait(false); + RequestContext context = new RequestContext + { + CancellationToken = cancellationToken + }; + HttpMessage message = _devTestLabGlobalSchedulesRestClient.CreateGetRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, default, context); + Response result = await Pipeline.ProcessMessageAsync(message, context).ConfigureAwait(false); + Response response = Response.FromValue(DevTestLabScheduleData.FromResponse(result), result); + return Response.FromValue(new DevTestLabGlobalScheduleResource(Client, response.Value), response.GetRawResponse()); } else { - var current = (await GetAsync(cancellationToken: cancellationToken).ConfigureAwait(false)).Value.Data; - var patch = new DevTestLabSchedulePatch(); + DevTestLabScheduleData current = (await GetAsync(cancellationToken: cancellationToken).ConfigureAwait(false)).Value.Data; + DevTestLabSchedulePatch patch = new DevTestLabSchedulePatch(); 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) @@ -701,54 +740,40 @@ public virtual async Task> SetTagsAsy } } - /// - /// Replace the tags on the resource with the given set. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/schedules/{name} - /// - /// - /// Operation Id - /// GlobalSchedules_Get - /// - /// - /// Default Api Version - /// 2018-09-15 - /// - /// - /// 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 = _devTestLabGlobalScheduleGlobalSchedulesClientDiagnostics.CreateScope("DevTestLabGlobalScheduleResource.SetTags"); + using DiagnosticScope scope = _devTestLabGlobalSchedulesClientDiagnostics.CreateScope("DevTestLabGlobalScheduleResource.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 = _devTestLabGlobalScheduleGlobalSchedulesRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, null, cancellationToken); - return Response.FromValue(new DevTestLabGlobalScheduleResource(Client, originalResponse.Value), originalResponse.GetRawResponse()); + GetTagResource().CreateOrUpdate(WaitUntil.Completed, originalTags.Value.Data, cancellationToken); + RequestContext context = new RequestContext + { + CancellationToken = cancellationToken + }; + HttpMessage message = _devTestLabGlobalSchedulesRestClient.CreateGetRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, default, context); + Response result = Pipeline.ProcessMessage(message, context); + Response response = Response.FromValue(DevTestLabScheduleData.FromResponse(result), result); + return Response.FromValue(new DevTestLabGlobalScheduleResource(Client, response.Value), response.GetRawResponse()); } else { - var current = Get(cancellationToken: cancellationToken).Value.Data; - var patch = new DevTestLabSchedulePatch(); + DevTestLabScheduleData current = Get(cancellationToken: cancellationToken).Value.Data; + DevTestLabSchedulePatch patch = new DevTestLabSchedulePatch(); 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) @@ -758,27 +783,7 @@ public virtual Response SetTags(IDictionary - /// Removes a tag by key from the resource. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/schedules/{name} - /// - /// - /// Operation Id - /// GlobalSchedules_Get - /// - /// - /// Default Api Version - /// 2018-09-15 - /// - /// - /// Resource - /// - /// - /// - /// + /// Removes a tag by key from the resource. /// The key for the tag. /// The cancellation token to use. /// is null. @@ -786,29 +791,35 @@ public virtual async Task> RemoveTagA { Argument.AssertNotNull(key, nameof(key)); - using var scope = _devTestLabGlobalScheduleGlobalSchedulesClientDiagnostics.CreateScope("DevTestLabGlobalScheduleResource.RemoveTag"); + using DiagnosticScope scope = _devTestLabGlobalSchedulesClientDiagnostics.CreateScope("DevTestLabGlobalScheduleResource.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 _devTestLabGlobalScheduleGlobalSchedulesRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, null, cancellationToken).ConfigureAwait(false); - return Response.FromValue(new DevTestLabGlobalScheduleResource(Client, originalResponse.Value), originalResponse.GetRawResponse()); + await GetTagResource().CreateOrUpdateAsync(WaitUntil.Completed, originalTags.Value.Data, cancellationToken).ConfigureAwait(false); + RequestContext context = new RequestContext + { + CancellationToken = cancellationToken + }; + HttpMessage message = _devTestLabGlobalSchedulesRestClient.CreateGetRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, default, context); + Response result = await Pipeline.ProcessMessageAsync(message, context).ConfigureAwait(false); + Response response = Response.FromValue(DevTestLabScheduleData.FromResponse(result), result); + return Response.FromValue(new DevTestLabGlobalScheduleResource(Client, response.Value), response.GetRawResponse()); } else { - var current = (await GetAsync(cancellationToken: cancellationToken).ConfigureAwait(false)).Value.Data; - var patch = new DevTestLabSchedulePatch(); - foreach (var tag in current.Tags) + DevTestLabScheduleData current = (await GetAsync(cancellationToken: cancellationToken).ConfigureAwait(false)).Value.Data; + DevTestLabSchedulePatch patch = new DevTestLabSchedulePatch(); + 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) @@ -818,27 +829,7 @@ public virtual async Task> RemoveTagA } } - /// - /// Removes a tag by key from the resource. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/schedules/{name} - /// - /// - /// Operation Id - /// GlobalSchedules_Get - /// - /// - /// Default Api Version - /// 2018-09-15 - /// - /// - /// Resource - /// - /// - /// - /// + /// Removes a tag by key from the resource. /// The key for the tag. /// The cancellation token to use. /// is null. @@ -846,29 +837,35 @@ public virtual Response RemoveTag(string key, { Argument.AssertNotNull(key, nameof(key)); - using var scope = _devTestLabGlobalScheduleGlobalSchedulesClientDiagnostics.CreateScope("DevTestLabGlobalScheduleResource.RemoveTag"); + using DiagnosticScope scope = _devTestLabGlobalSchedulesClientDiagnostics.CreateScope("DevTestLabGlobalScheduleResource.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 = _devTestLabGlobalScheduleGlobalSchedulesRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, null, cancellationToken); - return Response.FromValue(new DevTestLabGlobalScheduleResource(Client, originalResponse.Value), originalResponse.GetRawResponse()); + GetTagResource().CreateOrUpdate(WaitUntil.Completed, originalTags.Value.Data, cancellationToken); + RequestContext context = new RequestContext + { + CancellationToken = cancellationToken + }; + HttpMessage message = _devTestLabGlobalSchedulesRestClient.CreateGetRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, default, context); + Response result = Pipeline.ProcessMessage(message, context); + Response response = Response.FromValue(DevTestLabScheduleData.FromResponse(result), result); + return Response.FromValue(new DevTestLabGlobalScheduleResource(Client, response.Value), response.GetRawResponse()); } else { - var current = Get(cancellationToken: cancellationToken).Value.Data; - var patch = new DevTestLabSchedulePatch(); - foreach (var tag in current.Tags) + DevTestLabScheduleData current = Get(cancellationToken: cancellationToken).Value.Data; + DevTestLabSchedulePatch patch = new DevTestLabSchedulePatch(); + 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) diff --git a/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/DevTestLabNotificationChannelCollection.cs b/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/DevTestLabNotificationChannelCollection.cs index 6a55723b9c99..d5fd42bdbedd 100644 --- a/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/DevTestLabNotificationChannelCollection.cs +++ b/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/DevTestLabNotificationChannelCollection.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.DevTestLabs { @@ -24,51 +25,49 @@ namespace Azure.ResourceManager.DevTestLabs /// public partial class DevTestLabNotificationChannelCollection : ArmCollection, IEnumerable, IAsyncEnumerable { - private readonly ClientDiagnostics _devTestLabNotificationChannelNotificationChannelsClientDiagnostics; - private readonly NotificationChannelsRestOperations _devTestLabNotificationChannelNotificationChannelsRestClient; + private readonly ClientDiagnostics _notificationChannelsClientDiagnostics; + private readonly NotificationChannels _notificationChannelsRestClient; - /// Initializes a new instance of the class for mocking. + /// Initializes a new instance of DevTestLabNotificationChannelCollection for mocking. protected DevTestLabNotificationChannelCollection() { } - /// 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 DevTestLabNotificationChannelCollection(ArmClient client, ResourceIdentifier id) : base(client, id) { - _devTestLabNotificationChannelNotificationChannelsClientDiagnostics = new ClientDiagnostics("Azure.ResourceManager.DevTestLabs", DevTestLabNotificationChannelResource.ResourceType.Namespace, Diagnostics); - TryGetApiVersion(DevTestLabNotificationChannelResource.ResourceType, out string devTestLabNotificationChannelNotificationChannelsApiVersion); - _devTestLabNotificationChannelNotificationChannelsRestClient = new NotificationChannelsRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, devTestLabNotificationChannelNotificationChannelsApiVersion); -#if DEBUG - ValidateResourceId(Id); -#endif + TryGetApiVersion(DevTestLabNotificationChannelResource.ResourceType, out string devTestLabNotificationChannelApiVersion); + _notificationChannelsClientDiagnostics = new ClientDiagnostics("Azure.ResourceManager.DevTestLabs", DevTestLabNotificationChannelResource.ResourceType.Namespace, Diagnostics); + _notificationChannelsRestClient = new NotificationChannels(_notificationChannelsClientDiagnostics, Pipeline, Endpoint, devTestLabNotificationChannelApiVersion ?? "2018-09-15"); + ValidateResourceId(id); } + /// + [Conditional("DEBUG")] internal static void ValidateResourceId(ResourceIdentifier id) { if (id.ResourceType != DevTestLabResource.ResourceType) - throw new ArgumentException(string.Format(CultureInfo.CurrentCulture, "Invalid resource type {0} expected {1}", id.ResourceType, DevTestLabResource.ResourceType), nameof(id)); + { + throw new ArgumentException(string.Format("Invalid resource type {0} expected {1}", id.ResourceType, DevTestLabResource.ResourceType), id); + } } /// /// Create or replace an existing notification channel. /// /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/notificationchannels/{name} - /// - /// - /// Operation Id - /// NotificationChannels_CreateOrUpdate + /// Request Path. + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/notificationchannels/{name}. /// /// - /// Default Api Version - /// 2018-09-15 + /// Operation Id. + /// NotificationChannels_CreateOrUpdate. /// /// - /// Resource - /// + /// Default Api Version. + /// 2018-09-15. /// /// /// @@ -76,23 +75,31 @@ internal static void ValidateResourceId(ResourceIdentifier id) /// The name of the notification channel. /// A notification. /// 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 name, DevTestLabNotificationChannelData data, CancellationToken cancellationToken = default) { Argument.AssertNotNullOrEmpty(name, nameof(name)); Argument.AssertNotNull(data, nameof(data)); - using var scope = _devTestLabNotificationChannelNotificationChannelsClientDiagnostics.CreateScope("DevTestLabNotificationChannelCollection.CreateOrUpdate"); + using DiagnosticScope scope = _notificationChannelsClientDiagnostics.CreateScope("DevTestLabNotificationChannelCollection.CreateOrUpdate"); scope.Start(); try { - var response = await _devTestLabNotificationChannelNotificationChannelsRestClient.CreateOrUpdateAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, name, data, cancellationToken).ConfigureAwait(false); - var uri = _devTestLabNotificationChannelNotificationChannelsRestClient.CreateCreateOrUpdateRequestUri(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, name, data); - var rehydrationToken = NextLinkOperationImplementation.GetRehydrationToken(RequestMethod.Put, uri.ToUri(), uri.ToString(), "None", null, OperationFinalStateVia.OriginalUri.ToString()); - var operation = new DevTestLabsArmOperation(Response.FromValue(new DevTestLabNotificationChannelResource(Client, response), response.GetRawResponse()), rehydrationToken); + RequestContext context = new RequestContext + { + CancellationToken = cancellationToken + }; + HttpMessage message = _notificationChannelsRestClient.CreateCreateOrUpdateRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, name, DevTestLabNotificationChannelData.ToRequestContent(data), context); + Response result = await Pipeline.ProcessMessageAsync(message, context).ConfigureAwait(false); + Response response = Response.FromValue(DevTestLabNotificationChannelData.FromResponse(result), result); + RequestUriBuilder uri = message.Request.Uri; + RehydrationToken rehydrationToken = NextLinkOperationImplementation.GetRehydrationToken(RequestMethod.Put, uri.ToUri(), uri.ToString(), "None", null, OperationFinalStateVia.OriginalUri.ToString()); + DevTestLabsArmOperation operation = new DevTestLabsArmOperation(Response.FromValue(new DevTestLabNotificationChannelResource(Client, response.Value), response.GetRawResponse()), rehydrationToken); if (waitUntil == WaitUntil.Completed) + { await operation.WaitForCompletionAsync(cancellationToken).ConfigureAwait(false); + } return operation; } catch (Exception e) @@ -106,20 +113,16 @@ public virtual async Task> C /// Create or replace an existing notification channel. /// /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/notificationchannels/{name} + /// Request Path. + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/notificationchannels/{name}. /// /// - /// Operation Id - /// NotificationChannels_CreateOrUpdate + /// Operation Id. + /// NotificationChannels_CreateOrUpdate. /// /// - /// Default Api Version - /// 2018-09-15 - /// - /// - /// Resource - /// + /// Default Api Version. + /// 2018-09-15. /// /// /// @@ -127,23 +130,31 @@ public virtual async Task> C /// The name of the notification channel. /// A notification. /// 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 name, DevTestLabNotificationChannelData data, CancellationToken cancellationToken = default) { Argument.AssertNotNullOrEmpty(name, nameof(name)); Argument.AssertNotNull(data, nameof(data)); - using var scope = _devTestLabNotificationChannelNotificationChannelsClientDiagnostics.CreateScope("DevTestLabNotificationChannelCollection.CreateOrUpdate"); + using DiagnosticScope scope = _notificationChannelsClientDiagnostics.CreateScope("DevTestLabNotificationChannelCollection.CreateOrUpdate"); scope.Start(); try { - var response = _devTestLabNotificationChannelNotificationChannelsRestClient.CreateOrUpdate(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, name, data, cancellationToken); - var uri = _devTestLabNotificationChannelNotificationChannelsRestClient.CreateCreateOrUpdateRequestUri(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, name, data); - var rehydrationToken = NextLinkOperationImplementation.GetRehydrationToken(RequestMethod.Put, uri.ToUri(), uri.ToString(), "None", null, OperationFinalStateVia.OriginalUri.ToString()); - var operation = new DevTestLabsArmOperation(Response.FromValue(new DevTestLabNotificationChannelResource(Client, response), response.GetRawResponse()), rehydrationToken); + RequestContext context = new RequestContext + { + CancellationToken = cancellationToken + }; + HttpMessage message = _notificationChannelsRestClient.CreateCreateOrUpdateRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, name, DevTestLabNotificationChannelData.ToRequestContent(data), context); + Response result = Pipeline.ProcessMessage(message, context); + Response response = Response.FromValue(DevTestLabNotificationChannelData.FromResponse(result), result); + RequestUriBuilder uri = message.Request.Uri; + RehydrationToken rehydrationToken = NextLinkOperationImplementation.GetRehydrationToken(RequestMethod.Put, uri.ToUri(), uri.ToString(), "None", null, OperationFinalStateVia.OriginalUri.ToString()); + DevTestLabsArmOperation operation = new DevTestLabsArmOperation(Response.FromValue(new DevTestLabNotificationChannelResource(Client, response.Value), response.GetRawResponse()), rehydrationToken); if (waitUntil == WaitUntil.Completed) + { operation.WaitForCompletion(cancellationToken); + } return operation; } catch (Exception e) @@ -157,39 +168,43 @@ public virtual ArmOperation CreateOrUpdat /// Get notification channel. /// /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/notificationchannels/{name} + /// Request Path. + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/notificationchannels/{name}. /// /// - /// Operation Id - /// NotificationChannels_Get + /// Operation Id. + /// NotificationChannels_Get. /// /// - /// Default Api Version - /// 2018-09-15 - /// - /// - /// Resource - /// + /// Default Api Version. + /// 2018-09-15. /// /// /// /// The name of the notification channel. /// Specify the $expand query. Example: 'properties($select=webHookUrl)'. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. - public virtual async Task> GetAsync(string name, string expand = null, CancellationToken cancellationToken = default) + /// is an empty string, and was expected to be non-empty. + public virtual async Task> GetAsync(string name, string expand = default, CancellationToken cancellationToken = default) { Argument.AssertNotNullOrEmpty(name, nameof(name)); - using var scope = _devTestLabNotificationChannelNotificationChannelsClientDiagnostics.CreateScope("DevTestLabNotificationChannelCollection.Get"); + using DiagnosticScope scope = _notificationChannelsClientDiagnostics.CreateScope("DevTestLabNotificationChannelCollection.Get"); scope.Start(); try { - var response = await _devTestLabNotificationChannelNotificationChannelsRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, name, expand, cancellationToken).ConfigureAwait(false); + RequestContext context = new RequestContext + { + CancellationToken = cancellationToken + }; + HttpMessage message = _notificationChannelsRestClient.CreateGetRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, name, expand, context); + Response result = await Pipeline.ProcessMessageAsync(message, context).ConfigureAwait(false); + Response response = Response.FromValue(DevTestLabNotificationChannelData.FromResponse(result), result); if (response.Value == null) + { throw new RequestFailedException(response.GetRawResponse()); + } return Response.FromValue(new DevTestLabNotificationChannelResource(Client, response.Value), response.GetRawResponse()); } catch (Exception e) @@ -203,39 +218,43 @@ public virtual async Task> GetAs /// Get notification channel. /// /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/notificationchannels/{name} - /// - /// - /// Operation Id - /// NotificationChannels_Get + /// Request Path. + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/notificationchannels/{name}. /// /// - /// Default Api Version - /// 2018-09-15 + /// Operation Id. + /// NotificationChannels_Get. /// /// - /// Resource - /// + /// Default Api Version. + /// 2018-09-15. /// /// /// /// The name of the notification channel. /// Specify the $expand query. Example: 'properties($select=webHookUrl)'. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. - public virtual Response Get(string name, string expand = null, CancellationToken cancellationToken = default) + /// is an empty string, and was expected to be non-empty. + public virtual Response Get(string name, string expand = default, CancellationToken cancellationToken = default) { Argument.AssertNotNullOrEmpty(name, nameof(name)); - using var scope = _devTestLabNotificationChannelNotificationChannelsClientDiagnostics.CreateScope("DevTestLabNotificationChannelCollection.Get"); + using DiagnosticScope scope = _notificationChannelsClientDiagnostics.CreateScope("DevTestLabNotificationChannelCollection.Get"); scope.Start(); try { - var response = _devTestLabNotificationChannelNotificationChannelsRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, name, expand, cancellationToken); + RequestContext context = new RequestContext + { + CancellationToken = cancellationToken + }; + HttpMessage message = _notificationChannelsRestClient.CreateGetRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, name, expand, context); + Response result = Pipeline.ProcessMessage(message, context); + Response response = Response.FromValue(DevTestLabNotificationChannelData.FromResponse(result), result); if (response.Value == null) + { throw new RequestFailedException(response.GetRawResponse()); + } return Response.FromValue(new DevTestLabNotificationChannelResource(Client, response.Value), response.GetRawResponse()); } catch (Exception e) @@ -249,20 +268,16 @@ public virtual Response Get(string name, /// List notification channels in a given lab. /// /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/notificationchannels + /// Request Path. + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/notificationchannels. /// /// - /// Operation Id - /// NotificationChannels_List + /// Operation Id. + /// NotificationChannels_List. /// /// - /// Default Api Version - /// 2018-09-15 - /// - /// - /// Resource - /// + /// Default Api Version. + /// 2018-09-15. /// /// /// @@ -271,32 +286,39 @@ public virtual Response Get(string name, /// The maximum number of resources to return from the operation. Example: '$top=10'. /// The ordering expression for the results, using OData notation. Example: '$orderby=name desc'. /// The cancellation token to use. - /// An async collection of that may take multiple service requests to iterate over. - public virtual AsyncPageable GetAllAsync(string expand = null, string filter = null, int? top = null, string orderby = null, CancellationToken cancellationToken = default) + /// A collection of that may take multiple service requests to iterate over. + public virtual AsyncPageable GetAllAsync(string expand = default, string filter = default, int? top = default, string @orderby = default, CancellationToken cancellationToken = default) { - HttpMessage FirstPageRequest(int? pageSizeHint) => _devTestLabNotificationChannelNotificationChannelsRestClient.CreateListRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, expand, filter, top, orderby); - HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _devTestLabNotificationChannelNotificationChannelsRestClient.CreateListNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName, Id.Name, expand, filter, top, orderby); - return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new DevTestLabNotificationChannelResource(Client, DevTestLabNotificationChannelData.DeserializeDevTestLabNotificationChannelData(e)), _devTestLabNotificationChannelNotificationChannelsClientDiagnostics, Pipeline, "DevTestLabNotificationChannelCollection.GetAll", "value", "nextLink", cancellationToken); + RequestContext context = new RequestContext + { + CancellationToken = cancellationToken + }; + return new AsyncPageableWrapper(new NotificationChannelsGetAllAsyncCollectionResultOfT( + _notificationChannelsRestClient, + Id.SubscriptionId, + Id.ResourceGroupName, + Id.Name, + expand, + filter, + top, + @orderby, + context), data => new DevTestLabNotificationChannelResource(Client, data)); } /// /// List notification channels in a given lab. /// /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/notificationchannels - /// - /// - /// Operation Id - /// NotificationChannels_List + /// Request Path. + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/notificationchannels. /// /// - /// Default Api Version - /// 2018-09-15 + /// Operation Id. + /// NotificationChannels_List. /// /// - /// Resource - /// + /// Default Api Version. + /// 2018-09-15. /// /// /// @@ -306,48 +328,73 @@ public virtual AsyncPageable GetAllAsync( /// The ordering expression for the results, using OData notation. Example: '$orderby=name desc'. /// The cancellation token to use. /// A collection of that may take multiple service requests to iterate over. - public virtual Pageable GetAll(string expand = null, string filter = null, int? top = null, string orderby = null, CancellationToken cancellationToken = default) + public virtual Pageable GetAll(string expand = default, string filter = default, int? top = default, string @orderby = default, CancellationToken cancellationToken = default) { - HttpMessage FirstPageRequest(int? pageSizeHint) => _devTestLabNotificationChannelNotificationChannelsRestClient.CreateListRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, expand, filter, top, orderby); - HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _devTestLabNotificationChannelNotificationChannelsRestClient.CreateListNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName, Id.Name, expand, filter, top, orderby); - return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new DevTestLabNotificationChannelResource(Client, DevTestLabNotificationChannelData.DeserializeDevTestLabNotificationChannelData(e)), _devTestLabNotificationChannelNotificationChannelsClientDiagnostics, Pipeline, "DevTestLabNotificationChannelCollection.GetAll", "value", "nextLink", cancellationToken); + RequestContext context = new RequestContext + { + CancellationToken = cancellationToken + }; + return new PageableWrapper(new NotificationChannelsGetAllCollectionResultOfT( + _notificationChannelsRestClient, + Id.SubscriptionId, + Id.ResourceGroupName, + Id.Name, + expand, + filter, + top, + @orderby, + context), data => new DevTestLabNotificationChannelResource(Client, data)); } /// /// Checks to see if the resource exists in azure. /// /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/notificationchannels/{name} - /// - /// - /// Operation Id - /// NotificationChannels_Get + /// Request Path. + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/notificationchannels/{name}. /// /// - /// Default Api Version - /// 2018-09-15 + /// Operation Id. + /// NotificationChannels_Get. /// /// - /// Resource - /// + /// Default Api Version. + /// 2018-09-15. /// /// /// /// The name of the notification channel. /// Specify the $expand query. Example: 'properties($select=webHookUrl)'. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. - public virtual async Task> ExistsAsync(string name, string expand = null, CancellationToken cancellationToken = default) + /// is an empty string, and was expected to be non-empty. + public virtual async Task> ExistsAsync(string name, string expand = default, CancellationToken cancellationToken = default) { Argument.AssertNotNullOrEmpty(name, nameof(name)); - using var scope = _devTestLabNotificationChannelNotificationChannelsClientDiagnostics.CreateScope("DevTestLabNotificationChannelCollection.Exists"); + using DiagnosticScope scope = _notificationChannelsClientDiagnostics.CreateScope("DevTestLabNotificationChannelCollection.Exists"); scope.Start(); try { - var response = await _devTestLabNotificationChannelNotificationChannelsRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, name, expand, cancellationToken: cancellationToken).ConfigureAwait(false); + RequestContext context = new RequestContext + { + CancellationToken = cancellationToken + }; + HttpMessage message = _notificationChannelsRestClient.CreateGetRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, name, expand, context); + await Pipeline.SendAsync(message, context.CancellationToken).ConfigureAwait(false); + Response result = message.Response; + Response response = default; + switch (result.Status) + { + case 200: + response = Response.FromValue(DevTestLabNotificationChannelData.FromResponse(result), result); + break; + case 404: + response = Response.FromValue((DevTestLabNotificationChannelData)null, result); + break; + default: + throw new RequestFailedException(result); + } return Response.FromValue(response.Value != null, response.GetRawResponse()); } catch (Exception e) @@ -361,37 +408,51 @@ public virtual async Task> ExistsAsync(string name, string expand /// Checks to see if the resource exists in azure. /// /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/notificationchannels/{name} + /// Request Path. + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/notificationchannels/{name}. /// /// - /// Operation Id - /// NotificationChannels_Get + /// Operation Id. + /// NotificationChannels_Get. /// /// - /// Default Api Version - /// 2018-09-15 - /// - /// - /// Resource - /// + /// Default Api Version. + /// 2018-09-15. /// /// /// /// The name of the notification channel. /// Specify the $expand query. Example: 'properties($select=webHookUrl)'. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. - public virtual Response Exists(string name, string expand = null, CancellationToken cancellationToken = default) + /// is an empty string, and was expected to be non-empty. + public virtual Response Exists(string name, string expand = default, CancellationToken cancellationToken = default) { Argument.AssertNotNullOrEmpty(name, nameof(name)); - using var scope = _devTestLabNotificationChannelNotificationChannelsClientDiagnostics.CreateScope("DevTestLabNotificationChannelCollection.Exists"); + using DiagnosticScope scope = _notificationChannelsClientDiagnostics.CreateScope("DevTestLabNotificationChannelCollection.Exists"); scope.Start(); try { - var response = _devTestLabNotificationChannelNotificationChannelsRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, name, expand, cancellationToken: cancellationToken); + RequestContext context = new RequestContext + { + CancellationToken = cancellationToken + }; + HttpMessage message = _notificationChannelsRestClient.CreateGetRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, name, expand, context); + Pipeline.Send(message, context.CancellationToken); + Response result = message.Response; + Response response = default; + switch (result.Status) + { + case 200: + response = Response.FromValue(DevTestLabNotificationChannelData.FromResponse(result), result); + break; + case 404: + response = Response.FromValue((DevTestLabNotificationChannelData)null, result); + break; + default: + throw new RequestFailedException(result); + } return Response.FromValue(response.Value != null, response.GetRawResponse()); } catch (Exception e) @@ -405,39 +466,55 @@ public virtual Response Exists(string name, string expand = null, Cancella /// Tries to get details for this resource from the service. /// /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/notificationchannels/{name} - /// - /// - /// Operation Id - /// NotificationChannels_Get + /// Request Path. + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/notificationchannels/{name}. /// /// - /// Default Api Version - /// 2018-09-15 + /// Operation Id. + /// NotificationChannels_Get. /// /// - /// Resource - /// + /// Default Api Version. + /// 2018-09-15. /// /// /// /// The name of the notification channel. /// Specify the $expand query. Example: 'properties($select=webHookUrl)'. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. - public virtual async Task> GetIfExistsAsync(string name, string expand = null, CancellationToken cancellationToken = default) + /// is an empty string, and was expected to be non-empty. + public virtual async Task> GetIfExistsAsync(string name, string expand = default, CancellationToken cancellationToken = default) { Argument.AssertNotNullOrEmpty(name, nameof(name)); - using var scope = _devTestLabNotificationChannelNotificationChannelsClientDiagnostics.CreateScope("DevTestLabNotificationChannelCollection.GetIfExists"); + using DiagnosticScope scope = _notificationChannelsClientDiagnostics.CreateScope("DevTestLabNotificationChannelCollection.GetIfExists"); scope.Start(); try { - var response = await _devTestLabNotificationChannelNotificationChannelsRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, name, expand, cancellationToken: cancellationToken).ConfigureAwait(false); + RequestContext context = new RequestContext + { + CancellationToken = cancellationToken + }; + HttpMessage message = _notificationChannelsRestClient.CreateGetRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, name, expand, context); + await Pipeline.SendAsync(message, context.CancellationToken).ConfigureAwait(false); + Response result = message.Response; + Response response = default; + switch (result.Status) + { + case 200: + response = Response.FromValue(DevTestLabNotificationChannelData.FromResponse(result), result); + break; + case 404: + response = Response.FromValue((DevTestLabNotificationChannelData)null, result); + break; + default: + throw new RequestFailedException(result); + } if (response.Value == null) + { return new NoValueResponse(response.GetRawResponse()); + } return Response.FromValue(new DevTestLabNotificationChannelResource(Client, response.Value), response.GetRawResponse()); } catch (Exception e) @@ -451,39 +528,55 @@ public virtual async Task /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/notificationchannels/{name} + /// Request Path. + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/notificationchannels/{name}. /// /// - /// Operation Id - /// NotificationChannels_Get + /// Operation Id. + /// NotificationChannels_Get. /// /// - /// Default Api Version - /// 2018-09-15 - /// - /// - /// Resource - /// + /// Default Api Version. + /// 2018-09-15. /// /// /// /// The name of the notification channel. /// Specify the $expand query. Example: 'properties($select=webHookUrl)'. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. - public virtual NullableResponse GetIfExists(string name, string expand = null, CancellationToken cancellationToken = default) + /// is an empty string, and was expected to be non-empty. + public virtual NullableResponse GetIfExists(string name, string expand = default, CancellationToken cancellationToken = default) { Argument.AssertNotNullOrEmpty(name, nameof(name)); - using var scope = _devTestLabNotificationChannelNotificationChannelsClientDiagnostics.CreateScope("DevTestLabNotificationChannelCollection.GetIfExists"); + using DiagnosticScope scope = _notificationChannelsClientDiagnostics.CreateScope("DevTestLabNotificationChannelCollection.GetIfExists"); scope.Start(); try { - var response = _devTestLabNotificationChannelNotificationChannelsRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, name, expand, cancellationToken: cancellationToken); + RequestContext context = new RequestContext + { + CancellationToken = cancellationToken + }; + HttpMessage message = _notificationChannelsRestClient.CreateGetRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, name, expand, context); + Pipeline.Send(message, context.CancellationToken); + Response result = message.Response; + Response response = default; + switch (result.Status) + { + case 200: + response = Response.FromValue(DevTestLabNotificationChannelData.FromResponse(result), result); + break; + case 404: + response = Response.FromValue((DevTestLabNotificationChannelData)null, result); + break; + default: + throw new RequestFailedException(result); + } if (response.Value == null) + { return new NoValueResponse(response.GetRawResponse()); + } return Response.FromValue(new DevTestLabNotificationChannelResource(Client, response.Value), response.GetRawResponse()); } catch (Exception e) @@ -503,6 +596,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/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/DevTestLabNotificationChannelData.Serialization.cs b/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/DevTestLabNotificationChannelData.Serialization.cs index c48ba9fcf633..b74674806237 100644 --- a/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/DevTestLabNotificationChannelData.Serialization.cs +++ b/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/DevTestLabNotificationChannelData.Serialization.cs @@ -10,16 +10,47 @@ using System.Collections.Generic; using System.Text; using System.Text.Json; +using Azure; using Azure.Core; using Azure.ResourceManager.DevTestLabs.Models; using Azure.ResourceManager.Models; namespace Azure.ResourceManager.DevTestLabs { - public partial class DevTestLabNotificationChannelData : IUtf8JsonSerializable, IJsonModel + /// A notification. + public partial class DevTestLabNotificationChannelData : TrackedResourceData, IJsonModel { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + /// Initializes a new instance of for deserialization. + internal DevTestLabNotificationChannelData() + { + } + /// 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)) + { + return DeserializeDevTestLabNotificationChannelData(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(DevTestLabNotificationChannelData)} does not support reading '{options.Format}' format."); + } + } + + /// The to deserialize the from. + internal static DevTestLabNotificationChannelData FromResponse(Response response) + { + using JsonDocument document = JsonDocument.Parse(response.Content, ModelSerializationExtensions.JsonDocumentOptions); + return DeserializeDevTestLabNotificationChannelData(document.RootElement, ModelSerializationExtensions.WireOptions); + } + + /// The JSON writer. + /// The client options for reading and writing models. void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) { writer.WriteStartObject(); @@ -31,245 +62,153 @@ void IJsonModel.Write(Utf8JsonWriter writer, /// The client options for reading and writing models. protected override void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; if (format != "J") { throw new FormatException($"The model {nameof(DevTestLabNotificationChannelData)} does not support writing '{format}' format."); } - base.JsonModelWriteCore(writer, options); writer.WritePropertyName("properties"u8); - writer.WriteStartObject(); - if (Optional.IsDefined(WebHookUri)) + writer.WriteObjectValue(Properties, options); + if (Optional.IsCollectionDefined(Tags)) { - writer.WritePropertyName("webHookUrl"u8); - writer.WriteStringValue(WebHookUri.AbsoluteUri); - } - if (Optional.IsDefined(EmailRecipient)) - { - writer.WritePropertyName("emailRecipient"u8); - writer.WriteStringValue(EmailRecipient); - } - if (Optional.IsDefined(NotificationLocale)) - { - writer.WritePropertyName("notificationLocale"u8); - writer.WriteStringValue(NotificationLocale); - } - if (Optional.IsDefined(Description)) - { - writer.WritePropertyName("description"u8); - writer.WriteStringValue(Description); - } - if (Optional.IsCollectionDefined(Events)) - { - writer.WritePropertyName("events"u8); - writer.WriteStartArray(); - foreach (var item in Events) + writer.WritePropertyName("tags"u8); + writer.WriteStartObject(); + foreach (var item in Tags) { - writer.WriteObjectValue(item, options); + writer.WritePropertyName(item.Key); + if (item.Value == null) + { + writer.WriteNullValue(); + continue; + } + writer.WriteStringValue(item.Value); } - writer.WriteEndArray(); - } - if (options.Format != "W" && Optional.IsDefined(CreatedOn)) - { - writer.WritePropertyName("createdDate"u8); - writer.WriteStringValue(CreatedOn.Value, "O"); - } - if (options.Format != "W" && Optional.IsDefined(ProvisioningState)) - { - writer.WritePropertyName("provisioningState"u8); - writer.WriteStringValue(ProvisioningState); + writer.WriteEndObject(); } - if (options.Format != "W" && Optional.IsDefined(UniqueIdentifier)) - { - writer.WritePropertyName("uniqueIdentifier"u8); - writer.WriteStringValue(UniqueIdentifier.Value); - } - writer.WriteEndObject(); } - DevTestLabNotificationChannelData IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + /// The JSON reader. + /// The client options for reading and writing models. + DevTestLabNotificationChannelData IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) => (DevTestLabNotificationChannelData)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(DevTestLabNotificationChannelData)} does not support reading '{format}' format."); } - using JsonDocument document = JsonDocument.ParseValue(ref reader); return DeserializeDevTestLabNotificationChannelData(document.RootElement, options); } - internal static DevTestLabNotificationChannelData DeserializeDevTestLabNotificationChannelData(JsonElement element, ModelReaderWriterOptions options = null) + /// The JSON element to deserialize. + /// The client options for reading and writing models. + internal static DevTestLabNotificationChannelData DeserializeDevTestLabNotificationChannelData(JsonElement element, ModelReaderWriterOptions options) { - options ??= ModelSerializationExtensions.WireOptions; - if (element.ValueKind == JsonValueKind.Null) { return null; } - IDictionary tags = default; - AzureLocation location = default; ResourceIdentifier id = default; string name = default; - ResourceType type = default; + ResourceType resourceType = default; SystemData systemData = default; - Uri webHookUrl = default; - string emailRecipient = default; - string notificationLocale = default; - string description = default; - IList events = default; - DateTimeOffset? createdDate = default; - string provisioningState = default; - Guid? uniqueIdentifier = default; - IDictionary serializedAdditionalRawData = default; - Dictionary rawDataDictionary = new Dictionary(); - foreach (var property in element.EnumerateObject()) + IDictionary additionalBinaryDataProperties = new ChangeTrackingDictionary(); + AzureLocation location = default; + NotificationChannelProperties properties = default; + IDictionary tags = default; + foreach (var prop in element.EnumerateObject()) { - if (property.NameEquals("tags"u8)) + if (prop.NameEquals("id"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()) - { - dictionary.Add(property0.Name, property0.Value.GetString()); - } - tags = dictionary; + id = new ResourceIdentifier(prop.Value.GetString()); continue; } - if (property.NameEquals("location"u8)) + if (prop.NameEquals("name"u8)) { - location = new AzureLocation(property.Value.GetString()); + name = prop.Value.GetString(); continue; } - if (property.NameEquals("id"u8)) + if (prop.NameEquals("type"u8)) { - id = new ResourceIdentifier(property.Value.GetString()); + if (prop.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + resourceType = new ResourceType(prop.Value.GetString()); continue; } - if (property.NameEquals("name"u8)) + if (prop.NameEquals("systemData"u8)) { - name = property.Value.GetString(); + if (prop.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + systemData = ModelReaderWriter.Read(new BinaryData(Encoding.UTF8.GetBytes(prop.Value.GetRawText())), ModelSerializationExtensions.WireOptions, AzureResourceManagerDevTestLabsContext.Default); 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) - { - continue; - } - systemData = ModelReaderWriter.Read(new BinaryData(Encoding.UTF8.GetBytes(property.Value.GetRawText())), ModelSerializationExtensions.WireOptions, AzureResourceManagerDevTestLabsContext.Default); + properties = NotificationChannelProperties.DeserializeNotificationChannelProperties(prop.Value, options); continue; } - if (property.NameEquals("properties"u8)) + if (prop.NameEquals("tags"u8)) { - if (property.Value.ValueKind == JsonValueKind.Null) + if (prop.Value.ValueKind == JsonValueKind.Null) { - property.ThrowNonNullablePropertyIsNull(); continue; } - foreach (var property0 in property.Value.EnumerateObject()) + Dictionary dictionary = new Dictionary(); + foreach (var prop0 in prop.Value.EnumerateObject()) { - if (property0.NameEquals("webHookUrl"u8)) - { - if (property0.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - webHookUrl = new Uri(property0.Value.GetString()); - continue; - } - if (property0.NameEquals("emailRecipient"u8)) - { - emailRecipient = property0.Value.GetString(); - continue; - } - if (property0.NameEquals("notificationLocale"u8)) - { - notificationLocale = property0.Value.GetString(); - continue; - } - if (property0.NameEquals("description"u8)) - { - description = property0.Value.GetString(); - continue; - } - if (property0.NameEquals("events"u8)) - { - if (property0.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - List array = new List(); - foreach (var item in property0.Value.EnumerateArray()) - { - array.Add(DevTestLabNotificationChannelEvent.DeserializeDevTestLabNotificationChannelEvent(item, options)); - } - events = array; - continue; - } - if (property0.NameEquals("createdDate"u8)) - { - if (property0.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - createdDate = property0.Value.GetDateTimeOffset("O"); - continue; - } - if (property0.NameEquals("provisioningState"u8)) + if (prop0.Value.ValueKind == JsonValueKind.Null) { - provisioningState = property0.Value.GetString(); - continue; + dictionary.Add(prop0.Name, null); } - if (property0.NameEquals("uniqueIdentifier"u8)) + else { - if (property0.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - uniqueIdentifier = property0.Value.GetGuid(); - continue; + dictionary.Add(prop0.Name, prop0.Value.GetString()); } } + tags = dictionary; 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 DevTestLabNotificationChannelData( id, name, - type, + resourceType, systemData, - tags ?? new ChangeTrackingDictionary(), + additionalBinaryDataProperties, location, - webHookUrl, - emailRecipient, - notificationLocale, - description, - events ?? new ChangeTrackingList(), - createdDate, - provisioningState, - uniqueIdentifier, - serializedAdditionalRawData); + properties, + tags ?? new ChangeTrackingDictionary()); } - 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": @@ -279,22 +218,23 @@ BinaryData IPersistableModel.Write(ModelReade } } - DevTestLabNotificationChannelData 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. + DevTestLabNotificationChannelData IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) => (DevTestLabNotificationChannelData)PersistableModelCreateCore(data, options); - switch (format) + /// The client options for reading and writing models. + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + + /// The to serialize into . + internal static RequestContent ToRequestContent(DevTestLabNotificationChannelData devTestLabNotificationChannelData) + { + if (devTestLabNotificationChannelData == null) { - case "J": - { - using JsonDocument document = JsonDocument.Parse(data, ModelSerializationExtensions.JsonDocumentOptions); - return DeserializeDevTestLabNotificationChannelData(document.RootElement, options); - } - default: - throw new FormatException($"The model {nameof(DevTestLabNotificationChannelData)} does not support reading '{options.Format}' format."); + return null; } + Utf8JsonRequestContent content = new Utf8JsonRequestContent(); + content.JsonWriter.WriteObjectValue(devTestLabNotificationChannelData, ModelSerializationExtensions.WireOptions); + return content; } - - string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; } } diff --git a/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/DevTestLabNotificationChannelData.cs b/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/DevTestLabNotificationChannelData.cs index 0e9c2579c5b5..a40674632231 100644 --- a/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/DevTestLabNotificationChannelData.cs +++ b/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/DevTestLabNotificationChannelData.cs @@ -13,100 +13,143 @@ namespace Azure.ResourceManager.DevTestLabs { - /// - /// A class representing the DevTestLabNotificationChannel data model. - /// A notification. - /// + /// A notification. public partial class DevTestLabNotificationChannelData : 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 DevTestLabNotificationChannelData(AzureLocation location) : base(location) { - Events = new ChangeTrackingList(); + } /// Initializes a new instance of . - /// The id. - /// The name. - /// The resourceType. - /// The systemData. - /// The tags. - /// The location. - /// The webhook URL to send notifications to. - /// The email recipient to send notifications to (can be a list of semi-colon separated email addresses). - /// The locale to use when sending a notification (fallback for unsupported languages is EN). - /// Description of notification. - /// The list of event for which this notification is enabled. - /// The creation date of the notification channel. - /// The provisioning status of the resource. - /// The unique immutable identifier of a resource (Guid). - /// Keeps track of any properties unknown to the library. - internal DevTestLabNotificationChannelData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, IDictionary tags, AzureLocation location, Uri webHookUri, string emailRecipient, string notificationLocale, string description, IList events, DateTimeOffset? createdOn, string provisioningState, Guid? uniqueIdentifier, IDictionary serializedAdditionalRawData) : base(id, name, resourceType, systemData, tags, 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. + /// The geo-location where the resource lives. + /// The properties of the resource. + /// Resource tags. + internal DevTestLabNotificationChannelData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, IDictionary additionalBinaryDataProperties, AzureLocation location, NotificationChannelProperties properties, IDictionary tags) : base(id, name, resourceType, systemData, tags, location) { - WebHookUri = webHookUri; - EmailRecipient = emailRecipient; - NotificationLocale = notificationLocale; - Description = description; - Events = events; - CreatedOn = createdOn; - ProvisioningState = provisioningState; - UniqueIdentifier = uniqueIdentifier; - _serializedAdditionalRawData = serializedAdditionalRawData; + _additionalBinaryDataProperties = additionalBinaryDataProperties; + Properties = properties; } - /// Initializes a new instance of for deserialization. - internal DevTestLabNotificationChannelData() + /// The properties of the resource. + internal NotificationChannelProperties Properties { get; set; } + + /// The webhook URL to send notifications to. + public Uri WebHookUri { + get + { + return Properties is null ? default : Properties.WebHookUri; + } + set + { + if (Properties is null) + { + Properties = new NotificationChannelProperties(); + } + Properties.WebHookUri = value; + } } - /// The webhook URL to send notifications to. - public Uri WebHookUri { get; set; } /// The email recipient to send notifications to (can be a list of semi-colon separated email addresses). - public string EmailRecipient { get; set; } + public string EmailRecipient + { + get + { + return Properties is null ? default : Properties.EmailRecipient; + } + set + { + if (Properties is null) + { + Properties = new NotificationChannelProperties(); + } + Properties.EmailRecipient = value; + } + } + /// The locale to use when sending a notification (fallback for unsupported languages is EN). - public string NotificationLocale { get; set; } + public string NotificationLocale + { + get + { + return Properties is null ? default : Properties.NotificationLocale; + } + set + { + if (Properties is null) + { + Properties = new NotificationChannelProperties(); + } + Properties.NotificationLocale = value; + } + } + /// Description of notification. - public string Description { get; set; } + public string Description + { + get + { + return Properties is null ? default : Properties.Description; + } + set + { + if (Properties is null) + { + Properties = new NotificationChannelProperties(); + } + Properties.Description = value; + } + } + /// The list of event for which this notification is enabled. - public IList Events { get; } + public IList Events + { + get + { + if (Properties is null) + { + Properties = new NotificationChannelProperties(); + } + return Properties.Events; + } + } + /// The creation date of the notification channel. - public DateTimeOffset? CreatedOn { get; } + public DateTimeOffset? CreatedOn + { + get + { + return Properties is null ? default : Properties.CreatedOn; + } + } + /// The provisioning status of the resource. - public string ProvisioningState { get; } + public string ProvisioningState + { + get + { + return Properties is null ? default : Properties.ProvisioningState; + } + } + /// The unique immutable identifier of a resource (Guid). - public Guid? UniqueIdentifier { get; } + public Guid? UniqueIdentifier + { + get + { + return Properties is null ? default : Properties.UniqueIdentifier; + } + } } } diff --git a/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/DevTestLabNotificationChannelResource.Serialization.cs b/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/DevTestLabNotificationChannelResource.Serialization.cs index a8a1190f1352..7df6b730ed8b 100644 --- a/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/DevTestLabNotificationChannelResource.Serialization.cs +++ b/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/DevTestLabNotificationChannelResource.Serialization.cs @@ -11,19 +11,29 @@ namespace Azure.ResourceManager.DevTestLabs { + /// public partial class DevTestLabNotificationChannelResource : IJsonModel { - private static DevTestLabNotificationChannelData s_dataDeserializationInstance; - private static DevTestLabNotificationChannelData DataDeserializationInstance => s_dataDeserializationInstance ??= new(); + private static IJsonModel s_dataDeserializationInstance; + private static IJsonModel DataDeserializationInstance => s_dataDeserializationInstance ??= new DevTestLabNotificationChannelData(); + + /// 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); - DevTestLabNotificationChannelData 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. + DevTestLabNotificationChannelData 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, AzureResourceManagerDevTestLabsContext.Default); + /// The binary data to be processed. + /// The client options for reading and writing models. DevTestLabNotificationChannelData IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) => ModelReaderWriter.Read(data, options, AzureResourceManagerDevTestLabsContext.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/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/DevTestLabNotificationChannelResource.cs b/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/DevTestLabNotificationChannelResource.cs index 2aaea613ecae..f982e0ef852d 100644 --- a/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/DevTestLabNotificationChannelResource.cs +++ b/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/DevTestLabNotificationChannelResource.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.DevTestLabs.Models; +using Azure.ResourceManager.Resources; namespace Azure.ResourceManager.DevTestLabs { /// - /// A Class representing a DevTestLabNotificationChannel 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 GetDevTestLabNotificationChannelResource method. - /// Otherwise you can get one from its parent resource using the GetDevTestLabNotificationChannel method. + /// A class representing a DevTestLabNotificationChannel 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 GetDevTestLabNotificationChannels method. /// public partial class DevTestLabNotificationChannelResource : ArmResource { - /// Generate the resource identifier of a instance. - /// The subscriptionId. - /// The resourceGroupName. - /// The labName. - /// The name. - public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string labName, string name) - { - var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/notificationchannels/{name}"; - return new ResourceIdentifier(resourceId); - } - - private readonly ClientDiagnostics _devTestLabNotificationChannelNotificationChannelsClientDiagnostics; - private readonly NotificationChannelsRestOperations _devTestLabNotificationChannelNotificationChannelsRestClient; + private readonly ClientDiagnostics _notificationChannelsClientDiagnostics; + private readonly NotificationChannels _notificationChannelsRestClient; private readonly DevTestLabNotificationChannelData _data; - /// Gets the resource type for the operations. public static readonly ResourceType ResourceType = "Microsoft.DevTestLab/labs/notificationchannels"; - /// Initializes a new instance of the class for mocking. + /// Initializes a new instance of DevTestLabNotificationChannelResource for mocking. protected DevTestLabNotificationChannelResource() { } - /// 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 DevTestLabNotificationChannelResource(ArmClient client, DevTestLabNotificationChannelData data) : this(client, data.Id) @@ -56,72 +46,94 @@ internal DevTestLabNotificationChannelResource(ArmClient client, DevTestLabNotif _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 DevTestLabNotificationChannelResource(ArmClient client, ResourceIdentifier id) : base(client, id) { - _devTestLabNotificationChannelNotificationChannelsClientDiagnostics = new ClientDiagnostics("Azure.ResourceManager.DevTestLabs", ResourceType.Namespace, Diagnostics); - TryGetApiVersion(ResourceType, out string devTestLabNotificationChannelNotificationChannelsApiVersion); - _devTestLabNotificationChannelNotificationChannelsRestClient = new NotificationChannelsRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, devTestLabNotificationChannelNotificationChannelsApiVersion); -#if DEBUG - ValidateResourceId(Id); -#endif + TryGetApiVersion(ResourceType, out string devTestLabNotificationChannelApiVersion); + _notificationChannelsClientDiagnostics = new ClientDiagnostics("Azure.ResourceManager.DevTestLabs", ResourceType.Namespace, Diagnostics); + _notificationChannelsRestClient = new NotificationChannels(_notificationChannelsClientDiagnostics, Pipeline, Endpoint, devTestLabNotificationChannelApiVersion ?? "2018-09-15"); + 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 DevTestLabNotificationChannelData 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 labName. + /// The name. + public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string labName, string name) + { + string resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/notificationchannels/{name}"; + 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 notification channel. /// /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/notificationchannels/{name} + /// Request Path. + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/notificationchannels/{name}. /// /// - /// Operation Id - /// NotificationChannels_Get + /// Operation Id. + /// NotificationChannels_Get. /// /// - /// Default Api Version - /// 2018-09-15 + /// Default Api Version. + /// 2018-09-15. /// /// - /// Resource - /// + /// Resource. + /// . /// /// /// /// Specify the $expand query. Example: 'properties($select=webHookUrl)'. /// The cancellation token to use. - public virtual async Task> GetAsync(string expand = null, CancellationToken cancellationToken = default) + public virtual async Task> GetAsync(string expand = default, CancellationToken cancellationToken = default) { - using var scope = _devTestLabNotificationChannelNotificationChannelsClientDiagnostics.CreateScope("DevTestLabNotificationChannelResource.Get"); + using DiagnosticScope scope = _notificationChannelsClientDiagnostics.CreateScope("DevTestLabNotificationChannelResource.Get"); scope.Start(); try { - var response = await _devTestLabNotificationChannelNotificationChannelsRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, expand, cancellationToken).ConfigureAwait(false); + RequestContext context = new RequestContext + { + CancellationToken = cancellationToken + }; + HttpMessage message = _notificationChannelsRestClient.CreateGetRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, expand, context); + Response result = await Pipeline.ProcessMessageAsync(message, context).ConfigureAwait(false); + Response response = Response.FromValue(DevTestLabNotificationChannelData.FromResponse(result), result); if (response.Value == null) + { throw new RequestFailedException(response.GetRawResponse()); + } return Response.FromValue(new DevTestLabNotificationChannelResource(Client, response.Value), response.GetRawResponse()); } catch (Exception e) @@ -135,34 +147,42 @@ public virtual async Task> GetAs /// Get notification channel. /// /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/notificationchannels/{name} + /// Request Path. + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/notificationchannels/{name}. /// /// - /// Operation Id - /// NotificationChannels_Get + /// Operation Id. + /// NotificationChannels_Get. /// /// - /// Default Api Version - /// 2018-09-15 + /// Default Api Version. + /// 2018-09-15. /// /// - /// Resource - /// + /// Resource. + /// . /// /// /// /// Specify the $expand query. Example: 'properties($select=webHookUrl)'. /// The cancellation token to use. - public virtual Response Get(string expand = null, CancellationToken cancellationToken = default) + public virtual Response Get(string expand = default, CancellationToken cancellationToken = default) { - using var scope = _devTestLabNotificationChannelNotificationChannelsClientDiagnostics.CreateScope("DevTestLabNotificationChannelResource.Get"); + using DiagnosticScope scope = _notificationChannelsClientDiagnostics.CreateScope("DevTestLabNotificationChannelResource.Get"); scope.Start(); try { - var response = _devTestLabNotificationChannelNotificationChannelsRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, expand, cancellationToken); + RequestContext context = new RequestContext + { + CancellationToken = cancellationToken + }; + HttpMessage message = _notificationChannelsRestClient.CreateGetRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, expand, context); + Response result = Pipeline.ProcessMessage(message, context); + Response response = Response.FromValue(DevTestLabNotificationChannelData.FromResponse(result), result); if (response.Value == null) + { throw new RequestFailedException(response.GetRawResponse()); + } return Response.FromValue(new DevTestLabNotificationChannelResource(Client, response.Value), response.GetRawResponse()); } catch (Exception e) @@ -173,41 +193,49 @@ public virtual Response Get(string expand } /// - /// Delete notification channel. + /// Allows modifying tags of notification channels. All other properties will be ignored. /// /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/notificationchannels/{name} + /// Request Path. + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/notificationchannels/{name}. /// /// - /// Operation Id - /// NotificationChannels_Delete + /// Operation Id. + /// NotificationChannels_Update. /// /// - /// Default Api Version - /// 2018-09-15 + /// Default Api Version. + /// 2018-09-15. /// /// - /// Resource - /// + /// Resource. + /// . /// /// /// - /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. + /// A notification. /// The cancellation token to use. - public virtual async Task DeleteAsync(WaitUntil waitUntil, CancellationToken cancellationToken = default) + /// is null. + public virtual async Task> UpdateAsync(DevTestLabNotificationChannelPatch patch, CancellationToken cancellationToken = default) { - using var scope = _devTestLabNotificationChannelNotificationChannelsClientDiagnostics.CreateScope("DevTestLabNotificationChannelResource.Delete"); + Argument.AssertNotNull(patch, nameof(patch)); + + using DiagnosticScope scope = _notificationChannelsClientDiagnostics.CreateScope("DevTestLabNotificationChannelResource.Update"); scope.Start(); try { - var response = await _devTestLabNotificationChannelNotificationChannelsRestClient.DeleteAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, cancellationToken).ConfigureAwait(false); - var uri = _devTestLabNotificationChannelNotificationChannelsRestClient.CreateDeleteRequestUri(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name); - var rehydrationToken = NextLinkOperationImplementation.GetRehydrationToken(RequestMethod.Delete, uri.ToUri(), uri.ToString(), "None", null, OperationFinalStateVia.OriginalUri.ToString()); - var operation = new DevTestLabsArmOperation(response, rehydrationToken); - if (waitUntil == WaitUntil.Completed) - await operation.WaitForCompletionResponseAsync(cancellationToken).ConfigureAwait(false); - return operation; + RequestContext context = new RequestContext + { + CancellationToken = cancellationToken + }; + HttpMessage message = _notificationChannelsRestClient.CreateUpdateRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, DevTestLabNotificationChannelPatch.ToRequestContent(patch), context); + Response result = await Pipeline.ProcessMessageAsync(message, context).ConfigureAwait(false); + Response response = Response.FromValue(DevTestLabNotificationChannelData.FromResponse(result), result); + if (response.Value == null) + { + throw new RequestFailedException(response.GetRawResponse()); + } + return Response.FromValue(new DevTestLabNotificationChannelResource(Client, response.Value), response.GetRawResponse()); } catch (Exception e) { @@ -217,41 +245,49 @@ public virtual async Task DeleteAsync(WaitUntil waitUntil, Cancell } /// - /// Delete notification channel. + /// Allows modifying tags of notification channels. All other properties will be ignored. /// /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/notificationchannels/{name} + /// Request Path. + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/notificationchannels/{name}. /// /// - /// Operation Id - /// NotificationChannels_Delete + /// Operation Id. + /// NotificationChannels_Update. /// /// - /// Default Api Version - /// 2018-09-15 + /// Default Api Version. + /// 2018-09-15. /// /// - /// Resource - /// + /// Resource. + /// . /// /// /// - /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. + /// A notification. /// The cancellation token to use. - public virtual ArmOperation Delete(WaitUntil waitUntil, CancellationToken cancellationToken = default) + /// is null. + public virtual Response Update(DevTestLabNotificationChannelPatch patch, CancellationToken cancellationToken = default) { - using var scope = _devTestLabNotificationChannelNotificationChannelsClientDiagnostics.CreateScope("DevTestLabNotificationChannelResource.Delete"); + Argument.AssertNotNull(patch, nameof(patch)); + + using DiagnosticScope scope = _notificationChannelsClientDiagnostics.CreateScope("DevTestLabNotificationChannelResource.Update"); scope.Start(); try { - var response = _devTestLabNotificationChannelNotificationChannelsRestClient.Delete(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, cancellationToken); - var uri = _devTestLabNotificationChannelNotificationChannelsRestClient.CreateDeleteRequestUri(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name); - var rehydrationToken = NextLinkOperationImplementation.GetRehydrationToken(RequestMethod.Delete, uri.ToUri(), uri.ToString(), "None", null, OperationFinalStateVia.OriginalUri.ToString()); - var operation = new DevTestLabsArmOperation(response, rehydrationToken); - if (waitUntil == WaitUntil.Completed) - operation.WaitForCompletionResponse(cancellationToken); - return operation; + RequestContext context = new RequestContext + { + CancellationToken = cancellationToken + }; + HttpMessage message = _notificationChannelsRestClient.CreateUpdateRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, DevTestLabNotificationChannelPatch.ToRequestContent(patch), context); + Response result = Pipeline.ProcessMessage(message, context); + Response response = Response.FromValue(DevTestLabNotificationChannelData.FromResponse(result), result); + if (response.Value == null) + { + throw new RequestFailedException(response.GetRawResponse()); + } + return Response.FromValue(new DevTestLabNotificationChannelResource(Client, response.Value), response.GetRawResponse()); } catch (Exception e) { @@ -261,39 +297,48 @@ public virtual ArmOperation Delete(WaitUntil waitUntil, CancellationToken cancel } /// - /// Allows modifying tags of notification channels. All other properties will be ignored. + /// Delete notification channel. /// /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/notificationchannels/{name} + /// Request Path. + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/notificationchannels/{name}. /// /// - /// Operation Id - /// NotificationChannels_Update + /// Operation Id. + /// NotificationChannels_Delete. /// /// - /// Default Api Version - /// 2018-09-15 + /// Default Api Version. + /// 2018-09-15. /// /// - /// Resource - /// + /// Resource. + /// . /// /// /// - /// A notification. + /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. /// The cancellation token to use. - /// is null. - public virtual async Task> UpdateAsync(DevTestLabNotificationChannelPatch patch, CancellationToken cancellationToken = default) + public virtual async Task DeleteAsync(WaitUntil waitUntil, CancellationToken cancellationToken = default) { - Argument.AssertNotNull(patch, nameof(patch)); - - using var scope = _devTestLabNotificationChannelNotificationChannelsClientDiagnostics.CreateScope("DevTestLabNotificationChannelResource.Update"); + using DiagnosticScope scope = _notificationChannelsClientDiagnostics.CreateScope("DevTestLabNotificationChannelResource.Delete"); scope.Start(); try { - var response = await _devTestLabNotificationChannelNotificationChannelsRestClient.UpdateAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, patch, cancellationToken).ConfigureAwait(false); - return Response.FromValue(new DevTestLabNotificationChannelResource(Client, response.Value), response.GetRawResponse()); + RequestContext context = new RequestContext + { + CancellationToken = cancellationToken + }; + HttpMessage message = _notificationChannelsRestClient.CreateDeleteRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, context); + Response response = await Pipeline.ProcessMessageAsync(message, context).ConfigureAwait(false); + RequestUriBuilder uri = message.Request.Uri; + RehydrationToken rehydrationToken = NextLinkOperationImplementation.GetRehydrationToken(RequestMethod.Delete, uri.ToUri(), uri.ToString(), "None", null, OperationFinalStateVia.OriginalUri.ToString()); + DevTestLabsArmOperation operation = new DevTestLabsArmOperation(response, rehydrationToken); + if (waitUntil == WaitUntil.Completed) + { + await operation.WaitForCompletionResponseAsync(cancellationToken).ConfigureAwait(false); + } + return operation; } catch (Exception e) { @@ -303,39 +348,48 @@ public virtual async Task> Updat } /// - /// Allows modifying tags of notification channels. All other properties will be ignored. + /// Delete notification channel. /// /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/notificationchannels/{name} + /// Request Path. + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/notificationchannels/{name}. /// /// - /// Operation Id - /// NotificationChannels_Update + /// Operation Id. + /// NotificationChannels_Delete. /// /// - /// Default Api Version - /// 2018-09-15 + /// Default Api Version. + /// 2018-09-15. /// /// - /// Resource - /// + /// Resource. + /// . /// /// /// - /// A notification. + /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. /// The cancellation token to use. - /// is null. - public virtual Response Update(DevTestLabNotificationChannelPatch patch, CancellationToken cancellationToken = default) + public virtual ArmOperation Delete(WaitUntil waitUntil, CancellationToken cancellationToken = default) { - Argument.AssertNotNull(patch, nameof(patch)); - - using var scope = _devTestLabNotificationChannelNotificationChannelsClientDiagnostics.CreateScope("DevTestLabNotificationChannelResource.Update"); + using DiagnosticScope scope = _notificationChannelsClientDiagnostics.CreateScope("DevTestLabNotificationChannelResource.Delete"); scope.Start(); try { - var response = _devTestLabNotificationChannelNotificationChannelsRestClient.Update(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, patch, cancellationToken); - return Response.FromValue(new DevTestLabNotificationChannelResource(Client, response.Value), response.GetRawResponse()); + RequestContext context = new RequestContext + { + CancellationToken = cancellationToken + }; + HttpMessage message = _notificationChannelsRestClient.CreateDeleteRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, context); + Response response = Pipeline.ProcessMessage(message, context); + RequestUriBuilder uri = message.Request.Uri; + RehydrationToken rehydrationToken = NextLinkOperationImplementation.GetRehydrationToken(RequestMethod.Delete, uri.ToUri(), uri.ToString(), "None", null, OperationFinalStateVia.OriginalUri.ToString()); + DevTestLabsArmOperation operation = new DevTestLabsArmOperation(response, rehydrationToken); + if (waitUntil == WaitUntil.Completed) + { + operation.WaitForCompletionResponse(cancellationToken); + } + return operation; } catch (Exception e) { @@ -348,20 +402,20 @@ public virtual Response Update(DevTestLab /// Send notification to provided channel. /// /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/notificationchannels/{name}/notify + /// Request Path. + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/notificationchannels/{name}/notify. /// /// - /// Operation Id - /// NotificationChannels_Notify + /// Operation Id. + /// NotificationChannels_Notify. /// /// - /// Default Api Version - /// 2018-09-15 + /// Default Api Version. + /// 2018-09-15. /// /// - /// Resource - /// + /// Resource. + /// . /// /// /// @@ -372,11 +426,16 @@ public virtual async Task NotifyAsync(DevTestLabNotificationChannelNot { Argument.AssertNotNull(content, nameof(content)); - using var scope = _devTestLabNotificationChannelNotificationChannelsClientDiagnostics.CreateScope("DevTestLabNotificationChannelResource.Notify"); + using DiagnosticScope scope = _notificationChannelsClientDiagnostics.CreateScope("DevTestLabNotificationChannelResource.Notify"); scope.Start(); try { - var response = await _devTestLabNotificationChannelNotificationChannelsRestClient.NotifyAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, content, cancellationToken).ConfigureAwait(false); + RequestContext context = new RequestContext + { + CancellationToken = cancellationToken + }; + HttpMessage message = _notificationChannelsRestClient.CreateNotifyRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, DevTestLabNotificationChannelNotifyContent.ToRequestContent(content), context); + Response response = await Pipeline.ProcessMessageAsync(message, context).ConfigureAwait(false); return response; } catch (Exception e) @@ -390,20 +449,20 @@ public virtual async Task NotifyAsync(DevTestLabNotificationChannelNot /// Send notification to provided channel. /// /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/notificationchannels/{name}/notify + /// Request Path. + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/notificationchannels/{name}/notify. /// /// - /// Operation Id - /// NotificationChannels_Notify + /// Operation Id. + /// NotificationChannels_Notify. /// /// - /// Default Api Version - /// 2018-09-15 + /// Default Api Version. + /// 2018-09-15. /// /// - /// Resource - /// + /// Resource. + /// . /// /// /// @@ -414,11 +473,16 @@ public virtual Response Notify(DevTestLabNotificationChannelNotifyContent conten { Argument.AssertNotNull(content, nameof(content)); - using var scope = _devTestLabNotificationChannelNotificationChannelsClientDiagnostics.CreateScope("DevTestLabNotificationChannelResource.Notify"); + using DiagnosticScope scope = _notificationChannelsClientDiagnostics.CreateScope("DevTestLabNotificationChannelResource.Notify"); scope.Start(); try { - var response = _devTestLabNotificationChannelNotificationChannelsRestClient.Notify(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, content, cancellationToken); + RequestContext context = new RequestContext + { + CancellationToken = cancellationToken + }; + HttpMessage message = _notificationChannelsRestClient.CreateNotifyRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, DevTestLabNotificationChannelNotifyContent.ToRequestContent(content), context); + Response response = Pipeline.ProcessMessage(message, context); return response; } catch (Exception e) @@ -428,27 +492,7 @@ public virtual Response Notify(DevTestLabNotificationChannelNotifyContent conten } } - /// - /// Add a tag to the current resource. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/notificationchannels/{name} - /// - /// - /// Operation Id - /// NotificationChannels_Get - /// - /// - /// Default Api Version - /// 2018-09-15 - /// - /// - /// Resource - /// - /// - /// - /// + /// Add a tag to the current resource. /// The key for the tag. /// The value for the tag. /// The cancellation token to use. @@ -458,29 +502,35 @@ public virtual async Task> AddTa Argument.AssertNotNull(key, nameof(key)); Argument.AssertNotNull(value, nameof(value)); - using var scope = _devTestLabNotificationChannelNotificationChannelsClientDiagnostics.CreateScope("DevTestLabNotificationChannelResource.AddTag"); + using DiagnosticScope scope = _notificationChannelsClientDiagnostics.CreateScope("DevTestLabNotificationChannelResource.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 _devTestLabNotificationChannelNotificationChannelsRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, null, cancellationToken).ConfigureAwait(false); - return Response.FromValue(new DevTestLabNotificationChannelResource(Client, originalResponse.Value), originalResponse.GetRawResponse()); + await GetTagResource().CreateOrUpdateAsync(WaitUntil.Completed, originalTags.Value.Data, cancellationToken).ConfigureAwait(false); + RequestContext context = new RequestContext + { + CancellationToken = cancellationToken + }; + HttpMessage message = _notificationChannelsRestClient.CreateGetRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, default, context); + Response result = await Pipeline.ProcessMessageAsync(message, context).ConfigureAwait(false); + Response response = Response.FromValue(DevTestLabNotificationChannelData.FromResponse(result), result); + return Response.FromValue(new DevTestLabNotificationChannelResource(Client, response.Value), response.GetRawResponse()); } else { - var current = (await GetAsync(cancellationToken: cancellationToken).ConfigureAwait(false)).Value.Data; - var patch = new DevTestLabNotificationChannelPatch(); - foreach (var tag in current.Tags) + DevTestLabNotificationChannelData current = (await GetAsync(cancellationToken: cancellationToken).ConfigureAwait(false)).Value.Data; + DevTestLabNotificationChannelPatch patch = new DevTestLabNotificationChannelPatch(); + 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) @@ -490,27 +540,7 @@ public virtual async Task> AddTa } } - /// - /// Add a tag to the current resource. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/notificationchannels/{name} - /// - /// - /// Operation Id - /// NotificationChannels_Get - /// - /// - /// Default Api Version - /// 2018-09-15 - /// - /// - /// Resource - /// - /// - /// - /// + /// Add a tag to the current resource. /// The key for the tag. /// The value for the tag. /// The cancellation token to use. @@ -520,29 +550,35 @@ public virtual Response AddTag(string key Argument.AssertNotNull(key, nameof(key)); Argument.AssertNotNull(value, nameof(value)); - using var scope = _devTestLabNotificationChannelNotificationChannelsClientDiagnostics.CreateScope("DevTestLabNotificationChannelResource.AddTag"); + using DiagnosticScope scope = _notificationChannelsClientDiagnostics.CreateScope("DevTestLabNotificationChannelResource.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 = _devTestLabNotificationChannelNotificationChannelsRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, null, cancellationToken); - return Response.FromValue(new DevTestLabNotificationChannelResource(Client, originalResponse.Value), originalResponse.GetRawResponse()); + GetTagResource().CreateOrUpdate(WaitUntil.Completed, originalTags.Value.Data, cancellationToken); + RequestContext context = new RequestContext + { + CancellationToken = cancellationToken + }; + HttpMessage message = _notificationChannelsRestClient.CreateGetRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, default, context); + Response result = Pipeline.ProcessMessage(message, context); + Response response = Response.FromValue(DevTestLabNotificationChannelData.FromResponse(result), result); + return Response.FromValue(new DevTestLabNotificationChannelResource(Client, response.Value), response.GetRawResponse()); } else { - var current = Get(cancellationToken: cancellationToken).Value.Data; - var patch = new DevTestLabNotificationChannelPatch(); - foreach (var tag in current.Tags) + DevTestLabNotificationChannelData current = Get(cancellationToken: cancellationToken).Value.Data; + DevTestLabNotificationChannelPatch patch = new DevTestLabNotificationChannelPatch(); + 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) @@ -552,54 +588,40 @@ public virtual Response AddTag(string key } } - /// - /// Replace the tags on the resource with the given set. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/notificationchannels/{name} - /// - /// - /// Operation Id - /// NotificationChannels_Get - /// - /// - /// Default Api Version - /// 2018-09-15 - /// - /// - /// 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 = _devTestLabNotificationChannelNotificationChannelsClientDiagnostics.CreateScope("DevTestLabNotificationChannelResource.SetTags"); + using DiagnosticScope scope = _notificationChannelsClientDiagnostics.CreateScope("DevTestLabNotificationChannelResource.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 _devTestLabNotificationChannelNotificationChannelsRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, null, cancellationToken).ConfigureAwait(false); - return Response.FromValue(new DevTestLabNotificationChannelResource(Client, originalResponse.Value), originalResponse.GetRawResponse()); + await GetTagResource().CreateOrUpdateAsync(WaitUntil.Completed, originalTags.Value.Data, cancellationToken).ConfigureAwait(false); + RequestContext context = new RequestContext + { + CancellationToken = cancellationToken + }; + HttpMessage message = _notificationChannelsRestClient.CreateGetRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, default, context); + Response result = await Pipeline.ProcessMessageAsync(message, context).ConfigureAwait(false); + Response response = Response.FromValue(DevTestLabNotificationChannelData.FromResponse(result), result); + return Response.FromValue(new DevTestLabNotificationChannelResource(Client, response.Value), response.GetRawResponse()); } else { - var current = (await GetAsync(cancellationToken: cancellationToken).ConfigureAwait(false)).Value.Data; - var patch = new DevTestLabNotificationChannelPatch(); + DevTestLabNotificationChannelData current = (await GetAsync(cancellationToken: cancellationToken).ConfigureAwait(false)).Value.Data; + DevTestLabNotificationChannelPatch patch = new DevTestLabNotificationChannelPatch(); 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) @@ -609,54 +631,40 @@ public virtual async Task> SetTa } } - /// - /// Replace the tags on the resource with the given set. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/notificationchannels/{name} - /// - /// - /// Operation Id - /// NotificationChannels_Get - /// - /// - /// Default Api Version - /// 2018-09-15 - /// - /// - /// 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 = _devTestLabNotificationChannelNotificationChannelsClientDiagnostics.CreateScope("DevTestLabNotificationChannelResource.SetTags"); + using DiagnosticScope scope = _notificationChannelsClientDiagnostics.CreateScope("DevTestLabNotificationChannelResource.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 = _devTestLabNotificationChannelNotificationChannelsRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, null, cancellationToken); - return Response.FromValue(new DevTestLabNotificationChannelResource(Client, originalResponse.Value), originalResponse.GetRawResponse()); + GetTagResource().CreateOrUpdate(WaitUntil.Completed, originalTags.Value.Data, cancellationToken); + RequestContext context = new RequestContext + { + CancellationToken = cancellationToken + }; + HttpMessage message = _notificationChannelsRestClient.CreateGetRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, default, context); + Response result = Pipeline.ProcessMessage(message, context); + Response response = Response.FromValue(DevTestLabNotificationChannelData.FromResponse(result), result); + return Response.FromValue(new DevTestLabNotificationChannelResource(Client, response.Value), response.GetRawResponse()); } else { - var current = Get(cancellationToken: cancellationToken).Value.Data; - var patch = new DevTestLabNotificationChannelPatch(); + DevTestLabNotificationChannelData current = Get(cancellationToken: cancellationToken).Value.Data; + DevTestLabNotificationChannelPatch patch = new DevTestLabNotificationChannelPatch(); 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) @@ -666,27 +674,7 @@ public virtual Response SetTags(IDictiona } } - /// - /// Removes a tag by key from the resource. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/notificationchannels/{name} - /// - /// - /// Operation Id - /// NotificationChannels_Get - /// - /// - /// Default Api Version - /// 2018-09-15 - /// - /// - /// Resource - /// - /// - /// - /// + /// Removes a tag by key from the resource. /// The key for the tag. /// The cancellation token to use. /// is null. @@ -694,29 +682,35 @@ public virtual async Task> Remov { Argument.AssertNotNull(key, nameof(key)); - using var scope = _devTestLabNotificationChannelNotificationChannelsClientDiagnostics.CreateScope("DevTestLabNotificationChannelResource.RemoveTag"); + using DiagnosticScope scope = _notificationChannelsClientDiagnostics.CreateScope("DevTestLabNotificationChannelResource.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 _devTestLabNotificationChannelNotificationChannelsRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, null, cancellationToken).ConfigureAwait(false); - return Response.FromValue(new DevTestLabNotificationChannelResource(Client, originalResponse.Value), originalResponse.GetRawResponse()); + await GetTagResource().CreateOrUpdateAsync(WaitUntil.Completed, originalTags.Value.Data, cancellationToken).ConfigureAwait(false); + RequestContext context = new RequestContext + { + CancellationToken = cancellationToken + }; + HttpMessage message = _notificationChannelsRestClient.CreateGetRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, default, context); + Response result = await Pipeline.ProcessMessageAsync(message, context).ConfigureAwait(false); + Response response = Response.FromValue(DevTestLabNotificationChannelData.FromResponse(result), result); + return Response.FromValue(new DevTestLabNotificationChannelResource(Client, response.Value), response.GetRawResponse()); } else { - var current = (await GetAsync(cancellationToken: cancellationToken).ConfigureAwait(false)).Value.Data; - var patch = new DevTestLabNotificationChannelPatch(); - foreach (var tag in current.Tags) + DevTestLabNotificationChannelData current = (await GetAsync(cancellationToken: cancellationToken).ConfigureAwait(false)).Value.Data; + DevTestLabNotificationChannelPatch patch = new DevTestLabNotificationChannelPatch(); + 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) @@ -726,27 +720,7 @@ public virtual async Task> Remov } } - /// - /// Removes a tag by key from the resource. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/notificationchannels/{name} - /// - /// - /// Operation Id - /// NotificationChannels_Get - /// - /// - /// Default Api Version - /// 2018-09-15 - /// - /// - /// Resource - /// - /// - /// - /// + /// Removes a tag by key from the resource. /// The key for the tag. /// The cancellation token to use. /// is null. @@ -754,29 +728,35 @@ public virtual Response RemoveTag(string { Argument.AssertNotNull(key, nameof(key)); - using var scope = _devTestLabNotificationChannelNotificationChannelsClientDiagnostics.CreateScope("DevTestLabNotificationChannelResource.RemoveTag"); + using DiagnosticScope scope = _notificationChannelsClientDiagnostics.CreateScope("DevTestLabNotificationChannelResource.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 = _devTestLabNotificationChannelNotificationChannelsRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, null, cancellationToken); - return Response.FromValue(new DevTestLabNotificationChannelResource(Client, originalResponse.Value), originalResponse.GetRawResponse()); + GetTagResource().CreateOrUpdate(WaitUntil.Completed, originalTags.Value.Data, cancellationToken); + RequestContext context = new RequestContext + { + CancellationToken = cancellationToken + }; + HttpMessage message = _notificationChannelsRestClient.CreateGetRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, default, context); + Response result = Pipeline.ProcessMessage(message, context); + Response response = Response.FromValue(DevTestLabNotificationChannelData.FromResponse(result), result); + return Response.FromValue(new DevTestLabNotificationChannelResource(Client, response.Value), response.GetRawResponse()); } else { - var current = Get(cancellationToken: cancellationToken).Value.Data; - var patch = new DevTestLabNotificationChannelPatch(); - foreach (var tag in current.Tags) + DevTestLabNotificationChannelData current = Get(cancellationToken: cancellationToken).Value.Data; + DevTestLabNotificationChannelPatch patch = new DevTestLabNotificationChannelPatch(); + 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) diff --git a/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/DevTestLabPolicyCollection.cs b/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/DevTestLabPolicyCollection.cs index cc6e0b3eac0b..0cc77b6b6ebe 100644 --- a/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/DevTestLabPolicyCollection.cs +++ b/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/DevTestLabPolicyCollection.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.DevTestLabs { @@ -24,80 +25,85 @@ namespace Azure.ResourceManager.DevTestLabs /// public partial class DevTestLabPolicyCollection : ArmCollection, IEnumerable, IAsyncEnumerable { - private readonly ClientDiagnostics _devTestLabPolicyPoliciesClientDiagnostics; - private readonly PoliciesRestOperations _devTestLabPolicyPoliciesRestClient; + private readonly ClientDiagnostics _policiesClientDiagnostics; + private readonly Policies _policiesRestClient; + /// The policySetName. private readonly string _policySetName; - /// Initializes a new instance of the class for mocking. + /// Initializes a new instance of DevTestLabPolicyCollection for mocking. protected DevTestLabPolicyCollection() { } - /// 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 name of the policy set. - /// is null. - /// is an empty string, and was expected to be non-empty. + /// The identifier of the resource that is the target of operations. + /// The policySetName for the resource. internal DevTestLabPolicyCollection(ArmClient client, ResourceIdentifier id, string policySetName) : base(client, id) { + TryGetApiVersion(DevTestLabPolicyResource.ResourceType, out string devTestLabPolicyApiVersion); _policySetName = policySetName; - _devTestLabPolicyPoliciesClientDiagnostics = new ClientDiagnostics("Azure.ResourceManager.DevTestLabs", DevTestLabPolicyResource.ResourceType.Namespace, Diagnostics); - TryGetApiVersion(DevTestLabPolicyResource.ResourceType, out string devTestLabPolicyPoliciesApiVersion); - _devTestLabPolicyPoliciesRestClient = new PoliciesRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, devTestLabPolicyPoliciesApiVersion); -#if DEBUG - ValidateResourceId(Id); -#endif + _policiesClientDiagnostics = new ClientDiagnostics("Azure.ResourceManager.DevTestLabs", DevTestLabPolicyResource.ResourceType.Namespace, Diagnostics); + _policiesRestClient = new Policies(_policiesClientDiagnostics, Pipeline, Endpoint, devTestLabPolicyApiVersion ?? "2018-09-15"); + ValidateResourceId(id); } + /// + [Conditional("DEBUG")] internal static void ValidateResourceId(ResourceIdentifier id) { if (id.ResourceType != DevTestLabResource.ResourceType) - throw new ArgumentException(string.Format(CultureInfo.CurrentCulture, "Invalid resource type {0} expected {1}", id.ResourceType, DevTestLabResource.ResourceType), nameof(id)); + { + throw new ArgumentException(string.Format("Invalid resource type {0} expected {1}", id.ResourceType, DevTestLabResource.ResourceType), id); + } } /// /// Create or replace an existing policy. /// /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/policysets/{policySetName}/policies/{name} - /// - /// - /// Operation Id - /// Policies_CreateOrUpdate + /// Request Path. + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/policysets/{policySetName}/policies/{name}. /// /// - /// Default Api Version - /// 2018-09-15 + /// Operation Id. + /// Policies_CreateOrUpdate. /// /// - /// Resource - /// + /// Default Api Version. + /// 2018-09-15. /// /// /// /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. - /// The name of the policy. + /// The name of the Policy. /// A Policy. /// 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 name, DevTestLabPolicyData data, CancellationToken cancellationToken = default) { Argument.AssertNotNullOrEmpty(name, nameof(name)); Argument.AssertNotNull(data, nameof(data)); - using var scope = _devTestLabPolicyPoliciesClientDiagnostics.CreateScope("DevTestLabPolicyCollection.CreateOrUpdate"); + using DiagnosticScope scope = _policiesClientDiagnostics.CreateScope("DevTestLabPolicyCollection.CreateOrUpdate"); scope.Start(); try { - var response = await _devTestLabPolicyPoliciesRestClient.CreateOrUpdateAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, _policySetName, name, data, cancellationToken).ConfigureAwait(false); - var uri = _devTestLabPolicyPoliciesRestClient.CreateCreateOrUpdateRequestUri(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, _policySetName, name, data); - var rehydrationToken = NextLinkOperationImplementation.GetRehydrationToken(RequestMethod.Put, uri.ToUri(), uri.ToString(), "None", null, OperationFinalStateVia.OriginalUri.ToString()); - var operation = new DevTestLabsArmOperation(Response.FromValue(new DevTestLabPolicyResource(Client, response), response.GetRawResponse()), rehydrationToken); + RequestContext context = new RequestContext + { + CancellationToken = cancellationToken + }; + HttpMessage message = _policiesRestClient.CreateCreateOrUpdateRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, _policySetName, name, DevTestLabPolicyData.ToRequestContent(data), context); + Response result = await Pipeline.ProcessMessageAsync(message, context).ConfigureAwait(false); + Response response = Response.FromValue(DevTestLabPolicyData.FromResponse(result), result); + RequestUriBuilder uri = message.Request.Uri; + RehydrationToken rehydrationToken = NextLinkOperationImplementation.GetRehydrationToken(RequestMethod.Put, uri.ToUri(), uri.ToString(), "None", null, OperationFinalStateVia.OriginalUri.ToString()); + DevTestLabsArmOperation operation = new DevTestLabsArmOperation(Response.FromValue(new DevTestLabPolicyResource(Client, response.Value), response.GetRawResponse()), rehydrationToken); if (waitUntil == WaitUntil.Completed) + { await operation.WaitForCompletionAsync(cancellationToken).ConfigureAwait(false); + } return operation; } catch (Exception e) @@ -111,44 +117,48 @@ public virtual async Task> CreateOrUpdate /// Create or replace an existing policy. /// /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/policysets/{policySetName}/policies/{name} + /// Request Path. + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/policysets/{policySetName}/policies/{name}. /// /// - /// Operation Id - /// Policies_CreateOrUpdate + /// Operation Id. + /// Policies_CreateOrUpdate. /// /// - /// Default Api Version - /// 2018-09-15 - /// - /// - /// Resource - /// + /// Default Api Version. + /// 2018-09-15. /// /// /// /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. - /// The name of the policy. + /// The name of the Policy. /// A Policy. /// 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 name, DevTestLabPolicyData data, CancellationToken cancellationToken = default) { Argument.AssertNotNullOrEmpty(name, nameof(name)); Argument.AssertNotNull(data, nameof(data)); - using var scope = _devTestLabPolicyPoliciesClientDiagnostics.CreateScope("DevTestLabPolicyCollection.CreateOrUpdate"); + using DiagnosticScope scope = _policiesClientDiagnostics.CreateScope("DevTestLabPolicyCollection.CreateOrUpdate"); scope.Start(); try { - var response = _devTestLabPolicyPoliciesRestClient.CreateOrUpdate(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, _policySetName, name, data, cancellationToken); - var uri = _devTestLabPolicyPoliciesRestClient.CreateCreateOrUpdateRequestUri(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, _policySetName, name, data); - var rehydrationToken = NextLinkOperationImplementation.GetRehydrationToken(RequestMethod.Put, uri.ToUri(), uri.ToString(), "None", null, OperationFinalStateVia.OriginalUri.ToString()); - var operation = new DevTestLabsArmOperation(Response.FromValue(new DevTestLabPolicyResource(Client, response), response.GetRawResponse()), rehydrationToken); + RequestContext context = new RequestContext + { + CancellationToken = cancellationToken + }; + HttpMessage message = _policiesRestClient.CreateCreateOrUpdateRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, _policySetName, name, DevTestLabPolicyData.ToRequestContent(data), context); + Response result = Pipeline.ProcessMessage(message, context); + Response response = Response.FromValue(DevTestLabPolicyData.FromResponse(result), result); + RequestUriBuilder uri = message.Request.Uri; + RehydrationToken rehydrationToken = NextLinkOperationImplementation.GetRehydrationToken(RequestMethod.Put, uri.ToUri(), uri.ToString(), "None", null, OperationFinalStateVia.OriginalUri.ToString()); + DevTestLabsArmOperation operation = new DevTestLabsArmOperation(Response.FromValue(new DevTestLabPolicyResource(Client, response.Value), response.GetRawResponse()), rehydrationToken); if (waitUntil == WaitUntil.Completed) + { operation.WaitForCompletion(cancellationToken); + } return operation; } catch (Exception e) @@ -162,39 +172,43 @@ public virtual ArmOperation CreateOrUpdate(WaitUntil w /// Get policy. /// /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/policysets/{policySetName}/policies/{name} + /// Request Path. + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/policysets/{policySetName}/policies/{name}. /// /// - /// Operation Id - /// Policies_Get + /// Operation Id. + /// Policies_Get. /// /// - /// Default Api Version - /// 2018-09-15 - /// - /// - /// Resource - /// + /// Default Api Version. + /// 2018-09-15. /// /// /// - /// The name of the policy. + /// The name of the Policy. /// Specify the $expand query. Example: 'properties($select=description)'. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. - public virtual async Task> GetAsync(string name, string expand = null, CancellationToken cancellationToken = default) + /// is an empty string, and was expected to be non-empty. + public virtual async Task> GetAsync(string name, string expand = default, CancellationToken cancellationToken = default) { Argument.AssertNotNullOrEmpty(name, nameof(name)); - using var scope = _devTestLabPolicyPoliciesClientDiagnostics.CreateScope("DevTestLabPolicyCollection.Get"); + using DiagnosticScope scope = _policiesClientDiagnostics.CreateScope("DevTestLabPolicyCollection.Get"); scope.Start(); try { - var response = await _devTestLabPolicyPoliciesRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, _policySetName, name, expand, cancellationToken).ConfigureAwait(false); + RequestContext context = new RequestContext + { + CancellationToken = cancellationToken + }; + HttpMessage message = _policiesRestClient.CreateGetRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, _policySetName, name, expand, context); + Response result = await Pipeline.ProcessMessageAsync(message, context).ConfigureAwait(false); + Response response = Response.FromValue(DevTestLabPolicyData.FromResponse(result), result); if (response.Value == null) + { throw new RequestFailedException(response.GetRawResponse()); + } return Response.FromValue(new DevTestLabPolicyResource(Client, response.Value), response.GetRawResponse()); } catch (Exception e) @@ -208,39 +222,43 @@ public virtual async Task> GetAsync(string na /// Get policy. /// /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/policysets/{policySetName}/policies/{name} - /// - /// - /// Operation Id - /// Policies_Get + /// Request Path. + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/policysets/{policySetName}/policies/{name}. /// /// - /// Default Api Version - /// 2018-09-15 + /// Operation Id. + /// Policies_Get. /// /// - /// Resource - /// + /// Default Api Version. + /// 2018-09-15. /// /// /// - /// The name of the policy. + /// The name of the Policy. /// Specify the $expand query. Example: 'properties($select=description)'. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. - public virtual Response Get(string name, string expand = null, CancellationToken cancellationToken = default) + /// is an empty string, and was expected to be non-empty. + public virtual Response Get(string name, string expand = default, CancellationToken cancellationToken = default) { Argument.AssertNotNullOrEmpty(name, nameof(name)); - using var scope = _devTestLabPolicyPoliciesClientDiagnostics.CreateScope("DevTestLabPolicyCollection.Get"); + using DiagnosticScope scope = _policiesClientDiagnostics.CreateScope("DevTestLabPolicyCollection.Get"); scope.Start(); try { - var response = _devTestLabPolicyPoliciesRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, _policySetName, name, expand, cancellationToken); + RequestContext context = new RequestContext + { + CancellationToken = cancellationToken + }; + HttpMessage message = _policiesRestClient.CreateGetRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, _policySetName, name, expand, context); + Response result = Pipeline.ProcessMessage(message, context); + Response response = Response.FromValue(DevTestLabPolicyData.FromResponse(result), result); if (response.Value == null) + { throw new RequestFailedException(response.GetRawResponse()); + } return Response.FromValue(new DevTestLabPolicyResource(Client, response.Value), response.GetRawResponse()); } catch (Exception e) @@ -254,20 +272,16 @@ public virtual Response Get(string name, string expand /// List policies in a given policy set. /// /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/policysets/{policySetName}/policies + /// Request Path. + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/policysets/{policySetName}/policies. /// /// - /// Operation Id - /// Policies_List + /// Operation Id. + /// Policies_List. /// /// - /// Default Api Version - /// 2018-09-15 - /// - /// - /// Resource - /// + /// Default Api Version. + /// 2018-09-15. /// /// /// @@ -276,32 +290,40 @@ public virtual Response Get(string name, string expand /// The maximum number of resources to return from the operation. Example: '$top=10'. /// The ordering expression for the results, using OData notation. Example: '$orderby=name desc'. /// The cancellation token to use. - /// An async collection of that may take multiple service requests to iterate over. - public virtual AsyncPageable GetAllAsync(string expand = null, string filter = null, int? top = null, string orderby = null, CancellationToken cancellationToken = default) + /// A collection of that may take multiple service requests to iterate over. + public virtual AsyncPageable GetAllAsync(string expand = default, string filter = default, int? top = default, string @orderby = default, CancellationToken cancellationToken = default) { - HttpMessage FirstPageRequest(int? pageSizeHint) => _devTestLabPolicyPoliciesRestClient.CreateListRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, _policySetName, expand, filter, top, orderby); - HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _devTestLabPolicyPoliciesRestClient.CreateListNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName, Id.Name, _policySetName, expand, filter, top, orderby); - return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new DevTestLabPolicyResource(Client, DevTestLabPolicyData.DeserializeDevTestLabPolicyData(e)), _devTestLabPolicyPoliciesClientDiagnostics, Pipeline, "DevTestLabPolicyCollection.GetAll", "value", "nextLink", cancellationToken); + RequestContext context = new RequestContext + { + CancellationToken = cancellationToken + }; + return new AsyncPageableWrapper(new PoliciesGetAllAsyncCollectionResultOfT( + _policiesRestClient, + Id.SubscriptionId, + Id.ResourceGroupName, + Id.Name, + _policySetName, + expand, + filter, + top, + @orderby, + context), data => new DevTestLabPolicyResource(Client, data)); } /// /// List policies in a given policy set. /// /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/policysets/{policySetName}/policies - /// - /// - /// Operation Id - /// Policies_List + /// Request Path. + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/policysets/{policySetName}/policies. /// /// - /// Default Api Version - /// 2018-09-15 + /// Operation Id. + /// Policies_List. /// /// - /// Resource - /// + /// Default Api Version. + /// 2018-09-15. /// /// /// @@ -311,48 +333,74 @@ public virtual AsyncPageable GetAllAsync(string expand /// The ordering expression for the results, using OData notation. Example: '$orderby=name desc'. /// The cancellation token to use. /// A collection of that may take multiple service requests to iterate over. - public virtual Pageable GetAll(string expand = null, string filter = null, int? top = null, string orderby = null, CancellationToken cancellationToken = default) + public virtual Pageable GetAll(string expand = default, string filter = default, int? top = default, string @orderby = default, CancellationToken cancellationToken = default) { - HttpMessage FirstPageRequest(int? pageSizeHint) => _devTestLabPolicyPoliciesRestClient.CreateListRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, _policySetName, expand, filter, top, orderby); - HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _devTestLabPolicyPoliciesRestClient.CreateListNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName, Id.Name, _policySetName, expand, filter, top, orderby); - return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new DevTestLabPolicyResource(Client, DevTestLabPolicyData.DeserializeDevTestLabPolicyData(e)), _devTestLabPolicyPoliciesClientDiagnostics, Pipeline, "DevTestLabPolicyCollection.GetAll", "value", "nextLink", cancellationToken); + RequestContext context = new RequestContext + { + CancellationToken = cancellationToken + }; + return new PageableWrapper(new PoliciesGetAllCollectionResultOfT( + _policiesRestClient, + Id.SubscriptionId, + Id.ResourceGroupName, + Id.Name, + _policySetName, + expand, + filter, + top, + @orderby, + context), data => new DevTestLabPolicyResource(Client, data)); } /// /// Checks to see if the resource exists in azure. /// /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/policysets/{policySetName}/policies/{name} - /// - /// - /// Operation Id - /// Policies_Get + /// Request Path. + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/policysets/{policySetName}/policies/{name}. /// /// - /// Default Api Version - /// 2018-09-15 + /// Operation Id. + /// Policies_Get. /// /// - /// Resource - /// + /// Default Api Version. + /// 2018-09-15. /// /// /// - /// The name of the policy. + /// The name of the Policy. /// Specify the $expand query. Example: 'properties($select=description)'. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. - public virtual async Task> ExistsAsync(string name, string expand = null, CancellationToken cancellationToken = default) + /// is an empty string, and was expected to be non-empty. + public virtual async Task> ExistsAsync(string name, string expand = default, CancellationToken cancellationToken = default) { Argument.AssertNotNullOrEmpty(name, nameof(name)); - using var scope = _devTestLabPolicyPoliciesClientDiagnostics.CreateScope("DevTestLabPolicyCollection.Exists"); + using DiagnosticScope scope = _policiesClientDiagnostics.CreateScope("DevTestLabPolicyCollection.Exists"); scope.Start(); try { - var response = await _devTestLabPolicyPoliciesRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, _policySetName, name, expand, cancellationToken: cancellationToken).ConfigureAwait(false); + RequestContext context = new RequestContext + { + CancellationToken = cancellationToken + }; + HttpMessage message = _policiesRestClient.CreateGetRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, _policySetName, name, expand, context); + await Pipeline.SendAsync(message, context.CancellationToken).ConfigureAwait(false); + Response result = message.Response; + Response response = default; + switch (result.Status) + { + case 200: + response = Response.FromValue(DevTestLabPolicyData.FromResponse(result), result); + break; + case 404: + response = Response.FromValue((DevTestLabPolicyData)null, result); + break; + default: + throw new RequestFailedException(result); + } return Response.FromValue(response.Value != null, response.GetRawResponse()); } catch (Exception e) @@ -366,37 +414,51 @@ public virtual async Task> ExistsAsync(string name, string expand /// Checks to see if the resource exists in azure. /// /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/policysets/{policySetName}/policies/{name} + /// Request Path. + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/policysets/{policySetName}/policies/{name}. /// /// - /// Operation Id - /// Policies_Get + /// Operation Id. + /// Policies_Get. /// /// - /// Default Api Version - /// 2018-09-15 - /// - /// - /// Resource - /// + /// Default Api Version. + /// 2018-09-15. /// /// /// - /// The name of the policy. + /// The name of the Policy. /// Specify the $expand query. Example: 'properties($select=description)'. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. - public virtual Response Exists(string name, string expand = null, CancellationToken cancellationToken = default) + /// is an empty string, and was expected to be non-empty. + public virtual Response Exists(string name, string expand = default, CancellationToken cancellationToken = default) { Argument.AssertNotNullOrEmpty(name, nameof(name)); - using var scope = _devTestLabPolicyPoliciesClientDiagnostics.CreateScope("DevTestLabPolicyCollection.Exists"); + using DiagnosticScope scope = _policiesClientDiagnostics.CreateScope("DevTestLabPolicyCollection.Exists"); scope.Start(); try { - var response = _devTestLabPolicyPoliciesRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, _policySetName, name, expand, cancellationToken: cancellationToken); + RequestContext context = new RequestContext + { + CancellationToken = cancellationToken + }; + HttpMessage message = _policiesRestClient.CreateGetRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, _policySetName, name, expand, context); + Pipeline.Send(message, context.CancellationToken); + Response result = message.Response; + Response response = default; + switch (result.Status) + { + case 200: + response = Response.FromValue(DevTestLabPolicyData.FromResponse(result), result); + break; + case 404: + response = Response.FromValue((DevTestLabPolicyData)null, result); + break; + default: + throw new RequestFailedException(result); + } return Response.FromValue(response.Value != null, response.GetRawResponse()); } catch (Exception e) @@ -410,39 +472,55 @@ public virtual Response Exists(string name, string expand = null, Cancella /// Tries to get details for this resource from the service. /// /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/policysets/{policySetName}/policies/{name} - /// - /// - /// Operation Id - /// Policies_Get + /// Request Path. + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/policysets/{policySetName}/policies/{name}. /// /// - /// Default Api Version - /// 2018-09-15 + /// Operation Id. + /// Policies_Get. /// /// - /// Resource - /// + /// Default Api Version. + /// 2018-09-15. /// /// /// - /// The name of the policy. + /// The name of the Policy. /// Specify the $expand query. Example: 'properties($select=description)'. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. - public virtual async Task> GetIfExistsAsync(string name, string expand = null, CancellationToken cancellationToken = default) + /// is an empty string, and was expected to be non-empty. + public virtual async Task> GetIfExistsAsync(string name, string expand = default, CancellationToken cancellationToken = default) { Argument.AssertNotNullOrEmpty(name, nameof(name)); - using var scope = _devTestLabPolicyPoliciesClientDiagnostics.CreateScope("DevTestLabPolicyCollection.GetIfExists"); + using DiagnosticScope scope = _policiesClientDiagnostics.CreateScope("DevTestLabPolicyCollection.GetIfExists"); scope.Start(); try { - var response = await _devTestLabPolicyPoliciesRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, _policySetName, name, expand, cancellationToken: cancellationToken).ConfigureAwait(false); + RequestContext context = new RequestContext + { + CancellationToken = cancellationToken + }; + HttpMessage message = _policiesRestClient.CreateGetRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, _policySetName, name, expand, context); + await Pipeline.SendAsync(message, context.CancellationToken).ConfigureAwait(false); + Response result = message.Response; + Response response = default; + switch (result.Status) + { + case 200: + response = Response.FromValue(DevTestLabPolicyData.FromResponse(result), result); + break; + case 404: + response = Response.FromValue((DevTestLabPolicyData)null, result); + break; + default: + throw new RequestFailedException(result); + } if (response.Value == null) + { return new NoValueResponse(response.GetRawResponse()); + } return Response.FromValue(new DevTestLabPolicyResource(Client, response.Value), response.GetRawResponse()); } catch (Exception e) @@ -456,39 +534,55 @@ public virtual async Task> GetIfExist /// Tries to get details for this resource from the service. /// /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/policysets/{policySetName}/policies/{name} + /// Request Path. + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/policysets/{policySetName}/policies/{name}. /// /// - /// Operation Id - /// Policies_Get + /// Operation Id. + /// Policies_Get. /// /// - /// Default Api Version - /// 2018-09-15 - /// - /// - /// Resource - /// + /// Default Api Version. + /// 2018-09-15. /// /// /// - /// The name of the policy. + /// The name of the Policy. /// Specify the $expand query. Example: 'properties($select=description)'. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. - public virtual NullableResponse GetIfExists(string name, string expand = null, CancellationToken cancellationToken = default) + /// is an empty string, and was expected to be non-empty. + public virtual NullableResponse GetIfExists(string name, string expand = default, CancellationToken cancellationToken = default) { Argument.AssertNotNullOrEmpty(name, nameof(name)); - using var scope = _devTestLabPolicyPoliciesClientDiagnostics.CreateScope("DevTestLabPolicyCollection.GetIfExists"); + using DiagnosticScope scope = _policiesClientDiagnostics.CreateScope("DevTestLabPolicyCollection.GetIfExists"); scope.Start(); try { - var response = _devTestLabPolicyPoliciesRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, _policySetName, name, expand, cancellationToken: cancellationToken); + RequestContext context = new RequestContext + { + CancellationToken = cancellationToken + }; + HttpMessage message = _policiesRestClient.CreateGetRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, _policySetName, name, expand, context); + Pipeline.Send(message, context.CancellationToken); + Response result = message.Response; + Response response = default; + switch (result.Status) + { + case 200: + response = Response.FromValue(DevTestLabPolicyData.FromResponse(result), result); + break; + case 404: + response = Response.FromValue((DevTestLabPolicyData)null, result); + break; + default: + throw new RequestFailedException(result); + } if (response.Value == null) + { return new NoValueResponse(response.GetRawResponse()); + } return Response.FromValue(new DevTestLabPolicyResource(Client, response.Value), response.GetRawResponse()); } catch (Exception e) @@ -508,6 +602,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/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/DevTestLabPolicyData.Serialization.cs b/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/DevTestLabPolicyData.Serialization.cs index 3398ed223afb..8cc0cb7c25b5 100644 --- a/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/DevTestLabPolicyData.Serialization.cs +++ b/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/DevTestLabPolicyData.Serialization.cs @@ -10,16 +10,47 @@ using System.Collections.Generic; using System.Text; using System.Text.Json; +using Azure; using Azure.Core; using Azure.ResourceManager.DevTestLabs.Models; using Azure.ResourceManager.Models; namespace Azure.ResourceManager.DevTestLabs { - public partial class DevTestLabPolicyData : IUtf8JsonSerializable, IJsonModel + /// A Policy. + public partial class DevTestLabPolicyData : TrackedResourceData, IJsonModel { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + /// Initializes a new instance of for deserialization. + internal DevTestLabPolicyData() + { + } + + /// 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)) + { + return DeserializeDevTestLabPolicyData(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(DevTestLabPolicyData)} does not support reading '{options.Format}' format."); + } + } + /// The to deserialize the from. + internal static DevTestLabPolicyData FromResponse(Response response) + { + using JsonDocument document = JsonDocument.Parse(response.Content, ModelSerializationExtensions.JsonDocumentOptions); + return DeserializeDevTestLabPolicyData(document.RootElement, ModelSerializationExtensions.WireOptions); + } + + /// The JSON writer. + /// The client options for reading and writing models. void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) { writer.WriteStartObject(); @@ -31,251 +62,153 @@ void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWr /// 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(DevTestLabPolicyData)} does not support writing '{format}' format."); } - base.JsonModelWriteCore(writer, options); writer.WritePropertyName("properties"u8); - writer.WriteStartObject(); - if (Optional.IsDefined(Description)) - { - writer.WritePropertyName("description"u8); - writer.WriteStringValue(Description); - } - if (Optional.IsDefined(Status)) - { - writer.WritePropertyName("status"u8); - writer.WriteStringValue(Status.Value.ToString()); - } - if (Optional.IsDefined(FactName)) + writer.WriteObjectValue(Properties, options); + if (Optional.IsCollectionDefined(Tags)) { - writer.WritePropertyName("factName"u8); - writer.WriteStringValue(FactName.Value.ToString()); - } - if (Optional.IsDefined(FactData)) - { - writer.WritePropertyName("factData"u8); - writer.WriteStringValue(FactData); - } - if (Optional.IsDefined(Threshold)) - { - writer.WritePropertyName("threshold"u8); - writer.WriteStringValue(Threshold); - } - if (Optional.IsDefined(EvaluatorType)) - { - writer.WritePropertyName("evaluatorType"u8); - writer.WriteStringValue(EvaluatorType.Value.ToString()); - } - if (options.Format != "W" && Optional.IsDefined(CreatedOn)) - { - writer.WritePropertyName("createdDate"u8); - writer.WriteStringValue(CreatedOn.Value, "O"); - } - if (options.Format != "W" && Optional.IsDefined(ProvisioningState)) - { - writer.WritePropertyName("provisioningState"u8); - writer.WriteStringValue(ProvisioningState); - } - if (options.Format != "W" && Optional.IsDefined(UniqueIdentifier)) - { - writer.WritePropertyName("uniqueIdentifier"u8); - writer.WriteStringValue(UniqueIdentifier.Value); + writer.WritePropertyName("tags"u8); + writer.WriteStartObject(); + foreach (var item in Tags) + { + writer.WritePropertyName(item.Key); + if (item.Value == null) + { + writer.WriteNullValue(); + continue; + } + writer.WriteStringValue(item.Value); + } + writer.WriteEndObject(); } - writer.WriteEndObject(); } - DevTestLabPolicyData IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + /// The JSON reader. + /// The client options for reading and writing models. + DevTestLabPolicyData IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) => (DevTestLabPolicyData)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(DevTestLabPolicyData)} does not support reading '{format}' format."); } - using JsonDocument document = JsonDocument.ParseValue(ref reader); return DeserializeDevTestLabPolicyData(document.RootElement, options); } - internal static DevTestLabPolicyData DeserializeDevTestLabPolicyData(JsonElement element, ModelReaderWriterOptions options = null) + /// The JSON element to deserialize. + /// The client options for reading and writing models. + internal static DevTestLabPolicyData DeserializeDevTestLabPolicyData(JsonElement element, ModelReaderWriterOptions options) { - options ??= ModelSerializationExtensions.WireOptions; - if (element.ValueKind == JsonValueKind.Null) { return null; } - IDictionary tags = default; - AzureLocation location = default; ResourceIdentifier id = default; string name = default; - ResourceType type = default; + ResourceType resourceType = default; SystemData systemData = default; - string description = default; - DevTestLabPolicyStatus? status = default; - DevTestLabPolicyFactName? factName = default; - string factData = default; - string threshold = default; - DevTestLabPolicyEvaluatorType? evaluatorType = default; - DateTimeOffset? createdDate = default; - string provisioningState = default; - Guid? uniqueIdentifier = default; - IDictionary serializedAdditionalRawData = default; - Dictionary rawDataDictionary = new Dictionary(); - foreach (var property in element.EnumerateObject()) + IDictionary additionalBinaryDataProperties = new ChangeTrackingDictionary(); + AzureLocation location = default; + PolicyProperties properties = default; + IDictionary tags = default; + foreach (var prop in element.EnumerateObject()) { - if (property.NameEquals("tags"u8)) + if (prop.NameEquals("id"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()) - { - dictionary.Add(property0.Name, property0.Value.GetString()); - } - tags = dictionary; + id = new ResourceIdentifier(prop.Value.GetString()); continue; } - if (property.NameEquals("location"u8)) + if (prop.NameEquals("name"u8)) { - location = new AzureLocation(property.Value.GetString()); + name = prop.Value.GetString(); continue; } - if (property.NameEquals("id"u8)) + if (prop.NameEquals("type"u8)) { - id = new ResourceIdentifier(property.Value.GetString()); + if (prop.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + resourceType = new ResourceType(prop.Value.GetString()); continue; } - if (property.NameEquals("name"u8)) + if (prop.NameEquals("systemData"u8)) { - name = property.Value.GetString(); + if (prop.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + systemData = ModelReaderWriter.Read(new BinaryData(Encoding.UTF8.GetBytes(prop.Value.GetRawText())), ModelSerializationExtensions.WireOptions, AzureResourceManagerDevTestLabsContext.Default); 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) - { - continue; - } - systemData = ModelReaderWriter.Read(new BinaryData(Encoding.UTF8.GetBytes(property.Value.GetRawText())), ModelSerializationExtensions.WireOptions, AzureResourceManagerDevTestLabsContext.Default); + properties = PolicyProperties.DeserializePolicyProperties(prop.Value, options); continue; } - if (property.NameEquals("properties"u8)) + if (prop.NameEquals("tags"u8)) { - if (property.Value.ValueKind == JsonValueKind.Null) + if (prop.Value.ValueKind == JsonValueKind.Null) { - property.ThrowNonNullablePropertyIsNull(); continue; } - foreach (var property0 in property.Value.EnumerateObject()) + Dictionary dictionary = new Dictionary(); + foreach (var prop0 in prop.Value.EnumerateObject()) { - if (property0.NameEquals("description"u8)) - { - description = property0.Value.GetString(); - continue; - } - if (property0.NameEquals("status"u8)) - { - if (property0.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - status = new DevTestLabPolicyStatus(property0.Value.GetString()); - continue; - } - if (property0.NameEquals("factName"u8)) - { - if (property0.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - factName = new DevTestLabPolicyFactName(property0.Value.GetString()); - continue; - } - if (property0.NameEquals("factData"u8)) - { - factData = property0.Value.GetString(); - continue; - } - if (property0.NameEquals("threshold"u8)) - { - threshold = property0.Value.GetString(); - continue; - } - if (property0.NameEquals("evaluatorType"u8)) + if (prop0.Value.ValueKind == JsonValueKind.Null) { - if (property0.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - evaluatorType = new DevTestLabPolicyEvaluatorType(property0.Value.GetString()); - continue; + dictionary.Add(prop0.Name, null); } - if (property0.NameEquals("createdDate"u8)) + else { - if (property0.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - createdDate = property0.Value.GetDateTimeOffset("O"); - continue; - } - if (property0.NameEquals("provisioningState"u8)) - { - provisioningState = property0.Value.GetString(); - continue; - } - if (property0.NameEquals("uniqueIdentifier"u8)) - { - if (property0.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - uniqueIdentifier = property0.Value.GetGuid(); - continue; + dictionary.Add(prop0.Name, prop0.Value.GetString()); } } + tags = dictionary; 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 DevTestLabPolicyData( id, name, - type, + resourceType, systemData, - tags ?? new ChangeTrackingDictionary(), + additionalBinaryDataProperties, location, - description, - status, - factName, - factData, - threshold, - evaluatorType, - createdDate, - provisioningState, - uniqueIdentifier, - serializedAdditionalRawData); + properties, + tags ?? new ChangeTrackingDictionary()); } - 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": @@ -285,22 +218,23 @@ BinaryData IPersistableModel.Write(ModelReaderWriterOption } } - DevTestLabPolicyData 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. + DevTestLabPolicyData IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) => (DevTestLabPolicyData)PersistableModelCreateCore(data, options); - switch (format) + /// The client options for reading and writing models. + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + + /// The to serialize into . + internal static RequestContent ToRequestContent(DevTestLabPolicyData devTestLabPolicyData) + { + if (devTestLabPolicyData == null) { - case "J": - { - using JsonDocument document = JsonDocument.Parse(data, ModelSerializationExtensions.JsonDocumentOptions); - return DeserializeDevTestLabPolicyData(document.RootElement, options); - } - default: - throw new FormatException($"The model {nameof(DevTestLabPolicyData)} does not support reading '{options.Format}' format."); + return null; } + Utf8JsonRequestContent content = new Utf8JsonRequestContent(); + content.JsonWriter.WriteObjectValue(devTestLabPolicyData, ModelSerializationExtensions.WireOptions); + return content; } - - string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; } } diff --git a/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/DevTestLabPolicyData.cs b/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/DevTestLabPolicyData.cs index dc354c1dbb91..84cc01f9b7de 100644 --- a/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/DevTestLabPolicyData.cs +++ b/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/DevTestLabPolicyData.cs @@ -13,103 +13,164 @@ namespace Azure.ResourceManager.DevTestLabs { - /// - /// A class representing the DevTestLabPolicy data model. - /// A Policy. - /// + /// A Policy. public partial class DevTestLabPolicyData : 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 DevTestLabPolicyData(AzureLocation location) : base(location) { + } /// Initializes a new instance of . - /// The id. - /// The name. - /// The resourceType. - /// The systemData. - /// The tags. - /// The location. - /// The description of the policy. - /// The status of the policy. - /// The fact name of the policy (e.g. LabVmCount, LabVmSize, MaxVmsAllowedPerLab, etc. - /// The fact data of the policy. - /// The threshold of the policy (i.e. a number for MaxValuePolicy, and a JSON array of values for AllowedValuesPolicy). - /// The evaluator type of the policy (i.e. AllowedValuesPolicy, MaxValuePolicy). - /// The creation date of the policy. - /// The provisioning status of the resource. - /// The unique immutable identifier of a resource (Guid). - /// Keeps track of any properties unknown to the library. - internal DevTestLabPolicyData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, IDictionary tags, AzureLocation location, string description, DevTestLabPolicyStatus? status, DevTestLabPolicyFactName? factName, string factData, string threshold, DevTestLabPolicyEvaluatorType? evaluatorType, DateTimeOffset? createdOn, string provisioningState, Guid? uniqueIdentifier, IDictionary serializedAdditionalRawData) : base(id, name, resourceType, systemData, tags, 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. + /// The geo-location where the resource lives. + /// The properties of the resource. + /// The tags of the resource. + internal DevTestLabPolicyData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, IDictionary additionalBinaryDataProperties, AzureLocation location, PolicyProperties properties, IDictionary tags) : base(id, name, resourceType, systemData, tags, location) { - Description = description; - Status = status; - FactName = factName; - FactData = factData; - Threshold = threshold; - EvaluatorType = evaluatorType; - CreatedOn = createdOn; - ProvisioningState = provisioningState; - UniqueIdentifier = uniqueIdentifier; - _serializedAdditionalRawData = serializedAdditionalRawData; + _additionalBinaryDataProperties = additionalBinaryDataProperties; + Properties = properties; } - /// Initializes a new instance of for deserialization. - internal DevTestLabPolicyData() + /// The properties of the resource. + internal PolicyProperties Properties { get; set; } + + /// The description of the policy. + public string Description { + get + { + return Properties is null ? default : Properties.Description; + } + set + { + if (Properties is null) + { + Properties = new PolicyProperties(); + } + Properties.Description = value; + } } - /// The description of the policy. - public string Description { get; set; } /// The status of the policy. - public DevTestLabPolicyStatus? Status { get; set; } + public DevTestLabPolicyStatus? Status + { + get + { + return Properties is null ? default : Properties.Status; + } + set + { + if (Properties is null) + { + Properties = new PolicyProperties(); + } + Properties.Status = value.Value; + } + } + /// The fact name of the policy (e.g. LabVmCount, LabVmSize, MaxVmsAllowedPerLab, etc. - public DevTestLabPolicyFactName? FactName { get; set; } + public DevTestLabPolicyFactName? FactName + { + get + { + return Properties is null ? default : Properties.FactName; + } + set + { + if (Properties is null) + { + Properties = new PolicyProperties(); + } + Properties.FactName = value.Value; + } + } + /// The fact data of the policy. - public string FactData { get; set; } + public string FactData + { + get + { + return Properties is null ? default : Properties.FactData; + } + set + { + if (Properties is null) + { + Properties = new PolicyProperties(); + } + Properties.FactData = value; + } + } + /// The threshold of the policy (i.e. a number for MaxValuePolicy, and a JSON array of values for AllowedValuesPolicy). - public string Threshold { get; set; } + public string Threshold + { + get + { + return Properties is null ? default : Properties.Threshold; + } + set + { + if (Properties is null) + { + Properties = new PolicyProperties(); + } + Properties.Threshold = value; + } + } + /// The evaluator type of the policy (i.e. AllowedValuesPolicy, MaxValuePolicy). - public DevTestLabPolicyEvaluatorType? EvaluatorType { get; set; } + public DevTestLabPolicyEvaluatorType? EvaluatorType + { + get + { + return Properties is null ? default : Properties.EvaluatorType; + } + set + { + if (Properties is null) + { + Properties = new PolicyProperties(); + } + Properties.EvaluatorType = value.Value; + } + } + /// The creation date of the policy. - public DateTimeOffset? CreatedOn { get; } + public DateTimeOffset? CreatedOn + { + get + { + return Properties is null ? default : Properties.CreatedOn; + } + } + /// The provisioning status of the resource. - public string ProvisioningState { get; } + public string ProvisioningState + { + get + { + return Properties is null ? default : Properties.ProvisioningState; + } + } + /// The unique immutable identifier of a resource (Guid). - public Guid? UniqueIdentifier { get; } + public Guid? UniqueIdentifier + { + get + { + return Properties is null ? default : Properties.UniqueIdentifier; + } + } } } diff --git a/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/DevTestLabPolicyResource.Serialization.cs b/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/DevTestLabPolicyResource.Serialization.cs index b2c28c6dbb37..0249eec6ee37 100644 --- a/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/DevTestLabPolicyResource.Serialization.cs +++ b/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/DevTestLabPolicyResource.Serialization.cs @@ -11,19 +11,29 @@ namespace Azure.ResourceManager.DevTestLabs { + /// public partial class DevTestLabPolicyResource : IJsonModel { - private static DevTestLabPolicyData s_dataDeserializationInstance; - private static DevTestLabPolicyData DataDeserializationInstance => s_dataDeserializationInstance ??= new(); + private static IJsonModel s_dataDeserializationInstance; + private static IJsonModel DataDeserializationInstance => s_dataDeserializationInstance ??= new DevTestLabPolicyData(); + + /// 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); - DevTestLabPolicyData 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. + DevTestLabPolicyData 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, AzureResourceManagerDevTestLabsContext.Default); + /// The binary data to be processed. + /// The client options for reading and writing models. DevTestLabPolicyData IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) => ModelReaderWriter.Read(data, options, AzureResourceManagerDevTestLabsContext.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/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/DevTestLabPolicyResource.cs b/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/DevTestLabPolicyResource.cs index c5acb4b705fa..420440009283 100644 --- a/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/DevTestLabPolicyResource.cs +++ b/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/DevTestLabPolicyResource.cs @@ -7,48 +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.DevTestLabs.Models; +using Azure.ResourceManager.Resources; namespace Azure.ResourceManager.DevTestLabs { /// - /// A Class representing a DevTestLabPolicy 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 GetDevTestLabPolicyResource method. - /// Otherwise you can get one from its parent resource using the GetDevTestLabPolicy method. + /// A class representing a DevTestLabPolicy 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 GetDevTestLabPolicies method. /// public partial class DevTestLabPolicyResource : ArmResource { - /// Generate the resource identifier of a instance. - /// The subscriptionId. - /// The resourceGroupName. - /// The labName. - /// The policySetName. - /// The name. - public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string labName, string policySetName, string name) - { - var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/policysets/{policySetName}/policies/{name}"; - return new ResourceIdentifier(resourceId); - } - - private readonly ClientDiagnostics _devTestLabPolicyPoliciesClientDiagnostics; - private readonly PoliciesRestOperations _devTestLabPolicyPoliciesRestClient; + private readonly ClientDiagnostics _policiesClientDiagnostics; + private readonly Policies _policiesRestClient; private readonly DevTestLabPolicyData _data; - /// Gets the resource type for the operations. public static readonly ResourceType ResourceType = "Microsoft.DevTestLab/labs/policysets/policies"; - /// Initializes a new instance of the class for mocking. + /// Initializes a new instance of DevTestLabPolicyResource for mocking. protected DevTestLabPolicyResource() { } - /// 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 DevTestLabPolicyResource(ArmClient client, DevTestLabPolicyData data) : this(client, data.Id) @@ -57,72 +46,95 @@ internal DevTestLabPolicyResource(ArmClient client, DevTestLabPolicyData data) : _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 DevTestLabPolicyResource(ArmClient client, ResourceIdentifier id) : base(client, id) { - _devTestLabPolicyPoliciesClientDiagnostics = new ClientDiagnostics("Azure.ResourceManager.DevTestLabs", ResourceType.Namespace, Diagnostics); - TryGetApiVersion(ResourceType, out string devTestLabPolicyPoliciesApiVersion); - _devTestLabPolicyPoliciesRestClient = new PoliciesRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, devTestLabPolicyPoliciesApiVersion); -#if DEBUG - ValidateResourceId(Id); -#endif + TryGetApiVersion(ResourceType, out string devTestLabPolicyApiVersion); + _policiesClientDiagnostics = new ClientDiagnostics("Azure.ResourceManager.DevTestLabs", ResourceType.Namespace, Diagnostics); + _policiesRestClient = new Policies(_policiesClientDiagnostics, Pipeline, Endpoint, devTestLabPolicyApiVersion ?? "2018-09-15"); + 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 DevTestLabPolicyData 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 labName. + /// The policySetName. + /// The name. + public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string labName, string policySetName, string name) + { + string resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/policysets/{policySetName}/policies/{name}"; + 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 policy. /// /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/policysets/{policySetName}/policies/{name} + /// Request Path. + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/policysets/{policySetName}/policies/{name}. /// /// - /// Operation Id - /// Policies_Get + /// Operation Id. + /// Policies_Get. /// /// - /// Default Api Version - /// 2018-09-15 + /// Default Api Version. + /// 2018-09-15. /// /// - /// Resource - /// + /// Resource. + /// . /// /// /// /// Specify the $expand query. Example: 'properties($select=description)'. /// The cancellation token to use. - public virtual async Task> GetAsync(string expand = null, CancellationToken cancellationToken = default) + public virtual async Task> GetAsync(string expand = default, CancellationToken cancellationToken = default) { - using var scope = _devTestLabPolicyPoliciesClientDiagnostics.CreateScope("DevTestLabPolicyResource.Get"); + using DiagnosticScope scope = _policiesClientDiagnostics.CreateScope("DevTestLabPolicyResource.Get"); scope.Start(); try { - var response = await _devTestLabPolicyPoliciesRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, expand, cancellationToken).ConfigureAwait(false); + RequestContext context = new RequestContext + { + CancellationToken = cancellationToken + }; + HttpMessage message = _policiesRestClient.CreateGetRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, expand, context); + Response result = await Pipeline.ProcessMessageAsync(message, context).ConfigureAwait(false); + Response response = Response.FromValue(DevTestLabPolicyData.FromResponse(result), result); if (response.Value == null) + { throw new RequestFailedException(response.GetRawResponse()); + } return Response.FromValue(new DevTestLabPolicyResource(Client, response.Value), response.GetRawResponse()); } catch (Exception e) @@ -136,34 +148,42 @@ public virtual async Task> GetAsync(string ex /// Get policy. /// /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/policysets/{policySetName}/policies/{name} + /// Request Path. + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/policysets/{policySetName}/policies/{name}. /// /// - /// Operation Id - /// Policies_Get + /// Operation Id. + /// Policies_Get. /// /// - /// Default Api Version - /// 2018-09-15 + /// Default Api Version. + /// 2018-09-15. /// /// - /// Resource - /// + /// Resource. + /// . /// /// /// /// Specify the $expand query. Example: 'properties($select=description)'. /// The cancellation token to use. - public virtual Response Get(string expand = null, CancellationToken cancellationToken = default) + public virtual Response Get(string expand = default, CancellationToken cancellationToken = default) { - using var scope = _devTestLabPolicyPoliciesClientDiagnostics.CreateScope("DevTestLabPolicyResource.Get"); + using DiagnosticScope scope = _policiesClientDiagnostics.CreateScope("DevTestLabPolicyResource.Get"); scope.Start(); try { - var response = _devTestLabPolicyPoliciesRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, expand, cancellationToken); + RequestContext context = new RequestContext + { + CancellationToken = cancellationToken + }; + HttpMessage message = _policiesRestClient.CreateGetRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, expand, context); + Response result = Pipeline.ProcessMessage(message, context); + Response response = Response.FromValue(DevTestLabPolicyData.FromResponse(result), result); if (response.Value == null) + { throw new RequestFailedException(response.GetRawResponse()); + } return Response.FromValue(new DevTestLabPolicyResource(Client, response.Value), response.GetRawResponse()); } catch (Exception e) @@ -174,41 +194,49 @@ public virtual Response Get(string expand = null, Canc } /// - /// Delete policy. + /// Allows modifying tags of policies. All other properties will be ignored. /// /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/policysets/{policySetName}/policies/{name} + /// Request Path. + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/policysets/{policySetName}/policies/{name}. /// /// - /// Operation Id - /// Policies_Delete + /// Operation Id. + /// Policies_Update. /// /// - /// Default Api Version - /// 2018-09-15 + /// Default Api Version. + /// 2018-09-15. /// /// - /// Resource - /// + /// Resource. + /// . /// /// /// - /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. + /// A Policy. /// The cancellation token to use. - public virtual async Task DeleteAsync(WaitUntil waitUntil, CancellationToken cancellationToken = default) + /// is null. + public virtual async Task> UpdateAsync(DevTestLabPolicyPatch patch, CancellationToken cancellationToken = default) { - using var scope = _devTestLabPolicyPoliciesClientDiagnostics.CreateScope("DevTestLabPolicyResource.Delete"); + Argument.AssertNotNull(patch, nameof(patch)); + + using DiagnosticScope scope = _policiesClientDiagnostics.CreateScope("DevTestLabPolicyResource.Update"); scope.Start(); try { - var response = await _devTestLabPolicyPoliciesRestClient.DeleteAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, cancellationToken).ConfigureAwait(false); - var uri = _devTestLabPolicyPoliciesRestClient.CreateDeleteRequestUri(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name); - var rehydrationToken = NextLinkOperationImplementation.GetRehydrationToken(RequestMethod.Delete, uri.ToUri(), uri.ToString(), "None", null, OperationFinalStateVia.OriginalUri.ToString()); - var operation = new DevTestLabsArmOperation(response, rehydrationToken); - if (waitUntil == WaitUntil.Completed) - await operation.WaitForCompletionResponseAsync(cancellationToken).ConfigureAwait(false); - return operation; + RequestContext context = new RequestContext + { + CancellationToken = cancellationToken + }; + HttpMessage message = _policiesRestClient.CreateUpdateRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, DevTestLabPolicyPatch.ToRequestContent(patch), context); + Response result = await Pipeline.ProcessMessageAsync(message, context).ConfigureAwait(false); + Response response = Response.FromValue(DevTestLabPolicyData.FromResponse(result), result); + if (response.Value == null) + { + throw new RequestFailedException(response.GetRawResponse()); + } + return Response.FromValue(new DevTestLabPolicyResource(Client, response.Value), response.GetRawResponse()); } catch (Exception e) { @@ -218,41 +246,49 @@ public virtual async Task DeleteAsync(WaitUntil waitUntil, Cancell } /// - /// Delete policy. + /// Allows modifying tags of policies. All other properties will be ignored. /// /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/policysets/{policySetName}/policies/{name} + /// Request Path. + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/policysets/{policySetName}/policies/{name}. /// /// - /// Operation Id - /// Policies_Delete + /// Operation Id. + /// Policies_Update. /// /// - /// Default Api Version - /// 2018-09-15 + /// Default Api Version. + /// 2018-09-15. /// /// - /// Resource - /// + /// Resource. + /// . /// /// /// - /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. + /// A Policy. /// The cancellation token to use. - public virtual ArmOperation Delete(WaitUntil waitUntil, CancellationToken cancellationToken = default) + /// is null. + public virtual Response Update(DevTestLabPolicyPatch patch, CancellationToken cancellationToken = default) { - using var scope = _devTestLabPolicyPoliciesClientDiagnostics.CreateScope("DevTestLabPolicyResource.Delete"); + Argument.AssertNotNull(patch, nameof(patch)); + + using DiagnosticScope scope = _policiesClientDiagnostics.CreateScope("DevTestLabPolicyResource.Update"); scope.Start(); try { - var response = _devTestLabPolicyPoliciesRestClient.Delete(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, cancellationToken); - var uri = _devTestLabPolicyPoliciesRestClient.CreateDeleteRequestUri(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name); - var rehydrationToken = NextLinkOperationImplementation.GetRehydrationToken(RequestMethod.Delete, uri.ToUri(), uri.ToString(), "None", null, OperationFinalStateVia.OriginalUri.ToString()); - var operation = new DevTestLabsArmOperation(response, rehydrationToken); - if (waitUntil == WaitUntil.Completed) - operation.WaitForCompletionResponse(cancellationToken); - return operation; + RequestContext context = new RequestContext + { + CancellationToken = cancellationToken + }; + HttpMessage message = _policiesRestClient.CreateUpdateRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, DevTestLabPolicyPatch.ToRequestContent(patch), context); + Response result = Pipeline.ProcessMessage(message, context); + Response response = Response.FromValue(DevTestLabPolicyData.FromResponse(result), result); + if (response.Value == null) + { + throw new RequestFailedException(response.GetRawResponse()); + } + return Response.FromValue(new DevTestLabPolicyResource(Client, response.Value), response.GetRawResponse()); } catch (Exception e) { @@ -262,39 +298,48 @@ public virtual ArmOperation Delete(WaitUntil waitUntil, CancellationToken cancel } /// - /// Allows modifying tags of policies. All other properties will be ignored. + /// Delete policy. /// /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/policysets/{policySetName}/policies/{name} + /// Request Path. + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/policysets/{policySetName}/policies/{name}. /// /// - /// Operation Id - /// Policies_Update + /// Operation Id. + /// Policies_Delete. /// /// - /// Default Api Version - /// 2018-09-15 + /// Default Api Version. + /// 2018-09-15. /// /// - /// Resource - /// + /// Resource. + /// . /// /// /// - /// A Policy. + /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. /// The cancellation token to use. - /// is null. - public virtual async Task> UpdateAsync(DevTestLabPolicyPatch patch, CancellationToken cancellationToken = default) + public virtual async Task DeleteAsync(WaitUntil waitUntil, CancellationToken cancellationToken = default) { - Argument.AssertNotNull(patch, nameof(patch)); - - using var scope = _devTestLabPolicyPoliciesClientDiagnostics.CreateScope("DevTestLabPolicyResource.Update"); + using DiagnosticScope scope = _policiesClientDiagnostics.CreateScope("DevTestLabPolicyResource.Delete"); scope.Start(); try { - var response = await _devTestLabPolicyPoliciesRestClient.UpdateAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, patch, cancellationToken).ConfigureAwait(false); - return Response.FromValue(new DevTestLabPolicyResource(Client, response.Value), response.GetRawResponse()); + RequestContext context = new RequestContext + { + CancellationToken = cancellationToken + }; + HttpMessage message = _policiesRestClient.CreateDeleteRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, context); + Response response = await Pipeline.ProcessMessageAsync(message, context).ConfigureAwait(false); + RequestUriBuilder uri = message.Request.Uri; + RehydrationToken rehydrationToken = NextLinkOperationImplementation.GetRehydrationToken(RequestMethod.Delete, uri.ToUri(), uri.ToString(), "None", null, OperationFinalStateVia.OriginalUri.ToString()); + DevTestLabsArmOperation operation = new DevTestLabsArmOperation(response, rehydrationToken); + if (waitUntil == WaitUntil.Completed) + { + await operation.WaitForCompletionResponseAsync(cancellationToken).ConfigureAwait(false); + } + return operation; } catch (Exception e) { @@ -304,39 +349,48 @@ public virtual async Task> UpdateAsync(DevTes } /// - /// Allows modifying tags of policies. All other properties will be ignored. + /// Delete policy. /// /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/policysets/{policySetName}/policies/{name} + /// Request Path. + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/policysets/{policySetName}/policies/{name}. /// /// - /// Operation Id - /// Policies_Update + /// Operation Id. + /// Policies_Delete. /// /// - /// Default Api Version - /// 2018-09-15 + /// Default Api Version. + /// 2018-09-15. /// /// - /// Resource - /// + /// Resource. + /// . /// /// /// - /// A Policy. + /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. /// The cancellation token to use. - /// is null. - public virtual Response Update(DevTestLabPolicyPatch patch, CancellationToken cancellationToken = default) + public virtual ArmOperation Delete(WaitUntil waitUntil, CancellationToken cancellationToken = default) { - Argument.AssertNotNull(patch, nameof(patch)); - - using var scope = _devTestLabPolicyPoliciesClientDiagnostics.CreateScope("DevTestLabPolicyResource.Update"); + using DiagnosticScope scope = _policiesClientDiagnostics.CreateScope("DevTestLabPolicyResource.Delete"); scope.Start(); try { - var response = _devTestLabPolicyPoliciesRestClient.Update(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, patch, cancellationToken); - return Response.FromValue(new DevTestLabPolicyResource(Client, response.Value), response.GetRawResponse()); + RequestContext context = new RequestContext + { + CancellationToken = cancellationToken + }; + HttpMessage message = _policiesRestClient.CreateDeleteRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, context); + Response response = Pipeline.ProcessMessage(message, context); + RequestUriBuilder uri = message.Request.Uri; + RehydrationToken rehydrationToken = NextLinkOperationImplementation.GetRehydrationToken(RequestMethod.Delete, uri.ToUri(), uri.ToString(), "None", null, OperationFinalStateVia.OriginalUri.ToString()); + DevTestLabsArmOperation operation = new DevTestLabsArmOperation(response, rehydrationToken); + if (waitUntil == WaitUntil.Completed) + { + operation.WaitForCompletionResponse(cancellationToken); + } + return operation; } catch (Exception e) { @@ -345,27 +399,7 @@ public virtual Response Update(DevTestLabPolicyPatch p } } - /// - /// Add a tag to the current resource. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/policysets/{policySetName}/policies/{name} - /// - /// - /// Operation Id - /// Policies_Get - /// - /// - /// Default Api Version - /// 2018-09-15 - /// - /// - /// Resource - /// - /// - /// - /// + /// Add a tag to the current resource. /// The key for the tag. /// The value for the tag. /// The cancellation token to use. @@ -375,29 +409,35 @@ public virtual async Task> AddTagAsync(string Argument.AssertNotNull(key, nameof(key)); Argument.AssertNotNull(value, nameof(value)); - using var scope = _devTestLabPolicyPoliciesClientDiagnostics.CreateScope("DevTestLabPolicyResource.AddTag"); + using DiagnosticScope scope = _policiesClientDiagnostics.CreateScope("DevTestLabPolicyResource.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 _devTestLabPolicyPoliciesRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, null, cancellationToken).ConfigureAwait(false); - return Response.FromValue(new DevTestLabPolicyResource(Client, originalResponse.Value), originalResponse.GetRawResponse()); + await GetTagResource().CreateOrUpdateAsync(WaitUntil.Completed, originalTags.Value.Data, cancellationToken).ConfigureAwait(false); + RequestContext context = new RequestContext + { + CancellationToken = cancellationToken + }; + HttpMessage message = _policiesRestClient.CreateGetRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, default, context); + Response result = await Pipeline.ProcessMessageAsync(message, context).ConfigureAwait(false); + Response response = Response.FromValue(DevTestLabPolicyData.FromResponse(result), result); + return Response.FromValue(new DevTestLabPolicyResource(Client, response.Value), response.GetRawResponse()); } else { - var current = (await GetAsync(cancellationToken: cancellationToken).ConfigureAwait(false)).Value.Data; - var patch = new DevTestLabPolicyPatch(); - foreach (var tag in current.Tags) + DevTestLabPolicyData current = (await GetAsync(cancellationToken: cancellationToken).ConfigureAwait(false)).Value.Data; + DevTestLabPolicyPatch patch = new DevTestLabPolicyPatch(); + 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) @@ -407,27 +447,7 @@ public virtual async Task> AddTagAsync(string } } - /// - /// Add a tag to the current resource. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/policysets/{policySetName}/policies/{name} - /// - /// - /// Operation Id - /// Policies_Get - /// - /// - /// Default Api Version - /// 2018-09-15 - /// - /// - /// 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 +457,35 @@ public virtual Response AddTag(string key, string valu Argument.AssertNotNull(key, nameof(key)); Argument.AssertNotNull(value, nameof(value)); - using var scope = _devTestLabPolicyPoliciesClientDiagnostics.CreateScope("DevTestLabPolicyResource.AddTag"); + using DiagnosticScope scope = _policiesClientDiagnostics.CreateScope("DevTestLabPolicyResource.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 = _devTestLabPolicyPoliciesRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, null, cancellationToken); - return Response.FromValue(new DevTestLabPolicyResource(Client, originalResponse.Value), originalResponse.GetRawResponse()); + GetTagResource().CreateOrUpdate(WaitUntil.Completed, originalTags.Value.Data, cancellationToken); + RequestContext context = new RequestContext + { + CancellationToken = cancellationToken + }; + HttpMessage message = _policiesRestClient.CreateGetRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, default, context); + Response result = Pipeline.ProcessMessage(message, context); + Response response = Response.FromValue(DevTestLabPolicyData.FromResponse(result), result); + return Response.FromValue(new DevTestLabPolicyResource(Client, response.Value), response.GetRawResponse()); } else { - var current = Get(cancellationToken: cancellationToken).Value.Data; - var patch = new DevTestLabPolicyPatch(); - foreach (var tag in current.Tags) + DevTestLabPolicyData current = Get(cancellationToken: cancellationToken).Value.Data; + DevTestLabPolicyPatch patch = new DevTestLabPolicyPatch(); + 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) @@ -469,54 +495,40 @@ public virtual Response AddTag(string key, string valu } } - /// - /// Replace the tags on the resource with the given set. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/policysets/{policySetName}/policies/{name} - /// - /// - /// Operation Id - /// Policies_Get - /// - /// - /// Default Api Version - /// 2018-09-15 - /// - /// - /// 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 = _devTestLabPolicyPoliciesClientDiagnostics.CreateScope("DevTestLabPolicyResource.SetTags"); + using DiagnosticScope scope = _policiesClientDiagnostics.CreateScope("DevTestLabPolicyResource.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 _devTestLabPolicyPoliciesRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, null, cancellationToken).ConfigureAwait(false); - return Response.FromValue(new DevTestLabPolicyResource(Client, originalResponse.Value), originalResponse.GetRawResponse()); + await GetTagResource().CreateOrUpdateAsync(WaitUntil.Completed, originalTags.Value.Data, cancellationToken).ConfigureAwait(false); + RequestContext context = new RequestContext + { + CancellationToken = cancellationToken + }; + HttpMessage message = _policiesRestClient.CreateGetRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, default, context); + Response result = await Pipeline.ProcessMessageAsync(message, context).ConfigureAwait(false); + Response response = Response.FromValue(DevTestLabPolicyData.FromResponse(result), result); + return Response.FromValue(new DevTestLabPolicyResource(Client, response.Value), response.GetRawResponse()); } else { - var current = (await GetAsync(cancellationToken: cancellationToken).ConfigureAwait(false)).Value.Data; - var patch = new DevTestLabPolicyPatch(); + DevTestLabPolicyData current = (await GetAsync(cancellationToken: cancellationToken).ConfigureAwait(false)).Value.Data; + DevTestLabPolicyPatch patch = new DevTestLabPolicyPatch(); 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) @@ -526,54 +538,40 @@ public virtual async Task> SetTagsAsync(IDict } } - /// - /// Replace the tags on the resource with the given set. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/policysets/{policySetName}/policies/{name} - /// - /// - /// Operation Id - /// Policies_Get - /// - /// - /// Default Api Version - /// 2018-09-15 - /// - /// - /// 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 = _devTestLabPolicyPoliciesClientDiagnostics.CreateScope("DevTestLabPolicyResource.SetTags"); + using DiagnosticScope scope = _policiesClientDiagnostics.CreateScope("DevTestLabPolicyResource.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 = _devTestLabPolicyPoliciesRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, null, cancellationToken); - return Response.FromValue(new DevTestLabPolicyResource(Client, originalResponse.Value), originalResponse.GetRawResponse()); + GetTagResource().CreateOrUpdate(WaitUntil.Completed, originalTags.Value.Data, cancellationToken); + RequestContext context = new RequestContext + { + CancellationToken = cancellationToken + }; + HttpMessage message = _policiesRestClient.CreateGetRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, default, context); + Response result = Pipeline.ProcessMessage(message, context); + Response response = Response.FromValue(DevTestLabPolicyData.FromResponse(result), result); + return Response.FromValue(new DevTestLabPolicyResource(Client, response.Value), response.GetRawResponse()); } else { - var current = Get(cancellationToken: cancellationToken).Value.Data; - var patch = new DevTestLabPolicyPatch(); + DevTestLabPolicyData current = Get(cancellationToken: cancellationToken).Value.Data; + DevTestLabPolicyPatch patch = new DevTestLabPolicyPatch(); 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) @@ -583,27 +581,7 @@ public virtual Response SetTags(IDictionary - /// Removes a tag by key from the resource. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/policysets/{policySetName}/policies/{name} - /// - /// - /// Operation Id - /// Policies_Get - /// - /// - /// Default Api Version - /// 2018-09-15 - /// - /// - /// Resource - /// - /// - /// - /// + /// Removes a tag by key from the resource. /// The key for the tag. /// The cancellation token to use. /// is null. @@ -611,29 +589,35 @@ public virtual async Task> RemoveTagAsync(str { Argument.AssertNotNull(key, nameof(key)); - using var scope = _devTestLabPolicyPoliciesClientDiagnostics.CreateScope("DevTestLabPolicyResource.RemoveTag"); + using DiagnosticScope scope = _policiesClientDiagnostics.CreateScope("DevTestLabPolicyResource.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 _devTestLabPolicyPoliciesRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, null, cancellationToken).ConfigureAwait(false); - return Response.FromValue(new DevTestLabPolicyResource(Client, originalResponse.Value), originalResponse.GetRawResponse()); + await GetTagResource().CreateOrUpdateAsync(WaitUntil.Completed, originalTags.Value.Data, cancellationToken).ConfigureAwait(false); + RequestContext context = new RequestContext + { + CancellationToken = cancellationToken + }; + HttpMessage message = _policiesRestClient.CreateGetRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, default, context); + Response result = await Pipeline.ProcessMessageAsync(message, context).ConfigureAwait(false); + Response response = Response.FromValue(DevTestLabPolicyData.FromResponse(result), result); + return Response.FromValue(new DevTestLabPolicyResource(Client, response.Value), response.GetRawResponse()); } else { - var current = (await GetAsync(cancellationToken: cancellationToken).ConfigureAwait(false)).Value.Data; - var patch = new DevTestLabPolicyPatch(); - foreach (var tag in current.Tags) + DevTestLabPolicyData current = (await GetAsync(cancellationToken: cancellationToken).ConfigureAwait(false)).Value.Data; + DevTestLabPolicyPatch patch = new DevTestLabPolicyPatch(); + 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) @@ -643,27 +627,7 @@ public virtual async Task> RemoveTagAsync(str } } - /// - /// Removes a tag by key from the resource. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/policysets/{policySetName}/policies/{name} - /// - /// - /// Operation Id - /// Policies_Get - /// - /// - /// Default Api Version - /// 2018-09-15 - /// - /// - /// Resource - /// - /// - /// - /// + /// Removes a tag by key from the resource. /// The key for the tag. /// The cancellation token to use. /// is null. @@ -671,29 +635,35 @@ public virtual Response RemoveTag(string key, Cancella { Argument.AssertNotNull(key, nameof(key)); - using var scope = _devTestLabPolicyPoliciesClientDiagnostics.CreateScope("DevTestLabPolicyResource.RemoveTag"); + using DiagnosticScope scope = _policiesClientDiagnostics.CreateScope("DevTestLabPolicyResource.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 = _devTestLabPolicyPoliciesRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, null, cancellationToken); - return Response.FromValue(new DevTestLabPolicyResource(Client, originalResponse.Value), originalResponse.GetRawResponse()); + GetTagResource().CreateOrUpdate(WaitUntil.Completed, originalTags.Value.Data, cancellationToken); + RequestContext context = new RequestContext + { + CancellationToken = cancellationToken + }; + HttpMessage message = _policiesRestClient.CreateGetRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, default, context); + Response result = Pipeline.ProcessMessage(message, context); + Response response = Response.FromValue(DevTestLabPolicyData.FromResponse(result), result); + return Response.FromValue(new DevTestLabPolicyResource(Client, response.Value), response.GetRawResponse()); } else { - var current = Get(cancellationToken: cancellationToken).Value.Data; - var patch = new DevTestLabPolicyPatch(); - foreach (var tag in current.Tags) + DevTestLabPolicyData current = Get(cancellationToken: cancellationToken).Value.Data; + DevTestLabPolicyPatch patch = new DevTestLabPolicyPatch(); + 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) diff --git a/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/DevTestLabResource.Serialization.cs b/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/DevTestLabResource.Serialization.cs index c85a337f7510..520fa07ad18e 100644 --- a/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/DevTestLabResource.Serialization.cs +++ b/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/DevTestLabResource.Serialization.cs @@ -8,22 +8,33 @@ using System; using System.ClientModel.Primitives; using System.Text.Json; +using Azure.ResourceManager; namespace Azure.ResourceManager.DevTestLabs { - public partial class DevTestLabResource : IJsonModel + /// + public partial class DevTestLabResource : ArmResource, IJsonModel { - private static DevTestLabData s_dataDeserializationInstance; - private static DevTestLabData DataDeserializationInstance => s_dataDeserializationInstance ??= new(); + private static IJsonModel s_dataDeserializationInstance; + private static IJsonModel DataDeserializationInstance => s_dataDeserializationInstance ??= new DevTestLabData(); + + /// 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); - DevTestLabData 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. + DevTestLabData 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, AzureResourceManagerDevTestLabsContext.Default); + /// The binary data to be processed. + /// The client options for reading and writing models. DevTestLabData IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) => ModelReaderWriter.Read(data, options, AzureResourceManagerDevTestLabsContext.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/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/DevTestLabResource.cs b/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/DevTestLabResource.cs index 3b8c628aba44..e98ec8f55d41 100644 --- a/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/DevTestLabResource.cs +++ b/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/DevTestLabResource.cs @@ -6,56 +6,42 @@ #nullable disable using System; -using System.ClientModel.Primitives; using System.Collections.Generic; -using System.Globalization; -using System.Text; +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.DevTestLabs.Models; using Azure.ResourceManager.Resources; -using Azure.ResourceManager.Resources.Models; namespace Azure.ResourceManager.DevTestLabs { /// - /// A Class representing a DevTestLab 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 GetDevTestLabResource method. - /// Otherwise you can get one from its parent resource using the GetDevTestLab method. + /// A class representing a DevTestLab 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 GetDevTestLabs method. /// public partial class DevTestLabResource : ArmResource { - /// Generate the resource identifier of a instance. - /// The subscriptionId. - /// The resourceGroupName. - /// The name. - public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string name) - { - var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{name}"; - return new ResourceIdentifier(resourceId); - } - - private readonly ClientDiagnostics _devTestLabLabsClientDiagnostics; - private readonly LabsRestOperations _devTestLabLabsRestClient; + private readonly ClientDiagnostics _labsClientDiagnostics; + private readonly Labs _labsRestClient; private readonly ClientDiagnostics _galleryImagesClientDiagnostics; - private readonly GalleryImagesRestOperations _galleryImagesRestClient; + private readonly GalleryImages _galleryImagesRestClient; private readonly ClientDiagnostics _policySetsClientDiagnostics; - private readonly PolicySetsRestOperations _policySetsRestClient; + private readonly PolicySets _policySetsRestClient; private readonly DevTestLabData _data; - /// Gets the resource type for the operations. public static readonly ResourceType ResourceType = "Microsoft.DevTestLab/labs"; - /// Initializes a new instance of the class for mocking. + /// Initializes a new instance of DevTestLabResource for mocking. protected DevTestLabResource() { } - /// 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 DevTestLabResource(ArmClient client, DevTestLabData data) : this(client, data.Id) @@ -64,861 +50,1078 @@ internal DevTestLabResource(ArmClient client, DevTestLabData data) : this(client _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 DevTestLabResource(ArmClient client, ResourceIdentifier id) : base(client, id) { - _devTestLabLabsClientDiagnostics = new ClientDiagnostics("Azure.ResourceManager.DevTestLabs", ResourceType.Namespace, Diagnostics); - TryGetApiVersion(ResourceType, out string devTestLabLabsApiVersion); - _devTestLabLabsRestClient = new LabsRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, devTestLabLabsApiVersion); - _galleryImagesClientDiagnostics = new ClientDiagnostics("Azure.ResourceManager.DevTestLabs", ProviderConstants.DefaultProviderNamespace, Diagnostics); - _galleryImagesRestClient = new GalleryImagesRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint); - _policySetsClientDiagnostics = new ClientDiagnostics("Azure.ResourceManager.DevTestLabs", ProviderConstants.DefaultProviderNamespace, Diagnostics); - _policySetsRestClient = new PolicySetsRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint); -#if DEBUG - ValidateResourceId(Id); -#endif + TryGetApiVersion(ResourceType, out string devTestLabApiVersion); + _labsClientDiagnostics = new ClientDiagnostics("Azure.ResourceManager.DevTestLabs", ResourceType.Namespace, Diagnostics); + _labsRestClient = new Labs(_labsClientDiagnostics, Pipeline, Endpoint, devTestLabApiVersion ?? "2018-09-15"); + _galleryImagesClientDiagnostics = new ClientDiagnostics("Azure.ResourceManager.DevTestLabs", ResourceType.Namespace, Diagnostics); + _galleryImagesRestClient = new GalleryImages(_galleryImagesClientDiagnostics, Pipeline, Endpoint, devTestLabApiVersion ?? "2018-09-15"); + _policySetsClientDiagnostics = new ClientDiagnostics("Azure.ResourceManager.DevTestLabs", ResourceType.Namespace, Diagnostics); + _policySetsRestClient = new PolicySets(_policySetsClientDiagnostics, Pipeline, Endpoint, devTestLabApiVersion ?? "2018-09-15"); + 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 DevTestLabData 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) + /// Generate the resource identifier for this resource. + /// The subscriptionId. + /// The resourceGroupName. + /// The name. + public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string name) { - if (id.ResourceType != ResourceType) - throw new ArgumentException(string.Format(CultureInfo.CurrentCulture, "Invalid resource type {0} expected {1}", id.ResourceType, ResourceType), nameof(id)); + string resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{name}"; + return new ResourceIdentifier(resourceId); } - /// Gets a collection of DevTestLabScheduleResources in the DevTestLab. - /// An object representing collection of DevTestLabScheduleResources and their operations over a DevTestLabScheduleResource. - public virtual DevTestLabScheduleCollection GetDevTestLabSchedules() + /// + [Conditional("DEBUG")] + internal static void ValidateResourceId(ResourceIdentifier id) { - return GetCachedClient(client => new DevTestLabScheduleCollection(client, Id)); + if (id.ResourceType != ResourceType) + { + throw new ArgumentException(string.Format("Invalid resource type {0} expected {1}", id.ResourceType, ResourceType), id); + } } /// - /// Get schedule. + /// Get lab. /// /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/schedules/{name} + /// Request Path. + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{name}. /// /// - /// Operation Id - /// Schedules_Get + /// Operation Id. + /// Labs_Get. /// /// - /// Default Api Version - /// 2018-09-15 + /// Default Api Version. + /// 2018-09-15. /// /// - /// Resource - /// + /// Resource. + /// . /// /// /// - /// The name of the schedule. - /// Specify the $expand query. Example: 'properties($select=status)'. + /// Specify the $expand query. Example: 'properties($select=defaultStorageAccount)'. /// The cancellation token to use. - /// is null. - /// is an empty string, and was expected to be non-empty. - [ForwardsClientCalls] - public virtual async Task> GetDevTestLabScheduleAsync(string name, string expand = null, CancellationToken cancellationToken = default) + public virtual async Task> GetAsync(string expand = default, CancellationToken cancellationToken = default) { - return await GetDevTestLabSchedules().GetAsync(name, expand, cancellationToken).ConfigureAwait(false); + using DiagnosticScope scope = _labsClientDiagnostics.CreateScope("DevTestLabResource.Get"); + scope.Start(); + try + { + RequestContext context = new RequestContext + { + CancellationToken = cancellationToken + }; + HttpMessage message = _labsRestClient.CreateGetRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, expand, context); + Response result = await Pipeline.ProcessMessageAsync(message, context).ConfigureAwait(false); + Response response = Response.FromValue(DevTestLabData.FromResponse(result), result); + if (response.Value == null) + { + throw new RequestFailedException(response.GetRawResponse()); + } + return Response.FromValue(new DevTestLabResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } } /// - /// Get schedule. + /// Get lab. /// /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/schedules/{name} + /// Request Path. + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{name}. /// /// - /// Operation Id - /// Schedules_Get + /// Operation Id. + /// Labs_Get. /// /// - /// Default Api Version - /// 2018-09-15 + /// Default Api Version. + /// 2018-09-15. /// /// - /// Resource - /// + /// Resource. + /// . /// /// /// - /// The name of the schedule. - /// Specify the $expand query. Example: 'properties($select=status)'. + /// Specify the $expand query. Example: 'properties($select=defaultStorageAccount)'. /// The cancellation token to use. - /// is null. - /// is an empty string, and was expected to be non-empty. - [ForwardsClientCalls] - public virtual Response GetDevTestLabSchedule(string name, string expand = null, CancellationToken cancellationToken = default) - { - return GetDevTestLabSchedules().Get(name, expand, cancellationToken); - } - - /// Gets a collection of DevTestLabArtifactSourceResources in the DevTestLab. - /// An object representing collection of DevTestLabArtifactSourceResources and their operations over a DevTestLabArtifactSourceResource. - public virtual DevTestLabArtifactSourceCollection GetDevTestLabArtifactSources() + public virtual Response Get(string expand = default, CancellationToken cancellationToken = default) { - return GetCachedClient(client => new DevTestLabArtifactSourceCollection(client, Id)); + using DiagnosticScope scope = _labsClientDiagnostics.CreateScope("DevTestLabResource.Get"); + scope.Start(); + try + { + RequestContext context = new RequestContext + { + CancellationToken = cancellationToken + }; + HttpMessage message = _labsRestClient.CreateGetRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, expand, context); + Response result = Pipeline.ProcessMessage(message, context); + Response response = Response.FromValue(DevTestLabData.FromResponse(result), result); + if (response.Value == null) + { + throw new RequestFailedException(response.GetRawResponse()); + } + return Response.FromValue(new DevTestLabResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } } /// - /// Get artifact source. + /// Allows modifying tags of labs. All other properties will be ignored. /// /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/artifactsources/{name} + /// Request Path. + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{name}. /// /// - /// Operation Id - /// ArtifactSources_Get + /// Operation Id. + /// Labs_Update. /// /// - /// Default Api Version - /// 2018-09-15 + /// Default Api Version. + /// 2018-09-15. /// /// - /// Resource - /// + /// Resource. + /// . /// /// /// - /// The name of the artifact source. - /// Specify the $expand query. Example: 'properties($select=displayName)'. + /// A lab. /// The cancellation token to use. - /// is null. - /// is an empty string, and was expected to be non-empty. - [ForwardsClientCalls] - public virtual async Task> GetDevTestLabArtifactSourceAsync(string name, string expand = null, CancellationToken cancellationToken = default) + /// is null. + public virtual async Task> UpdateAsync(DevTestLabPatch patch, CancellationToken cancellationToken = default) { - return await GetDevTestLabArtifactSources().GetAsync(name, expand, cancellationToken).ConfigureAwait(false); + Argument.AssertNotNull(patch, nameof(patch)); + + using DiagnosticScope scope = _labsClientDiagnostics.CreateScope("DevTestLabResource.Update"); + scope.Start(); + try + { + RequestContext context = new RequestContext + { + CancellationToken = cancellationToken + }; + HttpMessage message = _labsRestClient.CreateUpdateRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, DevTestLabPatch.ToRequestContent(patch), context); + Response result = await Pipeline.ProcessMessageAsync(message, context).ConfigureAwait(false); + Response response = Response.FromValue(DevTestLabData.FromResponse(result), result); + if (response.Value == null) + { + throw new RequestFailedException(response.GetRawResponse()); + } + return Response.FromValue(new DevTestLabResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } } /// - /// Get artifact source. + /// Allows modifying tags of labs. All other properties will be ignored. /// /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/artifactsources/{name} + /// Request Path. + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{name}. /// /// - /// Operation Id - /// ArtifactSources_Get + /// Operation Id. + /// Labs_Update. /// /// - /// Default Api Version - /// 2018-09-15 + /// Default Api Version. + /// 2018-09-15. /// /// - /// Resource - /// + /// Resource. + /// . /// /// /// - /// The name of the artifact source. - /// Specify the $expand query. Example: 'properties($select=displayName)'. + /// A lab. /// The cancellation token to use. - /// is null. - /// is an empty string, and was expected to be non-empty. - [ForwardsClientCalls] - public virtual Response GetDevTestLabArtifactSource(string name, string expand = null, CancellationToken cancellationToken = default) + /// is null. + public virtual Response Update(DevTestLabPatch patch, CancellationToken cancellationToken = default) { - return GetDevTestLabArtifactSources().Get(name, expand, cancellationToken); - } + Argument.AssertNotNull(patch, nameof(patch)); - /// Gets a collection of DevTestLabCostResources in the DevTestLab. - /// An object representing collection of DevTestLabCostResources and their operations over a DevTestLabCostResource. - public virtual DevTestLabCostCollection GetDevTestLabCosts() - { - return GetCachedClient(client => new DevTestLabCostCollection(client, Id)); + using DiagnosticScope scope = _labsClientDiagnostics.CreateScope("DevTestLabResource.Update"); + scope.Start(); + try + { + RequestContext context = new RequestContext + { + CancellationToken = cancellationToken + }; + HttpMessage message = _labsRestClient.CreateUpdateRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, DevTestLabPatch.ToRequestContent(patch), context); + Response result = Pipeline.ProcessMessage(message, context); + Response response = Response.FromValue(DevTestLabData.FromResponse(result), result); + if (response.Value == null) + { + throw new RequestFailedException(response.GetRawResponse()); + } + return Response.FromValue(new DevTestLabResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } } /// - /// Get cost. + /// Delete lab. This operation can take a while to complete. /// /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/costs/{name} + /// Request Path. + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{name}. /// /// - /// Operation Id - /// Costs_Get + /// Operation Id. + /// Labs_Delete. /// /// - /// Default Api Version - /// 2018-09-15 + /// Default Api Version. + /// 2018-09-15. /// /// - /// Resource - /// + /// Resource. + /// . /// /// /// - /// The name of the cost. - /// Specify the $expand query. Example: 'properties($expand=labCostDetails)'. + /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. /// The cancellation token to use. - /// is null. - /// is an empty string, and was expected to be non-empty. - [ForwardsClientCalls] - public virtual async Task> GetDevTestLabCostAsync(string name, string expand = null, CancellationToken cancellationToken = default) + public virtual async Task DeleteAsync(WaitUntil waitUntil, CancellationToken cancellationToken = default) { - return await GetDevTestLabCosts().GetAsync(name, expand, cancellationToken).ConfigureAwait(false); + using DiagnosticScope scope = _labsClientDiagnostics.CreateScope("DevTestLabResource.Delete"); + scope.Start(); + try + { + RequestContext context = new RequestContext + { + CancellationToken = cancellationToken + }; + HttpMessage message = _labsRestClient.CreateDeleteRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, context); + Response response = await Pipeline.ProcessMessageAsync(message, context).ConfigureAwait(false); + DevTestLabsArmOperation operation = new DevTestLabsArmOperation(_labsClientDiagnostics, Pipeline, message.Request, response, OperationFinalStateVia.Location); + if (waitUntil == WaitUntil.Completed) + { + await operation.WaitForCompletionResponseAsync(cancellationToken).ConfigureAwait(false); + } + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } } /// - /// Get cost. + /// Delete lab. This operation can take a while to complete. /// /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/costs/{name} + /// Request Path. + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{name}. /// /// - /// Operation Id - /// Costs_Get + /// Operation Id. + /// Labs_Delete. /// /// - /// Default Api Version - /// 2018-09-15 + /// Default Api Version. + /// 2018-09-15. /// /// - /// Resource - /// + /// Resource. + /// . /// /// /// - /// The name of the cost. - /// Specify the $expand query. Example: 'properties($expand=labCostDetails)'. + /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. /// The cancellation token to use. - /// is null. - /// is an empty string, and was expected to be non-empty. - [ForwardsClientCalls] - public virtual Response GetDevTestLabCost(string name, string expand = null, CancellationToken cancellationToken = default) - { - return GetDevTestLabCosts().Get(name, expand, cancellationToken); - } - - /// Gets a collection of DevTestLabCustomImageResources in the DevTestLab. - /// An object representing collection of DevTestLabCustomImageResources and their operations over a DevTestLabCustomImageResource. - public virtual DevTestLabCustomImageCollection GetDevTestLabCustomImages() + public virtual ArmOperation Delete(WaitUntil waitUntil, CancellationToken cancellationToken = default) { - return GetCachedClient(client => new DevTestLabCustomImageCollection(client, Id)); + using DiagnosticScope scope = _labsClientDiagnostics.CreateScope("DevTestLabResource.Delete"); + scope.Start(); + try + { + RequestContext context = new RequestContext + { + CancellationToken = cancellationToken + }; + HttpMessage message = _labsRestClient.CreateDeleteRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, context); + Response response = Pipeline.ProcessMessage(message, context); + DevTestLabsArmOperation operation = new DevTestLabsArmOperation(_labsClientDiagnostics, Pipeline, message.Request, response, OperationFinalStateVia.Location); + if (waitUntil == WaitUntil.Completed) + { + operation.WaitForCompletionResponse(cancellationToken); + } + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } } /// - /// Get custom image. + /// List gallery images in a given lab. /// /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/customimages/{name} + /// Request Path. + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/galleryimages. /// /// - /// Operation Id - /// CustomImages_Get + /// Operation Id. + /// GalleryImages_List. /// /// - /// Default Api Version - /// 2018-09-15 + /// Default Api Version. + /// 2018-09-15. /// /// - /// Resource - /// + /// Resource. + /// . /// /// /// - /// The name of the custom image. - /// Specify the $expand query. Example: 'properties($select=vm)'. + /// Specify the $expand query. Example: 'properties($select=displayName)'. + /// The filter to apply to the operation. Example: '$filter=contains(name,'myName'). + /// The maximum number of resources to return from the operation. Example: '$top=10'. + /// The ordering expression for the results, using OData notation. Example: '$orderby=name desc'. /// The cancellation token to use. - /// is null. - /// is an empty string, and was expected to be non-empty. - [ForwardsClientCalls] - public virtual async Task> GetDevTestLabCustomImageAsync(string name, string expand = null, CancellationToken cancellationToken = default) + /// A collection of that may take multiple service requests to iterate over. + public virtual AsyncPageable GetGalleryImagesAsync(string expand = default, string filter = default, int? top = default, string @orderby = default, CancellationToken cancellationToken = default) { - return await GetDevTestLabCustomImages().GetAsync(name, expand, cancellationToken).ConfigureAwait(false); + RequestContext context = new RequestContext + { + CancellationToken = cancellationToken + }; + return new GalleryImagesGetGalleryImagesAsyncCollectionResultOfT( + _galleryImagesRestClient, + Id.SubscriptionId, + Id.ResourceGroupName, + Id.Name, + expand, + filter, + top, + @orderby, + context); } /// - /// Get custom image. + /// List gallery images in a given lab. /// /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/customimages/{name} + /// Request Path. + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/galleryimages. /// /// - /// Operation Id - /// CustomImages_Get + /// Operation Id. + /// GalleryImages_List. /// /// - /// Default Api Version - /// 2018-09-15 + /// Default Api Version. + /// 2018-09-15. /// /// - /// Resource - /// + /// Resource. + /// . /// /// /// - /// The name of the custom image. - /// Specify the $expand query. Example: 'properties($select=vm)'. + /// Specify the $expand query. Example: 'properties($select=displayName)'. + /// The filter to apply to the operation. Example: '$filter=contains(name,'myName'). + /// The maximum number of resources to return from the operation. Example: '$top=10'. + /// The ordering expression for the results, using OData notation. Example: '$orderby=name desc'. /// The cancellation token to use. - /// is null. - /// is an empty string, and was expected to be non-empty. - [ForwardsClientCalls] - public virtual Response GetDevTestLabCustomImage(string name, string expand = null, CancellationToken cancellationToken = default) - { - return GetDevTestLabCustomImages().Get(name, expand, cancellationToken); - } - - /// Gets a collection of DevTestLabFormulaResources in the DevTestLab. - /// An object representing collection of DevTestLabFormulaResources and their operations over a DevTestLabFormulaResource. - public virtual DevTestLabFormulaCollection GetDevTestLabFormulas() + /// A collection of that may take multiple service requests to iterate over. + public virtual Pageable GetGalleryImages(string expand = default, string filter = default, int? top = default, string @orderby = default, CancellationToken cancellationToken = default) { - return GetCachedClient(client => new DevTestLabFormulaCollection(client, Id)); + RequestContext context = new RequestContext + { + CancellationToken = cancellationToken + }; + return new GalleryImagesGetGalleryImagesCollectionResultOfT( + _galleryImagesRestClient, + Id.SubscriptionId, + Id.ResourceGroupName, + Id.Name, + expand, + filter, + top, + @orderby, + context); } /// - /// Get formula. + /// Claim a random claimable virtual machine in the lab. This operation can take a while to complete. /// /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/formulas/{name} + /// Request Path. + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{name}/claimAnyVm. /// /// - /// Operation Id - /// Formulas_Get + /// Operation Id. + /// Labs_ClaimAnyVm. /// /// - /// Default Api Version - /// 2018-09-15 + /// Default Api Version. + /// 2018-09-15. /// /// - /// Resource - /// + /// Resource. + /// . /// /// /// - /// The name of the formula. - /// Specify the $expand query. Example: 'properties($select=description)'. + /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. /// The cancellation token to use. - /// is null. - /// is an empty string, and was expected to be non-empty. - [ForwardsClientCalls] - public virtual async Task> GetDevTestLabFormulaAsync(string name, string expand = null, CancellationToken cancellationToken = default) + public virtual async Task ClaimAnyVmAsync(WaitUntil waitUntil, CancellationToken cancellationToken = default) { - return await GetDevTestLabFormulas().GetAsync(name, expand, cancellationToken).ConfigureAwait(false); + using DiagnosticScope scope = _labsClientDiagnostics.CreateScope("DevTestLabResource.ClaimAnyVm"); + scope.Start(); + try + { + RequestContext context = new RequestContext + { + CancellationToken = cancellationToken + }; + HttpMessage message = _labsRestClient.CreateClaimAnyVmRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, context); + Response response = await Pipeline.ProcessMessageAsync(message, context).ConfigureAwait(false); + DevTestLabsArmOperation operation = new DevTestLabsArmOperation(_labsClientDiagnostics, Pipeline, message.Request, response, OperationFinalStateVia.Location); + if (waitUntil == WaitUntil.Completed) + { + await operation.WaitForCompletionResponseAsync(cancellationToken).ConfigureAwait(false); + } + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } } /// - /// Get formula. + /// Claim a random claimable virtual machine in the lab. This operation can take a while to complete. /// /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/formulas/{name} + /// Request Path. + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{name}/claimAnyVm. /// /// - /// Operation Id - /// Formulas_Get + /// Operation Id. + /// Labs_ClaimAnyVm. /// /// - /// Default Api Version - /// 2018-09-15 + /// Default Api Version. + /// 2018-09-15. /// /// - /// Resource - /// + /// Resource. + /// . /// /// /// - /// The name of the formula. - /// Specify the $expand query. Example: 'properties($select=description)'. + /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. /// The cancellation token to use. - /// is null. - /// is an empty string, and was expected to be non-empty. - [ForwardsClientCalls] - public virtual Response GetDevTestLabFormula(string name, string expand = null, CancellationToken cancellationToken = default) - { - return GetDevTestLabFormulas().Get(name, expand, cancellationToken); - } - - /// Gets a collection of DevTestLabNotificationChannelResources in the DevTestLab. - /// An object representing collection of DevTestLabNotificationChannelResources and their operations over a DevTestLabNotificationChannelResource. - public virtual DevTestLabNotificationChannelCollection GetDevTestLabNotificationChannels() + public virtual ArmOperation ClaimAnyVm(WaitUntil waitUntil, CancellationToken cancellationToken = default) { - return GetCachedClient(client => new DevTestLabNotificationChannelCollection(client, Id)); - } - - /// - /// Get notification channel. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/notificationchannels/{name} - /// + using DiagnosticScope scope = _labsClientDiagnostics.CreateScope("DevTestLabResource.ClaimAnyVm"); + scope.Start(); + try + { + RequestContext context = new RequestContext + { + CancellationToken = cancellationToken + }; + HttpMessage message = _labsRestClient.CreateClaimAnyVmRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, context); + Response response = Pipeline.ProcessMessage(message, context); + DevTestLabsArmOperation operation = new DevTestLabsArmOperation(_labsClientDiagnostics, Pipeline, message.Request, response, OperationFinalStateVia.Location); + if (waitUntil == WaitUntil.Completed) + { + operation.WaitForCompletionResponse(cancellationToken); + } + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Create virtual machines in a lab. This operation can take a while to complete. + /// /// - /// Operation Id - /// NotificationChannels_Get + /// Request Path. + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{name}/createEnvironment. /// /// - /// Default Api Version - /// 2018-09-15 + /// Operation Id. + /// Labs_CreateEnvironment. /// /// - /// Resource - /// + /// Default Api Version. + /// 2018-09-15. + /// + /// + /// Resource. + /// . /// /// /// - /// The name of the notification channel. - /// Specify the $expand query. Example: 'properties($select=webHookUrl)'. + /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. + /// Properties for creating a 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> GetDevTestLabNotificationChannelAsync(string name, string expand = null, CancellationToken cancellationToken = default) + /// is null. + public virtual async Task CreateEnvironmentAsync(WaitUntil waitUntil, DevTestLabVmCreationContent content, CancellationToken cancellationToken = default) { - return await GetDevTestLabNotificationChannels().GetAsync(name, expand, cancellationToken).ConfigureAwait(false); + Argument.AssertNotNull(content, nameof(content)); + + using DiagnosticScope scope = _labsClientDiagnostics.CreateScope("DevTestLabResource.CreateEnvironment"); + scope.Start(); + try + { + RequestContext context = new RequestContext + { + CancellationToken = cancellationToken + }; + HttpMessage message = _labsRestClient.CreateCreateEnvironmentRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, DevTestLabVmCreationContent.ToRequestContent(content), context); + Response response = await Pipeline.ProcessMessageAsync(message, context).ConfigureAwait(false); + DevTestLabsArmOperation operation = new DevTestLabsArmOperation(_labsClientDiagnostics, Pipeline, message.Request, response, OperationFinalStateVia.Location); + if (waitUntil == WaitUntil.Completed) + { + await operation.WaitForCompletionResponseAsync(cancellationToken).ConfigureAwait(false); + } + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } } /// - /// Get notification channel. + /// Create virtual machines in a lab. This operation can take a while to complete. /// /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/notificationchannels/{name} + /// Request Path. + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{name}/createEnvironment. /// /// - /// Operation Id - /// NotificationChannels_Get + /// Operation Id. + /// Labs_CreateEnvironment. /// /// - /// Default Api Version - /// 2018-09-15 + /// Default Api Version. + /// 2018-09-15. /// /// - /// Resource - /// + /// Resource. + /// . /// /// /// - /// The name of the notification channel. - /// Specify the $expand query. Example: 'properties($select=webHookUrl)'. + /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. + /// Properties for creating a virtual machine. /// The cancellation token to use. - /// is null. - /// is an empty string, and was expected to be non-empty. - [ForwardsClientCalls] - public virtual Response GetDevTestLabNotificationChannel(string name, string expand = null, CancellationToken cancellationToken = default) + /// is null. + public virtual ArmOperation CreateEnvironment(WaitUntil waitUntil, DevTestLabVmCreationContent content, CancellationToken cancellationToken = default) { - return GetDevTestLabNotificationChannels().Get(name, expand, cancellationToken); - } + Argument.AssertNotNull(content, nameof(content)); - /// Gets a collection of DevTestLabPolicyResources in the DevTestLab. - /// The name of the policy set. - /// is null. - /// is an empty string, and was expected to be non-empty. - /// An object representing collection of DevTestLabPolicyResources and their operations over a DevTestLabPolicyResource. - public virtual DevTestLabPolicyCollection GetDevTestLabPolicies(string policySetName) - { - return new DevTestLabPolicyCollection(Client, Id, policySetName); + using DiagnosticScope scope = _labsClientDiagnostics.CreateScope("DevTestLabResource.CreateEnvironment"); + scope.Start(); + try + { + RequestContext context = new RequestContext + { + CancellationToken = cancellationToken + }; + HttpMessage message = _labsRestClient.CreateCreateEnvironmentRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, DevTestLabVmCreationContent.ToRequestContent(content), context); + Response response = Pipeline.ProcessMessage(message, context); + DevTestLabsArmOperation operation = new DevTestLabsArmOperation(_labsClientDiagnostics, Pipeline, message.Request, response, OperationFinalStateVia.Location); + if (waitUntil == WaitUntil.Completed) + { + operation.WaitForCompletionResponse(cancellationToken); + } + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } } /// - /// Get policy. + /// Exports the lab resource usage into a storage account This operation can take a while to complete. /// /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/policysets/{policySetName}/policies/{name} + /// Request Path. + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{name}/exportResourceUsage. /// /// - /// Operation Id - /// Policies_Get + /// Operation Id. + /// Labs_ExportResourceUsage. /// /// - /// Default Api Version - /// 2018-09-15 + /// Default Api Version. + /// 2018-09-15. /// /// - /// Resource - /// + /// Resource. + /// . /// /// /// - /// The name of the policy set. - /// The name of the policy. - /// Specify the $expand query. Example: 'properties($select=description)'. + /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. + /// The parameters of the export operation. /// The cancellation token to use. - /// or is null. - /// or is an empty string, and was expected to be non-empty. - [ForwardsClientCalls] - public virtual async Task> GetDevTestLabPolicyAsync(string policySetName, string name, string expand = null, CancellationToken cancellationToken = default) + /// is null. + public virtual async Task ExportResourceUsageAsync(WaitUntil waitUntil, DevTestLabExportResourceUsageContent content, CancellationToken cancellationToken = default) { - return await GetDevTestLabPolicies(policySetName).GetAsync(name, expand, cancellationToken).ConfigureAwait(false); + Argument.AssertNotNull(content, nameof(content)); + + using DiagnosticScope scope = _labsClientDiagnostics.CreateScope("DevTestLabResource.ExportResourceUsage"); + scope.Start(); + try + { + RequestContext context = new RequestContext + { + CancellationToken = cancellationToken + }; + HttpMessage message = _labsRestClient.CreateExportResourceUsageRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, DevTestLabExportResourceUsageContent.ToRequestContent(content), context); + Response response = await Pipeline.ProcessMessageAsync(message, context).ConfigureAwait(false); + DevTestLabsArmOperation operation = new DevTestLabsArmOperation(_labsClientDiagnostics, Pipeline, message.Request, response, OperationFinalStateVia.Location); + if (waitUntil == WaitUntil.Completed) + { + await operation.WaitForCompletionResponseAsync(cancellationToken).ConfigureAwait(false); + } + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } } /// - /// Get policy. + /// Exports the lab resource usage into a storage account This operation can take a while to complete. /// /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/policysets/{policySetName}/policies/{name} + /// Request Path. + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{name}/exportResourceUsage. /// /// - /// Operation Id - /// Policies_Get + /// Operation Id. + /// Labs_ExportResourceUsage. /// /// - /// Default Api Version - /// 2018-09-15 + /// Default Api Version. + /// 2018-09-15. /// /// - /// Resource - /// + /// Resource. + /// . /// /// /// - /// The name of the policy set. - /// The name of the policy. - /// Specify the $expand query. Example: 'properties($select=description)'. + /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. + /// The parameters of the export operation. /// The cancellation token to use. - /// or is null. - /// or is an empty string, and was expected to be non-empty. - [ForwardsClientCalls] - public virtual Response GetDevTestLabPolicy(string policySetName, string name, string expand = null, CancellationToken cancellationToken = default) + /// is null. + public virtual ArmOperation ExportResourceUsage(WaitUntil waitUntil, DevTestLabExportResourceUsageContent content, CancellationToken cancellationToken = default) { - return GetDevTestLabPolicies(policySetName).Get(name, expand, cancellationToken); - } + Argument.AssertNotNull(content, nameof(content)); - /// Gets a collection of DevTestLabServiceRunnerResources in the DevTestLab. - /// An object representing collection of DevTestLabServiceRunnerResources and their operations over a DevTestLabServiceRunnerResource. - public virtual DevTestLabServiceRunnerCollection GetDevTestLabServiceRunners() - { - return GetCachedClient(client => new DevTestLabServiceRunnerCollection(client, Id)); + using DiagnosticScope scope = _labsClientDiagnostics.CreateScope("DevTestLabResource.ExportResourceUsage"); + scope.Start(); + try + { + RequestContext context = new RequestContext + { + CancellationToken = cancellationToken + }; + HttpMessage message = _labsRestClient.CreateExportResourceUsageRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, DevTestLabExportResourceUsageContent.ToRequestContent(content), context); + Response response = Pipeline.ProcessMessage(message, context); + DevTestLabsArmOperation operation = new DevTestLabsArmOperation(_labsClientDiagnostics, Pipeline, message.Request, response, OperationFinalStateVia.Location); + if (waitUntil == WaitUntil.Completed) + { + operation.WaitForCompletionResponse(cancellationToken); + } + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } } /// - /// Get service runner. + /// Generate a URI for uploading custom disk images to a Lab. /// /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/servicerunners/{name} + /// Request Path. + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{name}/generateUploadUri. /// /// - /// Operation Id - /// ServiceRunners_Get + /// Operation Id. + /// Labs_GenerateUploadUri. /// /// - /// Default Api Version - /// 2018-09-15 + /// Default Api Version. + /// 2018-09-15. /// /// - /// Resource - /// + /// Resource. + /// . /// /// /// - /// The name of the service runner. + /// Properties for generating an upload URI. /// The cancellation token to use. - /// is null. - /// is an empty string, and was expected to be non-empty. - [ForwardsClientCalls] - public virtual async Task> GetDevTestLabServiceRunnerAsync(string name, CancellationToken cancellationToken = default) + /// is null. + public virtual async Task> GenerateUploadUriAsync(DevTestLabGenerateUploadUriContent content, CancellationToken cancellationToken = default) { - return await GetDevTestLabServiceRunners().GetAsync(name, cancellationToken).ConfigureAwait(false); + Argument.AssertNotNull(content, nameof(content)); + + using DiagnosticScope scope = _labsClientDiagnostics.CreateScope("DevTestLabResource.GenerateUploadUri"); + scope.Start(); + try + { + RequestContext context = new RequestContext + { + CancellationToken = cancellationToken + }; + HttpMessage message = _labsRestClient.CreateGenerateUploadUriRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, DevTestLabGenerateUploadUriContent.ToRequestContent(content), context); + Response result = await Pipeline.ProcessMessageAsync(message, context).ConfigureAwait(false); + Response response = Response.FromValue(DevTestLabGenerateUploadUriResult.FromResponse(result), result); + if (response.Value == null) + { + throw new RequestFailedException(response.GetRawResponse()); + } + return response; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } } /// - /// Get service runner. + /// Generate a URI for uploading custom disk images to a Lab. /// /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/servicerunners/{name} + /// Request Path. + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{name}/generateUploadUri. /// /// - /// Operation Id - /// ServiceRunners_Get + /// Operation Id. + /// Labs_GenerateUploadUri. /// /// - /// Default Api Version - /// 2018-09-15 + /// Default Api Version. + /// 2018-09-15. /// /// - /// Resource - /// + /// Resource. + /// . /// /// /// - /// The name of the service runner. + /// Properties for generating an upload URI. /// The cancellation token to use. - /// is null. - /// is an empty string, and was expected to be non-empty. - [ForwardsClientCalls] - public virtual Response GetDevTestLabServiceRunner(string name, CancellationToken cancellationToken = default) + /// is null. + public virtual Response GenerateUploadUri(DevTestLabGenerateUploadUriContent content, CancellationToken cancellationToken = default) { - return GetDevTestLabServiceRunners().Get(name, cancellationToken); - } + Argument.AssertNotNull(content, nameof(content)); - /// Gets a collection of DevTestLabUserResources in the DevTestLab. - /// An object representing collection of DevTestLabUserResources and their operations over a DevTestLabUserResource. - public virtual DevTestLabUserCollection GetDevTestLabUsers() - { - return GetCachedClient(client => new DevTestLabUserCollection(client, Id)); + using DiagnosticScope scope = _labsClientDiagnostics.CreateScope("DevTestLabResource.GenerateUploadUri"); + scope.Start(); + try + { + RequestContext context = new RequestContext + { + CancellationToken = cancellationToken + }; + HttpMessage message = _labsRestClient.CreateGenerateUploadUriRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, DevTestLabGenerateUploadUriContent.ToRequestContent(content), context); + Response result = Pipeline.ProcessMessage(message, context); + Response response = Response.FromValue(DevTestLabGenerateUploadUriResult.FromResponse(result), result); + if (response.Value == null) + { + throw new RequestFailedException(response.GetRawResponse()); + } + return response; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } } /// - /// Get user profile. + /// Import a virtual machine into a different lab. This operation can take a while to complete. /// /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/users/{name} + /// Request Path. + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{name}/importVirtualMachine. /// /// - /// Operation Id - /// Users_Get + /// Operation Id. + /// Labs_ImportVirtualMachine. /// /// - /// Default Api Version - /// 2018-09-15 + /// Default Api Version. + /// 2018-09-15. /// /// - /// Resource - /// + /// Resource. + /// . /// /// /// - /// The name of the user profile. - /// Specify the $expand query. Example: 'properties($select=identity)'. + /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. + /// This represents the payload required to import a virtual machine from a different lab into the current one. /// The cancellation token to use. - /// is null. - /// is an empty string, and was expected to be non-empty. - [ForwardsClientCalls] - public virtual async Task> GetDevTestLabUserAsync(string name, string expand = null, CancellationToken cancellationToken = default) + /// is null. + public virtual async Task ImportVmAsync(WaitUntil waitUntil, DevTestLabImportVmContent content, CancellationToken cancellationToken = default) { - return await GetDevTestLabUsers().GetAsync(name, expand, cancellationToken).ConfigureAwait(false); + Argument.AssertNotNull(content, nameof(content)); + + using DiagnosticScope scope = _labsClientDiagnostics.CreateScope("DevTestLabResource.ImportVm"); + scope.Start(); + try + { + RequestContext context = new RequestContext + { + CancellationToken = cancellationToken + }; + HttpMessage message = _labsRestClient.CreateImportVmRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, DevTestLabImportVmContent.ToRequestContent(content), context); + Response response = await Pipeline.ProcessMessageAsync(message, context).ConfigureAwait(false); + DevTestLabsArmOperation operation = new DevTestLabsArmOperation(_labsClientDiagnostics, Pipeline, message.Request, response, OperationFinalStateVia.Location); + if (waitUntil == WaitUntil.Completed) + { + await operation.WaitForCompletionResponseAsync(cancellationToken).ConfigureAwait(false); + } + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } } /// - /// Get user profile. + /// Import a virtual machine into a different lab. This operation can take a while to complete. /// /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/users/{name} + /// Request Path. + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{name}/importVirtualMachine. /// /// - /// Operation Id - /// Users_Get + /// Operation Id. + /// Labs_ImportVirtualMachine. /// /// - /// Default Api Version - /// 2018-09-15 + /// Default Api Version. + /// 2018-09-15. /// /// - /// Resource - /// + /// Resource. + /// . /// /// /// - /// The name of the user profile. - /// Specify the $expand query. Example: 'properties($select=identity)'. + /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. + /// This represents the payload required to import a virtual machine from a different lab into the current one. /// The cancellation token to use. - /// is null. - /// is an empty string, and was expected to be non-empty. - [ForwardsClientCalls] - public virtual Response GetDevTestLabUser(string name, string expand = null, CancellationToken cancellationToken = default) + /// is null. + public virtual ArmOperation ImportVm(WaitUntil waitUntil, DevTestLabImportVmContent content, CancellationToken cancellationToken = default) { - return GetDevTestLabUsers().Get(name, expand, cancellationToken); - } + Argument.AssertNotNull(content, nameof(content)); - /// Gets a collection of DevTestLabVmResources in the DevTestLab. - /// An object representing collection of DevTestLabVmResources and their operations over a DevTestLabVmResource. - public virtual DevTestLabVmCollection GetDevTestLabVms() - { - return GetCachedClient(client => new DevTestLabVmCollection(client, Id)); + using DiagnosticScope scope = _labsClientDiagnostics.CreateScope("DevTestLabResource.ImportVm"); + scope.Start(); + try + { + RequestContext context = new RequestContext + { + CancellationToken = cancellationToken + }; + HttpMessage message = _labsRestClient.CreateImportVmRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, DevTestLabImportVmContent.ToRequestContent(content), context); + Response response = Pipeline.ProcessMessage(message, context); + DevTestLabsArmOperation operation = new DevTestLabsArmOperation(_labsClientDiagnostics, Pipeline, message.Request, response, OperationFinalStateVia.Location); + if (waitUntil == WaitUntil.Completed) + { + operation.WaitForCompletionResponse(cancellationToken); + } + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } } /// - /// Get virtual machine. + /// List disk images available for custom image creation. /// /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/virtualmachines/{name} + /// Request Path. + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{name}/listVhds. /// /// - /// Operation Id - /// VirtualMachines_Get + /// Operation Id. + /// Labs_ListVhds. /// /// - /// Default Api Version - /// 2018-09-15 + /// Default Api Version. + /// 2018-09-15. /// /// - /// Resource - /// + /// Resource. + /// . /// /// /// - /// The name of the virtual machine. - /// Specify the $expand query. Example: 'properties($expand=artifacts,computeVm,networkInterface,applicableSchedule)'. /// The cancellation token to use. - /// is null. - /// is an empty string, and was expected to be non-empty. - [ForwardsClientCalls] - public virtual async Task> GetDevTestLabVmAsync(string name, string expand = null, CancellationToken cancellationToken = default) + /// A collection of that may take multiple service requests to iterate over. + public virtual AsyncPageable GetDevTestLabVhdsAsync(CancellationToken cancellationToken = default) { - return await GetDevTestLabVms().GetAsync(name, expand, cancellationToken).ConfigureAwait(false); + RequestContext context = new RequestContext + { + CancellationToken = cancellationToken + }; + return new LabsGetDevTestLabVhdsAsyncCollectionResultOfT(_labsRestClient, Id.SubscriptionId, Id.ResourceGroupName, Id.Name, context); } /// - /// Get virtual machine. + /// List disk images available for custom image creation. /// /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/virtualmachines/{name} + /// Request Path. + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{name}/listVhds. /// /// - /// Operation Id - /// VirtualMachines_Get + /// Operation Id. + /// Labs_ListVhds. /// /// - /// Default Api Version - /// 2018-09-15 + /// Default Api Version. + /// 2018-09-15. /// /// - /// Resource - /// + /// Resource. + /// . /// /// /// - /// The name of the virtual machine. - /// Specify the $expand query. Example: 'properties($expand=artifacts,computeVm,networkInterface,applicableSchedule)'. /// The cancellation token to use. - /// is null. - /// is an empty string, and was expected to be non-empty. - [ForwardsClientCalls] - public virtual Response GetDevTestLabVm(string name, string expand = null, CancellationToken cancellationToken = default) - { - return GetDevTestLabVms().Get(name, expand, cancellationToken); - } - - /// Gets a collection of DevTestLabVirtualNetworkResources in the DevTestLab. - /// An object representing collection of DevTestLabVirtualNetworkResources and their operations over a DevTestLabVirtualNetworkResource. - public virtual DevTestLabVirtualNetworkCollection GetDevTestLabVirtualNetworks() - { - return GetCachedClient(client => new DevTestLabVirtualNetworkCollection(client, Id)); - } - - /// - /// Get virtual network. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/virtualnetworks/{name} - /// - /// - /// Operation Id - /// VirtualNetworks_Get - /// - /// - /// Default Api Version - /// 2018-09-15 - /// - /// - /// Resource - /// - /// - /// - /// - /// The name of the virtual network. - /// Specify the $expand query. Example: 'properties($expand=externalSubnets)'. - /// The cancellation token to use. - /// is null. - /// is an empty string, and was expected to be non-empty. - [ForwardsClientCalls] - public virtual async Task> GetDevTestLabVirtualNetworkAsync(string name, string expand = null, CancellationToken cancellationToken = default) + /// A collection of that may take multiple service requests to iterate over. + public virtual Pageable GetDevTestLabVhds(CancellationToken cancellationToken = default) { - return await GetDevTestLabVirtualNetworks().GetAsync(name, expand, cancellationToken).ConfigureAwait(false); + RequestContext context = new RequestContext + { + CancellationToken = cancellationToken + }; + return new LabsGetDevTestLabVhdsCollectionResultOfT(_labsRestClient, Id.SubscriptionId, Id.ResourceGroupName, Id.Name, context); } /// - /// Get virtual network. + /// Evaluates lab policy. /// /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/virtualnetworks/{name} + /// Request Path. + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/policysets/{name}/evaluatePolicies. /// /// - /// Operation Id - /// VirtualNetworks_Get + /// Operation Id. + /// PolicySets_EvaluatePolicies. /// /// - /// Default Api Version - /// 2018-09-15 + /// Default Api Version. + /// 2018-09-15. /// /// - /// Resource - /// + /// Resource. + /// . /// /// /// - /// The name of the virtual network. - /// Specify the $expand query. Example: 'properties($expand=externalSubnets)'. + /// The name of the PolicySet. + /// Request body for evaluating a policy set. /// The cancellation token to use. - /// is null. + /// or is null. /// is an empty string, and was expected to be non-empty. - [ForwardsClientCalls] - public virtual Response GetDevTestLabVirtualNetwork(string name, string expand = null, CancellationToken cancellationToken = default) + public virtual async Task> EvaluatePoliciesAsync(string name, DevTestLabEvaluatePoliciesContent content, CancellationToken cancellationToken = default) { - return GetDevTestLabVirtualNetworks().Get(name, expand, cancellationToken); - } + Argument.AssertNotNullOrEmpty(name, nameof(name)); + Argument.AssertNotNull(content, nameof(content)); - /// - /// Get lab. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{name} - /// - /// - /// Operation Id - /// Labs_Get - /// - /// - /// Default Api Version - /// 2018-09-15 - /// - /// - /// Resource - /// - /// - /// - /// - /// Specify the $expand query. Example: 'properties($select=defaultStorageAccount)'. - /// The cancellation token to use. - public virtual async Task> GetAsync(string expand = null, CancellationToken cancellationToken = default) - { - using var scope = _devTestLabLabsClientDiagnostics.CreateScope("DevTestLabResource.Get"); + using DiagnosticScope scope = _policySetsClientDiagnostics.CreateScope("DevTestLabResource.EvaluatePolicies"); scope.Start(); try { - var response = await _devTestLabLabsRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, expand, cancellationToken).ConfigureAwait(false); + RequestContext context = new RequestContext + { + CancellationToken = cancellationToken + }; + HttpMessage message = _policySetsRestClient.CreateEvaluatePoliciesRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, name, DevTestLabEvaluatePoliciesContent.ToRequestContent(content), context); + Response result = await Pipeline.ProcessMessageAsync(message, context).ConfigureAwait(false); + Response response = Response.FromValue(DevTestLabEvaluatePoliciesResult.FromResponse(result), result); if (response.Value == null) + { throw new RequestFailedException(response.GetRawResponse()); - return Response.FromValue(new DevTestLabResource(Client, response.Value), response.GetRawResponse()); + } + return response; } catch (Exception e) { @@ -928,38 +1131,52 @@ public virtual async Task> GetAsync(string expand = } /// - /// Get lab. + /// Evaluates lab policy. /// /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{name} + /// Request Path. + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/policysets/{name}/evaluatePolicies. /// /// - /// Operation Id - /// Labs_Get + /// Operation Id. + /// PolicySets_EvaluatePolicies. /// /// - /// Default Api Version - /// 2018-09-15 + /// Default Api Version. + /// 2018-09-15. /// /// - /// Resource - /// + /// Resource. + /// . /// /// /// - /// Specify the $expand query. Example: 'properties($select=defaultStorageAccount)'. + /// The name of the PolicySet. + /// Request body for evaluating a policy set. /// The cancellation token to use. - public virtual Response Get(string expand = null, CancellationToken cancellationToken = default) + /// or is null. + /// is an empty string, and was expected to be non-empty. + public virtual Response EvaluatePolicies(string name, DevTestLabEvaluatePoliciesContent content, CancellationToken cancellationToken = default) { - using var scope = _devTestLabLabsClientDiagnostics.CreateScope("DevTestLabResource.Get"); + Argument.AssertNotNullOrEmpty(name, nameof(name)); + Argument.AssertNotNull(content, nameof(content)); + + using DiagnosticScope scope = _policySetsClientDiagnostics.CreateScope("DevTestLabResource.EvaluatePolicies"); scope.Start(); try { - var response = _devTestLabLabsRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, expand, cancellationToken); + RequestContext context = new RequestContext + { + CancellationToken = cancellationToken + }; + HttpMessage message = _policySetsRestClient.CreateEvaluatePoliciesRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, name, DevTestLabEvaluatePoliciesContent.ToRequestContent(content), context); + Response result = Pipeline.ProcessMessage(message, context); + Response response = Response.FromValue(DevTestLabEvaluatePoliciesResult.FromResponse(result), result); if (response.Value == null) + { throw new RequestFailedException(response.GetRawResponse()); - return Response.FromValue(new DevTestLabResource(Client, response.Value), response.GetRawResponse()); + } + return response; } catch (Exception e) { @@ -968,40 +1185,46 @@ public virtual Response Get(string expand = null, Cancellati } } - /// - /// Delete lab. This operation can take a while to complete. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{name} - /// - /// - /// Operation Id - /// Labs_Delete - /// - /// - /// Default Api Version - /// 2018-09-15 - /// - /// - /// Resource - /// - /// - /// - /// - /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. + /// Add a tag to the current resource. + /// The key for the tag. + /// The value for the tag. /// The cancellation token to use. - public virtual async Task DeleteAsync(WaitUntil waitUntil, CancellationToken cancellationToken = default) + /// or is null. + public virtual async Task> AddTagAsync(string key, string value, CancellationToken cancellationToken = default) { - using var scope = _devTestLabLabsClientDiagnostics.CreateScope("DevTestLabResource.Delete"); + Argument.AssertNotNull(key, nameof(key)); + Argument.AssertNotNull(value, nameof(value)); + + using DiagnosticScope scope = _labsClientDiagnostics.CreateScope("DevTestLabResource.AddTag"); scope.Start(); try { - var response = await _devTestLabLabsRestClient.DeleteAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, cancellationToken).ConfigureAwait(false); - var operation = new DevTestLabsArmOperation(_devTestLabLabsClientDiagnostics, Pipeline, _devTestLabLabsRestClient.CreateDeleteRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name).Request, response, OperationFinalStateVia.Location); - if (waitUntil == WaitUntil.Completed) - await operation.WaitForCompletionResponseAsync(cancellationToken).ConfigureAwait(false); - return operation; + if (await CanUseTagResourceAsync(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).ConfigureAwait(false); + RequestContext context = new RequestContext + { + CancellationToken = cancellationToken + }; + HttpMessage message = _labsRestClient.CreateGetRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, default, context); + Response result = await Pipeline.ProcessMessageAsync(message, context).ConfigureAwait(false); + Response response = Response.FromValue(DevTestLabData.FromResponse(result), result); + return Response.FromValue(new DevTestLabResource(Client, response.Value), response.GetRawResponse()); + } + else + { + DevTestLabData current = (await GetAsync(cancellationToken: cancellationToken).ConfigureAwait(false)).Value.Data; + DevTestLabPatch patch = new DevTestLabPatch(); + foreach (KeyValuePair tag in current.Tags) + { + patch.Tags.Add(tag); + } + patch.Tags[key] = value; + Response result = await UpdateAsync(patch, cancellationToken: cancellationToken).ConfigureAwait(false); + return Response.FromValue(result.Value, result.GetRawResponse()); + } } catch (Exception e) { @@ -1010,40 +1233,46 @@ public virtual async Task DeleteAsync(WaitUntil waitUntil, Cancell } } - /// - /// Delete lab. This operation can take a while to complete. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{name} - /// - /// - /// Operation Id - /// Labs_Delete - /// - /// - /// Default Api Version - /// 2018-09-15 - /// - /// - /// Resource - /// - /// - /// - /// - /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. + /// Add a tag to the current resource. + /// The key for the tag. + /// The value for the tag. /// The cancellation token to use. - public virtual ArmOperation Delete(WaitUntil waitUntil, CancellationToken cancellationToken = default) + /// or is null. + public virtual Response AddTag(string key, string value, CancellationToken cancellationToken = default) { - using var scope = _devTestLabLabsClientDiagnostics.CreateScope("DevTestLabResource.Delete"); + Argument.AssertNotNull(key, nameof(key)); + Argument.AssertNotNull(value, nameof(value)); + + using DiagnosticScope scope = _labsClientDiagnostics.CreateScope("DevTestLabResource.AddTag"); scope.Start(); try { - var response = _devTestLabLabsRestClient.Delete(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, cancellationToken); - var operation = new DevTestLabsArmOperation(_devTestLabLabsClientDiagnostics, Pipeline, _devTestLabLabsRestClient.CreateDeleteRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name).Request, response, OperationFinalStateVia.Location); - if (waitUntil == WaitUntil.Completed) - operation.WaitForCompletionResponse(cancellationToken); - return operation; + if (CanUseTagResource(cancellationToken)) + { + Response originalTags = GetTagResource().Get(cancellationToken); + originalTags.Value.Data.TagValues[key] = value; + GetTagResource().CreateOrUpdate(WaitUntil.Completed, originalTags.Value.Data, cancellationToken); + RequestContext context = new RequestContext + { + CancellationToken = cancellationToken + }; + HttpMessage message = _labsRestClient.CreateGetRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, default, context); + Response result = Pipeline.ProcessMessage(message, context); + Response response = Response.FromValue(DevTestLabData.FromResponse(result), result); + return Response.FromValue(new DevTestLabResource(Client, response.Value), response.GetRawResponse()); + } + else + { + DevTestLabData current = Get(cancellationToken: cancellationToken).Value.Data; + DevTestLabPatch patch = new DevTestLabPatch(); + foreach (KeyValuePair tag in current.Tags) + { + patch.Tags.Add(tag); + } + patch.Tags[key] = value; + Response result = Update(patch, cancellationToken: cancellationToken); + return Response.FromValue(result.Value, result.GetRawResponse()); + } } catch (Exception e) { @@ -1052,40 +1281,41 @@ public virtual ArmOperation Delete(WaitUntil waitUntil, CancellationToken cancel } } - /// - /// Allows modifying tags of labs. All other properties will be ignored. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{name} - /// - /// - /// Operation Id - /// Labs_Update - /// - /// - /// Default Api Version - /// 2018-09-15 - /// - /// - /// Resource - /// - /// - /// - /// - /// A lab. + /// 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> UpdateAsync(DevTestLabPatch patch, CancellationToken cancellationToken = default) + /// is null. + public virtual async Task> SetTagsAsync(IDictionary tags, CancellationToken cancellationToken = default) { - Argument.AssertNotNull(patch, nameof(patch)); + Argument.AssertNotNull(tags, nameof(tags)); - using var scope = _devTestLabLabsClientDiagnostics.CreateScope("DevTestLabResource.Update"); + using DiagnosticScope scope = _labsClientDiagnostics.CreateScope("DevTestLabResource.SetTags"); scope.Start(); try { - var response = await _devTestLabLabsRestClient.UpdateAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, patch, cancellationToken).ConfigureAwait(false); - return Response.FromValue(new DevTestLabResource(Client, response.Value), response.GetRawResponse()); + if (await CanUseTagResourceAsync(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).ConfigureAwait(false); + RequestContext context = new RequestContext + { + CancellationToken = cancellationToken + }; + HttpMessage message = _labsRestClient.CreateGetRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, default, context); + Response result = await Pipeline.ProcessMessageAsync(message, context).ConfigureAwait(false); + Response response = Response.FromValue(DevTestLabData.FromResponse(result), result); + return Response.FromValue(new DevTestLabResource(Client, response.Value), response.GetRawResponse()); + } + else + { + DevTestLabData current = (await GetAsync(cancellationToken: cancellationToken).ConfigureAwait(false)).Value.Data; + DevTestLabPatch patch = new DevTestLabPatch(); + patch.Tags.ReplaceWith(tags); + Response result = await UpdateAsync(patch, cancellationToken: cancellationToken).ConfigureAwait(false); + return Response.FromValue(result.Value, result.GetRawResponse()); + } } catch (Exception e) { @@ -1094,40 +1324,41 @@ public virtual async Task> UpdateAsync(DevTestLabPa } } - /// - /// Allows modifying tags of labs. All other properties will be ignored. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{name} - /// - /// - /// Operation Id - /// Labs_Update - /// - /// - /// Default Api Version - /// 2018-09-15 - /// - /// - /// Resource - /// - /// - /// - /// - /// A lab. + /// 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 Update(DevTestLabPatch patch, CancellationToken cancellationToken = default) + /// is null. + public virtual Response SetTags(IDictionary tags, CancellationToken cancellationToken = default) { - Argument.AssertNotNull(patch, nameof(patch)); + Argument.AssertNotNull(tags, nameof(tags)); - using var scope = _devTestLabLabsClientDiagnostics.CreateScope("DevTestLabResource.Update"); + using DiagnosticScope scope = _labsClientDiagnostics.CreateScope("DevTestLabResource.SetTags"); scope.Start(); try { - var response = _devTestLabLabsRestClient.Update(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, patch, cancellationToken); - return Response.FromValue(new DevTestLabResource(Client, response.Value), response.GetRawResponse()); + if (CanUseTagResource(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); + RequestContext context = new RequestContext + { + CancellationToken = cancellationToken + }; + HttpMessage message = _labsRestClient.CreateGetRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, default, context); + Response result = Pipeline.ProcessMessage(message, context); + Response response = Response.FromValue(DevTestLabData.FromResponse(result), result); + return Response.FromValue(new DevTestLabResource(Client, response.Value), response.GetRawResponse()); + } + else + { + DevTestLabData current = Get(cancellationToken: cancellationToken).Value.Data; + DevTestLabPatch patch = new DevTestLabPatch(); + patch.Tags.ReplaceWith(tags); + Response result = Update(patch, cancellationToken: cancellationToken); + return Response.FromValue(result.Value, result.GetRawResponse()); + } } catch (Exception e) { @@ -1136,40 +1367,44 @@ public virtual Response Update(DevTestLabPatch patch, Cancel } } - /// - /// Claim a random claimable virtual machine in the lab. This operation can take a while to complete. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{name}/claimAnyVm - /// - /// - /// Operation Id - /// Labs_ClaimAnyVm - /// - /// - /// Default Api Version - /// 2018-09-15 - /// - /// - /// Resource - /// - /// - /// - /// - /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. + /// Removes a tag by key from the resource. + /// The key for the tag. /// The cancellation token to use. - public virtual async Task ClaimAnyVmAsync(WaitUntil waitUntil, CancellationToken cancellationToken = default) + /// is null. + public virtual async Task> RemoveTagAsync(string key, CancellationToken cancellationToken = default) { - using var scope = _devTestLabLabsClientDiagnostics.CreateScope("DevTestLabResource.ClaimAnyVm"); + Argument.AssertNotNull(key, nameof(key)); + + using DiagnosticScope scope = _labsClientDiagnostics.CreateScope("DevTestLabResource.RemoveTag"); scope.Start(); try { - var response = await _devTestLabLabsRestClient.ClaimAnyVmAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, cancellationToken).ConfigureAwait(false); - var operation = new DevTestLabsArmOperation(_devTestLabLabsClientDiagnostics, Pipeline, _devTestLabLabsRestClient.CreateClaimAnyVmRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name).Request, response, OperationFinalStateVia.Location); - if (waitUntil == WaitUntil.Completed) - await operation.WaitForCompletionResponseAsync(cancellationToken).ConfigureAwait(false); - return operation; + if (await CanUseTagResourceAsync(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).ConfigureAwait(false); + RequestContext context = new RequestContext + { + CancellationToken = cancellationToken + }; + HttpMessage message = _labsRestClient.CreateGetRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, default, context); + Response result = await Pipeline.ProcessMessageAsync(message, context).ConfigureAwait(false); + Response response = Response.FromValue(DevTestLabData.FromResponse(result), result); + return Response.FromValue(new DevTestLabResource(Client, response.Value), response.GetRawResponse()); + } + else + { + DevTestLabData current = (await GetAsync(cancellationToken: cancellationToken).ConfigureAwait(false)).Value.Data; + DevTestLabPatch patch = new DevTestLabPatch(); + foreach (KeyValuePair tag in current.Tags) + { + patch.Tags.Add(tag); + } + patch.Tags.Remove(key); + Response result = await UpdateAsync(patch, cancellationToken: cancellationToken).ConfigureAwait(false); + return Response.FromValue(result.Value, result.GetRawResponse()); + } } catch (Exception e) { @@ -1178,40 +1413,44 @@ public virtual async Task ClaimAnyVmAsync(WaitUntil waitUntil, Can } } - /// - /// Claim a random claimable virtual machine in the lab. This operation can take a while to complete. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{name}/claimAnyVm - /// - /// - /// Operation Id - /// Labs_ClaimAnyVm - /// - /// - /// Default Api Version - /// 2018-09-15 - /// - /// - /// Resource - /// - /// - /// - /// - /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. + /// Removes a tag by key from the resource. + /// The key for the tag. /// The cancellation token to use. - public virtual ArmOperation ClaimAnyVm(WaitUntil waitUntil, CancellationToken cancellationToken = default) + /// is null. + public virtual Response RemoveTag(string key, CancellationToken cancellationToken = default) { - using var scope = _devTestLabLabsClientDiagnostics.CreateScope("DevTestLabResource.ClaimAnyVm"); + Argument.AssertNotNull(key, nameof(key)); + + using DiagnosticScope scope = _labsClientDiagnostics.CreateScope("DevTestLabResource.RemoveTag"); scope.Start(); try { - var response = _devTestLabLabsRestClient.ClaimAnyVm(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, cancellationToken); - var operation = new DevTestLabsArmOperation(_devTestLabLabsClientDiagnostics, Pipeline, _devTestLabLabsRestClient.CreateClaimAnyVmRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name).Request, response, OperationFinalStateVia.Location); - if (waitUntil == WaitUntil.Completed) - operation.WaitForCompletionResponse(cancellationToken); - return operation; + if (CanUseTagResource(cancellationToken)) + { + Response originalTags = GetTagResource().Get(cancellationToken); + originalTags.Value.Data.TagValues.Remove(key); + GetTagResource().CreateOrUpdate(WaitUntil.Completed, originalTags.Value.Data, cancellationToken); + RequestContext context = new RequestContext + { + CancellationToken = cancellationToken + }; + HttpMessage message = _labsRestClient.CreateGetRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, default, context); + Response result = Pipeline.ProcessMessage(message, context); + Response response = Response.FromValue(DevTestLabData.FromResponse(result), result); + return Response.FromValue(new DevTestLabResource(Client, response.Value), response.GetRawResponse()); + } + else + { + DevTestLabData current = Get(cancellationToken: cancellationToken).Value.Data; + DevTestLabPatch patch = new DevTestLabPatch(); + foreach (KeyValuePair tag in current.Tags) + { + patch.Tags.Add(tag); + } + patch.Tags.Remove(key); + Response result = Update(patch, cancellationToken: cancellationToken); + return Response.FromValue(result.Value, result.GetRawResponse()); + } } catch (Exception e) { @@ -1220,924 +1459,352 @@ public virtual ArmOperation ClaimAnyVm(WaitUntil waitUntil, CancellationToken ca } } - /// - /// Create virtual machines in a lab. This operation can take a while to complete. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{name}/createEnvironment - /// - /// - /// Operation Id - /// Labs_CreateEnvironment - /// - /// - /// Default Api Version - /// 2018-09-15 - /// - /// - /// Resource - /// - /// - /// - /// - /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. - /// Properties for creating a virtual machine. + /// Gets a collection of DevTestLabSchedules in the . + /// An object representing collection of DevTestLabSchedules and their operations over a DevTestLabScheduleResource. + public virtual DevTestLabScheduleCollection GetDevTestLabSchedules() + { + return GetCachedClient(client => new DevTestLabScheduleCollection(client, Id)); + } + + /// Get schedule. + /// The name of the Schedule. + /// Specify the $expand query. Example: 'properties($select=status)'. /// The cancellation token to use. - /// is null. - public virtual async Task CreateEnvironmentAsync(WaitUntil waitUntil, DevTestLabVmCreationContent content, CancellationToken cancellationToken = default) + /// is null. + /// is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public virtual async Task> GetDevTestLabScheduleAsync(string name, string expand = default, CancellationToken cancellationToken = default) { - Argument.AssertNotNull(content, nameof(content)); + Argument.AssertNotNullOrEmpty(name, nameof(name)); - using var scope = _devTestLabLabsClientDiagnostics.CreateScope("DevTestLabResource.CreateEnvironment"); - scope.Start(); - try - { - var response = await _devTestLabLabsRestClient.CreateEnvironmentAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, content, cancellationToken).ConfigureAwait(false); - var operation = new DevTestLabsArmOperation(_devTestLabLabsClientDiagnostics, Pipeline, _devTestLabLabsRestClient.CreateCreateEnvironmentRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, content).Request, response, OperationFinalStateVia.Location); - if (waitUntil == WaitUntil.Completed) - await operation.WaitForCompletionResponseAsync(cancellationToken).ConfigureAwait(false); - return operation; - } - catch (Exception e) - { - scope.Failed(e); - throw; - } + return await GetDevTestLabSchedules().GetAsync(name, expand, cancellationToken).ConfigureAwait(false); } - /// - /// Create virtual machines in a lab. This operation can take a while to complete. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{name}/createEnvironment - /// - /// - /// Operation Id - /// Labs_CreateEnvironment - /// - /// - /// Default Api Version - /// 2018-09-15 - /// - /// - /// Resource - /// - /// - /// - /// - /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. - /// Properties for creating a virtual machine. + /// Get schedule. + /// The name of the Schedule. + /// Specify the $expand query. Example: 'properties($select=status)'. /// The cancellation token to use. - /// is null. - public virtual ArmOperation CreateEnvironment(WaitUntil waitUntil, DevTestLabVmCreationContent content, CancellationToken cancellationToken = default) + /// is null. + /// is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public virtual Response GetDevTestLabSchedule(string name, string expand = default, CancellationToken cancellationToken = default) { - Argument.AssertNotNull(content, nameof(content)); + Argument.AssertNotNullOrEmpty(name, nameof(name)); - using var scope = _devTestLabLabsClientDiagnostics.CreateScope("DevTestLabResource.CreateEnvironment"); - scope.Start(); - try - { - var response = _devTestLabLabsRestClient.CreateEnvironment(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, content, cancellationToken); - var operation = new DevTestLabsArmOperation(_devTestLabLabsClientDiagnostics, Pipeline, _devTestLabLabsRestClient.CreateCreateEnvironmentRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, content).Request, response, OperationFinalStateVia.Location); - if (waitUntil == WaitUntil.Completed) - operation.WaitForCompletionResponse(cancellationToken); - return operation; - } - catch (Exception e) - { - scope.Failed(e); - throw; - } + return GetDevTestLabSchedules().Get(name, expand, cancellationToken); } - /// - /// Exports the lab resource usage into a storage account This operation can take a while to complete. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{name}/exportResourceUsage - /// - /// - /// Operation Id - /// Labs_ExportResourceUsage - /// - /// - /// Default Api Version - /// 2018-09-15 - /// - /// - /// Resource - /// - /// - /// - /// - /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. - /// The parameters of the export operation. + /// Gets a collection of DevTestLabArtifactSources in the . + /// An object representing collection of DevTestLabArtifactSources and their operations over a DevTestLabArtifactSourceResource. + public virtual DevTestLabArtifactSourceCollection GetDevTestLabArtifactSources() + { + return GetCachedClient(client => new DevTestLabArtifactSourceCollection(client, Id)); + } + + /// Get artifact source. + /// The name of the artifact source. + /// Specify the $expand query. Example: 'properties($select=displayName)'. /// The cancellation token to use. - /// is null. - public virtual async Task ExportResourceUsageAsync(WaitUntil waitUntil, DevTestLabExportResourceUsageContent content, CancellationToken cancellationToken = default) + /// is null. + /// is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public virtual async Task> GetDevTestLabArtifactSourceAsync(string name, string expand = default, CancellationToken cancellationToken = default) { - Argument.AssertNotNull(content, nameof(content)); + Argument.AssertNotNullOrEmpty(name, nameof(name)); - using var scope = _devTestLabLabsClientDiagnostics.CreateScope("DevTestLabResource.ExportResourceUsage"); - scope.Start(); - try - { - var response = await _devTestLabLabsRestClient.ExportResourceUsageAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, content, cancellationToken).ConfigureAwait(false); - var operation = new DevTestLabsArmOperation(_devTestLabLabsClientDiagnostics, Pipeline, _devTestLabLabsRestClient.CreateExportResourceUsageRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, content).Request, response, OperationFinalStateVia.Location); - if (waitUntil == WaitUntil.Completed) - await operation.WaitForCompletionResponseAsync(cancellationToken).ConfigureAwait(false); - return operation; - } - catch (Exception e) - { - scope.Failed(e); - throw; - } + return await GetDevTestLabArtifactSources().GetAsync(name, expand, cancellationToken).ConfigureAwait(false); } - /// - /// Exports the lab resource usage into a storage account This operation can take a while to complete. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{name}/exportResourceUsage - /// - /// - /// Operation Id - /// Labs_ExportResourceUsage - /// - /// - /// Default Api Version - /// 2018-09-15 - /// - /// - /// Resource - /// - /// - /// - /// - /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. - /// The parameters of the export operation. + /// Get artifact source. + /// The name of the artifact source. + /// Specify the $expand query. Example: 'properties($select=displayName)'. /// The cancellation token to use. - /// is null. - public virtual ArmOperation ExportResourceUsage(WaitUntil waitUntil, DevTestLabExportResourceUsageContent content, CancellationToken cancellationToken = default) + /// is null. + /// is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public virtual Response GetDevTestLabArtifactSource(string name, string expand = default, CancellationToken cancellationToken = default) { - Argument.AssertNotNull(content, nameof(content)); + Argument.AssertNotNullOrEmpty(name, nameof(name)); - using var scope = _devTestLabLabsClientDiagnostics.CreateScope("DevTestLabResource.ExportResourceUsage"); - scope.Start(); - try - { - var response = _devTestLabLabsRestClient.ExportResourceUsage(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, content, cancellationToken); - var operation = new DevTestLabsArmOperation(_devTestLabLabsClientDiagnostics, Pipeline, _devTestLabLabsRestClient.CreateExportResourceUsageRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, content).Request, response, OperationFinalStateVia.Location); - if (waitUntil == WaitUntil.Completed) - operation.WaitForCompletionResponse(cancellationToken); - return operation; - } - catch (Exception e) - { - scope.Failed(e); - throw; - } + return GetDevTestLabArtifactSources().Get(name, expand, cancellationToken); } - /// - /// Generate a URI for uploading custom disk images to a Lab. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{name}/generateUploadUri - /// - /// - /// Operation Id - /// Labs_GenerateUploadUri - /// - /// - /// Default Api Version - /// 2018-09-15 - /// - /// - /// Resource - /// - /// - /// - /// - /// Properties for generating an upload URI. + /// Gets a collection of DevTestLabCosts in the . + /// An object representing collection of DevTestLabCosts and their operations over a DevTestLabCostResource. + public virtual DevTestLabCostCollection GetDevTestLabCosts() + { + return GetCachedClient(client => new DevTestLabCostCollection(client, Id)); + } + + /// Get cost. + /// The name of the cost. + /// Specify the $expand query. Example: 'properties($expand=labCostDetails)'. /// The cancellation token to use. - /// is null. - public virtual async Task> GenerateUploadUriAsync(DevTestLabGenerateUploadUriContent content, CancellationToken cancellationToken = default) + /// is null. + /// is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public virtual async Task> GetDevTestLabCostAsync(string name, string expand = default, CancellationToken cancellationToken = default) { - Argument.AssertNotNull(content, nameof(content)); + Argument.AssertNotNullOrEmpty(name, nameof(name)); - using var scope = _devTestLabLabsClientDiagnostics.CreateScope("DevTestLabResource.GenerateUploadUri"); - scope.Start(); - try - { - var response = await _devTestLabLabsRestClient.GenerateUploadUriAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, content, cancellationToken).ConfigureAwait(false); - return response; - } - catch (Exception e) - { - scope.Failed(e); - throw; - } + return await GetDevTestLabCosts().GetAsync(name, expand, cancellationToken).ConfigureAwait(false); } - /// - /// Generate a URI for uploading custom disk images to a Lab. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{name}/generateUploadUri - /// - /// - /// Operation Id - /// Labs_GenerateUploadUri - /// - /// - /// Default Api Version - /// 2018-09-15 - /// - /// - /// Resource - /// - /// - /// - /// - /// Properties for generating an upload URI. + /// Get cost. + /// The name of the cost. + /// Specify the $expand query. Example: 'properties($expand=labCostDetails)'. /// The cancellation token to use. - /// is null. - public virtual Response GenerateUploadUri(DevTestLabGenerateUploadUriContent content, CancellationToken cancellationToken = default) + /// is null. + /// is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public virtual Response GetDevTestLabCost(string name, string expand = default, CancellationToken cancellationToken = default) { - Argument.AssertNotNull(content, nameof(content)); + Argument.AssertNotNullOrEmpty(name, nameof(name)); - using var scope = _devTestLabLabsClientDiagnostics.CreateScope("DevTestLabResource.GenerateUploadUri"); - scope.Start(); - try - { - var response = _devTestLabLabsRestClient.GenerateUploadUri(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, content, cancellationToken); - return response; - } - catch (Exception e) - { - scope.Failed(e); - throw; - } + return GetDevTestLabCosts().Get(name, expand, cancellationToken); } - /// - /// Import a virtual machine into a different lab. This operation can take a while to complete. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{name}/importVirtualMachine - /// - /// - /// Operation Id - /// Labs_ImportVm - /// - /// - /// Default Api Version - /// 2018-09-15 - /// - /// - /// Resource - /// - /// - /// - /// - /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. - /// This represents the payload required to import a virtual machine from a different lab into the current one. + /// Gets a collection of DevTestLabCustomImages in the . + /// An object representing collection of DevTestLabCustomImages and their operations over a DevTestLabCustomImageResource. + public virtual DevTestLabCustomImageCollection GetDevTestLabCustomImages() + { + return GetCachedClient(client => new DevTestLabCustomImageCollection(client, Id)); + } + + /// Get custom image. + /// The name of the CustomImage. + /// Specify the $expand query. Example: 'properties($select=vm)'. /// The cancellation token to use. - /// is null. - public virtual async Task ImportVmAsync(WaitUntil waitUntil, DevTestLabImportVmContent content, CancellationToken cancellationToken = default) + /// is null. + /// is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public virtual async Task> GetDevTestLabCustomImageAsync(string name, string expand = default, CancellationToken cancellationToken = default) { - Argument.AssertNotNull(content, nameof(content)); + Argument.AssertNotNullOrEmpty(name, nameof(name)); - using var scope = _devTestLabLabsClientDiagnostics.CreateScope("DevTestLabResource.ImportVm"); - scope.Start(); - try - { - var response = await _devTestLabLabsRestClient.ImportVmAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, content, cancellationToken).ConfigureAwait(false); - var operation = new DevTestLabsArmOperation(_devTestLabLabsClientDiagnostics, Pipeline, _devTestLabLabsRestClient.CreateImportVmRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, content).Request, response, OperationFinalStateVia.Location); - if (waitUntil == WaitUntil.Completed) - await operation.WaitForCompletionResponseAsync(cancellationToken).ConfigureAwait(false); - return operation; - } - catch (Exception e) - { - scope.Failed(e); - throw; - } + return await GetDevTestLabCustomImages().GetAsync(name, expand, cancellationToken).ConfigureAwait(false); } - /// - /// Import a virtual machine into a different lab. This operation can take a while to complete. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{name}/importVirtualMachine - /// - /// - /// Operation Id - /// Labs_ImportVm - /// - /// - /// Default Api Version - /// 2018-09-15 - /// - /// - /// Resource - /// - /// - /// - /// - /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. - /// This represents the payload required to import a virtual machine from a different lab into the current one. + /// Get custom image. + /// The name of the CustomImage. + /// Specify the $expand query. Example: 'properties($select=vm)'. /// The cancellation token to use. - /// is null. - public virtual ArmOperation ImportVm(WaitUntil waitUntil, DevTestLabImportVmContent content, CancellationToken cancellationToken = default) + /// is null. + /// is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public virtual Response GetDevTestLabCustomImage(string name, string expand = default, CancellationToken cancellationToken = default) { - Argument.AssertNotNull(content, nameof(content)); + Argument.AssertNotNullOrEmpty(name, nameof(name)); - using var scope = _devTestLabLabsClientDiagnostics.CreateScope("DevTestLabResource.ImportVm"); - scope.Start(); - try - { - var response = _devTestLabLabsRestClient.ImportVm(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, content, cancellationToken); - var operation = new DevTestLabsArmOperation(_devTestLabLabsClientDiagnostics, Pipeline, _devTestLabLabsRestClient.CreateImportVmRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, content).Request, response, OperationFinalStateVia.Location); - if (waitUntil == WaitUntil.Completed) - operation.WaitForCompletionResponse(cancellationToken); - return operation; - } - catch (Exception e) - { - scope.Failed(e); - throw; - } + return GetDevTestLabCustomImages().Get(name, expand, cancellationToken); } - /// - /// List disk images available for custom image creation. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{name}/listVhds - /// - /// - /// Operation Id - /// Labs_ListVhds - /// - /// - /// Default Api Version - /// 2018-09-15 - /// - /// - /// Resource - /// - /// - /// - /// + /// Gets a collection of DevTestLabFormulas in the . + /// An object representing collection of DevTestLabFormulas and their operations over a DevTestLabFormulaResource. + public virtual DevTestLabFormulaCollection GetDevTestLabFormulas() + { + return GetCachedClient(client => new DevTestLabFormulaCollection(client, Id)); + } + + /// Get formula. + /// The name of the formula. + /// Specify the $expand query. Example: 'properties($select=description)'. /// The cancellation token to use. - /// An async collection of that may take multiple service requests to iterate over. - public virtual AsyncPageable GetVhdsAsync(CancellationToken cancellationToken = default) + /// is null. + /// is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public virtual async Task> GetDevTestLabFormulaAsync(string name, string expand = default, CancellationToken cancellationToken = default) { - HttpMessage FirstPageRequest(int? pageSizeHint) => _devTestLabLabsRestClient.CreateListVhdsRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name); - HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _devTestLabLabsRestClient.CreateListVhdsNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName, Id.Name); - return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => ModelReaderWriter.Read(new BinaryData(Encoding.UTF8.GetBytes(e.GetRawText())), ModelSerializationExtensions.WireOptions, AzureResourceManagerDevTestLabsContext.Default), _devTestLabLabsClientDiagnostics, Pipeline, "DevTestLabResource.GetVhds", "value", "nextLink", cancellationToken); + Argument.AssertNotNullOrEmpty(name, nameof(name)); + + return await GetDevTestLabFormulas().GetAsync(name, expand, cancellationToken).ConfigureAwait(false); } - /// - /// List disk images available for custom image creation. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{name}/listVhds - /// - /// - /// Operation Id - /// Labs_ListVhds - /// - /// - /// Default Api Version - /// 2018-09-15 - /// - /// - /// Resource - /// - /// - /// - /// + /// Get formula. + /// The name of the formula. + /// Specify the $expand query. Example: 'properties($select=description)'. /// The cancellation token to use. - /// A collection of that may take multiple service requests to iterate over. - public virtual Pageable GetVhds(CancellationToken cancellationToken = default) + /// is null. + /// is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public virtual Response GetDevTestLabFormula(string name, string expand = default, CancellationToken cancellationToken = default) { - HttpMessage FirstPageRequest(int? pageSizeHint) => _devTestLabLabsRestClient.CreateListVhdsRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name); - HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _devTestLabLabsRestClient.CreateListVhdsNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName, Id.Name); - return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => ModelReaderWriter.Read(new BinaryData(Encoding.UTF8.GetBytes(e.GetRawText())), ModelSerializationExtensions.WireOptions, AzureResourceManagerDevTestLabsContext.Default), _devTestLabLabsClientDiagnostics, Pipeline, "DevTestLabResource.GetVhds", "value", "nextLink", cancellationToken); + Argument.AssertNotNullOrEmpty(name, nameof(name)); + + return GetDevTestLabFormulas().Get(name, expand, cancellationToken); } - /// - /// List gallery images in a given lab. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/galleryimages - /// - /// - /// Operation Id - /// GalleryImages_List - /// - /// - /// Default Api Version - /// 2018-09-15 - /// - /// - /// - /// Specify the $expand query. Example: 'properties($select=author)'. - /// The filter to apply to the operation. Example: '$filter=contains(name,'myName'). - /// The maximum number of resources to return from the operation. Example: '$top=10'. - /// The ordering expression for the results, using OData notation. Example: '$orderby=name desc'. + /// Gets a collection of DevTestLabNotificationChannels in the . + /// An object representing collection of DevTestLabNotificationChannels and their operations over a DevTestLabNotificationChannelResource. + public virtual DevTestLabNotificationChannelCollection GetDevTestLabNotificationChannels() + { + return GetCachedClient(client => new DevTestLabNotificationChannelCollection(client, Id)); + } + + /// Get notification channel. + /// The name of the notification channel. + /// Specify the $expand query. Example: 'properties($select=webHookUrl)'. /// The cancellation token to use. - /// An async collection of that may take multiple service requests to iterate over. - public virtual AsyncPageable GetGalleryImagesAsync(string expand = null, string filter = null, int? top = null, string orderby = null, CancellationToken cancellationToken = default) + /// is null. + /// is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public virtual async Task> GetDevTestLabNotificationChannelAsync(string name, string expand = default, CancellationToken cancellationToken = default) { - HttpMessage FirstPageRequest(int? pageSizeHint) => _galleryImagesRestClient.CreateListRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, expand, filter, top, orderby); - HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _galleryImagesRestClient.CreateListNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName, Id.Name, expand, filter, top, orderby); - return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => DevTestLabGalleryImage.DeserializeDevTestLabGalleryImage(e), _galleryImagesClientDiagnostics, Pipeline, "DevTestLabResource.GetGalleryImages", "value", "nextLink", cancellationToken); + Argument.AssertNotNullOrEmpty(name, nameof(name)); + + return await GetDevTestLabNotificationChannels().GetAsync(name, expand, cancellationToken).ConfigureAwait(false); } - /// - /// List gallery images in a given lab. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/galleryimages - /// - /// - /// Operation Id - /// GalleryImages_List - /// - /// - /// Default Api Version - /// 2018-09-15 - /// - /// - /// - /// Specify the $expand query. Example: 'properties($select=author)'. - /// The filter to apply to the operation. Example: '$filter=contains(name,'myName'). - /// The maximum number of resources to return from the operation. Example: '$top=10'. - /// The ordering expression for the results, using OData notation. Example: '$orderby=name desc'. + /// Get notification channel. + /// The name of the notification channel. + /// Specify the $expand query. Example: 'properties($select=webHookUrl)'. /// The cancellation token to use. - /// A collection of that may take multiple service requests to iterate over. - public virtual Pageable GetGalleryImages(string expand = null, string filter = null, int? top = null, string orderby = null, CancellationToken cancellationToken = default) + /// is null. + /// is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public virtual Response GetDevTestLabNotificationChannel(string name, string expand = default, CancellationToken cancellationToken = default) { - HttpMessage FirstPageRequest(int? pageSizeHint) => _galleryImagesRestClient.CreateListRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, expand, filter, top, orderby); - HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _galleryImagesRestClient.CreateListNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName, Id.Name, expand, filter, top, orderby); - return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => DevTestLabGalleryImage.DeserializeDevTestLabGalleryImage(e), _galleryImagesClientDiagnostics, Pipeline, "DevTestLabResource.GetGalleryImages", "value", "nextLink", cancellationToken); + Argument.AssertNotNullOrEmpty(name, nameof(name)); + + return GetDevTestLabNotificationChannels().Get(name, expand, cancellationToken); } - /// - /// Evaluates lab policy. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/policysets/{name}/evaluatePolicies - /// - /// - /// Operation Id - /// PolicySets_EvaluatePolicies - /// - /// - /// Default Api Version - /// 2018-09-15 - /// - /// - /// - /// The name of the policy set. - /// Request body for evaluating a policy set. + /// Gets a collection of DevTestLabServiceRunners in the . + /// An object representing collection of DevTestLabServiceRunners and their operations over a DevTestLabServiceRunnerResource. + public virtual DevTestLabServiceRunnerCollection GetDevTestLabServiceRunners() + { + return GetCachedClient(client => new DevTestLabServiceRunnerCollection(client, Id)); + } + + /// Get service runner. + /// The name of the service runner. /// The cancellation token to use. + /// is null. /// is an empty string, and was expected to be non-empty. - /// or is null. - public virtual async Task> EvaluatePoliciesAsync(string name, DevTestLabEvaluatePoliciesContent content, CancellationToken cancellationToken = default) + [ForwardsClientCalls] + public virtual async Task> GetDevTestLabServiceRunnerAsync(string name, CancellationToken cancellationToken = default) { Argument.AssertNotNullOrEmpty(name, nameof(name)); - Argument.AssertNotNull(content, nameof(content)); - using var scope = _policySetsClientDiagnostics.CreateScope("DevTestLabResource.EvaluatePolicies"); - scope.Start(); - try - { - var response = await _policySetsRestClient.EvaluatePoliciesAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, name, content, cancellationToken).ConfigureAwait(false); - return response; - } - catch (Exception e) - { - scope.Failed(e); - throw; - } + return await GetDevTestLabServiceRunners().GetAsync(name, cancellationToken).ConfigureAwait(false); } - /// - /// Evaluates lab policy. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/policysets/{name}/evaluatePolicies - /// - /// - /// Operation Id - /// PolicySets_EvaluatePolicies - /// - /// - /// Default Api Version - /// 2018-09-15 - /// - /// - /// - /// The name of the policy set. - /// Request body for evaluating a policy set. + /// Get service runner. + /// The name of the service runner. /// The cancellation token to use. + /// is null. /// is an empty string, and was expected to be non-empty. - /// or is null. - public virtual Response EvaluatePolicies(string name, DevTestLabEvaluatePoliciesContent content, CancellationToken cancellationToken = default) + [ForwardsClientCalls] + public virtual Response GetDevTestLabServiceRunner(string name, CancellationToken cancellationToken = default) { Argument.AssertNotNullOrEmpty(name, nameof(name)); - Argument.AssertNotNull(content, nameof(content)); - using var scope = _policySetsClientDiagnostics.CreateScope("DevTestLabResource.EvaluatePolicies"); - scope.Start(); - try - { - var response = _policySetsRestClient.EvaluatePolicies(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, name, content, cancellationToken); - return response; - } - catch (Exception e) - { - scope.Failed(e); - throw; - } + return GetDevTestLabServiceRunners().Get(name, cancellationToken); } - /// - /// Add a tag to the current resource. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{name} - /// - /// - /// Operation Id - /// Labs_Get - /// - /// - /// Default Api Version - /// 2018-09-15 - /// - /// - /// Resource - /// - /// - /// - /// - /// The key for the tag. - /// The value for the tag. + /// Gets a collection of DevTestLabUsers in the . + /// An object representing collection of DevTestLabUsers and their operations over a DevTestLabUserResource. + public virtual DevTestLabUserCollection GetDevTestLabUsers() + { + return GetCachedClient(client => new DevTestLabUserCollection(client, Id)); + } + + /// Get user profile. + /// The name of the user profile. + /// Specify the $expand query. Example: 'properties($select=identity)'. /// The cancellation token to use. - /// or is null. - public virtual async Task> AddTagAsync(string key, string value, CancellationToken cancellationToken = default) + /// is null. + /// is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public virtual async Task> GetDevTestLabUserAsync(string name, string expand = default, CancellationToken cancellationToken = default) { - Argument.AssertNotNull(key, nameof(key)); - Argument.AssertNotNull(value, nameof(value)); + Argument.AssertNotNullOrEmpty(name, nameof(name)); - using var scope = _devTestLabLabsClientDiagnostics.CreateScope("DevTestLabResource.AddTag"); - scope.Start(); - try - { - if (await CanUseTagResourceAsync(cancellationToken: cancellationToken).ConfigureAwait(false)) - { - var originalTags = await GetTagResource().GetAsync(cancellationToken).ConfigureAwait(false); - originalTags.Value.Data.TagValues[key] = value; - await GetTagResource().CreateOrUpdateAsync(WaitUntil.Completed, originalTags.Value.Data, cancellationToken: cancellationToken).ConfigureAwait(false); - var originalResponse = await _devTestLabLabsRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, null, cancellationToken).ConfigureAwait(false); - return Response.FromValue(new DevTestLabResource(Client, originalResponse.Value), originalResponse.GetRawResponse()); - } - else - { - var current = (await GetAsync(cancellationToken: cancellationToken).ConfigureAwait(false)).Value.Data; - var patch = new DevTestLabPatch(); - foreach (var tag in current.Tags) - { - patch.Tags.Add(tag); - } - patch.Tags[key] = value; - var result = await UpdateAsync(patch, cancellationToken: cancellationToken).ConfigureAwait(false); - return result; - } - } - catch (Exception e) - { - scope.Failed(e); - throw; - } + return await GetDevTestLabUsers().GetAsync(name, expand, cancellationToken).ConfigureAwait(false); } - /// - /// Add a tag to the current resource. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{name} - /// - /// - /// Operation Id - /// Labs_Get - /// - /// - /// Default Api Version - /// 2018-09-15 - /// - /// - /// Resource - /// - /// - /// - /// - /// The key for the tag. - /// The value for the tag. + /// Get user profile. + /// The name of the user profile. + /// Specify the $expand query. Example: 'properties($select=identity)'. /// The cancellation token to use. - /// or is null. - public virtual Response AddTag(string key, string value, CancellationToken cancellationToken = default) + /// is null. + /// is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public virtual Response GetDevTestLabUser(string name, string expand = default, CancellationToken cancellationToken = default) { - Argument.AssertNotNull(key, nameof(key)); - Argument.AssertNotNull(value, nameof(value)); + Argument.AssertNotNullOrEmpty(name, nameof(name)); - using var scope = _devTestLabLabsClientDiagnostics.CreateScope("DevTestLabResource.AddTag"); - scope.Start(); - try - { - if (CanUseTagResource(cancellationToken: cancellationToken)) - { - var originalTags = GetTagResource().Get(cancellationToken); - originalTags.Value.Data.TagValues[key] = value; - GetTagResource().CreateOrUpdate(WaitUntil.Completed, originalTags.Value.Data, cancellationToken: cancellationToken); - var originalResponse = _devTestLabLabsRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, null, cancellationToken); - return Response.FromValue(new DevTestLabResource(Client, originalResponse.Value), originalResponse.GetRawResponse()); - } - else - { - var current = Get(cancellationToken: cancellationToken).Value.Data; - var patch = new DevTestLabPatch(); - foreach (var tag in current.Tags) - { - patch.Tags.Add(tag); - } - patch.Tags[key] = value; - var result = Update(patch, cancellationToken: cancellationToken); - return result; - } - } - catch (Exception e) - { - scope.Failed(e); - throw; - } + return GetDevTestLabUsers().Get(name, expand, cancellationToken); } - /// - /// Replace the tags on the resource with the given set. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{name} - /// - /// - /// Operation Id - /// Labs_Get - /// - /// - /// Default Api Version - /// 2018-09-15 - /// - /// - /// Resource - /// - /// - /// - /// - /// The set of tags to use as replacement. + /// Gets a collection of DevTestLabVms in the . + /// An object representing collection of DevTestLabVms and their operations over a DevTestLabVmResource. + public virtual DevTestLabVmCollection GetDevTestLabVms() + { + return GetCachedClient(client => new DevTestLabVmCollection(client, Id)); + } + + /// Get virtual machine. + /// The name of the virtual machine. + /// Specify the $expand query. Example: 'properties($expand=artifacts,computeVm,networkInterface,applicableSchedule)'. /// The cancellation token to use. - /// is null. - public virtual async Task> SetTagsAsync(IDictionary tags, CancellationToken cancellationToken = default) + /// is null. + /// is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public virtual async Task> GetDevTestLabVmAsync(string name, string expand = default, CancellationToken cancellationToken = default) { - Argument.AssertNotNull(tags, nameof(tags)); + Argument.AssertNotNullOrEmpty(name, nameof(name)); - using var scope = _devTestLabLabsClientDiagnostics.CreateScope("DevTestLabResource.SetTags"); - scope.Start(); - try - { - if (await CanUseTagResourceAsync(cancellationToken: cancellationToken).ConfigureAwait(false)) - { - await GetTagResource().DeleteAsync(WaitUntil.Completed, cancellationToken: cancellationToken).ConfigureAwait(false); - var originalTags = await GetTagResource().GetAsync(cancellationToken).ConfigureAwait(false); - originalTags.Value.Data.TagValues.ReplaceWith(tags); - await GetTagResource().CreateOrUpdateAsync(WaitUntil.Completed, originalTags.Value.Data, cancellationToken: cancellationToken).ConfigureAwait(false); - var originalResponse = await _devTestLabLabsRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, null, cancellationToken).ConfigureAwait(false); - return Response.FromValue(new DevTestLabResource(Client, originalResponse.Value), originalResponse.GetRawResponse()); - } - else - { - var current = (await GetAsync(cancellationToken: cancellationToken).ConfigureAwait(false)).Value.Data; - var patch = new DevTestLabPatch(); - patch.Tags.ReplaceWith(tags); - var result = await UpdateAsync(patch, cancellationToken: cancellationToken).ConfigureAwait(false); - return result; - } - } - catch (Exception e) - { - scope.Failed(e); - throw; - } + return await GetDevTestLabVms().GetAsync(name, expand, cancellationToken).ConfigureAwait(false); } - /// - /// Replace the tags on the resource with the given set. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{name} - /// - /// - /// Operation Id - /// Labs_Get - /// - /// - /// Default Api Version - /// 2018-09-15 - /// - /// - /// Resource - /// - /// - /// - /// - /// The set of tags to use as replacement. + /// Get virtual machine. + /// The name of the virtual machine. + /// Specify the $expand query. Example: 'properties($expand=artifacts,computeVm,networkInterface,applicableSchedule)'. /// The cancellation token to use. - /// is null. - public virtual Response SetTags(IDictionary tags, CancellationToken cancellationToken = default) + /// is null. + /// is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public virtual Response GetDevTestLabVm(string name, string expand = default, CancellationToken cancellationToken = default) { - Argument.AssertNotNull(tags, nameof(tags)); + Argument.AssertNotNullOrEmpty(name, nameof(name)); - using var scope = _devTestLabLabsClientDiagnostics.CreateScope("DevTestLabResource.SetTags"); - scope.Start(); - try - { - if (CanUseTagResource(cancellationToken: cancellationToken)) - { - GetTagResource().Delete(WaitUntil.Completed, cancellationToken: cancellationToken); - var originalTags = GetTagResource().Get(cancellationToken); - originalTags.Value.Data.TagValues.ReplaceWith(tags); - GetTagResource().CreateOrUpdate(WaitUntil.Completed, originalTags.Value.Data, cancellationToken: cancellationToken); - var originalResponse = _devTestLabLabsRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, null, cancellationToken); - return Response.FromValue(new DevTestLabResource(Client, originalResponse.Value), originalResponse.GetRawResponse()); - } - else - { - var current = Get(cancellationToken: cancellationToken).Value.Data; - var patch = new DevTestLabPatch(); - patch.Tags.ReplaceWith(tags); - var result = Update(patch, cancellationToken: cancellationToken); - return result; - } - } - catch (Exception e) - { - scope.Failed(e); - throw; - } + return GetDevTestLabVms().Get(name, expand, cancellationToken); } - /// - /// Removes a tag by key from the resource. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{name} - /// - /// - /// Operation Id - /// Labs_Get - /// - /// - /// Default Api Version - /// 2018-09-15 - /// - /// - /// Resource - /// - /// - /// - /// - /// The key for the tag. + /// Gets a collection of DevTestLabVirtualNetworks in the . + /// An object representing collection of DevTestLabVirtualNetworks and their operations over a DevTestLabVirtualNetworkResource. + public virtual DevTestLabVirtualNetworkCollection GetDevTestLabVirtualNetworks() + { + return GetCachedClient(client => new DevTestLabVirtualNetworkCollection(client, Id)); + } + + /// Get virtual network. + /// The name of the virtual network. + /// Specify the $expand query. Example: 'properties($expand=externalSubnets)'. /// The cancellation token to use. - /// is null. - public virtual async Task> RemoveTagAsync(string key, CancellationToken cancellationToken = default) + /// is null. + /// is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public virtual async Task> GetDevTestLabVirtualNetworkAsync(string name, string expand = default, CancellationToken cancellationToken = default) { - Argument.AssertNotNull(key, nameof(key)); + Argument.AssertNotNullOrEmpty(name, nameof(name)); - using var scope = _devTestLabLabsClientDiagnostics.CreateScope("DevTestLabResource.RemoveTag"); - scope.Start(); - try - { - if (await CanUseTagResourceAsync(cancellationToken: cancellationToken).ConfigureAwait(false)) - { - var originalTags = await GetTagResource().GetAsync(cancellationToken).ConfigureAwait(false); - originalTags.Value.Data.TagValues.Remove(key); - await GetTagResource().CreateOrUpdateAsync(WaitUntil.Completed, originalTags.Value.Data, cancellationToken: cancellationToken).ConfigureAwait(false); - var originalResponse = await _devTestLabLabsRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, null, cancellationToken).ConfigureAwait(false); - return Response.FromValue(new DevTestLabResource(Client, originalResponse.Value), originalResponse.GetRawResponse()); - } - else - { - var current = (await GetAsync(cancellationToken: cancellationToken).ConfigureAwait(false)).Value.Data; - var patch = new DevTestLabPatch(); - foreach (var tag in current.Tags) - { - patch.Tags.Add(tag); - } - patch.Tags.Remove(key); - var result = await UpdateAsync(patch, cancellationToken: cancellationToken).ConfigureAwait(false); - return result; - } - } - catch (Exception e) - { - scope.Failed(e); - throw; - } + return await GetDevTestLabVirtualNetworks().GetAsync(name, expand, cancellationToken).ConfigureAwait(false); } - /// - /// Removes a tag by key from the resource. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{name} - /// - /// - /// Operation Id - /// Labs_Get - /// - /// - /// Default Api Version - /// 2018-09-15 - /// - /// - /// Resource - /// - /// - /// - /// - /// The key for the tag. + /// Get virtual network. + /// The name of the virtual network. + /// Specify the $expand query. Example: 'properties($expand=externalSubnets)'. /// The cancellation token to use. - /// is null. - public virtual Response RemoveTag(string key, CancellationToken cancellationToken = default) + /// is null. + /// is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public virtual Response GetDevTestLabVirtualNetwork(string name, string expand = default, CancellationToken cancellationToken = default) { - Argument.AssertNotNull(key, nameof(key)); + Argument.AssertNotNullOrEmpty(name, nameof(name)); - using var scope = _devTestLabLabsClientDiagnostics.CreateScope("DevTestLabResource.RemoveTag"); - scope.Start(); - try - { - if (CanUseTagResource(cancellationToken: cancellationToken)) - { - var originalTags = GetTagResource().Get(cancellationToken); - originalTags.Value.Data.TagValues.Remove(key); - GetTagResource().CreateOrUpdate(WaitUntil.Completed, originalTags.Value.Data, cancellationToken: cancellationToken); - var originalResponse = _devTestLabLabsRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, null, cancellationToken); - return Response.FromValue(new DevTestLabResource(Client, originalResponse.Value), originalResponse.GetRawResponse()); - } - else - { - var current = Get(cancellationToken: cancellationToken).Value.Data; - var patch = new DevTestLabPatch(); - foreach (var tag in current.Tags) - { - patch.Tags.Add(tag); - } - patch.Tags.Remove(key); - var result = Update(patch, cancellationToken: cancellationToken); - return result; - } - } - catch (Exception e) - { - scope.Failed(e); - throw; - } + return GetDevTestLabVirtualNetworks().Get(name, expand, cancellationToken); } } } diff --git a/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/DevTestLabScheduleCollection.cs b/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/DevTestLabScheduleCollection.cs index 7612bc078869..71781ada8a57 100644 --- a/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/DevTestLabScheduleCollection.cs +++ b/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/DevTestLabScheduleCollection.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.DevTestLabs { @@ -24,75 +25,81 @@ namespace Azure.ResourceManager.DevTestLabs /// public partial class DevTestLabScheduleCollection : ArmCollection, IEnumerable, IAsyncEnumerable { - private readonly ClientDiagnostics _devTestLabScheduleSchedulesClientDiagnostics; - private readonly SchedulesRestOperations _devTestLabScheduleSchedulesRestClient; + private readonly ClientDiagnostics _devTestLabSchedulesClientDiagnostics; + private readonly DevTestLabSchedules _devTestLabSchedulesRestClient; - /// Initializes a new instance of the class for mocking. + /// Initializes a new instance of DevTestLabScheduleCollection for mocking. protected DevTestLabScheduleCollection() { } - /// 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 DevTestLabScheduleCollection(ArmClient client, ResourceIdentifier id) : base(client, id) { - _devTestLabScheduleSchedulesClientDiagnostics = new ClientDiagnostics("Azure.ResourceManager.DevTestLabs", DevTestLabScheduleResource.ResourceType.Namespace, Diagnostics); - TryGetApiVersion(DevTestLabScheduleResource.ResourceType, out string devTestLabScheduleSchedulesApiVersion); - _devTestLabScheduleSchedulesRestClient = new SchedulesRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, devTestLabScheduleSchedulesApiVersion); -#if DEBUG - ValidateResourceId(Id); -#endif + TryGetApiVersion(DevTestLabScheduleResource.ResourceType, out string devTestLabScheduleApiVersion); + _devTestLabSchedulesClientDiagnostics = new ClientDiagnostics("Azure.ResourceManager.DevTestLabs", DevTestLabScheduleResource.ResourceType.Namespace, Diagnostics); + _devTestLabSchedulesRestClient = new DevTestLabSchedules(_devTestLabSchedulesClientDiagnostics, Pipeline, Endpoint, devTestLabScheduleApiVersion ?? "2018-09-15"); + ValidateResourceId(id); } + /// + [Conditional("DEBUG")] internal static void ValidateResourceId(ResourceIdentifier id) { if (id.ResourceType != DevTestLabResource.ResourceType) - throw new ArgumentException(string.Format(CultureInfo.CurrentCulture, "Invalid resource type {0} expected {1}", id.ResourceType, DevTestLabResource.ResourceType), nameof(id)); + { + throw new ArgumentException(string.Format("Invalid resource type {0} expected {1}", id.ResourceType, DevTestLabResource.ResourceType), id); + } } /// /// Create or replace an existing schedule. /// /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/schedules/{name} - /// - /// - /// Operation Id - /// Schedules_CreateOrUpdate + /// Request Path. + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/schedules/{name}. /// /// - /// Default Api Version - /// 2018-09-15 + /// Operation Id. + /// Schedules_CreateOrUpdate. /// /// - /// Resource - /// + /// Default Api Version. + /// 2018-09-15. /// /// /// /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. - /// The name of the schedule. + /// The name of the Schedule. /// A schedule. /// 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 name, DevTestLabScheduleData data, CancellationToken cancellationToken = default) { Argument.AssertNotNullOrEmpty(name, nameof(name)); Argument.AssertNotNull(data, nameof(data)); - using var scope = _devTestLabScheduleSchedulesClientDiagnostics.CreateScope("DevTestLabScheduleCollection.CreateOrUpdate"); + using DiagnosticScope scope = _devTestLabSchedulesClientDiagnostics.CreateScope("DevTestLabScheduleCollection.CreateOrUpdate"); scope.Start(); try { - var response = await _devTestLabScheduleSchedulesRestClient.CreateOrUpdateAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, name, data, cancellationToken).ConfigureAwait(false); - var uri = _devTestLabScheduleSchedulesRestClient.CreateCreateOrUpdateRequestUri(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, name, data); - var rehydrationToken = NextLinkOperationImplementation.GetRehydrationToken(RequestMethod.Put, uri.ToUri(), uri.ToString(), "None", null, OperationFinalStateVia.OriginalUri.ToString()); - var operation = new DevTestLabsArmOperation(Response.FromValue(new DevTestLabScheduleResource(Client, response), response.GetRawResponse()), rehydrationToken); + RequestContext context = new RequestContext + { + CancellationToken = cancellationToken + }; + HttpMessage message = _devTestLabSchedulesRestClient.CreateCreateOrUpdateRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, name, DevTestLabScheduleData.ToRequestContent(data), context); + Response result = await Pipeline.ProcessMessageAsync(message, context).ConfigureAwait(false); + Response response = Response.FromValue(DevTestLabScheduleData.FromResponse(result), result); + RequestUriBuilder uri = message.Request.Uri; + RehydrationToken rehydrationToken = NextLinkOperationImplementation.GetRehydrationToken(RequestMethod.Put, uri.ToUri(), uri.ToString(), "None", null, OperationFinalStateVia.OriginalUri.ToString()); + DevTestLabsArmOperation operation = new DevTestLabsArmOperation(Response.FromValue(new DevTestLabScheduleResource(Client, response.Value), response.GetRawResponse()), rehydrationToken); if (waitUntil == WaitUntil.Completed) + { await operation.WaitForCompletionAsync(cancellationToken).ConfigureAwait(false); + } return operation; } catch (Exception e) @@ -106,44 +113,48 @@ public virtual async Task> CreateOrUpda /// Create or replace an existing schedule. /// /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/schedules/{name} + /// Request Path. + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/schedules/{name}. /// /// - /// Operation Id - /// Schedules_CreateOrUpdate + /// Operation Id. + /// Schedules_CreateOrUpdate. /// /// - /// Default Api Version - /// 2018-09-15 - /// - /// - /// Resource - /// + /// Default Api Version. + /// 2018-09-15. /// /// /// /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. - /// The name of the schedule. + /// The name of the Schedule. /// A schedule. /// 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 name, DevTestLabScheduleData data, CancellationToken cancellationToken = default) { Argument.AssertNotNullOrEmpty(name, nameof(name)); Argument.AssertNotNull(data, nameof(data)); - using var scope = _devTestLabScheduleSchedulesClientDiagnostics.CreateScope("DevTestLabScheduleCollection.CreateOrUpdate"); + using DiagnosticScope scope = _devTestLabSchedulesClientDiagnostics.CreateScope("DevTestLabScheduleCollection.CreateOrUpdate"); scope.Start(); try { - var response = _devTestLabScheduleSchedulesRestClient.CreateOrUpdate(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, name, data, cancellationToken); - var uri = _devTestLabScheduleSchedulesRestClient.CreateCreateOrUpdateRequestUri(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, name, data); - var rehydrationToken = NextLinkOperationImplementation.GetRehydrationToken(RequestMethod.Put, uri.ToUri(), uri.ToString(), "None", null, OperationFinalStateVia.OriginalUri.ToString()); - var operation = new DevTestLabsArmOperation(Response.FromValue(new DevTestLabScheduleResource(Client, response), response.GetRawResponse()), rehydrationToken); + RequestContext context = new RequestContext + { + CancellationToken = cancellationToken + }; + HttpMessage message = _devTestLabSchedulesRestClient.CreateCreateOrUpdateRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, name, DevTestLabScheduleData.ToRequestContent(data), context); + Response result = Pipeline.ProcessMessage(message, context); + Response response = Response.FromValue(DevTestLabScheduleData.FromResponse(result), result); + RequestUriBuilder uri = message.Request.Uri; + RehydrationToken rehydrationToken = NextLinkOperationImplementation.GetRehydrationToken(RequestMethod.Put, uri.ToUri(), uri.ToString(), "None", null, OperationFinalStateVia.OriginalUri.ToString()); + DevTestLabsArmOperation operation = new DevTestLabsArmOperation(Response.FromValue(new DevTestLabScheduleResource(Client, response.Value), response.GetRawResponse()), rehydrationToken); if (waitUntil == WaitUntil.Completed) + { operation.WaitForCompletion(cancellationToken); + } return operation; } catch (Exception e) @@ -157,39 +168,43 @@ public virtual ArmOperation CreateOrUpdate(WaitUntil /// Get schedule. /// /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/schedules/{name} + /// Request Path. + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/schedules/{name}. /// /// - /// Operation Id - /// Schedules_Get + /// Operation Id. + /// Schedules_Get. /// /// - /// Default Api Version - /// 2018-09-15 - /// - /// - /// Resource - /// + /// Default Api Version. + /// 2018-09-15. /// /// /// - /// The name of the schedule. + /// The name of the Schedule. /// Specify the $expand query. Example: 'properties($select=status)'. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. - public virtual async Task> GetAsync(string name, string expand = null, CancellationToken cancellationToken = default) + /// is an empty string, and was expected to be non-empty. + public virtual async Task> GetAsync(string name, string expand = default, CancellationToken cancellationToken = default) { Argument.AssertNotNullOrEmpty(name, nameof(name)); - using var scope = _devTestLabScheduleSchedulesClientDiagnostics.CreateScope("DevTestLabScheduleCollection.Get"); + using DiagnosticScope scope = _devTestLabSchedulesClientDiagnostics.CreateScope("DevTestLabScheduleCollection.Get"); scope.Start(); try { - var response = await _devTestLabScheduleSchedulesRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, name, expand, cancellationToken).ConfigureAwait(false); + RequestContext context = new RequestContext + { + CancellationToken = cancellationToken + }; + HttpMessage message = _devTestLabSchedulesRestClient.CreateGetRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, name, expand, context); + Response result = await Pipeline.ProcessMessageAsync(message, context).ConfigureAwait(false); + Response response = Response.FromValue(DevTestLabScheduleData.FromResponse(result), result); if (response.Value == null) + { throw new RequestFailedException(response.GetRawResponse()); + } return Response.FromValue(new DevTestLabScheduleResource(Client, response.Value), response.GetRawResponse()); } catch (Exception e) @@ -203,39 +218,43 @@ public virtual async Task> GetAsync(string /// Get schedule. /// /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/schedules/{name} - /// - /// - /// Operation Id - /// Schedules_Get + /// Request Path. + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/schedules/{name}. /// /// - /// Default Api Version - /// 2018-09-15 + /// Operation Id. + /// Schedules_Get. /// /// - /// Resource - /// + /// Default Api Version. + /// 2018-09-15. /// /// /// - /// The name of the schedule. + /// The name of the Schedule. /// Specify the $expand query. Example: 'properties($select=status)'. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. - public virtual Response Get(string name, string expand = null, CancellationToken cancellationToken = default) + /// is an empty string, and was expected to be non-empty. + public virtual Response Get(string name, string expand = default, CancellationToken cancellationToken = default) { Argument.AssertNotNullOrEmpty(name, nameof(name)); - using var scope = _devTestLabScheduleSchedulesClientDiagnostics.CreateScope("DevTestLabScheduleCollection.Get"); + using DiagnosticScope scope = _devTestLabSchedulesClientDiagnostics.CreateScope("DevTestLabScheduleCollection.Get"); scope.Start(); try { - var response = _devTestLabScheduleSchedulesRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, name, expand, cancellationToken); + RequestContext context = new RequestContext + { + CancellationToken = cancellationToken + }; + HttpMessage message = _devTestLabSchedulesRestClient.CreateGetRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, name, expand, context); + Response result = Pipeline.ProcessMessage(message, context); + Response response = Response.FromValue(DevTestLabScheduleData.FromResponse(result), result); if (response.Value == null) + { throw new RequestFailedException(response.GetRawResponse()); + } return Response.FromValue(new DevTestLabScheduleResource(Client, response.Value), response.GetRawResponse()); } catch (Exception e) @@ -249,20 +268,16 @@ public virtual Response Get(string name, string expa /// List schedules in a given lab. /// /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/schedules + /// Request Path. + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/schedules. /// /// - /// Operation Id - /// Schedules_List + /// Operation Id. + /// Schedules_List. /// /// - /// Default Api Version - /// 2018-09-15 - /// - /// - /// Resource - /// + /// Default Api Version. + /// 2018-09-15. /// /// /// @@ -271,32 +286,39 @@ public virtual Response Get(string name, string expa /// The maximum number of resources to return from the operation. Example: '$top=10'. /// The ordering expression for the results, using OData notation. Example: '$orderby=name desc'. /// The cancellation token to use. - /// An async collection of that may take multiple service requests to iterate over. - public virtual AsyncPageable GetAllAsync(string expand = null, string filter = null, int? top = null, string orderby = null, CancellationToken cancellationToken = default) + /// A collection of that may take multiple service requests to iterate over. + public virtual AsyncPageable GetAllAsync(string expand = default, string filter = default, int? top = default, string @orderby = default, CancellationToken cancellationToken = default) { - HttpMessage FirstPageRequest(int? pageSizeHint) => _devTestLabScheduleSchedulesRestClient.CreateListRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, expand, filter, top, orderby); - HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _devTestLabScheduleSchedulesRestClient.CreateListNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName, Id.Name, expand, filter, top, orderby); - return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new DevTestLabScheduleResource(Client, DevTestLabScheduleData.DeserializeDevTestLabScheduleData(e)), _devTestLabScheduleSchedulesClientDiagnostics, Pipeline, "DevTestLabScheduleCollection.GetAll", "value", "nextLink", cancellationToken); + RequestContext context = new RequestContext + { + CancellationToken = cancellationToken + }; + return new AsyncPageableWrapper(new DevTestLabSchedulesGetAllAsyncCollectionResultOfT( + _devTestLabSchedulesRestClient, + Id.SubscriptionId, + Id.ResourceGroupName, + Id.Name, + expand, + filter, + top, + @orderby, + context), data => new DevTestLabScheduleResource(Client, data)); } /// /// List schedules in a given lab. /// /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/schedules - /// - /// - /// Operation Id - /// Schedules_List + /// Request Path. + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/schedules. /// /// - /// Default Api Version - /// 2018-09-15 + /// Operation Id. + /// Schedules_List. /// /// - /// Resource - /// + /// Default Api Version. + /// 2018-09-15. /// /// /// @@ -306,118 +328,73 @@ public virtual AsyncPageable GetAllAsync(string expa /// The ordering expression for the results, using OData notation. Example: '$orderby=name desc'. /// The cancellation token to use. /// A collection of that may take multiple service requests to iterate over. - public virtual Pageable GetAll(string expand = null, string filter = null, int? top = null, string orderby = null, CancellationToken cancellationToken = default) - { - HttpMessage FirstPageRequest(int? pageSizeHint) => _devTestLabScheduleSchedulesRestClient.CreateListRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, expand, filter, top, orderby); - HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _devTestLabScheduleSchedulesRestClient.CreateListNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName, Id.Name, expand, filter, top, orderby); - return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new DevTestLabScheduleResource(Client, DevTestLabScheduleData.DeserializeDevTestLabScheduleData(e)), _devTestLabScheduleSchedulesClientDiagnostics, Pipeline, "DevTestLabScheduleCollection.GetAll", "value", "nextLink", cancellationToken); - } - - /// - /// Lists all applicable schedules - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/schedules/{name}/listApplicable - /// - /// - /// Operation Id - /// Schedules_ListApplicable - /// - /// - /// Default Api Version - /// 2018-09-15 - /// - /// - /// Resource - /// - /// - /// - /// - /// The name of the schedule. - /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. - /// is null. - /// An async collection of that may take multiple service requests to iterate over. - public virtual AsyncPageable GetApplicableAsync(string name, CancellationToken cancellationToken = default) + public virtual Pageable GetAll(string expand = default, string filter = default, int? top = default, string @orderby = default, CancellationToken cancellationToken = default) { - Argument.AssertNotNullOrEmpty(name, nameof(name)); - - HttpMessage FirstPageRequest(int? pageSizeHint) => _devTestLabScheduleSchedulesRestClient.CreateListApplicableRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, name); - HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _devTestLabScheduleSchedulesRestClient.CreateListApplicableNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName, Id.Name, name); - return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new DevTestLabScheduleResource(Client, DevTestLabScheduleData.DeserializeDevTestLabScheduleData(e)), _devTestLabScheduleSchedulesClientDiagnostics, Pipeline, "DevTestLabScheduleCollection.GetApplicable", "value", "nextLink", cancellationToken); - } - - /// - /// Lists all applicable schedules - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/schedules/{name}/listApplicable - /// - /// - /// Operation Id - /// Schedules_ListApplicable - /// - /// - /// Default Api Version - /// 2018-09-15 - /// - /// - /// Resource - /// - /// - /// - /// - /// The name of the schedule. - /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. - /// is null. - /// A collection of that may take multiple service requests to iterate over. - public virtual Pageable GetApplicable(string name, CancellationToken cancellationToken = default) - { - Argument.AssertNotNullOrEmpty(name, nameof(name)); - - HttpMessage FirstPageRequest(int? pageSizeHint) => _devTestLabScheduleSchedulesRestClient.CreateListApplicableRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, name); - HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _devTestLabScheduleSchedulesRestClient.CreateListApplicableNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName, Id.Name, name); - return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new DevTestLabScheduleResource(Client, DevTestLabScheduleData.DeserializeDevTestLabScheduleData(e)), _devTestLabScheduleSchedulesClientDiagnostics, Pipeline, "DevTestLabScheduleCollection.GetApplicable", "value", "nextLink", cancellationToken); + RequestContext context = new RequestContext + { + CancellationToken = cancellationToken + }; + return new PageableWrapper(new DevTestLabSchedulesGetAllCollectionResultOfT( + _devTestLabSchedulesRestClient, + Id.SubscriptionId, + Id.ResourceGroupName, + Id.Name, + expand, + filter, + top, + @orderby, + context), data => new DevTestLabScheduleResource(Client, data)); } /// /// Checks to see if the resource exists in azure. /// /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/schedules/{name} - /// - /// - /// Operation Id - /// Schedules_Get + /// Request Path. + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/schedules/{name}. /// /// - /// Default Api Version - /// 2018-09-15 + /// Operation Id. + /// Schedules_Get. /// /// - /// Resource - /// + /// Default Api Version. + /// 2018-09-15. /// /// /// - /// The name of the schedule. + /// The name of the Schedule. /// Specify the $expand query. Example: 'properties($select=status)'. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. - public virtual async Task> ExistsAsync(string name, string expand = null, CancellationToken cancellationToken = default) + /// is an empty string, and was expected to be non-empty. + public virtual async Task> ExistsAsync(string name, string expand = default, CancellationToken cancellationToken = default) { Argument.AssertNotNullOrEmpty(name, nameof(name)); - using var scope = _devTestLabScheduleSchedulesClientDiagnostics.CreateScope("DevTestLabScheduleCollection.Exists"); + using DiagnosticScope scope = _devTestLabSchedulesClientDiagnostics.CreateScope("DevTestLabScheduleCollection.Exists"); scope.Start(); try { - var response = await _devTestLabScheduleSchedulesRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, name, expand, cancellationToken: cancellationToken).ConfigureAwait(false); + RequestContext context = new RequestContext + { + CancellationToken = cancellationToken + }; + HttpMessage message = _devTestLabSchedulesRestClient.CreateGetRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, name, expand, context); + await Pipeline.SendAsync(message, context.CancellationToken).ConfigureAwait(false); + Response result = message.Response; + Response response = default; + switch (result.Status) + { + case 200: + response = Response.FromValue(DevTestLabScheduleData.FromResponse(result), result); + break; + case 404: + response = Response.FromValue((DevTestLabScheduleData)null, result); + break; + default: + throw new RequestFailedException(result); + } return Response.FromValue(response.Value != null, response.GetRawResponse()); } catch (Exception e) @@ -431,37 +408,51 @@ public virtual async Task> ExistsAsync(string name, string expand /// Checks to see if the resource exists in azure. /// /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/schedules/{name} + /// Request Path. + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/schedules/{name}. /// /// - /// Operation Id - /// Schedules_Get + /// Operation Id. + /// Schedules_Get. /// /// - /// Default Api Version - /// 2018-09-15 - /// - /// - /// Resource - /// + /// Default Api Version. + /// 2018-09-15. /// /// /// - /// The name of the schedule. + /// The name of the Schedule. /// Specify the $expand query. Example: 'properties($select=status)'. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. - public virtual Response Exists(string name, string expand = null, CancellationToken cancellationToken = default) + /// is an empty string, and was expected to be non-empty. + public virtual Response Exists(string name, string expand = default, CancellationToken cancellationToken = default) { Argument.AssertNotNullOrEmpty(name, nameof(name)); - using var scope = _devTestLabScheduleSchedulesClientDiagnostics.CreateScope("DevTestLabScheduleCollection.Exists"); + using DiagnosticScope scope = _devTestLabSchedulesClientDiagnostics.CreateScope("DevTestLabScheduleCollection.Exists"); scope.Start(); try { - var response = _devTestLabScheduleSchedulesRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, name, expand, cancellationToken: cancellationToken); + RequestContext context = new RequestContext + { + CancellationToken = cancellationToken + }; + HttpMessage message = _devTestLabSchedulesRestClient.CreateGetRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, name, expand, context); + Pipeline.Send(message, context.CancellationToken); + Response result = message.Response; + Response response = default; + switch (result.Status) + { + case 200: + response = Response.FromValue(DevTestLabScheduleData.FromResponse(result), result); + break; + case 404: + response = Response.FromValue((DevTestLabScheduleData)null, result); + break; + default: + throw new RequestFailedException(result); + } return Response.FromValue(response.Value != null, response.GetRawResponse()); } catch (Exception e) @@ -475,39 +466,55 @@ public virtual Response Exists(string name, string expand = null, Cancella /// Tries to get details for this resource from the service. /// /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/schedules/{name} - /// - /// - /// Operation Id - /// Schedules_Get + /// Request Path. + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/schedules/{name}. /// /// - /// Default Api Version - /// 2018-09-15 + /// Operation Id. + /// Schedules_Get. /// /// - /// Resource - /// + /// Default Api Version. + /// 2018-09-15. /// /// /// - /// The name of the schedule. + /// The name of the Schedule. /// Specify the $expand query. Example: 'properties($select=status)'. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. - public virtual async Task> GetIfExistsAsync(string name, string expand = null, CancellationToken cancellationToken = default) + /// is an empty string, and was expected to be non-empty. + public virtual async Task> GetIfExistsAsync(string name, string expand = default, CancellationToken cancellationToken = default) { Argument.AssertNotNullOrEmpty(name, nameof(name)); - using var scope = _devTestLabScheduleSchedulesClientDiagnostics.CreateScope("DevTestLabScheduleCollection.GetIfExists"); + using DiagnosticScope scope = _devTestLabSchedulesClientDiagnostics.CreateScope("DevTestLabScheduleCollection.GetIfExists"); scope.Start(); try { - var response = await _devTestLabScheduleSchedulesRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, name, expand, cancellationToken: cancellationToken).ConfigureAwait(false); + RequestContext context = new RequestContext + { + CancellationToken = cancellationToken + }; + HttpMessage message = _devTestLabSchedulesRestClient.CreateGetRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, name, expand, context); + await Pipeline.SendAsync(message, context.CancellationToken).ConfigureAwait(false); + Response result = message.Response; + Response response = default; + switch (result.Status) + { + case 200: + response = Response.FromValue(DevTestLabScheduleData.FromResponse(result), result); + break; + case 404: + response = Response.FromValue((DevTestLabScheduleData)null, result); + break; + default: + throw new RequestFailedException(result); + } if (response.Value == null) + { return new NoValueResponse(response.GetRawResponse()); + } return Response.FromValue(new DevTestLabScheduleResource(Client, response.Value), response.GetRawResponse()); } catch (Exception e) @@ -521,39 +528,55 @@ public virtual async Task> GetIfExi /// Tries to get details for this resource from the service. /// /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/schedules/{name} + /// Request Path. + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/schedules/{name}. /// /// - /// Operation Id - /// Schedules_Get + /// Operation Id. + /// Schedules_Get. /// /// - /// Default Api Version - /// 2018-09-15 - /// - /// - /// Resource - /// + /// Default Api Version. + /// 2018-09-15. /// /// /// - /// The name of the schedule. + /// The name of the Schedule. /// Specify the $expand query. Example: 'properties($select=status)'. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. - public virtual NullableResponse GetIfExists(string name, string expand = null, CancellationToken cancellationToken = default) + /// is an empty string, and was expected to be non-empty. + public virtual NullableResponse GetIfExists(string name, string expand = default, CancellationToken cancellationToken = default) { Argument.AssertNotNullOrEmpty(name, nameof(name)); - using var scope = _devTestLabScheduleSchedulesClientDiagnostics.CreateScope("DevTestLabScheduleCollection.GetIfExists"); + using DiagnosticScope scope = _devTestLabSchedulesClientDiagnostics.CreateScope("DevTestLabScheduleCollection.GetIfExists"); scope.Start(); try { - var response = _devTestLabScheduleSchedulesRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, name, expand, cancellationToken: cancellationToken); + RequestContext context = new RequestContext + { + CancellationToken = cancellationToken + }; + HttpMessage message = _devTestLabSchedulesRestClient.CreateGetRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, name, expand, context); + Pipeline.Send(message, context.CancellationToken); + Response result = message.Response; + Response response = default; + switch (result.Status) + { + case 200: + response = Response.FromValue(DevTestLabScheduleData.FromResponse(result), result); + break; + case 404: + response = Response.FromValue((DevTestLabScheduleData)null, result); + break; + default: + throw new RequestFailedException(result); + } if (response.Value == null) + { return new NoValueResponse(response.GetRawResponse()); + } return Response.FromValue(new DevTestLabScheduleResource(Client, response.Value), response.GetRawResponse()); } catch (Exception e) @@ -573,6 +596,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/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/DevTestLabScheduleData.Serialization.cs b/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/DevTestLabScheduleData.Serialization.cs index 0c413625a009..4a7bab57f520 100644 --- a/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/DevTestLabScheduleData.Serialization.cs +++ b/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/DevTestLabScheduleData.Serialization.cs @@ -10,16 +10,47 @@ using System.Collections.Generic; using System.Text; using System.Text.Json; +using Azure; using Azure.Core; using Azure.ResourceManager.DevTestLabs.Models; using Azure.ResourceManager.Models; namespace Azure.ResourceManager.DevTestLabs { - public partial class DevTestLabScheduleData : IUtf8JsonSerializable, IJsonModel + /// A schedule. + public partial class DevTestLabScheduleData : TrackedResourceData, IJsonModel { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + /// Initializes a new instance of for deserialization. + internal DevTestLabScheduleData() + { + } + + /// 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)) + { + return DeserializeDevTestLabScheduleData(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(DevTestLabScheduleData)} does not support reading '{options.Format}' format."); + } + } + + /// The to deserialize the from. + internal static DevTestLabScheduleData FromResponse(Response response) + { + using JsonDocument document = JsonDocument.Parse(response.Content, ModelSerializationExtensions.JsonDocumentOptions); + return DeserializeDevTestLabScheduleData(document.RootElement, ModelSerializationExtensions.WireOptions); + } + /// The JSON writer. + /// The client options for reading and writing models. void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) { writer.WriteStartObject(); @@ -31,283 +62,153 @@ void IJsonModel.Write(Utf8JsonWriter writer, ModelReader /// 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(DevTestLabScheduleData)} does not support writing '{format}' format."); } - base.JsonModelWriteCore(writer, options); writer.WritePropertyName("properties"u8); - writer.WriteStartObject(); - if (Optional.IsDefined(Status)) - { - writer.WritePropertyName("status"u8); - writer.WriteStringValue(Status.Value.ToString()); - } - if (Optional.IsDefined(TaskType)) - { - writer.WritePropertyName("taskType"u8); - writer.WriteStringValue(TaskType); - } - if (Optional.IsDefined(WeeklyRecurrence)) - { - writer.WritePropertyName("weeklyRecurrence"u8); - writer.WriteObjectValue(WeeklyRecurrence, options); - } - if (Optional.IsDefined(DailyRecurrence)) + writer.WriteObjectValue(Properties, options); + if (Optional.IsCollectionDefined(Tags)) { - writer.WritePropertyName("dailyRecurrence"u8); - writer.WriteObjectValue(DailyRecurrence, options); - } - if (Optional.IsDefined(HourlyRecurrence)) - { - writer.WritePropertyName("hourlyRecurrence"u8); - writer.WriteObjectValue(HourlyRecurrence, options); - } - if (Optional.IsDefined(TimeZoneId)) - { - writer.WritePropertyName("timeZoneId"u8); - writer.WriteStringValue(TimeZoneId); - } - if (Optional.IsDefined(NotificationSettings)) - { - writer.WritePropertyName("notificationSettings"u8); - writer.WriteObjectValue(NotificationSettings, options); - } - if (options.Format != "W" && Optional.IsDefined(CreatedOn)) - { - writer.WritePropertyName("createdDate"u8); - writer.WriteStringValue(CreatedOn.Value, "O"); - } - if (Optional.IsDefined(TargetResourceId)) - { - writer.WritePropertyName("targetResourceId"u8); - writer.WriteStringValue(TargetResourceId); - } - if (options.Format != "W" && Optional.IsDefined(ProvisioningState)) - { - writer.WritePropertyName("provisioningState"u8); - writer.WriteStringValue(ProvisioningState); - } - if (options.Format != "W" && Optional.IsDefined(UniqueIdentifier)) - { - writer.WritePropertyName("uniqueIdentifier"u8); - writer.WriteStringValue(UniqueIdentifier.Value); + writer.WritePropertyName("tags"u8); + writer.WriteStartObject(); + foreach (var item in Tags) + { + writer.WritePropertyName(item.Key); + if (item.Value == null) + { + writer.WriteNullValue(); + continue; + } + writer.WriteStringValue(item.Value); + } + writer.WriteEndObject(); } - writer.WriteEndObject(); } - DevTestLabScheduleData IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + /// The JSON reader. + /// The client options for reading and writing models. + DevTestLabScheduleData IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) => (DevTestLabScheduleData)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(DevTestLabScheduleData)} does not support reading '{format}' format."); } - using JsonDocument document = JsonDocument.ParseValue(ref reader); return DeserializeDevTestLabScheduleData(document.RootElement, options); } - internal static DevTestLabScheduleData DeserializeDevTestLabScheduleData(JsonElement element, ModelReaderWriterOptions options = null) + /// The JSON element to deserialize. + /// The client options for reading and writing models. + internal static DevTestLabScheduleData DeserializeDevTestLabScheduleData(JsonElement element, ModelReaderWriterOptions options) { - options ??= ModelSerializationExtensions.WireOptions; - if (element.ValueKind == JsonValueKind.Null) { return null; } - IDictionary tags = default; - AzureLocation location = default; ResourceIdentifier id = default; string name = default; - ResourceType type = default; + ResourceType resourceType = default; SystemData systemData = default; - DevTestLabEnableStatus? status = default; - string taskType = default; - DevTestLabWeekDetails weeklyRecurrence = default; - DayDetails dailyRecurrence = default; - HourDetails hourlyRecurrence = default; - string timeZoneId = default; - DevTestLabNotificationSettings notificationSettings = default; - DateTimeOffset? createdDate = default; - string targetResourceId = default; - string provisioningState = default; - Guid? uniqueIdentifier = default; - IDictionary serializedAdditionalRawData = default; - Dictionary rawDataDictionary = new Dictionary(); - foreach (var property in element.EnumerateObject()) + IDictionary additionalBinaryDataProperties = new ChangeTrackingDictionary(); + AzureLocation location = default; + ScheduleProperties properties = default; + IDictionary tags = default; + foreach (var prop in element.EnumerateObject()) { - if (property.NameEquals("tags"u8)) + if (prop.NameEquals("id"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()) - { - dictionary.Add(property0.Name, property0.Value.GetString()); - } - tags = dictionary; + id = new ResourceIdentifier(prop.Value.GetString()); continue; } - if (property.NameEquals("location"u8)) + if (prop.NameEquals("name"u8)) { - location = new AzureLocation(property.Value.GetString()); + name = prop.Value.GetString(); continue; } - if (property.NameEquals("id"u8)) + if (prop.NameEquals("type"u8)) { - id = new ResourceIdentifier(property.Value.GetString()); + if (prop.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + resourceType = new ResourceType(prop.Value.GetString()); continue; } - if (property.NameEquals("name"u8)) + if (prop.NameEquals("systemData"u8)) { - name = property.Value.GetString(); + if (prop.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + systemData = ModelReaderWriter.Read(new BinaryData(Encoding.UTF8.GetBytes(prop.Value.GetRawText())), ModelSerializationExtensions.WireOptions, AzureResourceManagerDevTestLabsContext.Default); 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) - { - continue; - } - systemData = ModelReaderWriter.Read(new BinaryData(Encoding.UTF8.GetBytes(property.Value.GetRawText())), ModelSerializationExtensions.WireOptions, AzureResourceManagerDevTestLabsContext.Default); + properties = ScheduleProperties.DeserializeScheduleProperties(prop.Value, options); continue; } - if (property.NameEquals("properties"u8)) + if (prop.NameEquals("tags"u8)) { - if (property.Value.ValueKind == JsonValueKind.Null) + if (prop.Value.ValueKind == JsonValueKind.Null) { - property.ThrowNonNullablePropertyIsNull(); continue; } - foreach (var property0 in property.Value.EnumerateObject()) + Dictionary dictionary = new Dictionary(); + foreach (var prop0 in prop.Value.EnumerateObject()) { - if (property0.NameEquals("status"u8)) - { - if (property0.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - status = new DevTestLabEnableStatus(property0.Value.GetString()); - continue; - } - if (property0.NameEquals("taskType"u8)) - { - taskType = property0.Value.GetString(); - continue; - } - if (property0.NameEquals("weeklyRecurrence"u8)) - { - if (property0.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - weeklyRecurrence = DevTestLabWeekDetails.DeserializeDevTestLabWeekDetails(property0.Value, options); - continue; - } - if (property0.NameEquals("dailyRecurrence"u8)) - { - if (property0.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - dailyRecurrence = DayDetails.DeserializeDayDetails(property0.Value, options); - continue; - } - if (property0.NameEquals("hourlyRecurrence"u8)) - { - if (property0.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - hourlyRecurrence = HourDetails.DeserializeHourDetails(property0.Value, options); - continue; - } - if (property0.NameEquals("timeZoneId"u8)) - { - timeZoneId = property0.Value.GetString(); - continue; - } - if (property0.NameEquals("notificationSettings"u8)) + if (prop0.Value.ValueKind == JsonValueKind.Null) { - if (property0.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - notificationSettings = DevTestLabNotificationSettings.DeserializeDevTestLabNotificationSettings(property0.Value, options); - continue; + dictionary.Add(prop0.Name, null); } - if (property0.NameEquals("createdDate"u8)) + else { - if (property0.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - createdDate = property0.Value.GetDateTimeOffset("O"); - continue; - } - if (property0.NameEquals("targetResourceId"u8)) - { - targetResourceId = property0.Value.GetString(); - continue; - } - if (property0.NameEquals("provisioningState"u8)) - { - provisioningState = property0.Value.GetString(); - continue; - } - if (property0.NameEquals("uniqueIdentifier"u8)) - { - if (property0.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - uniqueIdentifier = property0.Value.GetGuid(); - continue; + dictionary.Add(prop0.Name, prop0.Value.GetString()); } } + tags = dictionary; 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 DevTestLabScheduleData( id, name, - type, + resourceType, systemData, - tags ?? new ChangeTrackingDictionary(), + additionalBinaryDataProperties, location, - status, - taskType, - weeklyRecurrence, - dailyRecurrence, - hourlyRecurrence, - timeZoneId, - notificationSettings, - createdDate, - targetResourceId, - provisioningState, - uniqueIdentifier, - serializedAdditionalRawData); + properties, + tags ?? new ChangeTrackingDictionary()); } - 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": @@ -317,22 +218,23 @@ BinaryData IPersistableModel.Write(ModelReaderWriterOpti } } - DevTestLabScheduleData 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. + DevTestLabScheduleData IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) => (DevTestLabScheduleData)PersistableModelCreateCore(data, options); - switch (format) + /// The client options for reading and writing models. + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + + /// The to serialize into . + internal static RequestContent ToRequestContent(DevTestLabScheduleData devTestLabScheduleData) + { + if (devTestLabScheduleData == null) { - case "J": - { - using JsonDocument document = JsonDocument.Parse(data, ModelSerializationExtensions.JsonDocumentOptions); - return DeserializeDevTestLabScheduleData(document.RootElement, options); - } - default: - throw new FormatException($"The model {nameof(DevTestLabScheduleData)} does not support reading '{options.Format}' format."); + return null; } + Utf8JsonRequestContent content = new Utf8JsonRequestContent(); + content.JsonWriter.WriteObjectValue(devTestLabScheduleData, ModelSerializationExtensions.WireOptions); + return content; } - - string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; } } diff --git a/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/DevTestLabScheduleData.cs b/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/DevTestLabScheduleData.cs index 0388dc264a1b..14efa311dfc1 100644 --- a/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/DevTestLabScheduleData.cs +++ b/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/DevTestLabScheduleData.cs @@ -13,135 +13,198 @@ namespace Azure.ResourceManager.DevTestLabs { - /// - /// A class representing the DevTestLabSchedule data model. - /// A schedule. - /// + /// A schedule. public partial class DevTestLabScheduleData : 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 DevTestLabScheduleData(AzureLocation location) : base(location) { + } /// Initializes a new instance of . - /// The id. - /// The name. - /// The resourceType. - /// The systemData. - /// The tags. - /// The location. - /// The status of the schedule (i.e. Enabled, Disabled). - /// The task type of the schedule (e.g. LabVmsShutdownTask, LabVmAutoStart). - /// If the schedule will occur only some days of the week, specify the weekly recurrence. - /// If the schedule will occur once each day of the week, specify the daily recurrence. - /// If the schedule will occur multiple times a day, specify the hourly recurrence. - /// The time zone ID (e.g. Pacific Standard time). - /// Notification settings. - /// The creation date of the schedule. - /// The resource ID to which the schedule belongs. - /// The provisioning status of the resource. - /// The unique immutable identifier of a resource (Guid). - /// Keeps track of any properties unknown to the library. - internal DevTestLabScheduleData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, IDictionary tags, AzureLocation location, DevTestLabEnableStatus? status, string taskType, DevTestLabWeekDetails weeklyRecurrence, DayDetails dailyRecurrence, HourDetails hourlyRecurrence, string timeZoneId, DevTestLabNotificationSettings notificationSettings, DateTimeOffset? createdOn, string targetResourceId, string provisioningState, Guid? uniqueIdentifier, IDictionary serializedAdditionalRawData) : base(id, name, resourceType, systemData, tags, 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. + /// The geo-location where the resource lives. + /// The properties of the resource. + /// Resource tags. + internal DevTestLabScheduleData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, IDictionary additionalBinaryDataProperties, AzureLocation location, ScheduleProperties properties, IDictionary tags) : base(id, name, resourceType, systemData, tags, location) { - Status = status; - TaskType = taskType; - WeeklyRecurrence = weeklyRecurrence; - DailyRecurrence = dailyRecurrence; - HourlyRecurrence = hourlyRecurrence; - TimeZoneId = timeZoneId; - NotificationSettings = notificationSettings; - CreatedOn = createdOn; - TargetResourceId = targetResourceId; - ProvisioningState = provisioningState; - UniqueIdentifier = uniqueIdentifier; - _serializedAdditionalRawData = serializedAdditionalRawData; + _additionalBinaryDataProperties = additionalBinaryDataProperties; + Properties = properties; } - /// Initializes a new instance of for deserialization. - internal DevTestLabScheduleData() + /// The properties of the resource. + internal ScheduleProperties Properties { get; set; } + + /// The status of the schedule (i.e. Enabled, Disabled). + public DevTestLabEnableStatus? Status { + get + { + return Properties is null ? default : Properties.Status; + } + set + { + if (Properties is null) + { + Properties = new ScheduleProperties(); + } + Properties.Status = value.Value; + } } - /// The status of the schedule (i.e. Enabled, Disabled). - public DevTestLabEnableStatus? Status { get; set; } /// The task type of the schedule (e.g. LabVmsShutdownTask, LabVmAutoStart). - public string TaskType { get; set; } + public string TaskType + { + get + { + return Properties is null ? default : Properties.TaskType; + } + set + { + if (Properties is null) + { + Properties = new ScheduleProperties(); + } + Properties.TaskType = value; + } + } + /// If the schedule will occur only some days of the week, specify the weekly recurrence. - public DevTestLabWeekDetails WeeklyRecurrence { get; set; } - /// If the schedule will occur once each day of the week, specify the daily recurrence. - internal DayDetails DailyRecurrence { get; set; } - /// The time of day the schedule will occur. - public string DailyRecurrenceTime + public DevTestLabWeekDetails WeeklyRecurrence { - get => DailyRecurrence is null ? default : DailyRecurrence.Time; + get + { + return Properties is null ? default : Properties.WeeklyRecurrence; + } set { - if (DailyRecurrence is null) - DailyRecurrence = new DayDetails(); - DailyRecurrence.Time = value; + if (Properties is null) + { + Properties = new ScheduleProperties(); + } + Properties.WeeklyRecurrence = value; } } - /// If the schedule will occur multiple times a day, specify the hourly recurrence. - internal HourDetails HourlyRecurrence { get; set; } - /// Minutes of the hour the schedule will run. - public int? HourlyRecurrenceMinute + /// The time zone ID (e.g. China Standard Time, Greenland Standard Time, Pacific Standard time, etc.). The possible values for this property can be found in `IReadOnlyCollection<string> TimeZoneConverter.TZConvert.KnownWindowsTimeZoneIds` (https://github.com/mattjohnsonpint/TimeZoneConverter/blob/main/README.md). + public string TimeZoneId { - get => HourlyRecurrence is null ? default : HourlyRecurrence.Minute; + get + { + return Properties is null ? default : Properties.TimeZoneId; + } set { - if (HourlyRecurrence is null) - HourlyRecurrence = new HourDetails(); - HourlyRecurrence.Minute = value; + if (Properties is null) + { + Properties = new ScheduleProperties(); + } + Properties.TimeZoneId = value; } } - /// The time zone ID (e.g. Pacific Standard time). - public string TimeZoneId { get; set; } /// Notification settings. - public DevTestLabNotificationSettings NotificationSettings { get; set; } + public DevTestLabNotificationSettings NotificationSettings + { + get + { + return Properties is null ? default : Properties.NotificationSettings; + } + set + { + if (Properties is null) + { + Properties = new ScheduleProperties(); + } + Properties.NotificationSettings = value; + } + } + /// The creation date of the schedule. - public DateTimeOffset? CreatedOn { get; } + public DateTimeOffset? CreatedOn + { + get + { + return Properties is null ? default : Properties.CreatedOn; + } + } + /// The resource ID to which the schedule belongs. - public string TargetResourceId { get; set; } + public string TargetResourceId + { + get + { + return Properties is null ? default : Properties.TargetResourceId; + } + set + { + if (Properties is null) + { + Properties = new ScheduleProperties(); + } + Properties.TargetResourceId = value; + } + } + /// The provisioning status of the resource. - public string ProvisioningState { get; } + public string ProvisioningState + { + get + { + return Properties is null ? default : Properties.ProvisioningState; + } + } + /// The unique immutable identifier of a resource (Guid). - public Guid? UniqueIdentifier { get; } + public Guid? UniqueIdentifier + { + get + { + return Properties is null ? default : Properties.UniqueIdentifier; + } + } + + /// The time of day the schedule will occur. + public string DailyRecurrenceTime + { + get + { + return Properties is null ? default : Properties.DailyRecurrenceTime; + } + set + { + if (Properties is null) + { + Properties = new ScheduleProperties(); + } + Properties.DailyRecurrenceTime = value; + } + } + + /// Minutes of the hour the schedule will run. + public int? HourlyRecurrenceMinute + { + get + { + return Properties is null ? default : Properties.HourlyRecurrenceMinute; + } + set + { + if (Properties is null) + { + Properties = new ScheduleProperties(); + } + Properties.HourlyRecurrenceMinute = value.Value; + } + } } } diff --git a/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/DevTestLabScheduleResource.Serialization.cs b/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/DevTestLabScheduleResource.Serialization.cs index 8b98feac1744..aca666aec6de 100644 --- a/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/DevTestLabScheduleResource.Serialization.cs +++ b/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/DevTestLabScheduleResource.Serialization.cs @@ -8,22 +8,33 @@ using System; using System.ClientModel.Primitives; using System.Text.Json; +using Azure.ResourceManager; namespace Azure.ResourceManager.DevTestLabs { - public partial class DevTestLabScheduleResource : IJsonModel + /// + public partial class DevTestLabScheduleResource : ArmResource, IJsonModel { - private static DevTestLabScheduleData s_dataDeserializationInstance; - private static DevTestLabScheduleData DataDeserializationInstance => s_dataDeserializationInstance ??= new(); + private static IJsonModel s_dataDeserializationInstance; + private static IJsonModel DataDeserializationInstance => s_dataDeserializationInstance ??= new DevTestLabScheduleData(); + + /// 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); - DevTestLabScheduleData 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. + DevTestLabScheduleData 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, AzureResourceManagerDevTestLabsContext.Default); + /// The binary data to be processed. + /// The client options for reading and writing models. DevTestLabScheduleData IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) => ModelReaderWriter.Read(data, options, AzureResourceManagerDevTestLabsContext.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/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/DevTestLabScheduleResource.cs b/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/DevTestLabScheduleResource.cs index 31b9ec7039db..8395dec18dc2 100644 --- a/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/DevTestLabScheduleResource.cs +++ b/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/DevTestLabScheduleResource.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.DevTestLabs.Models; +using Azure.ResourceManager.Resources; namespace Azure.ResourceManager.DevTestLabs { /// - /// A Class representing a DevTestLabSchedule 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 GetDevTestLabScheduleResource method. - /// Otherwise you can get one from its parent resource using the GetDevTestLabSchedule method. + /// A class representing a DevTestLabSchedule 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 GetDevTestLabSchedules method. /// public partial class DevTestLabScheduleResource : ArmResource { - /// Generate the resource identifier of a instance. - /// The subscriptionId. - /// The resourceGroupName. - /// The labName. - /// The name. - public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string labName, string name) - { - var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/schedules/{name}"; - return new ResourceIdentifier(resourceId); - } - - private readonly ClientDiagnostics _devTestLabScheduleSchedulesClientDiagnostics; - private readonly SchedulesRestOperations _devTestLabScheduleSchedulesRestClient; + private readonly ClientDiagnostics _devTestLabSchedulesClientDiagnostics; + private readonly DevTestLabSchedules _devTestLabSchedulesRestClient; private readonly DevTestLabScheduleData _data; - /// Gets the resource type for the operations. public static readonly ResourceType ResourceType = "Microsoft.DevTestLab/labs/schedules"; - /// Initializes a new instance of the class for mocking. + /// Initializes a new instance of DevTestLabScheduleResource for mocking. protected DevTestLabScheduleResource() { } - /// 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 DevTestLabScheduleResource(ArmClient client, DevTestLabScheduleData data) : this(client, data.Id) @@ -56,72 +46,94 @@ internal DevTestLabScheduleResource(ArmClient client, DevTestLabScheduleData dat _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 DevTestLabScheduleResource(ArmClient client, ResourceIdentifier id) : base(client, id) { - _devTestLabScheduleSchedulesClientDiagnostics = new ClientDiagnostics("Azure.ResourceManager.DevTestLabs", ResourceType.Namespace, Diagnostics); - TryGetApiVersion(ResourceType, out string devTestLabScheduleSchedulesApiVersion); - _devTestLabScheduleSchedulesRestClient = new SchedulesRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, devTestLabScheduleSchedulesApiVersion); -#if DEBUG - ValidateResourceId(Id); -#endif + TryGetApiVersion(ResourceType, out string devTestLabScheduleApiVersion); + _devTestLabSchedulesClientDiagnostics = new ClientDiagnostics("Azure.ResourceManager.DevTestLabs", ResourceType.Namespace, Diagnostics); + _devTestLabSchedulesRestClient = new DevTestLabSchedules(_devTestLabSchedulesClientDiagnostics, Pipeline, Endpoint, devTestLabScheduleApiVersion ?? "2018-09-15"); + 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 DevTestLabScheduleData 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 labName. + /// The name. + public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string labName, string name) + { + string resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/schedules/{name}"; + 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 schedule. /// /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/schedules/{name} + /// Request Path. + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/schedules/{name}. /// /// - /// Operation Id - /// Schedules_Get + /// Operation Id. + /// Schedules_Get. /// /// - /// Default Api Version - /// 2018-09-15 + /// Default Api Version. + /// 2018-09-15. /// /// - /// Resource - /// + /// Resource. + /// . /// /// /// /// Specify the $expand query. Example: 'properties($select=status)'. /// The cancellation token to use. - public virtual async Task> GetAsync(string expand = null, CancellationToken cancellationToken = default) + public virtual async Task> GetAsync(string expand = default, CancellationToken cancellationToken = default) { - using var scope = _devTestLabScheduleSchedulesClientDiagnostics.CreateScope("DevTestLabScheduleResource.Get"); + using DiagnosticScope scope = _devTestLabSchedulesClientDiagnostics.CreateScope("DevTestLabScheduleResource.Get"); scope.Start(); try { - var response = await _devTestLabScheduleSchedulesRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, expand, cancellationToken).ConfigureAwait(false); + RequestContext context = new RequestContext + { + CancellationToken = cancellationToken + }; + HttpMessage message = _devTestLabSchedulesRestClient.CreateGetRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, expand, context); + Response result = await Pipeline.ProcessMessageAsync(message, context).ConfigureAwait(false); + Response response = Response.FromValue(DevTestLabScheduleData.FromResponse(result), result); if (response.Value == null) + { throw new RequestFailedException(response.GetRawResponse()); + } return Response.FromValue(new DevTestLabScheduleResource(Client, response.Value), response.GetRawResponse()); } catch (Exception e) @@ -135,34 +147,42 @@ public virtual async Task> GetAsync(string /// Get schedule. /// /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/schedules/{name} + /// Request Path. + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/schedules/{name}. /// /// - /// Operation Id - /// Schedules_Get + /// Operation Id. + /// Schedules_Get. /// /// - /// Default Api Version - /// 2018-09-15 + /// Default Api Version. + /// 2018-09-15. /// /// - /// Resource - /// + /// Resource. + /// . /// /// /// /// Specify the $expand query. Example: 'properties($select=status)'. /// The cancellation token to use. - public virtual Response Get(string expand = null, CancellationToken cancellationToken = default) + public virtual Response Get(string expand = default, CancellationToken cancellationToken = default) { - using var scope = _devTestLabScheduleSchedulesClientDiagnostics.CreateScope("DevTestLabScheduleResource.Get"); + using DiagnosticScope scope = _devTestLabSchedulesClientDiagnostics.CreateScope("DevTestLabScheduleResource.Get"); scope.Start(); try { - var response = _devTestLabScheduleSchedulesRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, expand, cancellationToken); + RequestContext context = new RequestContext + { + CancellationToken = cancellationToken + }; + HttpMessage message = _devTestLabSchedulesRestClient.CreateGetRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, expand, context); + Response result = Pipeline.ProcessMessage(message, context); + Response response = Response.FromValue(DevTestLabScheduleData.FromResponse(result), result); if (response.Value == null) + { throw new RequestFailedException(response.GetRawResponse()); + } return Response.FromValue(new DevTestLabScheduleResource(Client, response.Value), response.GetRawResponse()); } catch (Exception e) @@ -173,41 +193,49 @@ public virtual Response Get(string expand = null, Ca } /// - /// Delete schedule. + /// Allows modifying tags of schedules. All other properties will be ignored. /// /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/schedules/{name} + /// Request Path. + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/schedules/{name}. /// /// - /// Operation Id - /// Schedules_Delete + /// Operation Id. + /// Schedules_Update. /// /// - /// Default Api Version - /// 2018-09-15 + /// Default Api Version. + /// 2018-09-15. /// /// - /// Resource - /// + /// Resource. + /// . /// /// /// - /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. + /// A schedule. /// The cancellation token to use. - public virtual async Task DeleteAsync(WaitUntil waitUntil, CancellationToken cancellationToken = default) + /// is null. + public virtual async Task> UpdateAsync(DevTestLabSchedulePatch patch, CancellationToken cancellationToken = default) { - using var scope = _devTestLabScheduleSchedulesClientDiagnostics.CreateScope("DevTestLabScheduleResource.Delete"); + Argument.AssertNotNull(patch, nameof(patch)); + + using DiagnosticScope scope = _devTestLabSchedulesClientDiagnostics.CreateScope("DevTestLabScheduleResource.Update"); scope.Start(); try { - var response = await _devTestLabScheduleSchedulesRestClient.DeleteAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, cancellationToken).ConfigureAwait(false); - var uri = _devTestLabScheduleSchedulesRestClient.CreateDeleteRequestUri(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name); - var rehydrationToken = NextLinkOperationImplementation.GetRehydrationToken(RequestMethod.Delete, uri.ToUri(), uri.ToString(), "None", null, OperationFinalStateVia.OriginalUri.ToString()); - var operation = new DevTestLabsArmOperation(response, rehydrationToken); - if (waitUntil == WaitUntil.Completed) - await operation.WaitForCompletionResponseAsync(cancellationToken).ConfigureAwait(false); - return operation; + RequestContext context = new RequestContext + { + CancellationToken = cancellationToken + }; + HttpMessage message = _devTestLabSchedulesRestClient.CreateUpdateRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, DevTestLabSchedulePatch.ToRequestContent(patch), context); + Response result = await Pipeline.ProcessMessageAsync(message, context).ConfigureAwait(false); + Response response = Response.FromValue(DevTestLabScheduleData.FromResponse(result), result); + if (response.Value == null) + { + throw new RequestFailedException(response.GetRawResponse()); + } + return Response.FromValue(new DevTestLabScheduleResource(Client, response.Value), response.GetRawResponse()); } catch (Exception e) { @@ -217,41 +245,49 @@ public virtual async Task DeleteAsync(WaitUntil waitUntil, Cancell } /// - /// Delete schedule. + /// Allows modifying tags of schedules. All other properties will be ignored. /// /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/schedules/{name} + /// Request Path. + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/schedules/{name}. /// /// - /// Operation Id - /// Schedules_Delete + /// Operation Id. + /// Schedules_Update. /// /// - /// Default Api Version - /// 2018-09-15 + /// Default Api Version. + /// 2018-09-15. /// /// - /// Resource - /// + /// Resource. + /// . /// /// /// - /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. + /// A schedule. /// The cancellation token to use. - public virtual ArmOperation Delete(WaitUntil waitUntil, CancellationToken cancellationToken = default) + /// is null. + public virtual Response Update(DevTestLabSchedulePatch patch, CancellationToken cancellationToken = default) { - using var scope = _devTestLabScheduleSchedulesClientDiagnostics.CreateScope("DevTestLabScheduleResource.Delete"); + Argument.AssertNotNull(patch, nameof(patch)); + + using DiagnosticScope scope = _devTestLabSchedulesClientDiagnostics.CreateScope("DevTestLabScheduleResource.Update"); scope.Start(); try { - var response = _devTestLabScheduleSchedulesRestClient.Delete(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, cancellationToken); - var uri = _devTestLabScheduleSchedulesRestClient.CreateDeleteRequestUri(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name); - var rehydrationToken = NextLinkOperationImplementation.GetRehydrationToken(RequestMethod.Delete, uri.ToUri(), uri.ToString(), "None", null, OperationFinalStateVia.OriginalUri.ToString()); - var operation = new DevTestLabsArmOperation(response, rehydrationToken); - if (waitUntil == WaitUntil.Completed) - operation.WaitForCompletionResponse(cancellationToken); - return operation; + RequestContext context = new RequestContext + { + CancellationToken = cancellationToken + }; + HttpMessage message = _devTestLabSchedulesRestClient.CreateUpdateRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, DevTestLabSchedulePatch.ToRequestContent(patch), context); + Response result = Pipeline.ProcessMessage(message, context); + Response response = Response.FromValue(DevTestLabScheduleData.FromResponse(result), result); + if (response.Value == null) + { + throw new RequestFailedException(response.GetRawResponse()); + } + return Response.FromValue(new DevTestLabScheduleResource(Client, response.Value), response.GetRawResponse()); } catch (Exception e) { @@ -261,39 +297,48 @@ public virtual ArmOperation Delete(WaitUntil waitUntil, CancellationToken cancel } /// - /// Allows modifying tags of schedules. All other properties will be ignored. + /// Delete schedule. /// /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/schedules/{name} + /// Request Path. + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/schedules/{name}. /// /// - /// Operation Id - /// Schedules_Update + /// Operation Id. + /// Schedules_Delete. /// /// - /// Default Api Version - /// 2018-09-15 + /// Default Api Version. + /// 2018-09-15. /// /// - /// Resource - /// + /// Resource. + /// . /// /// /// - /// A schedule. + /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. /// The cancellation token to use. - /// is null. - public virtual async Task> UpdateAsync(DevTestLabSchedulePatch patch, CancellationToken cancellationToken = default) + public virtual async Task DeleteAsync(WaitUntil waitUntil, CancellationToken cancellationToken = default) { - Argument.AssertNotNull(patch, nameof(patch)); - - using var scope = _devTestLabScheduleSchedulesClientDiagnostics.CreateScope("DevTestLabScheduleResource.Update"); + using DiagnosticScope scope = _devTestLabSchedulesClientDiagnostics.CreateScope("DevTestLabScheduleResource.Delete"); scope.Start(); try { - var response = await _devTestLabScheduleSchedulesRestClient.UpdateAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, patch, cancellationToken).ConfigureAwait(false); - return Response.FromValue(new DevTestLabScheduleResource(Client, response.Value), response.GetRawResponse()); + RequestContext context = new RequestContext + { + CancellationToken = cancellationToken + }; + HttpMessage message = _devTestLabSchedulesRestClient.CreateDeleteRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, context); + Response response = await Pipeline.ProcessMessageAsync(message, context).ConfigureAwait(false); + RequestUriBuilder uri = message.Request.Uri; + RehydrationToken rehydrationToken = NextLinkOperationImplementation.GetRehydrationToken(RequestMethod.Delete, uri.ToUri(), uri.ToString(), "None", null, OperationFinalStateVia.OriginalUri.ToString()); + DevTestLabsArmOperation operation = new DevTestLabsArmOperation(response, rehydrationToken); + if (waitUntil == WaitUntil.Completed) + { + await operation.WaitForCompletionResponseAsync(cancellationToken).ConfigureAwait(false); + } + return operation; } catch (Exception e) { @@ -303,39 +348,48 @@ public virtual async Task> UpdateAsync(DevT } /// - /// Allows modifying tags of schedules. All other properties will be ignored. + /// Delete schedule. /// /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/schedules/{name} + /// Request Path. + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/schedules/{name}. /// /// - /// Operation Id - /// Schedules_Update + /// Operation Id. + /// Schedules_Delete. /// /// - /// Default Api Version - /// 2018-09-15 + /// Default Api Version. + /// 2018-09-15. /// /// - /// Resource - /// + /// Resource. + /// . /// /// /// - /// A schedule. + /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. /// The cancellation token to use. - /// is null. - public virtual Response Update(DevTestLabSchedulePatch patch, CancellationToken cancellationToken = default) + public virtual ArmOperation Delete(WaitUntil waitUntil, CancellationToken cancellationToken = default) { - Argument.AssertNotNull(patch, nameof(patch)); - - using var scope = _devTestLabScheduleSchedulesClientDiagnostics.CreateScope("DevTestLabScheduleResource.Update"); + using DiagnosticScope scope = _devTestLabSchedulesClientDiagnostics.CreateScope("DevTestLabScheduleResource.Delete"); scope.Start(); try { - var response = _devTestLabScheduleSchedulesRestClient.Update(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, patch, cancellationToken); - return Response.FromValue(new DevTestLabScheduleResource(Client, response.Value), response.GetRawResponse()); + RequestContext context = new RequestContext + { + CancellationToken = cancellationToken + }; + HttpMessage message = _devTestLabSchedulesRestClient.CreateDeleteRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, context); + Response response = Pipeline.ProcessMessage(message, context); + RequestUriBuilder uri = message.Request.Uri; + RehydrationToken rehydrationToken = NextLinkOperationImplementation.GetRehydrationToken(RequestMethod.Delete, uri.ToUri(), uri.ToString(), "None", null, OperationFinalStateVia.OriginalUri.ToString()); + DevTestLabsArmOperation operation = new DevTestLabsArmOperation(response, rehydrationToken); + if (waitUntil == WaitUntil.Completed) + { + operation.WaitForCompletionResponse(cancellationToken); + } + return operation; } catch (Exception e) { @@ -348,20 +402,20 @@ public virtual Response Update(DevTestLabSchedulePat /// Execute a schedule. This operation can take a while to complete. /// /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/schedules/{name}/execute + /// Request Path. + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/schedules/{name}/execute. /// /// - /// Operation Id - /// Schedules_Execute + /// Operation Id. + /// Schedules_Execute. /// /// - /// Default Api Version - /// 2018-09-15 + /// Default Api Version. + /// 2018-09-15. /// /// - /// Resource - /// + /// Resource. + /// . /// /// /// @@ -369,14 +423,21 @@ public virtual Response Update(DevTestLabSchedulePat /// The cancellation token to use. public virtual async Task ExecuteAsync(WaitUntil waitUntil, CancellationToken cancellationToken = default) { - using var scope = _devTestLabScheduleSchedulesClientDiagnostics.CreateScope("DevTestLabScheduleResource.Execute"); + using DiagnosticScope scope = _devTestLabSchedulesClientDiagnostics.CreateScope("DevTestLabScheduleResource.Execute"); scope.Start(); try { - var response = await _devTestLabScheduleSchedulesRestClient.ExecuteAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, cancellationToken).ConfigureAwait(false); - var operation = new DevTestLabsArmOperation(_devTestLabScheduleSchedulesClientDiagnostics, Pipeline, _devTestLabScheduleSchedulesRestClient.CreateExecuteRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name).Request, response, OperationFinalStateVia.Location); + RequestContext context = new RequestContext + { + CancellationToken = cancellationToken + }; + HttpMessage message = _devTestLabSchedulesRestClient.CreateExecuteRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, context); + Response response = await Pipeline.ProcessMessageAsync(message, context).ConfigureAwait(false); + DevTestLabsArmOperation operation = new DevTestLabsArmOperation(_devTestLabSchedulesClientDiagnostics, Pipeline, message.Request, response, OperationFinalStateVia.Location); if (waitUntil == WaitUntil.Completed) + { await operation.WaitForCompletionResponseAsync(cancellationToken).ConfigureAwait(false); + } return operation; } catch (Exception e) @@ -390,20 +451,20 @@ public virtual async Task ExecuteAsync(WaitUntil waitUntil, Cancel /// Execute a schedule. This operation can take a while to complete. /// /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/schedules/{name}/execute + /// Request Path. + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/schedules/{name}/execute. /// /// - /// Operation Id - /// Schedules_Execute + /// Operation Id. + /// Schedules_Execute. /// /// - /// Default Api Version - /// 2018-09-15 + /// Default Api Version. + /// 2018-09-15. /// /// - /// Resource - /// + /// Resource. + /// . /// /// /// @@ -411,14 +472,21 @@ public virtual async Task ExecuteAsync(WaitUntil waitUntil, Cancel /// The cancellation token to use. public virtual ArmOperation Execute(WaitUntil waitUntil, CancellationToken cancellationToken = default) { - using var scope = _devTestLabScheduleSchedulesClientDiagnostics.CreateScope("DevTestLabScheduleResource.Execute"); + using DiagnosticScope scope = _devTestLabSchedulesClientDiagnostics.CreateScope("DevTestLabScheduleResource.Execute"); scope.Start(); try { - var response = _devTestLabScheduleSchedulesRestClient.Execute(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, cancellationToken); - var operation = new DevTestLabsArmOperation(_devTestLabScheduleSchedulesClientDiagnostics, Pipeline, _devTestLabScheduleSchedulesRestClient.CreateExecuteRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name).Request, response, OperationFinalStateVia.Location); + RequestContext context = new RequestContext + { + CancellationToken = cancellationToken + }; + HttpMessage message = _devTestLabSchedulesRestClient.CreateExecuteRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, context); + Response response = Pipeline.ProcessMessage(message, context); + DevTestLabsArmOperation operation = new DevTestLabsArmOperation(_devTestLabSchedulesClientDiagnostics, Pipeline, message.Request, response, OperationFinalStateVia.Location); if (waitUntil == WaitUntil.Completed) + { operation.WaitForCompletionResponse(cancellationToken); + } return operation; } catch (Exception e) @@ -428,27 +496,7 @@ public virtual ArmOperation Execute(WaitUntil waitUntil, CancellationToken cance } } - /// - /// Add a tag to the current resource. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/schedules/{name} - /// - /// - /// Operation Id - /// Schedules_Get - /// - /// - /// Default Api Version - /// 2018-09-15 - /// - /// - /// Resource - /// - /// - /// - /// + /// Add a tag to the current resource. /// The key for the tag. /// The value for the tag. /// The cancellation token to use. @@ -458,29 +506,35 @@ public virtual async Task> AddTagAsync(stri Argument.AssertNotNull(key, nameof(key)); Argument.AssertNotNull(value, nameof(value)); - using var scope = _devTestLabScheduleSchedulesClientDiagnostics.CreateScope("DevTestLabScheduleResource.AddTag"); + using DiagnosticScope scope = _devTestLabSchedulesClientDiagnostics.CreateScope("DevTestLabScheduleResource.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 _devTestLabScheduleSchedulesRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, null, cancellationToken).ConfigureAwait(false); - return Response.FromValue(new DevTestLabScheduleResource(Client, originalResponse.Value), originalResponse.GetRawResponse()); + await GetTagResource().CreateOrUpdateAsync(WaitUntil.Completed, originalTags.Value.Data, cancellationToken).ConfigureAwait(false); + RequestContext context = new RequestContext + { + CancellationToken = cancellationToken + }; + HttpMessage message = _devTestLabSchedulesRestClient.CreateGetRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, default, context); + Response result = await Pipeline.ProcessMessageAsync(message, context).ConfigureAwait(false); + Response response = Response.FromValue(DevTestLabScheduleData.FromResponse(result), result); + return Response.FromValue(new DevTestLabScheduleResource(Client, response.Value), response.GetRawResponse()); } else { - var current = (await GetAsync(cancellationToken: cancellationToken).ConfigureAwait(false)).Value.Data; - var patch = new DevTestLabSchedulePatch(); - foreach (var tag in current.Tags) + DevTestLabScheduleData current = (await GetAsync(cancellationToken: cancellationToken).ConfigureAwait(false)).Value.Data; + DevTestLabSchedulePatch patch = new DevTestLabSchedulePatch(); + 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) @@ -490,27 +544,7 @@ public virtual async Task> AddTagAsync(stri } } - /// - /// Add a tag to the current resource. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/schedules/{name} - /// - /// - /// Operation Id - /// Schedules_Get - /// - /// - /// Default Api Version - /// 2018-09-15 - /// - /// - /// Resource - /// - /// - /// - /// + /// Add a tag to the current resource. /// The key for the tag. /// The value for the tag. /// The cancellation token to use. @@ -520,29 +554,35 @@ public virtual Response AddTag(string key, string va Argument.AssertNotNull(key, nameof(key)); Argument.AssertNotNull(value, nameof(value)); - using var scope = _devTestLabScheduleSchedulesClientDiagnostics.CreateScope("DevTestLabScheduleResource.AddTag"); + using DiagnosticScope scope = _devTestLabSchedulesClientDiagnostics.CreateScope("DevTestLabScheduleResource.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 = _devTestLabScheduleSchedulesRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, null, cancellationToken); - return Response.FromValue(new DevTestLabScheduleResource(Client, originalResponse.Value), originalResponse.GetRawResponse()); + GetTagResource().CreateOrUpdate(WaitUntil.Completed, originalTags.Value.Data, cancellationToken); + RequestContext context = new RequestContext + { + CancellationToken = cancellationToken + }; + HttpMessage message = _devTestLabSchedulesRestClient.CreateGetRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, default, context); + Response result = Pipeline.ProcessMessage(message, context); + Response response = Response.FromValue(DevTestLabScheduleData.FromResponse(result), result); + return Response.FromValue(new DevTestLabScheduleResource(Client, response.Value), response.GetRawResponse()); } else { - var current = Get(cancellationToken: cancellationToken).Value.Data; - var patch = new DevTestLabSchedulePatch(); - foreach (var tag in current.Tags) + DevTestLabScheduleData current = Get(cancellationToken: cancellationToken).Value.Data; + DevTestLabSchedulePatch patch = new DevTestLabSchedulePatch(); + 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) @@ -552,54 +592,40 @@ public virtual Response AddTag(string key, string va } } - /// - /// Replace the tags on the resource with the given set. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/schedules/{name} - /// - /// - /// Operation Id - /// Schedules_Get - /// - /// - /// Default Api Version - /// 2018-09-15 - /// - /// - /// 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 = _devTestLabScheduleSchedulesClientDiagnostics.CreateScope("DevTestLabScheduleResource.SetTags"); + using DiagnosticScope scope = _devTestLabSchedulesClientDiagnostics.CreateScope("DevTestLabScheduleResource.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 _devTestLabScheduleSchedulesRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, null, cancellationToken).ConfigureAwait(false); - return Response.FromValue(new DevTestLabScheduleResource(Client, originalResponse.Value), originalResponse.GetRawResponse()); + await GetTagResource().CreateOrUpdateAsync(WaitUntil.Completed, originalTags.Value.Data, cancellationToken).ConfigureAwait(false); + RequestContext context = new RequestContext + { + CancellationToken = cancellationToken + }; + HttpMessage message = _devTestLabSchedulesRestClient.CreateGetRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, default, context); + Response result = await Pipeline.ProcessMessageAsync(message, context).ConfigureAwait(false); + Response response = Response.FromValue(DevTestLabScheduleData.FromResponse(result), result); + return Response.FromValue(new DevTestLabScheduleResource(Client, response.Value), response.GetRawResponse()); } else { - var current = (await GetAsync(cancellationToken: cancellationToken).ConfigureAwait(false)).Value.Data; - var patch = new DevTestLabSchedulePatch(); + DevTestLabScheduleData current = (await GetAsync(cancellationToken: cancellationToken).ConfigureAwait(false)).Value.Data; + DevTestLabSchedulePatch patch = new DevTestLabSchedulePatch(); 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) @@ -609,54 +635,40 @@ public virtual async Task> SetTagsAsync(IDi } } - /// - /// Replace the tags on the resource with the given set. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/schedules/{name} - /// - /// - /// Operation Id - /// Schedules_Get - /// - /// - /// Default Api Version - /// 2018-09-15 - /// - /// - /// 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 = _devTestLabScheduleSchedulesClientDiagnostics.CreateScope("DevTestLabScheduleResource.SetTags"); + using DiagnosticScope scope = _devTestLabSchedulesClientDiagnostics.CreateScope("DevTestLabScheduleResource.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 = _devTestLabScheduleSchedulesRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, null, cancellationToken); - return Response.FromValue(new DevTestLabScheduleResource(Client, originalResponse.Value), originalResponse.GetRawResponse()); + GetTagResource().CreateOrUpdate(WaitUntil.Completed, originalTags.Value.Data, cancellationToken); + RequestContext context = new RequestContext + { + CancellationToken = cancellationToken + }; + HttpMessage message = _devTestLabSchedulesRestClient.CreateGetRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, default, context); + Response result = Pipeline.ProcessMessage(message, context); + Response response = Response.FromValue(DevTestLabScheduleData.FromResponse(result), result); + return Response.FromValue(new DevTestLabScheduleResource(Client, response.Value), response.GetRawResponse()); } else { - var current = Get(cancellationToken: cancellationToken).Value.Data; - var patch = new DevTestLabSchedulePatch(); + DevTestLabScheduleData current = Get(cancellationToken: cancellationToken).Value.Data; + DevTestLabSchedulePatch patch = new DevTestLabSchedulePatch(); 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) @@ -666,27 +678,7 @@ public virtual Response SetTags(IDictionary - /// Removes a tag by key from the resource. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/schedules/{name} - /// - /// - /// Operation Id - /// Schedules_Get - /// - /// - /// Default Api Version - /// 2018-09-15 - /// - /// - /// Resource - /// - /// - /// - /// + /// Removes a tag by key from the resource. /// The key for the tag. /// The cancellation token to use. /// is null. @@ -694,29 +686,35 @@ public virtual async Task> RemoveTagAsync(s { Argument.AssertNotNull(key, nameof(key)); - using var scope = _devTestLabScheduleSchedulesClientDiagnostics.CreateScope("DevTestLabScheduleResource.RemoveTag"); + using DiagnosticScope scope = _devTestLabSchedulesClientDiagnostics.CreateScope("DevTestLabScheduleResource.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 _devTestLabScheduleSchedulesRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, null, cancellationToken).ConfigureAwait(false); - return Response.FromValue(new DevTestLabScheduleResource(Client, originalResponse.Value), originalResponse.GetRawResponse()); + await GetTagResource().CreateOrUpdateAsync(WaitUntil.Completed, originalTags.Value.Data, cancellationToken).ConfigureAwait(false); + RequestContext context = new RequestContext + { + CancellationToken = cancellationToken + }; + HttpMessage message = _devTestLabSchedulesRestClient.CreateGetRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, default, context); + Response result = await Pipeline.ProcessMessageAsync(message, context).ConfigureAwait(false); + Response response = Response.FromValue(DevTestLabScheduleData.FromResponse(result), result); + return Response.FromValue(new DevTestLabScheduleResource(Client, response.Value), response.GetRawResponse()); } else { - var current = (await GetAsync(cancellationToken: cancellationToken).ConfigureAwait(false)).Value.Data; - var patch = new DevTestLabSchedulePatch(); - foreach (var tag in current.Tags) + DevTestLabScheduleData current = (await GetAsync(cancellationToken: cancellationToken).ConfigureAwait(false)).Value.Data; + DevTestLabSchedulePatch patch = new DevTestLabSchedulePatch(); + 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) @@ -726,27 +724,7 @@ public virtual async Task> RemoveTagAsync(s } } - /// - /// Removes a tag by key from the resource. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/schedules/{name} - /// - /// - /// Operation Id - /// Schedules_Get - /// - /// - /// Default Api Version - /// 2018-09-15 - /// - /// - /// Resource - /// - /// - /// - /// + /// Removes a tag by key from the resource. /// The key for the tag. /// The cancellation token to use. /// is null. @@ -754,29 +732,35 @@ public virtual Response RemoveTag(string key, Cancel { Argument.AssertNotNull(key, nameof(key)); - using var scope = _devTestLabScheduleSchedulesClientDiagnostics.CreateScope("DevTestLabScheduleResource.RemoveTag"); + using DiagnosticScope scope = _devTestLabSchedulesClientDiagnostics.CreateScope("DevTestLabScheduleResource.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 = _devTestLabScheduleSchedulesRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, null, cancellationToken); - return Response.FromValue(new DevTestLabScheduleResource(Client, originalResponse.Value), originalResponse.GetRawResponse()); + GetTagResource().CreateOrUpdate(WaitUntil.Completed, originalTags.Value.Data, cancellationToken); + RequestContext context = new RequestContext + { + CancellationToken = cancellationToken + }; + HttpMessage message = _devTestLabSchedulesRestClient.CreateGetRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, default, context); + Response result = Pipeline.ProcessMessage(message, context); + Response response = Response.FromValue(DevTestLabScheduleData.FromResponse(result), result); + return Response.FromValue(new DevTestLabScheduleResource(Client, response.Value), response.GetRawResponse()); } else { - var current = Get(cancellationToken: cancellationToken).Value.Data; - var patch = new DevTestLabSchedulePatch(); - foreach (var tag in current.Tags) + DevTestLabScheduleData current = Get(cancellationToken: cancellationToken).Value.Data; + DevTestLabSchedulePatch patch = new DevTestLabSchedulePatch(); + 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) diff --git a/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/DevTestLabSecretCollection.cs b/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/DevTestLabSecretCollection.cs index 58d54054b5bb..7beca9a96fa0 100644 --- a/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/DevTestLabSecretCollection.cs +++ b/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/DevTestLabSecretCollection.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.DevTestLabs { @@ -24,51 +25,49 @@ namespace Azure.ResourceManager.DevTestLabs /// public partial class DevTestLabSecretCollection : ArmCollection, IEnumerable, IAsyncEnumerable { - private readonly ClientDiagnostics _devTestLabSecretSecretsClientDiagnostics; - private readonly SecretsRestOperations _devTestLabSecretSecretsRestClient; + private readonly ClientDiagnostics _secretsClientDiagnostics; + private readonly Secrets _secretsRestClient; - /// Initializes a new instance of the class for mocking. + /// Initializes a new instance of DevTestLabSecretCollection for mocking. protected DevTestLabSecretCollection() { } - /// 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 DevTestLabSecretCollection(ArmClient client, ResourceIdentifier id) : base(client, id) { - _devTestLabSecretSecretsClientDiagnostics = new ClientDiagnostics("Azure.ResourceManager.DevTestLabs", DevTestLabSecretResource.ResourceType.Namespace, Diagnostics); - TryGetApiVersion(DevTestLabSecretResource.ResourceType, out string devTestLabSecretSecretsApiVersion); - _devTestLabSecretSecretsRestClient = new SecretsRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, devTestLabSecretSecretsApiVersion); -#if DEBUG - ValidateResourceId(Id); -#endif + TryGetApiVersion(DevTestLabSecretResource.ResourceType, out string devTestLabSecretApiVersion); + _secretsClientDiagnostics = new ClientDiagnostics("Azure.ResourceManager.DevTestLabs", DevTestLabSecretResource.ResourceType.Namespace, Diagnostics); + _secretsRestClient = new Secrets(_secretsClientDiagnostics, Pipeline, Endpoint, devTestLabSecretApiVersion ?? "2018-09-15"); + ValidateResourceId(id); } + /// + [Conditional("DEBUG")] internal static void ValidateResourceId(ResourceIdentifier id) { if (id.ResourceType != DevTestLabUserResource.ResourceType) - throw new ArgumentException(string.Format(CultureInfo.CurrentCulture, "Invalid resource type {0} expected {1}", id.ResourceType, DevTestLabUserResource.ResourceType), nameof(id)); + { + throw new ArgumentException(string.Format("Invalid resource type {0} expected {1}", id.ResourceType, DevTestLabUserResource.ResourceType), id); + } } /// /// Create or replace an existing secret. This operation can take a while to complete. /// /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/users/{userName}/secrets/{name} - /// - /// - /// Operation Id - /// Secrets_CreateOrUpdate + /// Request Path. + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/users/{userName}/secrets/{name}. /// /// - /// Default Api Version - /// 2018-09-15 + /// Operation Id. + /// Secrets_CreateOrUpdate. /// /// - /// Resource - /// + /// Default Api Version. + /// 2018-09-15. /// /// /// @@ -76,21 +75,34 @@ internal static void ValidateResourceId(ResourceIdentifier id) /// The name of the secret. /// A secret. /// 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 name, DevTestLabSecretData data, CancellationToken cancellationToken = default) { Argument.AssertNotNullOrEmpty(name, nameof(name)); Argument.AssertNotNull(data, nameof(data)); - using var scope = _devTestLabSecretSecretsClientDiagnostics.CreateScope("DevTestLabSecretCollection.CreateOrUpdate"); + using DiagnosticScope scope = _secretsClientDiagnostics.CreateScope("DevTestLabSecretCollection.CreateOrUpdate"); scope.Start(); try { - var response = await _devTestLabSecretSecretsRestClient.CreateOrUpdateAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, name, data, cancellationToken).ConfigureAwait(false); - var operation = new DevTestLabsArmOperation(new DevTestLabSecretOperationSource(Client), _devTestLabSecretSecretsClientDiagnostics, Pipeline, _devTestLabSecretSecretsRestClient.CreateCreateOrUpdateRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, name, data).Request, response, OperationFinalStateVia.Location); + RequestContext context = new RequestContext + { + CancellationToken = cancellationToken + }; + HttpMessage message = _secretsRestClient.CreateCreateOrUpdateRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, name, DevTestLabSecretData.ToRequestContent(data), context); + Response response = await Pipeline.ProcessMessageAsync(message, context).ConfigureAwait(false); + DevTestLabsArmOperation operation = new DevTestLabsArmOperation( + new DevTestLabSecretOperationSource(Client), + _secretsClientDiagnostics, + Pipeline, + message.Request, + response, + OperationFinalStateVia.Location); if (waitUntil == WaitUntil.Completed) + { await operation.WaitForCompletionAsync(cancellationToken).ConfigureAwait(false); + } return operation; } catch (Exception e) @@ -104,20 +116,16 @@ public virtual async Task> CreateOrUpdate /// Create or replace an existing secret. This operation can take a while to complete. /// /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/users/{userName}/secrets/{name} + /// Request Path. + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/users/{userName}/secrets/{name}. /// /// - /// Operation Id - /// Secrets_CreateOrUpdate + /// Operation Id. + /// Secrets_CreateOrUpdate. /// /// - /// Default Api Version - /// 2018-09-15 - /// - /// - /// Resource - /// + /// Default Api Version. + /// 2018-09-15. /// /// /// @@ -125,21 +133,34 @@ public virtual async Task> CreateOrUpdate /// The name of the secret. /// A secret. /// 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 name, DevTestLabSecretData data, CancellationToken cancellationToken = default) { Argument.AssertNotNullOrEmpty(name, nameof(name)); Argument.AssertNotNull(data, nameof(data)); - using var scope = _devTestLabSecretSecretsClientDiagnostics.CreateScope("DevTestLabSecretCollection.CreateOrUpdate"); + using DiagnosticScope scope = _secretsClientDiagnostics.CreateScope("DevTestLabSecretCollection.CreateOrUpdate"); scope.Start(); try { - var response = _devTestLabSecretSecretsRestClient.CreateOrUpdate(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, name, data, cancellationToken); - var operation = new DevTestLabsArmOperation(new DevTestLabSecretOperationSource(Client), _devTestLabSecretSecretsClientDiagnostics, Pipeline, _devTestLabSecretSecretsRestClient.CreateCreateOrUpdateRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, name, data).Request, response, OperationFinalStateVia.Location); + RequestContext context = new RequestContext + { + CancellationToken = cancellationToken + }; + HttpMessage message = _secretsRestClient.CreateCreateOrUpdateRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, name, DevTestLabSecretData.ToRequestContent(data), context); + Response response = Pipeline.ProcessMessage(message, context); + DevTestLabsArmOperation operation = new DevTestLabsArmOperation( + new DevTestLabSecretOperationSource(Client), + _secretsClientDiagnostics, + Pipeline, + message.Request, + response, + OperationFinalStateVia.Location); if (waitUntil == WaitUntil.Completed) + { operation.WaitForCompletion(cancellationToken); + } return operation; } catch (Exception e) @@ -153,39 +174,43 @@ public virtual ArmOperation CreateOrUpdate(WaitUntil w /// Get secret. /// /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/users/{userName}/secrets/{name} + /// Request Path. + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/users/{userName}/secrets/{name}. /// /// - /// Operation Id - /// Secrets_Get + /// Operation Id. + /// Secrets_Get. /// /// - /// Default Api Version - /// 2018-09-15 - /// - /// - /// Resource - /// + /// Default Api Version. + /// 2018-09-15. /// /// /// /// The name of the secret. /// Specify the $expand query. Example: 'properties($select=value)'. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. - public virtual async Task> GetAsync(string name, string expand = null, CancellationToken cancellationToken = default) + /// is an empty string, and was expected to be non-empty. + public virtual async Task> GetAsync(string name, string expand = default, CancellationToken cancellationToken = default) { Argument.AssertNotNullOrEmpty(name, nameof(name)); - using var scope = _devTestLabSecretSecretsClientDiagnostics.CreateScope("DevTestLabSecretCollection.Get"); + using DiagnosticScope scope = _secretsClientDiagnostics.CreateScope("DevTestLabSecretCollection.Get"); scope.Start(); try { - var response = await _devTestLabSecretSecretsRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, name, expand, cancellationToken).ConfigureAwait(false); + RequestContext context = new RequestContext + { + CancellationToken = cancellationToken + }; + HttpMessage message = _secretsRestClient.CreateGetRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, name, expand, context); + Response result = await Pipeline.ProcessMessageAsync(message, context).ConfigureAwait(false); + Response response = Response.FromValue(DevTestLabSecretData.FromResponse(result), result); if (response.Value == null) + { throw new RequestFailedException(response.GetRawResponse()); + } return Response.FromValue(new DevTestLabSecretResource(Client, response.Value), response.GetRawResponse()); } catch (Exception e) @@ -199,39 +224,43 @@ public virtual async Task> GetAsync(string na /// Get secret. /// /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/users/{userName}/secrets/{name} - /// - /// - /// Operation Id - /// Secrets_Get + /// Request Path. + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/users/{userName}/secrets/{name}. /// /// - /// Default Api Version - /// 2018-09-15 + /// Operation Id. + /// Secrets_Get. /// /// - /// Resource - /// + /// Default Api Version. + /// 2018-09-15. /// /// /// /// The name of the secret. /// Specify the $expand query. Example: 'properties($select=value)'. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. - public virtual Response Get(string name, string expand = null, CancellationToken cancellationToken = default) + /// is an empty string, and was expected to be non-empty. + public virtual Response Get(string name, string expand = default, CancellationToken cancellationToken = default) { Argument.AssertNotNullOrEmpty(name, nameof(name)); - using var scope = _devTestLabSecretSecretsClientDiagnostics.CreateScope("DevTestLabSecretCollection.Get"); + using DiagnosticScope scope = _secretsClientDiagnostics.CreateScope("DevTestLabSecretCollection.Get"); scope.Start(); try { - var response = _devTestLabSecretSecretsRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, name, expand, cancellationToken); + RequestContext context = new RequestContext + { + CancellationToken = cancellationToken + }; + HttpMessage message = _secretsRestClient.CreateGetRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, name, expand, context); + Response result = Pipeline.ProcessMessage(message, context); + Response response = Response.FromValue(DevTestLabSecretData.FromResponse(result), result); if (response.Value == null) + { throw new RequestFailedException(response.GetRawResponse()); + } return Response.FromValue(new DevTestLabSecretResource(Client, response.Value), response.GetRawResponse()); } catch (Exception e) @@ -245,20 +274,16 @@ public virtual Response Get(string name, string expand /// List secrets in a given user profile. /// /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/users/{userName}/secrets + /// Request Path. + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/users/{userName}/secrets. /// /// - /// Operation Id - /// Secrets_List + /// Operation Id. + /// Secrets_List. /// /// - /// Default Api Version - /// 2018-09-15 - /// - /// - /// Resource - /// + /// Default Api Version. + /// 2018-09-15. /// /// /// @@ -267,32 +292,40 @@ public virtual Response Get(string name, string expand /// The maximum number of resources to return from the operation. Example: '$top=10'. /// The ordering expression for the results, using OData notation. Example: '$orderby=name desc'. /// The cancellation token to use. - /// An async collection of that may take multiple service requests to iterate over. - public virtual AsyncPageable GetAllAsync(string expand = null, string filter = null, int? top = null, string orderby = null, CancellationToken cancellationToken = default) + /// A collection of that may take multiple service requests to iterate over. + public virtual AsyncPageable GetAllAsync(string expand = default, string filter = default, int? top = default, string @orderby = default, CancellationToken cancellationToken = default) { - HttpMessage FirstPageRequest(int? pageSizeHint) => _devTestLabSecretSecretsRestClient.CreateListRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, expand, filter, top, orderby); - HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _devTestLabSecretSecretsRestClient.CreateListNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, expand, filter, top, orderby); - return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new DevTestLabSecretResource(Client, DevTestLabSecretData.DeserializeDevTestLabSecretData(e)), _devTestLabSecretSecretsClientDiagnostics, Pipeline, "DevTestLabSecretCollection.GetAll", "value", "nextLink", cancellationToken); + RequestContext context = new RequestContext + { + CancellationToken = cancellationToken + }; + return new AsyncPageableWrapper(new SecretsGetAllAsyncCollectionResultOfT( + _secretsRestClient, + Id.SubscriptionId, + Id.ResourceGroupName, + Id.Parent.Name, + Id.Name, + expand, + filter, + top, + @orderby, + context), data => new DevTestLabSecretResource(Client, data)); } /// /// List secrets in a given user profile. /// /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/users/{userName}/secrets - /// - /// - /// Operation Id - /// Secrets_List + /// Request Path. + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/users/{userName}/secrets. /// /// - /// Default Api Version - /// 2018-09-15 + /// Operation Id. + /// Secrets_List. /// /// - /// Resource - /// + /// Default Api Version. + /// 2018-09-15. /// /// /// @@ -302,48 +335,74 @@ public virtual AsyncPageable GetAllAsync(string expand /// The ordering expression for the results, using OData notation. Example: '$orderby=name desc'. /// The cancellation token to use. /// A collection of that may take multiple service requests to iterate over. - public virtual Pageable GetAll(string expand = null, string filter = null, int? top = null, string orderby = null, CancellationToken cancellationToken = default) + public virtual Pageable GetAll(string expand = default, string filter = default, int? top = default, string @orderby = default, CancellationToken cancellationToken = default) { - HttpMessage FirstPageRequest(int? pageSizeHint) => _devTestLabSecretSecretsRestClient.CreateListRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, expand, filter, top, orderby); - HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _devTestLabSecretSecretsRestClient.CreateListNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, expand, filter, top, orderby); - return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new DevTestLabSecretResource(Client, DevTestLabSecretData.DeserializeDevTestLabSecretData(e)), _devTestLabSecretSecretsClientDiagnostics, Pipeline, "DevTestLabSecretCollection.GetAll", "value", "nextLink", cancellationToken); + RequestContext context = new RequestContext + { + CancellationToken = cancellationToken + }; + return new PageableWrapper(new SecretsGetAllCollectionResultOfT( + _secretsRestClient, + Id.SubscriptionId, + Id.ResourceGroupName, + Id.Parent.Name, + Id.Name, + expand, + filter, + top, + @orderby, + context), data => new DevTestLabSecretResource(Client, data)); } /// /// Checks to see if the resource exists in azure. /// /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/users/{userName}/secrets/{name} - /// - /// - /// Operation Id - /// Secrets_Get + /// Request Path. + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/users/{userName}/secrets/{name}. /// /// - /// Default Api Version - /// 2018-09-15 + /// Operation Id. + /// Secrets_Get. /// /// - /// Resource - /// + /// Default Api Version. + /// 2018-09-15. /// /// /// /// The name of the secret. /// Specify the $expand query. Example: 'properties($select=value)'. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. - public virtual async Task> ExistsAsync(string name, string expand = null, CancellationToken cancellationToken = default) + /// is an empty string, and was expected to be non-empty. + public virtual async Task> ExistsAsync(string name, string expand = default, CancellationToken cancellationToken = default) { Argument.AssertNotNullOrEmpty(name, nameof(name)); - using var scope = _devTestLabSecretSecretsClientDiagnostics.CreateScope("DevTestLabSecretCollection.Exists"); + using DiagnosticScope scope = _secretsClientDiagnostics.CreateScope("DevTestLabSecretCollection.Exists"); scope.Start(); try { - var response = await _devTestLabSecretSecretsRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, name, expand, cancellationToken: cancellationToken).ConfigureAwait(false); + RequestContext context = new RequestContext + { + CancellationToken = cancellationToken + }; + HttpMessage message = _secretsRestClient.CreateGetRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, name, expand, context); + await Pipeline.SendAsync(message, context.CancellationToken).ConfigureAwait(false); + Response result = message.Response; + Response response = default; + switch (result.Status) + { + case 200: + response = Response.FromValue(DevTestLabSecretData.FromResponse(result), result); + break; + case 404: + response = Response.FromValue((DevTestLabSecretData)null, result); + break; + default: + throw new RequestFailedException(result); + } return Response.FromValue(response.Value != null, response.GetRawResponse()); } catch (Exception e) @@ -357,37 +416,51 @@ public virtual async Task> ExistsAsync(string name, string expand /// Checks to see if the resource exists in azure. /// /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/users/{userName}/secrets/{name} + /// Request Path. + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/users/{userName}/secrets/{name}. /// /// - /// Operation Id - /// Secrets_Get + /// Operation Id. + /// Secrets_Get. /// /// - /// Default Api Version - /// 2018-09-15 - /// - /// - /// Resource - /// + /// Default Api Version. + /// 2018-09-15. /// /// /// /// The name of the secret. /// Specify the $expand query. Example: 'properties($select=value)'. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. - public virtual Response Exists(string name, string expand = null, CancellationToken cancellationToken = default) + /// is an empty string, and was expected to be non-empty. + public virtual Response Exists(string name, string expand = default, CancellationToken cancellationToken = default) { Argument.AssertNotNullOrEmpty(name, nameof(name)); - using var scope = _devTestLabSecretSecretsClientDiagnostics.CreateScope("DevTestLabSecretCollection.Exists"); + using DiagnosticScope scope = _secretsClientDiagnostics.CreateScope("DevTestLabSecretCollection.Exists"); scope.Start(); try { - var response = _devTestLabSecretSecretsRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, name, expand, cancellationToken: cancellationToken); + RequestContext context = new RequestContext + { + CancellationToken = cancellationToken + }; + HttpMessage message = _secretsRestClient.CreateGetRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, name, expand, context); + Pipeline.Send(message, context.CancellationToken); + Response result = message.Response; + Response response = default; + switch (result.Status) + { + case 200: + response = Response.FromValue(DevTestLabSecretData.FromResponse(result), result); + break; + case 404: + response = Response.FromValue((DevTestLabSecretData)null, result); + break; + default: + throw new RequestFailedException(result); + } return Response.FromValue(response.Value != null, response.GetRawResponse()); } catch (Exception e) @@ -401,39 +474,55 @@ public virtual Response Exists(string name, string expand = null, Cancella /// Tries to get details for this resource from the service. /// /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/users/{userName}/secrets/{name} - /// - /// - /// Operation Id - /// Secrets_Get + /// Request Path. + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/users/{userName}/secrets/{name}. /// /// - /// Default Api Version - /// 2018-09-15 + /// Operation Id. + /// Secrets_Get. /// /// - /// Resource - /// + /// Default Api Version. + /// 2018-09-15. /// /// /// /// The name of the secret. /// Specify the $expand query. Example: 'properties($select=value)'. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. - public virtual async Task> GetIfExistsAsync(string name, string expand = null, CancellationToken cancellationToken = default) + /// is an empty string, and was expected to be non-empty. + public virtual async Task> GetIfExistsAsync(string name, string expand = default, CancellationToken cancellationToken = default) { Argument.AssertNotNullOrEmpty(name, nameof(name)); - using var scope = _devTestLabSecretSecretsClientDiagnostics.CreateScope("DevTestLabSecretCollection.GetIfExists"); + using DiagnosticScope scope = _secretsClientDiagnostics.CreateScope("DevTestLabSecretCollection.GetIfExists"); scope.Start(); try { - var response = await _devTestLabSecretSecretsRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, name, expand, cancellationToken: cancellationToken).ConfigureAwait(false); + RequestContext context = new RequestContext + { + CancellationToken = cancellationToken + }; + HttpMessage message = _secretsRestClient.CreateGetRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, name, expand, context); + await Pipeline.SendAsync(message, context.CancellationToken).ConfigureAwait(false); + Response result = message.Response; + Response response = default; + switch (result.Status) + { + case 200: + response = Response.FromValue(DevTestLabSecretData.FromResponse(result), result); + break; + case 404: + response = Response.FromValue((DevTestLabSecretData)null, result); + break; + default: + throw new RequestFailedException(result); + } if (response.Value == null) + { return new NoValueResponse(response.GetRawResponse()); + } return Response.FromValue(new DevTestLabSecretResource(Client, response.Value), response.GetRawResponse()); } catch (Exception e) @@ -447,39 +536,55 @@ public virtual async Task> GetIfExist /// Tries to get details for this resource from the service. /// /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/users/{userName}/secrets/{name} + /// Request Path. + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/users/{userName}/secrets/{name}. /// /// - /// Operation Id - /// Secrets_Get + /// Operation Id. + /// Secrets_Get. /// /// - /// Default Api Version - /// 2018-09-15 - /// - /// - /// Resource - /// + /// Default Api Version. + /// 2018-09-15. /// /// /// /// The name of the secret. /// Specify the $expand query. Example: 'properties($select=value)'. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. - public virtual NullableResponse GetIfExists(string name, string expand = null, CancellationToken cancellationToken = default) + /// is an empty string, and was expected to be non-empty. + public virtual NullableResponse GetIfExists(string name, string expand = default, CancellationToken cancellationToken = default) { Argument.AssertNotNullOrEmpty(name, nameof(name)); - using var scope = _devTestLabSecretSecretsClientDiagnostics.CreateScope("DevTestLabSecretCollection.GetIfExists"); + using DiagnosticScope scope = _secretsClientDiagnostics.CreateScope("DevTestLabSecretCollection.GetIfExists"); scope.Start(); try { - var response = _devTestLabSecretSecretsRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, name, expand, cancellationToken: cancellationToken); + RequestContext context = new RequestContext + { + CancellationToken = cancellationToken + }; + HttpMessage message = _secretsRestClient.CreateGetRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, name, expand, context); + Pipeline.Send(message, context.CancellationToken); + Response result = message.Response; + Response response = default; + switch (result.Status) + { + case 200: + response = Response.FromValue(DevTestLabSecretData.FromResponse(result), result); + break; + case 404: + response = Response.FromValue((DevTestLabSecretData)null, result); + break; + default: + throw new RequestFailedException(result); + } if (response.Value == null) + { return new NoValueResponse(response.GetRawResponse()); + } return Response.FromValue(new DevTestLabSecretResource(Client, response.Value), response.GetRawResponse()); } catch (Exception e) @@ -499,6 +604,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/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/DevTestLabSecretData.Serialization.cs b/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/DevTestLabSecretData.Serialization.cs index 55e8c401c7bd..738bc07c0b8d 100644 --- a/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/DevTestLabSecretData.Serialization.cs +++ b/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/DevTestLabSecretData.Serialization.cs @@ -10,15 +10,47 @@ using System.Collections.Generic; using System.Text; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.ResourceManager.DevTestLabs.Models; using Azure.ResourceManager.Models; namespace Azure.ResourceManager.DevTestLabs { - public partial class DevTestLabSecretData : IUtf8JsonSerializable, IJsonModel + /// A secret. + public partial class DevTestLabSecretData : TrackedResourceData, IJsonModel { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + /// Initializes a new instance of for deserialization. + internal DevTestLabSecretData() + { + } + + /// 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)) + { + return DeserializeDevTestLabSecretData(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(DevTestLabSecretData)} does not support reading '{options.Format}' format."); + } + } + /// The to deserialize the from. + internal static DevTestLabSecretData FromResponse(Response response) + { + using JsonDocument document = JsonDocument.Parse(response.Content, ModelSerializationExtensions.JsonDocumentOptions); + return DeserializeDevTestLabSecretData(document.RootElement, ModelSerializationExtensions.WireOptions); + } + + /// The JSON writer. + /// The client options for reading and writing models. void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) { writer.WriteStartObject(); @@ -30,163 +62,153 @@ void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWr /// 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(DevTestLabSecretData)} does not support writing '{format}' format."); } - base.JsonModelWriteCore(writer, options); writer.WritePropertyName("properties"u8); - writer.WriteStartObject(); - if (Optional.IsDefined(Value)) - { - writer.WritePropertyName("value"u8); - writer.WriteStringValue(Value); - } - if (options.Format != "W" && Optional.IsDefined(ProvisioningState)) - { - writer.WritePropertyName("provisioningState"u8); - writer.WriteStringValue(ProvisioningState); - } - if (options.Format != "W" && Optional.IsDefined(UniqueIdentifier)) + writer.WriteObjectValue(Properties, options); + if (Optional.IsCollectionDefined(Tags)) { - writer.WritePropertyName("uniqueIdentifier"u8); - writer.WriteStringValue(UniqueIdentifier.Value); + writer.WritePropertyName("tags"u8); + writer.WriteStartObject(); + foreach (var item in Tags) + { + writer.WritePropertyName(item.Key); + if (item.Value == null) + { + writer.WriteNullValue(); + continue; + } + writer.WriteStringValue(item.Value); + } + writer.WriteEndObject(); } - writer.WriteEndObject(); } - DevTestLabSecretData IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + /// The JSON reader. + /// The client options for reading and writing models. + DevTestLabSecretData IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) => (DevTestLabSecretData)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(DevTestLabSecretData)} does not support reading '{format}' format."); } - using JsonDocument document = JsonDocument.ParseValue(ref reader); return DeserializeDevTestLabSecretData(document.RootElement, options); } - internal static DevTestLabSecretData DeserializeDevTestLabSecretData(JsonElement element, ModelReaderWriterOptions options = null) + /// The JSON element to deserialize. + /// The client options for reading and writing models. + internal static DevTestLabSecretData DeserializeDevTestLabSecretData(JsonElement element, ModelReaderWriterOptions options) { - options ??= ModelSerializationExtensions.WireOptions; - if (element.ValueKind == JsonValueKind.Null) { return null; } - IDictionary tags = default; - AzureLocation location = default; ResourceIdentifier id = default; string name = default; - ResourceType type = default; + ResourceType resourceType = default; SystemData systemData = default; - string value = default; - string provisioningState = default; - Guid? uniqueIdentifier = default; - IDictionary serializedAdditionalRawData = default; - Dictionary rawDataDictionary = new Dictionary(); - foreach (var property in element.EnumerateObject()) + IDictionary additionalBinaryDataProperties = new ChangeTrackingDictionary(); + AzureLocation location = default; + SecretProperties properties = default; + IDictionary tags = default; + foreach (var prop in element.EnumerateObject()) { - if (property.NameEquals("tags"u8)) + if (prop.NameEquals("id"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()) - { - dictionary.Add(property0.Name, property0.Value.GetString()); - } - tags = dictionary; + id = new ResourceIdentifier(prop.Value.GetString()); continue; } - if (property.NameEquals("location"u8)) + if (prop.NameEquals("name"u8)) { - location = new AzureLocation(property.Value.GetString()); + name = prop.Value.GetString(); continue; } - if (property.NameEquals("id"u8)) + if (prop.NameEquals("type"u8)) { - id = new ResourceIdentifier(property.Value.GetString()); + if (prop.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + resourceType = new ResourceType(prop.Value.GetString()); continue; } - if (property.NameEquals("name"u8)) + if (prop.NameEquals("systemData"u8)) { - name = property.Value.GetString(); + if (prop.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + systemData = ModelReaderWriter.Read(new BinaryData(Encoding.UTF8.GetBytes(prop.Value.GetRawText())), ModelSerializationExtensions.WireOptions, AzureResourceManagerDevTestLabsContext.Default); 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) - { - continue; - } - systemData = ModelReaderWriter.Read(new BinaryData(Encoding.UTF8.GetBytes(property.Value.GetRawText())), ModelSerializationExtensions.WireOptions, AzureResourceManagerDevTestLabsContext.Default); + properties = SecretProperties.DeserializeSecretProperties(prop.Value, options); continue; } - if (property.NameEquals("properties"u8)) + if (prop.NameEquals("tags"u8)) { - if (property.Value.ValueKind == JsonValueKind.Null) + if (prop.Value.ValueKind == JsonValueKind.Null) { - property.ThrowNonNullablePropertyIsNull(); continue; } - foreach (var property0 in property.Value.EnumerateObject()) + Dictionary dictionary = new Dictionary(); + foreach (var prop0 in prop.Value.EnumerateObject()) { - if (property0.NameEquals("value"u8)) - { - value = property0.Value.GetString(); - continue; - } - if (property0.NameEquals("provisioningState"u8)) + if (prop0.Value.ValueKind == JsonValueKind.Null) { - provisioningState = property0.Value.GetString(); - continue; + dictionary.Add(prop0.Name, null); } - if (property0.NameEquals("uniqueIdentifier"u8)) + else { - if (property0.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - uniqueIdentifier = property0.Value.GetGuid(); - continue; + dictionary.Add(prop0.Name, prop0.Value.GetString()); } } + tags = dictionary; 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 DevTestLabSecretData( id, name, - type, + resourceType, systemData, - tags ?? new ChangeTrackingDictionary(), + additionalBinaryDataProperties, location, - value, - provisioningState, - uniqueIdentifier, - serializedAdditionalRawData); + properties, + tags ?? new ChangeTrackingDictionary()); } - 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": @@ -196,22 +218,23 @@ BinaryData IPersistableModel.Write(ModelReaderWriterOption } } - DevTestLabSecretData 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. + DevTestLabSecretData IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) => (DevTestLabSecretData)PersistableModelCreateCore(data, options); - switch (format) + /// The client options for reading and writing models. + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + + /// The to serialize into . + internal static RequestContent ToRequestContent(DevTestLabSecretData devTestLabSecretData) + { + if (devTestLabSecretData == null) { - case "J": - { - using JsonDocument document = JsonDocument.Parse(data, ModelSerializationExtensions.JsonDocumentOptions); - return DeserializeDevTestLabSecretData(document.RootElement, options); - } - default: - throw new FormatException($"The model {nameof(DevTestLabSecretData)} does not support reading '{options.Format}' format."); + return null; } + Utf8JsonRequestContent content = new Utf8JsonRequestContent(); + content.JsonWriter.WriteObjectValue(devTestLabSecretData, ModelSerializationExtensions.WireOptions); + return content; } - - string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; } } diff --git a/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/DevTestLabSecretData.cs b/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/DevTestLabSecretData.cs index b72572ee9a04..3b9d5653b5d6 100644 --- a/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/DevTestLabSecretData.cs +++ b/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/DevTestLabSecretData.cs @@ -8,83 +8,75 @@ using System; using System.Collections.Generic; using Azure.Core; +using Azure.ResourceManager.DevTestLabs.Models; using Azure.ResourceManager.Models; namespace Azure.ResourceManager.DevTestLabs { - /// - /// A class representing the DevTestLabSecret data model. - /// A secret. - /// + /// A secret. public partial class DevTestLabSecretData : 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 DevTestLabSecretData(AzureLocation location) : base(location) { + } /// Initializes a new instance of . - /// The id. - /// The name. - /// The resourceType. - /// The systemData. - /// The tags. - /// The location. - /// The value of the secret for secret creation. - /// The provisioning status of the resource. - /// The unique immutable identifier of a resource (Guid). - /// Keeps track of any properties unknown to the library. - internal DevTestLabSecretData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, IDictionary tags, AzureLocation location, string value, string provisioningState, Guid? uniqueIdentifier, IDictionary serializedAdditionalRawData) : base(id, name, resourceType, systemData, tags, 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. + /// The geo-location where the resource lives. + /// The properties of the resource. + /// Resource tags. + internal DevTestLabSecretData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, IDictionary additionalBinaryDataProperties, AzureLocation location, SecretProperties properties, IDictionary tags) : base(id, name, resourceType, systemData, tags, location) { - Value = value; - ProvisioningState = provisioningState; - UniqueIdentifier = uniqueIdentifier; - _serializedAdditionalRawData = serializedAdditionalRawData; + _additionalBinaryDataProperties = additionalBinaryDataProperties; + Properties = properties; } - /// Initializes a new instance of for deserialization. - internal DevTestLabSecretData() + /// The properties of the resource. + internal SecretProperties Properties { get; set; } + + /// The value of the secret for secret creation. + public string Value { + get + { + return Properties is null ? default : Properties.Value; + } + set + { + if (Properties is null) + { + Properties = new SecretProperties(); + } + Properties.Value = value; + } } - /// The value of the secret for secret creation. - public string Value { get; set; } /// The provisioning status of the resource. - public string ProvisioningState { get; } + public string ProvisioningState + { + get + { + return Properties is null ? default : Properties.ProvisioningState; + } + } + /// The unique immutable identifier of a resource (Guid). - public Guid? UniqueIdentifier { get; } + public Guid? UniqueIdentifier + { + get + { + return Properties is null ? default : Properties.UniqueIdentifier; + } + } } } diff --git a/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/DevTestLabSecretResource.Serialization.cs b/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/DevTestLabSecretResource.Serialization.cs index db120b7e0f20..c5187951283f 100644 --- a/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/DevTestLabSecretResource.Serialization.cs +++ b/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/DevTestLabSecretResource.Serialization.cs @@ -11,19 +11,29 @@ namespace Azure.ResourceManager.DevTestLabs { + /// public partial class DevTestLabSecretResource : IJsonModel { - private static DevTestLabSecretData s_dataDeserializationInstance; - private static DevTestLabSecretData DataDeserializationInstance => s_dataDeserializationInstance ??= new(); + private static IJsonModel s_dataDeserializationInstance; + private static IJsonModel DataDeserializationInstance => s_dataDeserializationInstance ??= new DevTestLabSecretData(); + + /// 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); - DevTestLabSecretData 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. + DevTestLabSecretData 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, AzureResourceManagerDevTestLabsContext.Default); + /// The binary data to be processed. + /// The client options for reading and writing models. DevTestLabSecretData IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) => ModelReaderWriter.Read(data, options, AzureResourceManagerDevTestLabsContext.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/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/DevTestLabSecretResource.cs b/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/DevTestLabSecretResource.cs index c110584588f8..16d35dfd0ee5 100644 --- a/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/DevTestLabSecretResource.cs +++ b/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/DevTestLabSecretResource.cs @@ -7,48 +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.DevTestLabs.Models; +using Azure.ResourceManager.Resources; namespace Azure.ResourceManager.DevTestLabs { /// - /// A Class representing a DevTestLabSecret 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 GetDevTestLabSecretResource method. - /// Otherwise you can get one from its parent resource using the GetDevTestLabSecret method. + /// A class representing a DevTestLabSecret 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 GetDevTestLabSecrets method. /// public partial class DevTestLabSecretResource : ArmResource { - /// Generate the resource identifier of a instance. - /// The subscriptionId. - /// The resourceGroupName. - /// The labName. - /// The userName. - /// The name. - public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string labName, string userName, string name) - { - var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/users/{userName}/secrets/{name}"; - return new ResourceIdentifier(resourceId); - } - - private readonly ClientDiagnostics _devTestLabSecretSecretsClientDiagnostics; - private readonly SecretsRestOperations _devTestLabSecretSecretsRestClient; + private readonly ClientDiagnostics _secretsClientDiagnostics; + private readonly Secrets _secretsRestClient; private readonly DevTestLabSecretData _data; - /// Gets the resource type for the operations. public static readonly ResourceType ResourceType = "Microsoft.DevTestLab/labs/users/secrets"; - /// Initializes a new instance of the class for mocking. + /// Initializes a new instance of DevTestLabSecretResource for mocking. protected DevTestLabSecretResource() { } - /// 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 DevTestLabSecretResource(ArmClient client, DevTestLabSecretData data) : this(client, data.Id) @@ -57,72 +46,95 @@ internal DevTestLabSecretResource(ArmClient client, DevTestLabSecretData data) : _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 DevTestLabSecretResource(ArmClient client, ResourceIdentifier id) : base(client, id) { - _devTestLabSecretSecretsClientDiagnostics = new ClientDiagnostics("Azure.ResourceManager.DevTestLabs", ResourceType.Namespace, Diagnostics); - TryGetApiVersion(ResourceType, out string devTestLabSecretSecretsApiVersion); - _devTestLabSecretSecretsRestClient = new SecretsRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, devTestLabSecretSecretsApiVersion); -#if DEBUG - ValidateResourceId(Id); -#endif + TryGetApiVersion(ResourceType, out string devTestLabSecretApiVersion); + _secretsClientDiagnostics = new ClientDiagnostics("Azure.ResourceManager.DevTestLabs", ResourceType.Namespace, Diagnostics); + _secretsRestClient = new Secrets(_secretsClientDiagnostics, Pipeline, Endpoint, devTestLabSecretApiVersion ?? "2018-09-15"); + 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 DevTestLabSecretData 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 labName. + /// The userName. + /// The name. + public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string labName, string userName, string name) + { + string resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/users/{userName}/secrets/{name}"; + 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 secret. /// /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/users/{userName}/secrets/{name} + /// Request Path. + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/users/{userName}/secrets/{name}. /// /// - /// Operation Id - /// Secrets_Get + /// Operation Id. + /// Secrets_Get. /// /// - /// Default Api Version - /// 2018-09-15 + /// Default Api Version. + /// 2018-09-15. /// /// - /// Resource - /// + /// Resource. + /// . /// /// /// /// Specify the $expand query. Example: 'properties($select=value)'. /// The cancellation token to use. - public virtual async Task> GetAsync(string expand = null, CancellationToken cancellationToken = default) + public virtual async Task> GetAsync(string expand = default, CancellationToken cancellationToken = default) { - using var scope = _devTestLabSecretSecretsClientDiagnostics.CreateScope("DevTestLabSecretResource.Get"); + using DiagnosticScope scope = _secretsClientDiagnostics.CreateScope("DevTestLabSecretResource.Get"); scope.Start(); try { - var response = await _devTestLabSecretSecretsRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, expand, cancellationToken).ConfigureAwait(false); + RequestContext context = new RequestContext + { + CancellationToken = cancellationToken + }; + HttpMessage message = _secretsRestClient.CreateGetRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, expand, context); + Response result = await Pipeline.ProcessMessageAsync(message, context).ConfigureAwait(false); + Response response = Response.FromValue(DevTestLabSecretData.FromResponse(result), result); if (response.Value == null) + { throw new RequestFailedException(response.GetRawResponse()); + } return Response.FromValue(new DevTestLabSecretResource(Client, response.Value), response.GetRawResponse()); } catch (Exception e) @@ -136,34 +148,42 @@ public virtual async Task> GetAsync(string ex /// Get secret. /// /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/users/{userName}/secrets/{name} + /// Request Path. + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/users/{userName}/secrets/{name}. /// /// - /// Operation Id - /// Secrets_Get + /// Operation Id. + /// Secrets_Get. /// /// - /// Default Api Version - /// 2018-09-15 + /// Default Api Version. + /// 2018-09-15. /// /// - /// Resource - /// + /// Resource. + /// . /// /// /// /// Specify the $expand query. Example: 'properties($select=value)'. /// The cancellation token to use. - public virtual Response Get(string expand = null, CancellationToken cancellationToken = default) + public virtual Response Get(string expand = default, CancellationToken cancellationToken = default) { - using var scope = _devTestLabSecretSecretsClientDiagnostics.CreateScope("DevTestLabSecretResource.Get"); + using DiagnosticScope scope = _secretsClientDiagnostics.CreateScope("DevTestLabSecretResource.Get"); scope.Start(); try { - var response = _devTestLabSecretSecretsRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, expand, cancellationToken); + RequestContext context = new RequestContext + { + CancellationToken = cancellationToken + }; + HttpMessage message = _secretsRestClient.CreateGetRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, expand, context); + Response result = Pipeline.ProcessMessage(message, context); + Response response = Response.FromValue(DevTestLabSecretData.FromResponse(result), result); if (response.Value == null) + { throw new RequestFailedException(response.GetRawResponse()); + } return Response.FromValue(new DevTestLabSecretResource(Client, response.Value), response.GetRawResponse()); } catch (Exception e) @@ -174,41 +194,49 @@ public virtual Response Get(string expand = null, Canc } /// - /// Delete secret. + /// Allows modifying tags of secrets. All other properties will be ignored. /// /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/users/{userName}/secrets/{name} + /// Request Path. + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/users/{userName}/secrets/{name}. /// /// - /// Operation Id - /// Secrets_Delete + /// Operation Id. + /// Secrets_Update. /// /// - /// Default Api Version - /// 2018-09-15 + /// Default Api Version. + /// 2018-09-15. /// /// - /// Resource - /// + /// Resource. + /// . /// /// /// - /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. + /// A secret. /// The cancellation token to use. - public virtual async Task DeleteAsync(WaitUntil waitUntil, CancellationToken cancellationToken = default) + /// is null. + public virtual async Task> UpdateAsync(DevTestLabSecretPatch patch, CancellationToken cancellationToken = default) { - using var scope = _devTestLabSecretSecretsClientDiagnostics.CreateScope("DevTestLabSecretResource.Delete"); + Argument.AssertNotNull(patch, nameof(patch)); + + using DiagnosticScope scope = _secretsClientDiagnostics.CreateScope("DevTestLabSecretResource.Update"); scope.Start(); try { - var response = await _devTestLabSecretSecretsRestClient.DeleteAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, cancellationToken).ConfigureAwait(false); - var uri = _devTestLabSecretSecretsRestClient.CreateDeleteRequestUri(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name); - var rehydrationToken = NextLinkOperationImplementation.GetRehydrationToken(RequestMethod.Delete, uri.ToUri(), uri.ToString(), "None", null, OperationFinalStateVia.OriginalUri.ToString()); - var operation = new DevTestLabsArmOperation(response, rehydrationToken); - if (waitUntil == WaitUntil.Completed) - await operation.WaitForCompletionResponseAsync(cancellationToken).ConfigureAwait(false); - return operation; + RequestContext context = new RequestContext + { + CancellationToken = cancellationToken + }; + HttpMessage message = _secretsRestClient.CreateUpdateRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, DevTestLabSecretPatch.ToRequestContent(patch), context); + Response result = await Pipeline.ProcessMessageAsync(message, context).ConfigureAwait(false); + Response response = Response.FromValue(DevTestLabSecretData.FromResponse(result), result); + if (response.Value == null) + { + throw new RequestFailedException(response.GetRawResponse()); + } + return Response.FromValue(new DevTestLabSecretResource(Client, response.Value), response.GetRawResponse()); } catch (Exception e) { @@ -218,41 +246,49 @@ public virtual async Task DeleteAsync(WaitUntil waitUntil, Cancell } /// - /// Delete secret. + /// Allows modifying tags of secrets. All other properties will be ignored. /// /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/users/{userName}/secrets/{name} + /// Request Path. + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/users/{userName}/secrets/{name}. /// /// - /// Operation Id - /// Secrets_Delete + /// Operation Id. + /// Secrets_Update. /// /// - /// Default Api Version - /// 2018-09-15 + /// Default Api Version. + /// 2018-09-15. /// /// - /// Resource - /// + /// Resource. + /// . /// /// /// - /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. + /// A secret. /// The cancellation token to use. - public virtual ArmOperation Delete(WaitUntil waitUntil, CancellationToken cancellationToken = default) + /// is null. + public virtual Response Update(DevTestLabSecretPatch patch, CancellationToken cancellationToken = default) { - using var scope = _devTestLabSecretSecretsClientDiagnostics.CreateScope("DevTestLabSecretResource.Delete"); + Argument.AssertNotNull(patch, nameof(patch)); + + using DiagnosticScope scope = _secretsClientDiagnostics.CreateScope("DevTestLabSecretResource.Update"); scope.Start(); try { - var response = _devTestLabSecretSecretsRestClient.Delete(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, cancellationToken); - var uri = _devTestLabSecretSecretsRestClient.CreateDeleteRequestUri(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name); - var rehydrationToken = NextLinkOperationImplementation.GetRehydrationToken(RequestMethod.Delete, uri.ToUri(), uri.ToString(), "None", null, OperationFinalStateVia.OriginalUri.ToString()); - var operation = new DevTestLabsArmOperation(response, rehydrationToken); - if (waitUntil == WaitUntil.Completed) - operation.WaitForCompletionResponse(cancellationToken); - return operation; + RequestContext context = new RequestContext + { + CancellationToken = cancellationToken + }; + HttpMessage message = _secretsRestClient.CreateUpdateRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, DevTestLabSecretPatch.ToRequestContent(patch), context); + Response result = Pipeline.ProcessMessage(message, context); + Response response = Response.FromValue(DevTestLabSecretData.FromResponse(result), result); + if (response.Value == null) + { + throw new RequestFailedException(response.GetRawResponse()); + } + return Response.FromValue(new DevTestLabSecretResource(Client, response.Value), response.GetRawResponse()); } catch (Exception e) { @@ -262,39 +298,48 @@ public virtual ArmOperation Delete(WaitUntil waitUntil, CancellationToken cancel } /// - /// Allows modifying tags of secrets. All other properties will be ignored. + /// Delete secret. /// /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/users/{userName}/secrets/{name} + /// Request Path. + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/users/{userName}/secrets/{name}. /// /// - /// Operation Id - /// Secrets_Update + /// Operation Id. + /// Secrets_Delete. /// /// - /// Default Api Version - /// 2018-09-15 + /// Default Api Version. + /// 2018-09-15. /// /// - /// Resource - /// + /// Resource. + /// . /// /// /// - /// A secret. + /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. /// The cancellation token to use. - /// is null. - public virtual async Task> UpdateAsync(DevTestLabSecretPatch patch, CancellationToken cancellationToken = default) + public virtual async Task DeleteAsync(WaitUntil waitUntil, CancellationToken cancellationToken = default) { - Argument.AssertNotNull(patch, nameof(patch)); - - using var scope = _devTestLabSecretSecretsClientDiagnostics.CreateScope("DevTestLabSecretResource.Update"); + using DiagnosticScope scope = _secretsClientDiagnostics.CreateScope("DevTestLabSecretResource.Delete"); scope.Start(); try { - var response = await _devTestLabSecretSecretsRestClient.UpdateAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, patch, cancellationToken).ConfigureAwait(false); - return Response.FromValue(new DevTestLabSecretResource(Client, response.Value), response.GetRawResponse()); + RequestContext context = new RequestContext + { + CancellationToken = cancellationToken + }; + HttpMessage message = _secretsRestClient.CreateDeleteRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, context); + Response response = await Pipeline.ProcessMessageAsync(message, context).ConfigureAwait(false); + RequestUriBuilder uri = message.Request.Uri; + RehydrationToken rehydrationToken = NextLinkOperationImplementation.GetRehydrationToken(RequestMethod.Delete, uri.ToUri(), uri.ToString(), "None", null, OperationFinalStateVia.OriginalUri.ToString()); + DevTestLabsArmOperation operation = new DevTestLabsArmOperation(response, rehydrationToken); + if (waitUntil == WaitUntil.Completed) + { + await operation.WaitForCompletionResponseAsync(cancellationToken).ConfigureAwait(false); + } + return operation; } catch (Exception e) { @@ -304,39 +349,48 @@ public virtual async Task> UpdateAsync(DevTes } /// - /// Allows modifying tags of secrets. All other properties will be ignored. + /// Delete secret. /// /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/users/{userName}/secrets/{name} + /// Request Path. + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/users/{userName}/secrets/{name}. /// /// - /// Operation Id - /// Secrets_Update + /// Operation Id. + /// Secrets_Delete. /// /// - /// Default Api Version - /// 2018-09-15 + /// Default Api Version. + /// 2018-09-15. /// /// - /// Resource - /// + /// Resource. + /// . /// /// /// - /// A secret. + /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. /// The cancellation token to use. - /// is null. - public virtual Response Update(DevTestLabSecretPatch patch, CancellationToken cancellationToken = default) + public virtual ArmOperation Delete(WaitUntil waitUntil, CancellationToken cancellationToken = default) { - Argument.AssertNotNull(patch, nameof(patch)); - - using var scope = _devTestLabSecretSecretsClientDiagnostics.CreateScope("DevTestLabSecretResource.Update"); + using DiagnosticScope scope = _secretsClientDiagnostics.CreateScope("DevTestLabSecretResource.Delete"); scope.Start(); try { - var response = _devTestLabSecretSecretsRestClient.Update(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, patch, cancellationToken); - return Response.FromValue(new DevTestLabSecretResource(Client, response.Value), response.GetRawResponse()); + RequestContext context = new RequestContext + { + CancellationToken = cancellationToken + }; + HttpMessage message = _secretsRestClient.CreateDeleteRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, context); + Response response = Pipeline.ProcessMessage(message, context); + RequestUriBuilder uri = message.Request.Uri; + RehydrationToken rehydrationToken = NextLinkOperationImplementation.GetRehydrationToken(RequestMethod.Delete, uri.ToUri(), uri.ToString(), "None", null, OperationFinalStateVia.OriginalUri.ToString()); + DevTestLabsArmOperation operation = new DevTestLabsArmOperation(response, rehydrationToken); + if (waitUntil == WaitUntil.Completed) + { + operation.WaitForCompletionResponse(cancellationToken); + } + return operation; } catch (Exception e) { @@ -345,27 +399,7 @@ public virtual Response Update(DevTestLabSecretPatch p } } - /// - /// Add a tag to the current resource. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/users/{userName}/secrets/{name} - /// - /// - /// Operation Id - /// Secrets_Get - /// - /// - /// Default Api Version - /// 2018-09-15 - /// - /// - /// Resource - /// - /// - /// - /// + /// Add a tag to the current resource. /// The key for the tag. /// The value for the tag. /// The cancellation token to use. @@ -375,29 +409,35 @@ public virtual async Task> AddTagAsync(string Argument.AssertNotNull(key, nameof(key)); Argument.AssertNotNull(value, nameof(value)); - using var scope = _devTestLabSecretSecretsClientDiagnostics.CreateScope("DevTestLabSecretResource.AddTag"); + using DiagnosticScope scope = _secretsClientDiagnostics.CreateScope("DevTestLabSecretResource.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 _devTestLabSecretSecretsRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, null, cancellationToken).ConfigureAwait(false); - return Response.FromValue(new DevTestLabSecretResource(Client, originalResponse.Value), originalResponse.GetRawResponse()); + await GetTagResource().CreateOrUpdateAsync(WaitUntil.Completed, originalTags.Value.Data, cancellationToken).ConfigureAwait(false); + RequestContext context = new RequestContext + { + CancellationToken = cancellationToken + }; + HttpMessage message = _secretsRestClient.CreateGetRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, default, context); + Response result = await Pipeline.ProcessMessageAsync(message, context).ConfigureAwait(false); + Response response = Response.FromValue(DevTestLabSecretData.FromResponse(result), result); + return Response.FromValue(new DevTestLabSecretResource(Client, response.Value), response.GetRawResponse()); } else { - var current = (await GetAsync(cancellationToken: cancellationToken).ConfigureAwait(false)).Value.Data; - var patch = new DevTestLabSecretPatch(); - foreach (var tag in current.Tags) + DevTestLabSecretData current = (await GetAsync(cancellationToken: cancellationToken).ConfigureAwait(false)).Value.Data; + DevTestLabSecretPatch patch = new DevTestLabSecretPatch(); + 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) @@ -407,27 +447,7 @@ public virtual async Task> AddTagAsync(string } } - /// - /// Add a tag to the current resource. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/users/{userName}/secrets/{name} - /// - /// - /// Operation Id - /// Secrets_Get - /// - /// - /// Default Api Version - /// 2018-09-15 - /// - /// - /// 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 +457,35 @@ public virtual Response AddTag(string key, string valu Argument.AssertNotNull(key, nameof(key)); Argument.AssertNotNull(value, nameof(value)); - using var scope = _devTestLabSecretSecretsClientDiagnostics.CreateScope("DevTestLabSecretResource.AddTag"); + using DiagnosticScope scope = _secretsClientDiagnostics.CreateScope("DevTestLabSecretResource.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 = _devTestLabSecretSecretsRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, null, cancellationToken); - return Response.FromValue(new DevTestLabSecretResource(Client, originalResponse.Value), originalResponse.GetRawResponse()); + GetTagResource().CreateOrUpdate(WaitUntil.Completed, originalTags.Value.Data, cancellationToken); + RequestContext context = new RequestContext + { + CancellationToken = cancellationToken + }; + HttpMessage message = _secretsRestClient.CreateGetRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, default, context); + Response result = Pipeline.ProcessMessage(message, context); + Response response = Response.FromValue(DevTestLabSecretData.FromResponse(result), result); + return Response.FromValue(new DevTestLabSecretResource(Client, response.Value), response.GetRawResponse()); } else { - var current = Get(cancellationToken: cancellationToken).Value.Data; - var patch = new DevTestLabSecretPatch(); - foreach (var tag in current.Tags) + DevTestLabSecretData current = Get(cancellationToken: cancellationToken).Value.Data; + DevTestLabSecretPatch patch = new DevTestLabSecretPatch(); + 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) @@ -469,54 +495,40 @@ public virtual Response AddTag(string key, string valu } } - /// - /// Replace the tags on the resource with the given set. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/users/{userName}/secrets/{name} - /// - /// - /// Operation Id - /// Secrets_Get - /// - /// - /// Default Api Version - /// 2018-09-15 - /// - /// - /// 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 = _devTestLabSecretSecretsClientDiagnostics.CreateScope("DevTestLabSecretResource.SetTags"); + using DiagnosticScope scope = _secretsClientDiagnostics.CreateScope("DevTestLabSecretResource.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 _devTestLabSecretSecretsRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, null, cancellationToken).ConfigureAwait(false); - return Response.FromValue(new DevTestLabSecretResource(Client, originalResponse.Value), originalResponse.GetRawResponse()); + await GetTagResource().CreateOrUpdateAsync(WaitUntil.Completed, originalTags.Value.Data, cancellationToken).ConfigureAwait(false); + RequestContext context = new RequestContext + { + CancellationToken = cancellationToken + }; + HttpMessage message = _secretsRestClient.CreateGetRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, default, context); + Response result = await Pipeline.ProcessMessageAsync(message, context).ConfigureAwait(false); + Response response = Response.FromValue(DevTestLabSecretData.FromResponse(result), result); + return Response.FromValue(new DevTestLabSecretResource(Client, response.Value), response.GetRawResponse()); } else { - var current = (await GetAsync(cancellationToken: cancellationToken).ConfigureAwait(false)).Value.Data; - var patch = new DevTestLabSecretPatch(); + DevTestLabSecretData current = (await GetAsync(cancellationToken: cancellationToken).ConfigureAwait(false)).Value.Data; + DevTestLabSecretPatch patch = new DevTestLabSecretPatch(); 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) @@ -526,54 +538,40 @@ public virtual async Task> SetTagsAsync(IDict } } - /// - /// Replace the tags on the resource with the given set. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/users/{userName}/secrets/{name} - /// - /// - /// Operation Id - /// Secrets_Get - /// - /// - /// Default Api Version - /// 2018-09-15 - /// - /// - /// 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 = _devTestLabSecretSecretsClientDiagnostics.CreateScope("DevTestLabSecretResource.SetTags"); + using DiagnosticScope scope = _secretsClientDiagnostics.CreateScope("DevTestLabSecretResource.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 = _devTestLabSecretSecretsRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, null, cancellationToken); - return Response.FromValue(new DevTestLabSecretResource(Client, originalResponse.Value), originalResponse.GetRawResponse()); + GetTagResource().CreateOrUpdate(WaitUntil.Completed, originalTags.Value.Data, cancellationToken); + RequestContext context = new RequestContext + { + CancellationToken = cancellationToken + }; + HttpMessage message = _secretsRestClient.CreateGetRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, default, context); + Response result = Pipeline.ProcessMessage(message, context); + Response response = Response.FromValue(DevTestLabSecretData.FromResponse(result), result); + return Response.FromValue(new DevTestLabSecretResource(Client, response.Value), response.GetRawResponse()); } else { - var current = Get(cancellationToken: cancellationToken).Value.Data; - var patch = new DevTestLabSecretPatch(); + DevTestLabSecretData current = Get(cancellationToken: cancellationToken).Value.Data; + DevTestLabSecretPatch patch = new DevTestLabSecretPatch(); 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) @@ -583,27 +581,7 @@ public virtual Response SetTags(IDictionary - /// Removes a tag by key from the resource. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/users/{userName}/secrets/{name} - /// - /// - /// Operation Id - /// Secrets_Get - /// - /// - /// Default Api Version - /// 2018-09-15 - /// - /// - /// Resource - /// - /// - /// - /// + /// Removes a tag by key from the resource. /// The key for the tag. /// The cancellation token to use. /// is null. @@ -611,29 +589,35 @@ public virtual async Task> RemoveTagAsync(str { Argument.AssertNotNull(key, nameof(key)); - using var scope = _devTestLabSecretSecretsClientDiagnostics.CreateScope("DevTestLabSecretResource.RemoveTag"); + using DiagnosticScope scope = _secretsClientDiagnostics.CreateScope("DevTestLabSecretResource.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 _devTestLabSecretSecretsRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, null, cancellationToken).ConfigureAwait(false); - return Response.FromValue(new DevTestLabSecretResource(Client, originalResponse.Value), originalResponse.GetRawResponse()); + await GetTagResource().CreateOrUpdateAsync(WaitUntil.Completed, originalTags.Value.Data, cancellationToken).ConfigureAwait(false); + RequestContext context = new RequestContext + { + CancellationToken = cancellationToken + }; + HttpMessage message = _secretsRestClient.CreateGetRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, default, context); + Response result = await Pipeline.ProcessMessageAsync(message, context).ConfigureAwait(false); + Response response = Response.FromValue(DevTestLabSecretData.FromResponse(result), result); + return Response.FromValue(new DevTestLabSecretResource(Client, response.Value), response.GetRawResponse()); } else { - var current = (await GetAsync(cancellationToken: cancellationToken).ConfigureAwait(false)).Value.Data; - var patch = new DevTestLabSecretPatch(); - foreach (var tag in current.Tags) + DevTestLabSecretData current = (await GetAsync(cancellationToken: cancellationToken).ConfigureAwait(false)).Value.Data; + DevTestLabSecretPatch patch = new DevTestLabSecretPatch(); + 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) @@ -643,27 +627,7 @@ public virtual async Task> RemoveTagAsync(str } } - /// - /// Removes a tag by key from the resource. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/users/{userName}/secrets/{name} - /// - /// - /// Operation Id - /// Secrets_Get - /// - /// - /// Default Api Version - /// 2018-09-15 - /// - /// - /// Resource - /// - /// - /// - /// + /// Removes a tag by key from the resource. /// The key for the tag. /// The cancellation token to use. /// is null. @@ -671,29 +635,35 @@ public virtual Response RemoveTag(string key, Cancella { Argument.AssertNotNull(key, nameof(key)); - using var scope = _devTestLabSecretSecretsClientDiagnostics.CreateScope("DevTestLabSecretResource.RemoveTag"); + using DiagnosticScope scope = _secretsClientDiagnostics.CreateScope("DevTestLabSecretResource.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 = _devTestLabSecretSecretsRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, null, cancellationToken); - return Response.FromValue(new DevTestLabSecretResource(Client, originalResponse.Value), originalResponse.GetRawResponse()); + GetTagResource().CreateOrUpdate(WaitUntil.Completed, originalTags.Value.Data, cancellationToken); + RequestContext context = new RequestContext + { + CancellationToken = cancellationToken + }; + HttpMessage message = _secretsRestClient.CreateGetRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, default, context); + Response result = Pipeline.ProcessMessage(message, context); + Response response = Response.FromValue(DevTestLabSecretData.FromResponse(result), result); + return Response.FromValue(new DevTestLabSecretResource(Client, response.Value), response.GetRawResponse()); } else { - var current = Get(cancellationToken: cancellationToken).Value.Data; - var patch = new DevTestLabSecretPatch(); - foreach (var tag in current.Tags) + DevTestLabSecretData current = Get(cancellationToken: cancellationToken).Value.Data; + DevTestLabSecretPatch patch = new DevTestLabSecretPatch(); + 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) diff --git a/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/DevTestLabServiceFabricCollection.cs b/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/DevTestLabServiceFabricCollection.cs index cd12e43656b5..113d323a7b4c 100644 --- a/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/DevTestLabServiceFabricCollection.cs +++ b/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/DevTestLabServiceFabricCollection.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.DevTestLabs { @@ -24,51 +25,49 @@ namespace Azure.ResourceManager.DevTestLabs /// public partial class DevTestLabServiceFabricCollection : ArmCollection, IEnumerable, IAsyncEnumerable { - private readonly ClientDiagnostics _devTestLabServiceFabricServiceFabricsClientDiagnostics; - private readonly ServiceFabricsRestOperations _devTestLabServiceFabricServiceFabricsRestClient; + private readonly ClientDiagnostics _serviceFabricsClientDiagnostics; + private readonly ServiceFabrics _serviceFabricsRestClient; - /// Initializes a new instance of the class for mocking. + /// Initializes a new instance of DevTestLabServiceFabricCollection for mocking. protected DevTestLabServiceFabricCollection() { } - /// 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 DevTestLabServiceFabricCollection(ArmClient client, ResourceIdentifier id) : base(client, id) { - _devTestLabServiceFabricServiceFabricsClientDiagnostics = new ClientDiagnostics("Azure.ResourceManager.DevTestLabs", DevTestLabServiceFabricResource.ResourceType.Namespace, Diagnostics); - TryGetApiVersion(DevTestLabServiceFabricResource.ResourceType, out string devTestLabServiceFabricServiceFabricsApiVersion); - _devTestLabServiceFabricServiceFabricsRestClient = new ServiceFabricsRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, devTestLabServiceFabricServiceFabricsApiVersion); -#if DEBUG - ValidateResourceId(Id); -#endif + TryGetApiVersion(DevTestLabServiceFabricResource.ResourceType, out string devTestLabServiceFabricApiVersion); + _serviceFabricsClientDiagnostics = new ClientDiagnostics("Azure.ResourceManager.DevTestLabs", DevTestLabServiceFabricResource.ResourceType.Namespace, Diagnostics); + _serviceFabricsRestClient = new ServiceFabrics(_serviceFabricsClientDiagnostics, Pipeline, Endpoint, devTestLabServiceFabricApiVersion ?? "2018-09-15"); + ValidateResourceId(id); } + /// + [Conditional("DEBUG")] internal static void ValidateResourceId(ResourceIdentifier id) { if (id.ResourceType != DevTestLabUserResource.ResourceType) - throw new ArgumentException(string.Format(CultureInfo.CurrentCulture, "Invalid resource type {0} expected {1}", id.ResourceType, DevTestLabUserResource.ResourceType), nameof(id)); + { + throw new ArgumentException(string.Format("Invalid resource type {0} expected {1}", id.ResourceType, DevTestLabUserResource.ResourceType), id); + } } /// /// Create or replace an existing service fabric. This operation can take a while to complete. /// /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/users/{userName}/servicefabrics/{name} - /// - /// - /// Operation Id - /// ServiceFabrics_CreateOrUpdate + /// Request Path. + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/users/{userName}/servicefabrics/{name}. /// /// - /// Default Api Version - /// 2018-09-15 + /// Operation Id. + /// ServiceFabrics_CreateOrUpdate. /// /// - /// Resource - /// + /// Default Api Version. + /// 2018-09-15. /// /// /// @@ -76,21 +75,34 @@ internal static void ValidateResourceId(ResourceIdentifier id) /// The name of the service fabric. /// A Service Fabric. /// 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 name, DevTestLabServiceFabricData data, CancellationToken cancellationToken = default) { Argument.AssertNotNullOrEmpty(name, nameof(name)); Argument.AssertNotNull(data, nameof(data)); - using var scope = _devTestLabServiceFabricServiceFabricsClientDiagnostics.CreateScope("DevTestLabServiceFabricCollection.CreateOrUpdate"); + using DiagnosticScope scope = _serviceFabricsClientDiagnostics.CreateScope("DevTestLabServiceFabricCollection.CreateOrUpdate"); scope.Start(); try { - var response = await _devTestLabServiceFabricServiceFabricsRestClient.CreateOrUpdateAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, name, data, cancellationToken).ConfigureAwait(false); - var operation = new DevTestLabsArmOperation(new DevTestLabServiceFabricOperationSource(Client), _devTestLabServiceFabricServiceFabricsClientDiagnostics, Pipeline, _devTestLabServiceFabricServiceFabricsRestClient.CreateCreateOrUpdateRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, name, data).Request, response, OperationFinalStateVia.Location); + RequestContext context = new RequestContext + { + CancellationToken = cancellationToken + }; + HttpMessage message = _serviceFabricsRestClient.CreateCreateOrUpdateRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, name, DevTestLabServiceFabricData.ToRequestContent(data), context); + Response response = await Pipeline.ProcessMessageAsync(message, context).ConfigureAwait(false); + DevTestLabsArmOperation operation = new DevTestLabsArmOperation( + new DevTestLabServiceFabricOperationSource(Client), + _serviceFabricsClientDiagnostics, + Pipeline, + message.Request, + response, + OperationFinalStateVia.Location); if (waitUntil == WaitUntil.Completed) + { await operation.WaitForCompletionAsync(cancellationToken).ConfigureAwait(false); + } return operation; } catch (Exception e) @@ -104,20 +116,16 @@ public virtual async Task> CreateO /// Create or replace an existing service fabric. This operation can take a while to complete. /// /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/users/{userName}/servicefabrics/{name} + /// Request Path. + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/users/{userName}/servicefabrics/{name}. /// /// - /// Operation Id - /// ServiceFabrics_CreateOrUpdate + /// Operation Id. + /// ServiceFabrics_CreateOrUpdate. /// /// - /// Default Api Version - /// 2018-09-15 - /// - /// - /// Resource - /// + /// Default Api Version. + /// 2018-09-15. /// /// /// @@ -125,21 +133,34 @@ public virtual async Task> CreateO /// The name of the service fabric. /// A Service Fabric. /// 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 name, DevTestLabServiceFabricData data, CancellationToken cancellationToken = default) { Argument.AssertNotNullOrEmpty(name, nameof(name)); Argument.AssertNotNull(data, nameof(data)); - using var scope = _devTestLabServiceFabricServiceFabricsClientDiagnostics.CreateScope("DevTestLabServiceFabricCollection.CreateOrUpdate"); + using DiagnosticScope scope = _serviceFabricsClientDiagnostics.CreateScope("DevTestLabServiceFabricCollection.CreateOrUpdate"); scope.Start(); try { - var response = _devTestLabServiceFabricServiceFabricsRestClient.CreateOrUpdate(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, name, data, cancellationToken); - var operation = new DevTestLabsArmOperation(new DevTestLabServiceFabricOperationSource(Client), _devTestLabServiceFabricServiceFabricsClientDiagnostics, Pipeline, _devTestLabServiceFabricServiceFabricsRestClient.CreateCreateOrUpdateRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, name, data).Request, response, OperationFinalStateVia.Location); + RequestContext context = new RequestContext + { + CancellationToken = cancellationToken + }; + HttpMessage message = _serviceFabricsRestClient.CreateCreateOrUpdateRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, name, DevTestLabServiceFabricData.ToRequestContent(data), context); + Response response = Pipeline.ProcessMessage(message, context); + DevTestLabsArmOperation operation = new DevTestLabsArmOperation( + new DevTestLabServiceFabricOperationSource(Client), + _serviceFabricsClientDiagnostics, + Pipeline, + message.Request, + response, + OperationFinalStateVia.Location); if (waitUntil == WaitUntil.Completed) + { operation.WaitForCompletion(cancellationToken); + } return operation; } catch (Exception e) @@ -153,39 +174,43 @@ public virtual ArmOperation CreateOrUpdate(Wait /// Get service fabric. /// /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/users/{userName}/servicefabrics/{name} + /// Request Path. + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/users/{userName}/servicefabrics/{name}. /// /// - /// Operation Id - /// ServiceFabrics_Get + /// Operation Id. + /// ServiceFabrics_Get. /// /// - /// Default Api Version - /// 2018-09-15 - /// - /// - /// Resource - /// + /// Default Api Version. + /// 2018-09-15. /// /// /// /// The name of the service fabric. /// Specify the $expand query. Example: 'properties($expand=applicableSchedule)'. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. - public virtual async Task> GetAsync(string name, string expand = null, CancellationToken cancellationToken = default) + /// is an empty string, and was expected to be non-empty. + public virtual async Task> GetAsync(string name, string expand = default, CancellationToken cancellationToken = default) { Argument.AssertNotNullOrEmpty(name, nameof(name)); - using var scope = _devTestLabServiceFabricServiceFabricsClientDiagnostics.CreateScope("DevTestLabServiceFabricCollection.Get"); + using DiagnosticScope scope = _serviceFabricsClientDiagnostics.CreateScope("DevTestLabServiceFabricCollection.Get"); scope.Start(); try { - var response = await _devTestLabServiceFabricServiceFabricsRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, name, expand, cancellationToken).ConfigureAwait(false); + RequestContext context = new RequestContext + { + CancellationToken = cancellationToken + }; + HttpMessage message = _serviceFabricsRestClient.CreateGetRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, name, expand, context); + Response result = await Pipeline.ProcessMessageAsync(message, context).ConfigureAwait(false); + Response response = Response.FromValue(DevTestLabServiceFabricData.FromResponse(result), result); if (response.Value == null) + { throw new RequestFailedException(response.GetRawResponse()); + } return Response.FromValue(new DevTestLabServiceFabricResource(Client, response.Value), response.GetRawResponse()); } catch (Exception e) @@ -199,39 +224,43 @@ public virtual async Task> GetAsync(st /// Get service fabric. /// /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/users/{userName}/servicefabrics/{name} - /// - /// - /// Operation Id - /// ServiceFabrics_Get + /// Request Path. + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/users/{userName}/servicefabrics/{name}. /// /// - /// Default Api Version - /// 2018-09-15 + /// Operation Id. + /// ServiceFabrics_Get. /// /// - /// Resource - /// + /// Default Api Version. + /// 2018-09-15. /// /// /// /// The name of the service fabric. /// Specify the $expand query. Example: 'properties($expand=applicableSchedule)'. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. - public virtual Response Get(string name, string expand = null, CancellationToken cancellationToken = default) + /// is an empty string, and was expected to be non-empty. + public virtual Response Get(string name, string expand = default, CancellationToken cancellationToken = default) { Argument.AssertNotNullOrEmpty(name, nameof(name)); - using var scope = _devTestLabServiceFabricServiceFabricsClientDiagnostics.CreateScope("DevTestLabServiceFabricCollection.Get"); + using DiagnosticScope scope = _serviceFabricsClientDiagnostics.CreateScope("DevTestLabServiceFabricCollection.Get"); scope.Start(); try { - var response = _devTestLabServiceFabricServiceFabricsRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, name, expand, cancellationToken); + RequestContext context = new RequestContext + { + CancellationToken = cancellationToken + }; + HttpMessage message = _serviceFabricsRestClient.CreateGetRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, name, expand, context); + Response result = Pipeline.ProcessMessage(message, context); + Response response = Response.FromValue(DevTestLabServiceFabricData.FromResponse(result), result); if (response.Value == null) + { throw new RequestFailedException(response.GetRawResponse()); + } return Response.FromValue(new DevTestLabServiceFabricResource(Client, response.Value), response.GetRawResponse()); } catch (Exception e) @@ -245,20 +274,16 @@ public virtual Response Get(string name, string /// List service fabrics in a given user profile. /// /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/users/{userName}/servicefabrics + /// Request Path. + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/users/{userName}/servicefabrics. /// /// - /// Operation Id - /// ServiceFabrics_List + /// Operation Id. + /// ServiceFabrics_List. /// /// - /// Default Api Version - /// 2018-09-15 - /// - /// - /// Resource - /// + /// Default Api Version. + /// 2018-09-15. /// /// /// @@ -267,32 +292,40 @@ public virtual Response Get(string name, string /// The maximum number of resources to return from the operation. Example: '$top=10'. /// The ordering expression for the results, using OData notation. Example: '$orderby=name desc'. /// The cancellation token to use. - /// An async collection of that may take multiple service requests to iterate over. - public virtual AsyncPageable GetAllAsync(string expand = null, string filter = null, int? top = null, string orderby = null, CancellationToken cancellationToken = default) + /// A collection of that may take multiple service requests to iterate over. + public virtual AsyncPageable GetAllAsync(string expand = default, string filter = default, int? top = default, string @orderby = default, CancellationToken cancellationToken = default) { - HttpMessage FirstPageRequest(int? pageSizeHint) => _devTestLabServiceFabricServiceFabricsRestClient.CreateListRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, expand, filter, top, orderby); - HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _devTestLabServiceFabricServiceFabricsRestClient.CreateListNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, expand, filter, top, orderby); - return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new DevTestLabServiceFabricResource(Client, DevTestLabServiceFabricData.DeserializeDevTestLabServiceFabricData(e)), _devTestLabServiceFabricServiceFabricsClientDiagnostics, Pipeline, "DevTestLabServiceFabricCollection.GetAll", "value", "nextLink", cancellationToken); + RequestContext context = new RequestContext + { + CancellationToken = cancellationToken + }; + return new AsyncPageableWrapper(new ServiceFabricsGetAllAsyncCollectionResultOfT( + _serviceFabricsRestClient, + Id.SubscriptionId, + Id.ResourceGroupName, + Id.Parent.Name, + Id.Name, + expand, + filter, + top, + @orderby, + context), data => new DevTestLabServiceFabricResource(Client, data)); } /// /// List service fabrics in a given user profile. /// /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/users/{userName}/servicefabrics - /// - /// - /// Operation Id - /// ServiceFabrics_List + /// Request Path. + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/users/{userName}/servicefabrics. /// /// - /// Default Api Version - /// 2018-09-15 + /// Operation Id. + /// ServiceFabrics_List. /// /// - /// Resource - /// + /// Default Api Version. + /// 2018-09-15. /// /// /// @@ -302,48 +335,74 @@ public virtual AsyncPageable GetAllAsync(string /// The ordering expression for the results, using OData notation. Example: '$orderby=name desc'. /// The cancellation token to use. /// A collection of that may take multiple service requests to iterate over. - public virtual Pageable GetAll(string expand = null, string filter = null, int? top = null, string orderby = null, CancellationToken cancellationToken = default) + public virtual Pageable GetAll(string expand = default, string filter = default, int? top = default, string @orderby = default, CancellationToken cancellationToken = default) { - HttpMessage FirstPageRequest(int? pageSizeHint) => _devTestLabServiceFabricServiceFabricsRestClient.CreateListRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, expand, filter, top, orderby); - HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _devTestLabServiceFabricServiceFabricsRestClient.CreateListNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, expand, filter, top, orderby); - return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new DevTestLabServiceFabricResource(Client, DevTestLabServiceFabricData.DeserializeDevTestLabServiceFabricData(e)), _devTestLabServiceFabricServiceFabricsClientDiagnostics, Pipeline, "DevTestLabServiceFabricCollection.GetAll", "value", "nextLink", cancellationToken); + RequestContext context = new RequestContext + { + CancellationToken = cancellationToken + }; + return new PageableWrapper(new ServiceFabricsGetAllCollectionResultOfT( + _serviceFabricsRestClient, + Id.SubscriptionId, + Id.ResourceGroupName, + Id.Parent.Name, + Id.Name, + expand, + filter, + top, + @orderby, + context), data => new DevTestLabServiceFabricResource(Client, data)); } /// /// Checks to see if the resource exists in azure. /// /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/users/{userName}/servicefabrics/{name} - /// - /// - /// Operation Id - /// ServiceFabrics_Get + /// Request Path. + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/users/{userName}/servicefabrics/{name}. /// /// - /// Default Api Version - /// 2018-09-15 + /// Operation Id. + /// ServiceFabrics_Get. /// /// - /// Resource - /// + /// Default Api Version. + /// 2018-09-15. /// /// /// /// The name of the service fabric. /// Specify the $expand query. Example: 'properties($expand=applicableSchedule)'. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. - public virtual async Task> ExistsAsync(string name, string expand = null, CancellationToken cancellationToken = default) + /// is an empty string, and was expected to be non-empty. + public virtual async Task> ExistsAsync(string name, string expand = default, CancellationToken cancellationToken = default) { Argument.AssertNotNullOrEmpty(name, nameof(name)); - using var scope = _devTestLabServiceFabricServiceFabricsClientDiagnostics.CreateScope("DevTestLabServiceFabricCollection.Exists"); + using DiagnosticScope scope = _serviceFabricsClientDiagnostics.CreateScope("DevTestLabServiceFabricCollection.Exists"); scope.Start(); try { - var response = await _devTestLabServiceFabricServiceFabricsRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, name, expand, cancellationToken: cancellationToken).ConfigureAwait(false); + RequestContext context = new RequestContext + { + CancellationToken = cancellationToken + }; + HttpMessage message = _serviceFabricsRestClient.CreateGetRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, name, expand, context); + await Pipeline.SendAsync(message, context.CancellationToken).ConfigureAwait(false); + Response result = message.Response; + Response response = default; + switch (result.Status) + { + case 200: + response = Response.FromValue(DevTestLabServiceFabricData.FromResponse(result), result); + break; + case 404: + response = Response.FromValue((DevTestLabServiceFabricData)null, result); + break; + default: + throw new RequestFailedException(result); + } return Response.FromValue(response.Value != null, response.GetRawResponse()); } catch (Exception e) @@ -357,37 +416,51 @@ public virtual async Task> ExistsAsync(string name, string expand /// Checks to see if the resource exists in azure. /// /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/users/{userName}/servicefabrics/{name} + /// Request Path. + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/users/{userName}/servicefabrics/{name}. /// /// - /// Operation Id - /// ServiceFabrics_Get + /// Operation Id. + /// ServiceFabrics_Get. /// /// - /// Default Api Version - /// 2018-09-15 - /// - /// - /// Resource - /// + /// Default Api Version. + /// 2018-09-15. /// /// /// /// The name of the service fabric. /// Specify the $expand query. Example: 'properties($expand=applicableSchedule)'. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. - public virtual Response Exists(string name, string expand = null, CancellationToken cancellationToken = default) + /// is an empty string, and was expected to be non-empty. + public virtual Response Exists(string name, string expand = default, CancellationToken cancellationToken = default) { Argument.AssertNotNullOrEmpty(name, nameof(name)); - using var scope = _devTestLabServiceFabricServiceFabricsClientDiagnostics.CreateScope("DevTestLabServiceFabricCollection.Exists"); + using DiagnosticScope scope = _serviceFabricsClientDiagnostics.CreateScope("DevTestLabServiceFabricCollection.Exists"); scope.Start(); try { - var response = _devTestLabServiceFabricServiceFabricsRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, name, expand, cancellationToken: cancellationToken); + RequestContext context = new RequestContext + { + CancellationToken = cancellationToken + }; + HttpMessage message = _serviceFabricsRestClient.CreateGetRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, name, expand, context); + Pipeline.Send(message, context.CancellationToken); + Response result = message.Response; + Response response = default; + switch (result.Status) + { + case 200: + response = Response.FromValue(DevTestLabServiceFabricData.FromResponse(result), result); + break; + case 404: + response = Response.FromValue((DevTestLabServiceFabricData)null, result); + break; + default: + throw new RequestFailedException(result); + } return Response.FromValue(response.Value != null, response.GetRawResponse()); } catch (Exception e) @@ -401,39 +474,55 @@ public virtual Response Exists(string name, string expand = null, Cancella /// Tries to get details for this resource from the service. /// /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/users/{userName}/servicefabrics/{name} - /// - /// - /// Operation Id - /// ServiceFabrics_Get + /// Request Path. + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/users/{userName}/servicefabrics/{name}. /// /// - /// Default Api Version - /// 2018-09-15 + /// Operation Id. + /// ServiceFabrics_Get. /// /// - /// Resource - /// + /// Default Api Version. + /// 2018-09-15. /// /// /// /// The name of the service fabric. /// Specify the $expand query. Example: 'properties($expand=applicableSchedule)'. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. - public virtual async Task> GetIfExistsAsync(string name, string expand = null, CancellationToken cancellationToken = default) + /// is an empty string, and was expected to be non-empty. + public virtual async Task> GetIfExistsAsync(string name, string expand = default, CancellationToken cancellationToken = default) { Argument.AssertNotNullOrEmpty(name, nameof(name)); - using var scope = _devTestLabServiceFabricServiceFabricsClientDiagnostics.CreateScope("DevTestLabServiceFabricCollection.GetIfExists"); + using DiagnosticScope scope = _serviceFabricsClientDiagnostics.CreateScope("DevTestLabServiceFabricCollection.GetIfExists"); scope.Start(); try { - var response = await _devTestLabServiceFabricServiceFabricsRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, name, expand, cancellationToken: cancellationToken).ConfigureAwait(false); + RequestContext context = new RequestContext + { + CancellationToken = cancellationToken + }; + HttpMessage message = _serviceFabricsRestClient.CreateGetRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, name, expand, context); + await Pipeline.SendAsync(message, context.CancellationToken).ConfigureAwait(false); + Response result = message.Response; + Response response = default; + switch (result.Status) + { + case 200: + response = Response.FromValue(DevTestLabServiceFabricData.FromResponse(result), result); + break; + case 404: + response = Response.FromValue((DevTestLabServiceFabricData)null, result); + break; + default: + throw new RequestFailedException(result); + } if (response.Value == null) + { return new NoValueResponse(response.GetRawResponse()); + } return Response.FromValue(new DevTestLabServiceFabricResource(Client, response.Value), response.GetRawResponse()); } catch (Exception e) @@ -447,39 +536,55 @@ public virtual async Task> Get /// Tries to get details for this resource from the service. /// /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/users/{userName}/servicefabrics/{name} + /// Request Path. + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/users/{userName}/servicefabrics/{name}. /// /// - /// Operation Id - /// ServiceFabrics_Get + /// Operation Id. + /// ServiceFabrics_Get. /// /// - /// Default Api Version - /// 2018-09-15 - /// - /// - /// Resource - /// + /// Default Api Version. + /// 2018-09-15. /// /// /// /// The name of the service fabric. /// Specify the $expand query. Example: 'properties($expand=applicableSchedule)'. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. - public virtual NullableResponse GetIfExists(string name, string expand = null, CancellationToken cancellationToken = default) + /// is an empty string, and was expected to be non-empty. + public virtual NullableResponse GetIfExists(string name, string expand = default, CancellationToken cancellationToken = default) { Argument.AssertNotNullOrEmpty(name, nameof(name)); - using var scope = _devTestLabServiceFabricServiceFabricsClientDiagnostics.CreateScope("DevTestLabServiceFabricCollection.GetIfExists"); + using DiagnosticScope scope = _serviceFabricsClientDiagnostics.CreateScope("DevTestLabServiceFabricCollection.GetIfExists"); scope.Start(); try { - var response = _devTestLabServiceFabricServiceFabricsRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, name, expand, cancellationToken: cancellationToken); + RequestContext context = new RequestContext + { + CancellationToken = cancellationToken + }; + HttpMessage message = _serviceFabricsRestClient.CreateGetRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, name, expand, context); + Pipeline.Send(message, context.CancellationToken); + Response result = message.Response; + Response response = default; + switch (result.Status) + { + case 200: + response = Response.FromValue(DevTestLabServiceFabricData.FromResponse(result), result); + break; + case 404: + response = Response.FromValue((DevTestLabServiceFabricData)null, result); + break; + default: + throw new RequestFailedException(result); + } if (response.Value == null) + { return new NoValueResponse(response.GetRawResponse()); + } return Response.FromValue(new DevTestLabServiceFabricResource(Client, response.Value), response.GetRawResponse()); } catch (Exception e) @@ -499,6 +604,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/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/DevTestLabServiceFabricData.Serialization.cs b/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/DevTestLabServiceFabricData.Serialization.cs index 8f214070cc18..d35edfe156d5 100644 --- a/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/DevTestLabServiceFabricData.Serialization.cs +++ b/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/DevTestLabServiceFabricData.Serialization.cs @@ -10,16 +10,47 @@ using System.Collections.Generic; using System.Text; using System.Text.Json; +using Azure; using Azure.Core; using Azure.ResourceManager.DevTestLabs.Models; using Azure.ResourceManager.Models; namespace Azure.ResourceManager.DevTestLabs { - public partial class DevTestLabServiceFabricData : IUtf8JsonSerializable, IJsonModel + /// A Service Fabric. + public partial class DevTestLabServiceFabricData : TrackedResourceData, IJsonModel { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + /// Initializes a new instance of for deserialization. + internal DevTestLabServiceFabricData() + { + } + + /// 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)) + { + return DeserializeDevTestLabServiceFabricData(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(DevTestLabServiceFabricData)} does not support reading '{options.Format}' format."); + } + } + /// The to deserialize the from. + internal static DevTestLabServiceFabricData FromResponse(Response response) + { + using JsonDocument document = JsonDocument.Parse(response.Content, ModelSerializationExtensions.JsonDocumentOptions); + return DeserializeDevTestLabServiceFabricData(document.RootElement, ModelSerializationExtensions.WireOptions); + } + + /// The JSON writer. + /// The client options for reading and writing models. void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) { writer.WriteStartObject(); @@ -31,191 +62,153 @@ void IJsonModel.Write(Utf8JsonWriter writer, ModelR /// 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(DevTestLabServiceFabricData)} does not support writing '{format}' format."); } - base.JsonModelWriteCore(writer, options); writer.WritePropertyName("properties"u8); - writer.WriteStartObject(); - if (Optional.IsDefined(ExternalServiceFabricId)) + writer.WriteObjectValue(Properties, options); + if (Optional.IsCollectionDefined(Tags)) { - writer.WritePropertyName("externalServiceFabricId"u8); - writer.WriteStringValue(ExternalServiceFabricId); - } - if (Optional.IsDefined(EnvironmentId)) - { - writer.WritePropertyName("environmentId"u8); - writer.WriteStringValue(EnvironmentId); - } - if (options.Format != "W" && Optional.IsDefined(ApplicableSchedule)) - { - writer.WritePropertyName("applicableSchedule"u8); - writer.WriteObjectValue(ApplicableSchedule, options); - } - if (options.Format != "W" && Optional.IsDefined(ProvisioningState)) - { - writer.WritePropertyName("provisioningState"u8); - writer.WriteStringValue(ProvisioningState); - } - if (options.Format != "W" && Optional.IsDefined(UniqueIdentifier)) - { - writer.WritePropertyName("uniqueIdentifier"u8); - writer.WriteStringValue(UniqueIdentifier.Value); + writer.WritePropertyName("tags"u8); + writer.WriteStartObject(); + foreach (var item in Tags) + { + writer.WritePropertyName(item.Key); + if (item.Value == null) + { + writer.WriteNullValue(); + continue; + } + writer.WriteStringValue(item.Value); + } + writer.WriteEndObject(); } - writer.WriteEndObject(); } - DevTestLabServiceFabricData IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + /// The JSON reader. + /// The client options for reading and writing models. + DevTestLabServiceFabricData IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) => (DevTestLabServiceFabricData)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(DevTestLabServiceFabricData)} does not support reading '{format}' format."); } - using JsonDocument document = JsonDocument.ParseValue(ref reader); return DeserializeDevTestLabServiceFabricData(document.RootElement, options); } - internal static DevTestLabServiceFabricData DeserializeDevTestLabServiceFabricData(JsonElement element, ModelReaderWriterOptions options = null) + /// The JSON element to deserialize. + /// The client options for reading and writing models. + internal static DevTestLabServiceFabricData DeserializeDevTestLabServiceFabricData(JsonElement element, ModelReaderWriterOptions options) { - options ??= ModelSerializationExtensions.WireOptions; - if (element.ValueKind == JsonValueKind.Null) { return null; } - IDictionary tags = default; - AzureLocation location = default; ResourceIdentifier id = default; string name = default; - ResourceType type = default; + ResourceType resourceType = default; SystemData systemData = default; - string externalServiceFabricId = default; - string environmentId = default; - DevTestLabApplicableSchedule applicableSchedule = default; - string provisioningState = default; - Guid? uniqueIdentifier = default; - IDictionary serializedAdditionalRawData = default; - Dictionary rawDataDictionary = new Dictionary(); - foreach (var property in element.EnumerateObject()) + IDictionary additionalBinaryDataProperties = new ChangeTrackingDictionary(); + AzureLocation location = default; + ServiceFabricProperties properties = default; + IDictionary tags = default; + foreach (var prop in element.EnumerateObject()) { - if (property.NameEquals("tags"u8)) + if (prop.NameEquals("id"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()) - { - dictionary.Add(property0.Name, property0.Value.GetString()); - } - tags = dictionary; + id = new ResourceIdentifier(prop.Value.GetString()); continue; } - if (property.NameEquals("location"u8)) + if (prop.NameEquals("name"u8)) { - location = new AzureLocation(property.Value.GetString()); + name = prop.Value.GetString(); continue; } - if (property.NameEquals("id"u8)) + if (prop.NameEquals("type"u8)) { - id = new ResourceIdentifier(property.Value.GetString()); + if (prop.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + resourceType = new ResourceType(prop.Value.GetString()); continue; } - if (property.NameEquals("name"u8)) + if (prop.NameEquals("systemData"u8)) { - name = property.Value.GetString(); + if (prop.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + systemData = ModelReaderWriter.Read(new BinaryData(Encoding.UTF8.GetBytes(prop.Value.GetRawText())), ModelSerializationExtensions.WireOptions, AzureResourceManagerDevTestLabsContext.Default); 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) - { - continue; - } - systemData = ModelReaderWriter.Read(new BinaryData(Encoding.UTF8.GetBytes(property.Value.GetRawText())), ModelSerializationExtensions.WireOptions, AzureResourceManagerDevTestLabsContext.Default); + properties = ServiceFabricProperties.DeserializeServiceFabricProperties(prop.Value, options); continue; } - if (property.NameEquals("properties"u8)) + if (prop.NameEquals("tags"u8)) { - if (property.Value.ValueKind == JsonValueKind.Null) + if (prop.Value.ValueKind == JsonValueKind.Null) { - property.ThrowNonNullablePropertyIsNull(); continue; } - foreach (var property0 in property.Value.EnumerateObject()) + Dictionary dictionary = new Dictionary(); + foreach (var prop0 in prop.Value.EnumerateObject()) { - if (property0.NameEquals("externalServiceFabricId"u8)) - { - externalServiceFabricId = property0.Value.GetString(); - continue; - } - if (property0.NameEquals("environmentId"u8)) - { - environmentId = property0.Value.GetString(); - continue; - } - if (property0.NameEquals("applicableSchedule"u8)) - { - if (property0.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - applicableSchedule = DevTestLabApplicableSchedule.DeserializeDevTestLabApplicableSchedule(property0.Value, options); - continue; - } - if (property0.NameEquals("provisioningState"u8)) + if (prop0.Value.ValueKind == JsonValueKind.Null) { - provisioningState = property0.Value.GetString(); - continue; + dictionary.Add(prop0.Name, null); } - if (property0.NameEquals("uniqueIdentifier"u8)) + else { - if (property0.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - uniqueIdentifier = property0.Value.GetGuid(); - continue; + dictionary.Add(prop0.Name, prop0.Value.GetString()); } } + tags = dictionary; 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 DevTestLabServiceFabricData( id, name, - type, + resourceType, systemData, - tags ?? new ChangeTrackingDictionary(), + additionalBinaryDataProperties, location, - externalServiceFabricId, - environmentId, - applicableSchedule, - provisioningState, - uniqueIdentifier, - serializedAdditionalRawData); + properties, + tags ?? new ChangeTrackingDictionary()); } - 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": @@ -225,22 +218,23 @@ BinaryData IPersistableModel.Write(ModelReaderWrite } } - DevTestLabServiceFabricData 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. + DevTestLabServiceFabricData IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) => (DevTestLabServiceFabricData)PersistableModelCreateCore(data, options); - switch (format) + /// The client options for reading and writing models. + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + + /// The to serialize into . + internal static RequestContent ToRequestContent(DevTestLabServiceFabricData devTestLabServiceFabricData) + { + if (devTestLabServiceFabricData == null) { - case "J": - { - using JsonDocument document = JsonDocument.Parse(data, ModelSerializationExtensions.JsonDocumentOptions); - return DeserializeDevTestLabServiceFabricData(document.RootElement, options); - } - default: - throw new FormatException($"The model {nameof(DevTestLabServiceFabricData)} does not support reading '{options.Format}' format."); + return null; } + Utf8JsonRequestContent content = new Utf8JsonRequestContent(); + content.JsonWriter.WriteObjectValue(devTestLabServiceFabricData, ModelSerializationExtensions.WireOptions); + return content; } - - string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; } } diff --git a/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/DevTestLabServiceFabricData.cs b/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/DevTestLabServiceFabricData.cs index d4b1620c725e..45e48e551de9 100644 --- a/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/DevTestLabServiceFabricData.cs +++ b/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/DevTestLabServiceFabricData.cs @@ -13,87 +13,96 @@ namespace Azure.ResourceManager.DevTestLabs { - /// - /// A class representing the DevTestLabServiceFabric data model. - /// A Service Fabric. - /// + /// A Service Fabric. public partial class DevTestLabServiceFabricData : 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 DevTestLabServiceFabricData(AzureLocation location) : base(location) { + } /// Initializes a new instance of . - /// The id. - /// The name. - /// The resourceType. - /// The systemData. - /// The tags. - /// The location. - /// The backing service fabric resource's id. - /// The resource id of the environment under which the service fabric resource is present. - /// The applicable schedule for the virtual machine. - /// The provisioning status of the resource. - /// The unique immutable identifier of a resource (Guid). - /// Keeps track of any properties unknown to the library. - internal DevTestLabServiceFabricData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, IDictionary tags, AzureLocation location, string externalServiceFabricId, string environmentId, DevTestLabApplicableSchedule applicableSchedule, string provisioningState, Guid? uniqueIdentifier, IDictionary serializedAdditionalRawData) : base(id, name, resourceType, systemData, tags, 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. + /// The geo-location where the resource lives. + /// The properties of the resource. + /// Resource tags. + internal DevTestLabServiceFabricData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, IDictionary additionalBinaryDataProperties, AzureLocation location, ServiceFabricProperties properties, IDictionary tags) : base(id, name, resourceType, systemData, tags, location) { - ExternalServiceFabricId = externalServiceFabricId; - EnvironmentId = environmentId; - ApplicableSchedule = applicableSchedule; - ProvisioningState = provisioningState; - UniqueIdentifier = uniqueIdentifier; - _serializedAdditionalRawData = serializedAdditionalRawData; + _additionalBinaryDataProperties = additionalBinaryDataProperties; + Properties = properties; } - /// Initializes a new instance of for deserialization. - internal DevTestLabServiceFabricData() + /// The properties of the resource. + internal ServiceFabricProperties Properties { get; set; } + + /// The backing service fabric resource's id. + public string ExternalServiceFabricId { + get + { + return Properties is null ? default : Properties.ExternalServiceFabricId; + } + set + { + if (Properties is null) + { + Properties = new ServiceFabricProperties(); + } + Properties.ExternalServiceFabricId = value; + } } - /// The backing service fabric resource's id. - public string ExternalServiceFabricId { get; set; } /// The resource id of the environment under which the service fabric resource is present. - public string EnvironmentId { get; set; } + public string EnvironmentId + { + get + { + return Properties is null ? default : Properties.EnvironmentId; + } + set + { + if (Properties is null) + { + Properties = new ServiceFabricProperties(); + } + Properties.EnvironmentId = value; + } + } + /// The applicable schedule for the virtual machine. - public DevTestLabApplicableSchedule ApplicableSchedule { get; } + public DevTestLabApplicableSchedule ApplicableSchedule + { + get + { + return Properties is null ? default : Properties.ApplicableSchedule; + } + } + /// The provisioning status of the resource. - public string ProvisioningState { get; } + public string ProvisioningState + { + get + { + return Properties is null ? default : Properties.ProvisioningState; + } + } + /// The unique immutable identifier of a resource (Guid). - public Guid? UniqueIdentifier { get; } + public Guid? UniqueIdentifier + { + get + { + return Properties is null ? default : Properties.UniqueIdentifier; + } + } } } diff --git a/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/DevTestLabServiceFabricResource.Serialization.cs b/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/DevTestLabServiceFabricResource.Serialization.cs index b95c5c7e13de..f7fe2691b1be 100644 --- a/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/DevTestLabServiceFabricResource.Serialization.cs +++ b/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/DevTestLabServiceFabricResource.Serialization.cs @@ -11,19 +11,29 @@ namespace Azure.ResourceManager.DevTestLabs { + /// public partial class DevTestLabServiceFabricResource : IJsonModel { - private static DevTestLabServiceFabricData s_dataDeserializationInstance; - private static DevTestLabServiceFabricData DataDeserializationInstance => s_dataDeserializationInstance ??= new(); + private static IJsonModel s_dataDeserializationInstance; + private static IJsonModel DataDeserializationInstance => s_dataDeserializationInstance ??= new DevTestLabServiceFabricData(); + + /// 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); - DevTestLabServiceFabricData 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. + DevTestLabServiceFabricData 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, AzureResourceManagerDevTestLabsContext.Default); + /// The binary data to be processed. + /// The client options for reading and writing models. DevTestLabServiceFabricData IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) => ModelReaderWriter.Read(data, options, AzureResourceManagerDevTestLabsContext.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/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/DevTestLabServiceFabricResource.cs b/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/DevTestLabServiceFabricResource.cs index fb0cf39b9d05..ebbc35981048 100644 --- a/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/DevTestLabServiceFabricResource.cs +++ b/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/DevTestLabServiceFabricResource.cs @@ -7,48 +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.DevTestLabs.Models; +using Azure.ResourceManager.Resources; namespace Azure.ResourceManager.DevTestLabs { /// - /// A Class representing a DevTestLabServiceFabric 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 GetDevTestLabServiceFabricResource method. - /// Otherwise you can get one from its parent resource using the GetDevTestLabServiceFabric method. + /// A class representing a DevTestLabServiceFabric 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 GetDevTestLabServiceFabrics method. /// public partial class DevTestLabServiceFabricResource : ArmResource { - /// Generate the resource identifier of a instance. - /// The subscriptionId. - /// The resourceGroupName. - /// The labName. - /// The userName. - /// The name. - public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string labName, string userName, string name) - { - var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/users/{userName}/servicefabrics/{name}"; - return new ResourceIdentifier(resourceId); - } - - private readonly ClientDiagnostics _devTestLabServiceFabricServiceFabricsClientDiagnostics; - private readonly ServiceFabricsRestOperations _devTestLabServiceFabricServiceFabricsRestClient; + private readonly ClientDiagnostics _serviceFabricsClientDiagnostics; + private readonly ServiceFabrics _serviceFabricsRestClient; private readonly DevTestLabServiceFabricData _data; - /// Gets the resource type for the operations. public static readonly ResourceType ResourceType = "Microsoft.DevTestLab/labs/users/servicefabrics"; - /// Initializes a new instance of the class for mocking. + /// Initializes a new instance of DevTestLabServiceFabricResource for mocking. protected DevTestLabServiceFabricResource() { } - /// 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 DevTestLabServiceFabricResource(ArmClient client, DevTestLabServiceFabricData data) : this(client, data.Id) @@ -57,143 +46,95 @@ internal DevTestLabServiceFabricResource(ArmClient client, DevTestLabServiceFabr _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 DevTestLabServiceFabricResource(ArmClient client, ResourceIdentifier id) : base(client, id) { - _devTestLabServiceFabricServiceFabricsClientDiagnostics = new ClientDiagnostics("Azure.ResourceManager.DevTestLabs", ResourceType.Namespace, Diagnostics); - TryGetApiVersion(ResourceType, out string devTestLabServiceFabricServiceFabricsApiVersion); - _devTestLabServiceFabricServiceFabricsRestClient = new ServiceFabricsRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, devTestLabServiceFabricServiceFabricsApiVersion); -#if DEBUG - ValidateResourceId(Id); -#endif + TryGetApiVersion(ResourceType, out string devTestLabServiceFabricApiVersion); + _serviceFabricsClientDiagnostics = new ClientDiagnostics("Azure.ResourceManager.DevTestLabs", ResourceType.Namespace, Diagnostics); + _serviceFabricsRestClient = new ServiceFabrics(_serviceFabricsClientDiagnostics, Pipeline, Endpoint, devTestLabServiceFabricApiVersion ?? "2018-09-15"); + 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 DevTestLabServiceFabricData 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 DevTestLabServiceFabricScheduleResources in the DevTestLabServiceFabric. - /// An object representing collection of DevTestLabServiceFabricScheduleResources and their operations over a DevTestLabServiceFabricScheduleResource. - public virtual DevTestLabServiceFabricScheduleCollection GetDevTestLabServiceFabricSchedules() - { - return GetCachedClient(client => new DevTestLabServiceFabricScheduleCollection(client, Id)); - } - - /// - /// Get schedule. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/users/{userName}/servicefabrics/{serviceFabricName}/schedules/{name} - /// - /// - /// Operation Id - /// ServiceFabricSchedules_Get - /// - /// - /// Default Api Version - /// 2018-09-15 - /// - /// - /// Resource - /// - /// - /// - /// - /// The name of the schedule. - /// Specify the $expand query. Example: 'properties($select=status)'. - /// The cancellation token to use. - /// is null. - /// is an empty string, and was expected to be non-empty. - [ForwardsClientCalls] - public virtual async Task> GetDevTestLabServiceFabricScheduleAsync(string name, string expand = null, CancellationToken cancellationToken = default) + /// Generate the resource identifier for this resource. + /// The subscriptionId. + /// The resourceGroupName. + /// The labName. + /// The userName. + /// The name. + public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string labName, string userName, string name) { - return await GetDevTestLabServiceFabricSchedules().GetAsync(name, expand, cancellationToken).ConfigureAwait(false); + string resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/users/{userName}/servicefabrics/{name}"; + return new ResourceIdentifier(resourceId); } - /// - /// Get schedule. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/users/{userName}/servicefabrics/{serviceFabricName}/schedules/{name} - /// - /// - /// Operation Id - /// ServiceFabricSchedules_Get - /// - /// - /// Default Api Version - /// 2018-09-15 - /// - /// - /// Resource - /// - /// - /// - /// - /// The name of the schedule. - /// Specify the $expand query. Example: 'properties($select=status)'. - /// The cancellation token to use. - /// is null. - /// is an empty string, and was expected to be non-empty. - [ForwardsClientCalls] - public virtual Response GetDevTestLabServiceFabricSchedule(string name, string expand = null, CancellationToken cancellationToken = default) + /// + [Conditional("DEBUG")] + internal static void ValidateResourceId(ResourceIdentifier id) { - return GetDevTestLabServiceFabricSchedules().Get(name, expand, cancellationToken); + if (id.ResourceType != ResourceType) + { + throw new ArgumentException(string.Format("Invalid resource type {0} expected {1}", id.ResourceType, ResourceType), id); + } } /// /// Get service fabric. /// /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/users/{userName}/servicefabrics/{name} + /// Request Path. + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/users/{userName}/servicefabrics/{name}. /// /// - /// Operation Id - /// ServiceFabrics_Get + /// Operation Id. + /// ServiceFabrics_Get. /// /// - /// Default Api Version - /// 2018-09-15 + /// Default Api Version. + /// 2018-09-15. /// /// - /// Resource - /// + /// Resource. + /// . /// /// /// /// Specify the $expand query. Example: 'properties($expand=applicableSchedule)'. /// The cancellation token to use. - public virtual async Task> GetAsync(string expand = null, CancellationToken cancellationToken = default) + public virtual async Task> GetAsync(string expand = default, CancellationToken cancellationToken = default) { - using var scope = _devTestLabServiceFabricServiceFabricsClientDiagnostics.CreateScope("DevTestLabServiceFabricResource.Get"); + using DiagnosticScope scope = _serviceFabricsClientDiagnostics.CreateScope("DevTestLabServiceFabricResource.Get"); scope.Start(); try { - var response = await _devTestLabServiceFabricServiceFabricsRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, expand, cancellationToken).ConfigureAwait(false); + RequestContext context = new RequestContext + { + CancellationToken = cancellationToken + }; + HttpMessage message = _serviceFabricsRestClient.CreateGetRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, expand, context); + Response result = await Pipeline.ProcessMessageAsync(message, context).ConfigureAwait(false); + Response response = Response.FromValue(DevTestLabServiceFabricData.FromResponse(result), result); if (response.Value == null) + { throw new RequestFailedException(response.GetRawResponse()); + } return Response.FromValue(new DevTestLabServiceFabricResource(Client, response.Value), response.GetRawResponse()); } catch (Exception e) @@ -207,34 +148,42 @@ public virtual async Task> GetAsync(st /// Get service fabric. /// /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/users/{userName}/servicefabrics/{name} + /// Request Path. + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/users/{userName}/servicefabrics/{name}. /// /// - /// Operation Id - /// ServiceFabrics_Get + /// Operation Id. + /// ServiceFabrics_Get. /// /// - /// Default Api Version - /// 2018-09-15 + /// Default Api Version. + /// 2018-09-15. /// /// - /// Resource - /// + /// Resource. + /// . /// /// /// /// Specify the $expand query. Example: 'properties($expand=applicableSchedule)'. /// The cancellation token to use. - public virtual Response Get(string expand = null, CancellationToken cancellationToken = default) + public virtual Response Get(string expand = default, CancellationToken cancellationToken = default) { - using var scope = _devTestLabServiceFabricServiceFabricsClientDiagnostics.CreateScope("DevTestLabServiceFabricResource.Get"); + using DiagnosticScope scope = _serviceFabricsClientDiagnostics.CreateScope("DevTestLabServiceFabricResource.Get"); scope.Start(); try { - var response = _devTestLabServiceFabricServiceFabricsRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, expand, cancellationToken); + RequestContext context = new RequestContext + { + CancellationToken = cancellationToken + }; + HttpMessage message = _serviceFabricsRestClient.CreateGetRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, expand, context); + Response result = Pipeline.ProcessMessage(message, context); + Response response = Response.FromValue(DevTestLabServiceFabricData.FromResponse(result), result); if (response.Value == null) + { throw new RequestFailedException(response.GetRawResponse()); + } return Response.FromValue(new DevTestLabServiceFabricResource(Client, response.Value), response.GetRawResponse()); } catch (Exception e) @@ -245,39 +194,49 @@ public virtual Response Get(string expand = nul } /// - /// Delete service fabric. This operation can take a while to complete. + /// Allows modifying tags of service fabrics. All other properties will be ignored. /// /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/users/{userName}/servicefabrics/{name} + /// Request Path. + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/users/{userName}/servicefabrics/{name}. /// /// - /// Operation Id - /// ServiceFabrics_Delete + /// Operation Id. + /// ServiceFabrics_Update. /// /// - /// Default Api Version - /// 2018-09-15 + /// Default Api Version. + /// 2018-09-15. /// /// - /// Resource - /// + /// Resource. + /// . /// /// /// - /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. + /// A Service Fabric. /// The cancellation token to use. - public virtual async Task DeleteAsync(WaitUntil waitUntil, CancellationToken cancellationToken = default) + /// is null. + public virtual async Task> UpdateAsync(DevTestLabServiceFabricPatch patch, CancellationToken cancellationToken = default) { - using var scope = _devTestLabServiceFabricServiceFabricsClientDiagnostics.CreateScope("DevTestLabServiceFabricResource.Delete"); + Argument.AssertNotNull(patch, nameof(patch)); + + using DiagnosticScope scope = _serviceFabricsClientDiagnostics.CreateScope("DevTestLabServiceFabricResource.Update"); scope.Start(); try { - var response = await _devTestLabServiceFabricServiceFabricsRestClient.DeleteAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, cancellationToken).ConfigureAwait(false); - var operation = new DevTestLabsArmOperation(_devTestLabServiceFabricServiceFabricsClientDiagnostics, Pipeline, _devTestLabServiceFabricServiceFabricsRestClient.CreateDeleteRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name).Request, response, OperationFinalStateVia.Location); - if (waitUntil == WaitUntil.Completed) - await operation.WaitForCompletionResponseAsync(cancellationToken).ConfigureAwait(false); - return operation; + RequestContext context = new RequestContext + { + CancellationToken = cancellationToken + }; + HttpMessage message = _serviceFabricsRestClient.CreateUpdateRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, DevTestLabServiceFabricPatch.ToRequestContent(patch), context); + Response result = await Pipeline.ProcessMessageAsync(message, context).ConfigureAwait(false); + Response response = Response.FromValue(DevTestLabServiceFabricData.FromResponse(result), result); + if (response.Value == null) + { + throw new RequestFailedException(response.GetRawResponse()); + } + return Response.FromValue(new DevTestLabServiceFabricResource(Client, response.Value), response.GetRawResponse()); } catch (Exception e) { @@ -287,39 +246,49 @@ public virtual async Task DeleteAsync(WaitUntil waitUntil, Cancell } /// - /// Delete service fabric. This operation can take a while to complete. + /// Allows modifying tags of service fabrics. All other properties will be ignored. /// /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/users/{userName}/servicefabrics/{name} + /// Request Path. + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/users/{userName}/servicefabrics/{name}. /// /// - /// Operation Id - /// ServiceFabrics_Delete + /// Operation Id. + /// ServiceFabrics_Update. /// /// - /// Default Api Version - /// 2018-09-15 + /// Default Api Version. + /// 2018-09-15. /// /// - /// Resource - /// + /// Resource. + /// . /// /// /// - /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. + /// A Service Fabric. /// The cancellation token to use. - public virtual ArmOperation Delete(WaitUntil waitUntil, CancellationToken cancellationToken = default) + /// is null. + public virtual Response Update(DevTestLabServiceFabricPatch patch, CancellationToken cancellationToken = default) { - using var scope = _devTestLabServiceFabricServiceFabricsClientDiagnostics.CreateScope("DevTestLabServiceFabricResource.Delete"); + Argument.AssertNotNull(patch, nameof(patch)); + + using DiagnosticScope scope = _serviceFabricsClientDiagnostics.CreateScope("DevTestLabServiceFabricResource.Update"); scope.Start(); try { - var response = _devTestLabServiceFabricServiceFabricsRestClient.Delete(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, cancellationToken); - var operation = new DevTestLabsArmOperation(_devTestLabServiceFabricServiceFabricsClientDiagnostics, Pipeline, _devTestLabServiceFabricServiceFabricsRestClient.CreateDeleteRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name).Request, response, OperationFinalStateVia.Location); - if (waitUntil == WaitUntil.Completed) - operation.WaitForCompletionResponse(cancellationToken); - return operation; + RequestContext context = new RequestContext + { + CancellationToken = cancellationToken + }; + HttpMessage message = _serviceFabricsRestClient.CreateUpdateRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, DevTestLabServiceFabricPatch.ToRequestContent(patch), context); + Response result = Pipeline.ProcessMessage(message, context); + Response response = Response.FromValue(DevTestLabServiceFabricData.FromResponse(result), result); + if (response.Value == null) + { + throw new RequestFailedException(response.GetRawResponse()); + } + return Response.FromValue(new DevTestLabServiceFabricResource(Client, response.Value), response.GetRawResponse()); } catch (Exception e) { @@ -329,39 +298,46 @@ public virtual ArmOperation Delete(WaitUntil waitUntil, CancellationToken cancel } /// - /// Allows modifying tags of service fabrics. All other properties will be ignored. + /// Delete service fabric. This operation can take a while to complete. /// /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/users/{userName}/servicefabrics/{name} + /// Request Path. + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/users/{userName}/servicefabrics/{name}. /// /// - /// Operation Id - /// ServiceFabrics_Update + /// Operation Id. + /// ServiceFabrics_Delete. /// /// - /// Default Api Version - /// 2018-09-15 + /// Default Api Version. + /// 2018-09-15. /// /// - /// Resource - /// + /// Resource. + /// . /// /// /// - /// A Service Fabric. + /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. /// The cancellation token to use. - /// is null. - public virtual async Task> UpdateAsync(DevTestLabServiceFabricPatch patch, CancellationToken cancellationToken = default) + public virtual async Task DeleteAsync(WaitUntil waitUntil, CancellationToken cancellationToken = default) { - Argument.AssertNotNull(patch, nameof(patch)); - - using var scope = _devTestLabServiceFabricServiceFabricsClientDiagnostics.CreateScope("DevTestLabServiceFabricResource.Update"); + using DiagnosticScope scope = _serviceFabricsClientDiagnostics.CreateScope("DevTestLabServiceFabricResource.Delete"); scope.Start(); try { - var response = await _devTestLabServiceFabricServiceFabricsRestClient.UpdateAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, patch, cancellationToken).ConfigureAwait(false); - return Response.FromValue(new DevTestLabServiceFabricResource(Client, response.Value), response.GetRawResponse()); + RequestContext context = new RequestContext + { + CancellationToken = cancellationToken + }; + HttpMessage message = _serviceFabricsRestClient.CreateDeleteRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, context); + Response response = await Pipeline.ProcessMessageAsync(message, context).ConfigureAwait(false); + DevTestLabsArmOperation operation = new DevTestLabsArmOperation(_serviceFabricsClientDiagnostics, Pipeline, message.Request, response, OperationFinalStateVia.Location); + if (waitUntil == WaitUntil.Completed) + { + await operation.WaitForCompletionResponseAsync(cancellationToken).ConfigureAwait(false); + } + return operation; } catch (Exception e) { @@ -371,39 +347,46 @@ public virtual async Task> UpdateAsync } /// - /// Allows modifying tags of service fabrics. All other properties will be ignored. + /// Delete service fabric. This operation can take a while to complete. /// /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/users/{userName}/servicefabrics/{name} + /// Request Path. + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/users/{userName}/servicefabrics/{name}. /// /// - /// Operation Id - /// ServiceFabrics_Update + /// Operation Id. + /// ServiceFabrics_Delete. /// /// - /// Default Api Version - /// 2018-09-15 + /// Default Api Version. + /// 2018-09-15. /// /// - /// Resource - /// + /// Resource. + /// . /// /// /// - /// A Service Fabric. + /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. /// The cancellation token to use. - /// is null. - public virtual Response Update(DevTestLabServiceFabricPatch patch, CancellationToken cancellationToken = default) + public virtual ArmOperation Delete(WaitUntil waitUntil, CancellationToken cancellationToken = default) { - Argument.AssertNotNull(patch, nameof(patch)); - - using var scope = _devTestLabServiceFabricServiceFabricsClientDiagnostics.CreateScope("DevTestLabServiceFabricResource.Update"); + using DiagnosticScope scope = _serviceFabricsClientDiagnostics.CreateScope("DevTestLabServiceFabricResource.Delete"); scope.Start(); try { - var response = _devTestLabServiceFabricServiceFabricsRestClient.Update(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, patch, cancellationToken); - return Response.FromValue(new DevTestLabServiceFabricResource(Client, response.Value), response.GetRawResponse()); + RequestContext context = new RequestContext + { + CancellationToken = cancellationToken + }; + HttpMessage message = _serviceFabricsRestClient.CreateDeleteRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, context); + Response response = Pipeline.ProcessMessage(message, context); + DevTestLabsArmOperation operation = new DevTestLabsArmOperation(_serviceFabricsClientDiagnostics, Pipeline, message.Request, response, OperationFinalStateVia.Location); + if (waitUntil == WaitUntil.Completed) + { + operation.WaitForCompletionResponse(cancellationToken); + } + return operation; } catch (Exception e) { @@ -416,31 +399,41 @@ public virtual Response Update(DevTestLabServic /// Lists the applicable start/stop schedules, if any. /// /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/users/{userName}/servicefabrics/{name}/listApplicableSchedules + /// Request Path. + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/users/{userName}/servicefabrics/{name}/listApplicableSchedules. /// /// - /// Operation Id - /// ServiceFabrics_ListApplicableSchedules + /// Operation Id. + /// ServiceFabrics_ListApplicableSchedules. /// /// - /// Default Api Version - /// 2018-09-15 + /// Default Api Version. + /// 2018-09-15. /// /// - /// Resource - /// + /// Resource. + /// . /// /// /// /// The cancellation token to use. public virtual async Task> GetApplicableSchedulesAsync(CancellationToken cancellationToken = default) { - using var scope = _devTestLabServiceFabricServiceFabricsClientDiagnostics.CreateScope("DevTestLabServiceFabricResource.GetApplicableSchedules"); + using DiagnosticScope scope = _serviceFabricsClientDiagnostics.CreateScope("DevTestLabServiceFabricResource.GetApplicableSchedules"); scope.Start(); try { - var response = await _devTestLabServiceFabricServiceFabricsRestClient.ListApplicableSchedulesAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, cancellationToken).ConfigureAwait(false); + RequestContext context = new RequestContext + { + CancellationToken = cancellationToken + }; + HttpMessage message = _serviceFabricsRestClient.CreateGetApplicableSchedulesRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, context); + Response result = await Pipeline.ProcessMessageAsync(message, context).ConfigureAwait(false); + Response response = Response.FromValue(DevTestLabApplicableSchedule.FromResponse(result), result); + if (response.Value == null) + { + throw new RequestFailedException(response.GetRawResponse()); + } return response; } catch (Exception e) @@ -454,31 +447,41 @@ public virtual async Task> GetApplicableS /// Lists the applicable start/stop schedules, if any. /// /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/users/{userName}/servicefabrics/{name}/listApplicableSchedules + /// Request Path. + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/users/{userName}/servicefabrics/{name}/listApplicableSchedules. /// /// - /// Operation Id - /// ServiceFabrics_ListApplicableSchedules + /// Operation Id. + /// ServiceFabrics_ListApplicableSchedules. /// /// - /// Default Api Version - /// 2018-09-15 + /// Default Api Version. + /// 2018-09-15. /// /// - /// Resource - /// + /// Resource. + /// . /// /// /// /// The cancellation token to use. public virtual Response GetApplicableSchedules(CancellationToken cancellationToken = default) { - using var scope = _devTestLabServiceFabricServiceFabricsClientDiagnostics.CreateScope("DevTestLabServiceFabricResource.GetApplicableSchedules"); + using DiagnosticScope scope = _serviceFabricsClientDiagnostics.CreateScope("DevTestLabServiceFabricResource.GetApplicableSchedules"); scope.Start(); try { - var response = _devTestLabServiceFabricServiceFabricsRestClient.ListApplicableSchedules(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, cancellationToken); + RequestContext context = new RequestContext + { + CancellationToken = cancellationToken + }; + HttpMessage message = _serviceFabricsRestClient.CreateGetApplicableSchedulesRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, context); + Response result = Pipeline.ProcessMessage(message, context); + Response response = Response.FromValue(DevTestLabApplicableSchedule.FromResponse(result), result); + if (response.Value == null) + { + throw new RequestFailedException(response.GetRawResponse()); + } return response; } catch (Exception e) @@ -492,20 +495,20 @@ public virtual Response GetApplicableSchedules(Can /// Start a service fabric. This operation can take a while to complete. /// /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/users/{userName}/servicefabrics/{name}/start + /// Request Path. + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/users/{userName}/servicefabrics/{name}/start. /// /// - /// Operation Id - /// ServiceFabrics_Start + /// Operation Id. + /// ServiceFabrics_Start. /// /// - /// Default Api Version - /// 2018-09-15 + /// Default Api Version. + /// 2018-09-15. /// /// - /// Resource - /// + /// Resource. + /// . /// /// /// @@ -513,14 +516,21 @@ public virtual Response GetApplicableSchedules(Can /// The cancellation token to use. public virtual async Task StartAsync(WaitUntil waitUntil, CancellationToken cancellationToken = default) { - using var scope = _devTestLabServiceFabricServiceFabricsClientDiagnostics.CreateScope("DevTestLabServiceFabricResource.Start"); + using DiagnosticScope scope = _serviceFabricsClientDiagnostics.CreateScope("DevTestLabServiceFabricResource.Start"); scope.Start(); try { - var response = await _devTestLabServiceFabricServiceFabricsRestClient.StartAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, cancellationToken).ConfigureAwait(false); - var operation = new DevTestLabsArmOperation(_devTestLabServiceFabricServiceFabricsClientDiagnostics, Pipeline, _devTestLabServiceFabricServiceFabricsRestClient.CreateStartRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name).Request, response, OperationFinalStateVia.Location); + RequestContext context = new RequestContext + { + CancellationToken = cancellationToken + }; + HttpMessage message = _serviceFabricsRestClient.CreateStartRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, context); + Response response = await Pipeline.ProcessMessageAsync(message, context).ConfigureAwait(false); + DevTestLabsArmOperation operation = new DevTestLabsArmOperation(_serviceFabricsClientDiagnostics, Pipeline, message.Request, response, OperationFinalStateVia.Location); if (waitUntil == WaitUntil.Completed) + { await operation.WaitForCompletionResponseAsync(cancellationToken).ConfigureAwait(false); + } return operation; } catch (Exception e) @@ -534,20 +544,20 @@ public virtual async Task StartAsync(WaitUntil waitUntil, Cancella /// Start a service fabric. This operation can take a while to complete. /// /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/users/{userName}/servicefabrics/{name}/start + /// Request Path. + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/users/{userName}/servicefabrics/{name}/start. /// /// - /// Operation Id - /// ServiceFabrics_Start + /// Operation Id. + /// ServiceFabrics_Start. /// /// - /// Default Api Version - /// 2018-09-15 + /// Default Api Version. + /// 2018-09-15. /// /// - /// Resource - /// + /// Resource. + /// . /// /// /// @@ -555,14 +565,21 @@ public virtual async Task StartAsync(WaitUntil waitUntil, Cancella /// The cancellation token to use. public virtual ArmOperation Start(WaitUntil waitUntil, CancellationToken cancellationToken = default) { - using var scope = _devTestLabServiceFabricServiceFabricsClientDiagnostics.CreateScope("DevTestLabServiceFabricResource.Start"); + using DiagnosticScope scope = _serviceFabricsClientDiagnostics.CreateScope("DevTestLabServiceFabricResource.Start"); scope.Start(); try { - var response = _devTestLabServiceFabricServiceFabricsRestClient.Start(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, cancellationToken); - var operation = new DevTestLabsArmOperation(_devTestLabServiceFabricServiceFabricsClientDiagnostics, Pipeline, _devTestLabServiceFabricServiceFabricsRestClient.CreateStartRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name).Request, response, OperationFinalStateVia.Location); + RequestContext context = new RequestContext + { + CancellationToken = cancellationToken + }; + HttpMessage message = _serviceFabricsRestClient.CreateStartRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, context); + Response response = Pipeline.ProcessMessage(message, context); + DevTestLabsArmOperation operation = new DevTestLabsArmOperation(_serviceFabricsClientDiagnostics, Pipeline, message.Request, response, OperationFinalStateVia.Location); if (waitUntil == WaitUntil.Completed) + { operation.WaitForCompletionResponse(cancellationToken); + } return operation; } catch (Exception e) @@ -576,20 +593,20 @@ public virtual ArmOperation Start(WaitUntil waitUntil, CancellationToken cancell /// Stop a service fabric This operation can take a while to complete. /// /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/users/{userName}/servicefabrics/{name}/stop + /// Request Path. + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/users/{userName}/servicefabrics/{name}/stop. /// /// - /// Operation Id - /// ServiceFabrics_Stop + /// Operation Id. + /// ServiceFabrics_Stop. /// /// - /// Default Api Version - /// 2018-09-15 + /// Default Api Version. + /// 2018-09-15. /// /// - /// Resource - /// + /// Resource. + /// . /// /// /// @@ -597,14 +614,21 @@ public virtual ArmOperation Start(WaitUntil waitUntil, CancellationToken cancell /// The cancellation token to use. public virtual async Task StopAsync(WaitUntil waitUntil, CancellationToken cancellationToken = default) { - using var scope = _devTestLabServiceFabricServiceFabricsClientDiagnostics.CreateScope("DevTestLabServiceFabricResource.Stop"); + using DiagnosticScope scope = _serviceFabricsClientDiagnostics.CreateScope("DevTestLabServiceFabricResource.Stop"); scope.Start(); try { - var response = await _devTestLabServiceFabricServiceFabricsRestClient.StopAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, cancellationToken).ConfigureAwait(false); - var operation = new DevTestLabsArmOperation(_devTestLabServiceFabricServiceFabricsClientDiagnostics, Pipeline, _devTestLabServiceFabricServiceFabricsRestClient.CreateStopRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name).Request, response, OperationFinalStateVia.Location); + RequestContext context = new RequestContext + { + CancellationToken = cancellationToken + }; + HttpMessage message = _serviceFabricsRestClient.CreateStopRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, context); + Response response = await Pipeline.ProcessMessageAsync(message, context).ConfigureAwait(false); + DevTestLabsArmOperation operation = new DevTestLabsArmOperation(_serviceFabricsClientDiagnostics, Pipeline, message.Request, response, OperationFinalStateVia.Location); if (waitUntil == WaitUntil.Completed) + { await operation.WaitForCompletionResponseAsync(cancellationToken).ConfigureAwait(false); + } return operation; } catch (Exception e) @@ -618,20 +642,20 @@ public virtual async Task StopAsync(WaitUntil waitUntil, Cancellat /// Stop a service fabric This operation can take a while to complete. /// /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/users/{userName}/servicefabrics/{name}/stop + /// Request Path. + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/users/{userName}/servicefabrics/{name}/stop. /// /// - /// Operation Id - /// ServiceFabrics_Stop + /// Operation Id. + /// ServiceFabrics_Stop. /// /// - /// Default Api Version - /// 2018-09-15 + /// Default Api Version. + /// 2018-09-15. /// /// - /// Resource - /// + /// Resource. + /// . /// /// /// @@ -639,14 +663,21 @@ public virtual async Task StopAsync(WaitUntil waitUntil, Cancellat /// The cancellation token to use. public virtual ArmOperation Stop(WaitUntil waitUntil, CancellationToken cancellationToken = default) { - using var scope = _devTestLabServiceFabricServiceFabricsClientDiagnostics.CreateScope("DevTestLabServiceFabricResource.Stop"); + using DiagnosticScope scope = _serviceFabricsClientDiagnostics.CreateScope("DevTestLabServiceFabricResource.Stop"); scope.Start(); try { - var response = _devTestLabServiceFabricServiceFabricsRestClient.Stop(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, cancellationToken); - var operation = new DevTestLabsArmOperation(_devTestLabServiceFabricServiceFabricsClientDiagnostics, Pipeline, _devTestLabServiceFabricServiceFabricsRestClient.CreateStopRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name).Request, response, OperationFinalStateVia.Location); + RequestContext context = new RequestContext + { + CancellationToken = cancellationToken + }; + HttpMessage message = _serviceFabricsRestClient.CreateStopRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, context); + Response response = Pipeline.ProcessMessage(message, context); + DevTestLabsArmOperation operation = new DevTestLabsArmOperation(_serviceFabricsClientDiagnostics, Pipeline, message.Request, response, OperationFinalStateVia.Location); if (waitUntil == WaitUntil.Completed) + { operation.WaitForCompletionResponse(cancellationToken); + } return operation; } catch (Exception e) @@ -656,27 +687,7 @@ public virtual ArmOperation Stop(WaitUntil waitUntil, CancellationToken cancella } } - /// - /// Add a tag to the current resource. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/users/{userName}/servicefabrics/{name} - /// - /// - /// Operation Id - /// ServiceFabrics_Get - /// - /// - /// Default Api Version - /// 2018-09-15 - /// - /// - /// Resource - /// - /// - /// - /// + /// Add a tag to the current resource. /// The key for the tag. /// The value for the tag. /// The cancellation token to use. @@ -686,29 +697,35 @@ public virtual async Task> AddTagAsync Argument.AssertNotNull(key, nameof(key)); Argument.AssertNotNull(value, nameof(value)); - using var scope = _devTestLabServiceFabricServiceFabricsClientDiagnostics.CreateScope("DevTestLabServiceFabricResource.AddTag"); + using DiagnosticScope scope = _serviceFabricsClientDiagnostics.CreateScope("DevTestLabServiceFabricResource.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 _devTestLabServiceFabricServiceFabricsRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, null, cancellationToken).ConfigureAwait(false); - return Response.FromValue(new DevTestLabServiceFabricResource(Client, originalResponse.Value), originalResponse.GetRawResponse()); + await GetTagResource().CreateOrUpdateAsync(WaitUntil.Completed, originalTags.Value.Data, cancellationToken).ConfigureAwait(false); + RequestContext context = new RequestContext + { + CancellationToken = cancellationToken + }; + HttpMessage message = _serviceFabricsRestClient.CreateGetRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, default, context); + Response result = await Pipeline.ProcessMessageAsync(message, context).ConfigureAwait(false); + Response response = Response.FromValue(DevTestLabServiceFabricData.FromResponse(result), result); + return Response.FromValue(new DevTestLabServiceFabricResource(Client, response.Value), response.GetRawResponse()); } else { - var current = (await GetAsync(cancellationToken: cancellationToken).ConfigureAwait(false)).Value.Data; - var patch = new DevTestLabServiceFabricPatch(); - foreach (var tag in current.Tags) + DevTestLabServiceFabricData current = (await GetAsync(cancellationToken: cancellationToken).ConfigureAwait(false)).Value.Data; + DevTestLabServiceFabricPatch patch = new DevTestLabServiceFabricPatch(); + 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) @@ -718,27 +735,7 @@ public virtual async Task> AddTagAsync } } - /// - /// Add a tag to the current resource. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/users/{userName}/servicefabrics/{name} - /// - /// - /// Operation Id - /// ServiceFabrics_Get - /// - /// - /// Default Api Version - /// 2018-09-15 - /// - /// - /// Resource - /// - /// - /// - /// + /// Add a tag to the current resource. /// The key for the tag. /// The value for the tag. /// The cancellation token to use. @@ -748,29 +745,35 @@ public virtual Response AddTag(string key, stri Argument.AssertNotNull(key, nameof(key)); Argument.AssertNotNull(value, nameof(value)); - using var scope = _devTestLabServiceFabricServiceFabricsClientDiagnostics.CreateScope("DevTestLabServiceFabricResource.AddTag"); + using DiagnosticScope scope = _serviceFabricsClientDiagnostics.CreateScope("DevTestLabServiceFabricResource.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 = _devTestLabServiceFabricServiceFabricsRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, null, cancellationToken); - return Response.FromValue(new DevTestLabServiceFabricResource(Client, originalResponse.Value), originalResponse.GetRawResponse()); + GetTagResource().CreateOrUpdate(WaitUntil.Completed, originalTags.Value.Data, cancellationToken); + RequestContext context = new RequestContext + { + CancellationToken = cancellationToken + }; + HttpMessage message = _serviceFabricsRestClient.CreateGetRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, default, context); + Response result = Pipeline.ProcessMessage(message, context); + Response response = Response.FromValue(DevTestLabServiceFabricData.FromResponse(result), result); + return Response.FromValue(new DevTestLabServiceFabricResource(Client, response.Value), response.GetRawResponse()); } else { - var current = Get(cancellationToken: cancellationToken).Value.Data; - var patch = new DevTestLabServiceFabricPatch(); - foreach (var tag in current.Tags) + DevTestLabServiceFabricData current = Get(cancellationToken: cancellationToken).Value.Data; + DevTestLabServiceFabricPatch patch = new DevTestLabServiceFabricPatch(); + 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) @@ -780,54 +783,40 @@ public virtual Response AddTag(string key, stri } } - /// - /// Replace the tags on the resource with the given set. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/users/{userName}/servicefabrics/{name} - /// - /// - /// Operation Id - /// ServiceFabrics_Get - /// - /// - /// Default Api Version - /// 2018-09-15 - /// - /// - /// 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 = _devTestLabServiceFabricServiceFabricsClientDiagnostics.CreateScope("DevTestLabServiceFabricResource.SetTags"); + using DiagnosticScope scope = _serviceFabricsClientDiagnostics.CreateScope("DevTestLabServiceFabricResource.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 _devTestLabServiceFabricServiceFabricsRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, null, cancellationToken).ConfigureAwait(false); - return Response.FromValue(new DevTestLabServiceFabricResource(Client, originalResponse.Value), originalResponse.GetRawResponse()); + await GetTagResource().CreateOrUpdateAsync(WaitUntil.Completed, originalTags.Value.Data, cancellationToken).ConfigureAwait(false); + RequestContext context = new RequestContext + { + CancellationToken = cancellationToken + }; + HttpMessage message = _serviceFabricsRestClient.CreateGetRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, default, context); + Response result = await Pipeline.ProcessMessageAsync(message, context).ConfigureAwait(false); + Response response = Response.FromValue(DevTestLabServiceFabricData.FromResponse(result), result); + return Response.FromValue(new DevTestLabServiceFabricResource(Client, response.Value), response.GetRawResponse()); } else { - var current = (await GetAsync(cancellationToken: cancellationToken).ConfigureAwait(false)).Value.Data; - var patch = new DevTestLabServiceFabricPatch(); + DevTestLabServiceFabricData current = (await GetAsync(cancellationToken: cancellationToken).ConfigureAwait(false)).Value.Data; + DevTestLabServiceFabricPatch patch = new DevTestLabServiceFabricPatch(); 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) @@ -837,54 +826,40 @@ public virtual async Task> SetTagsAsyn } } - /// - /// Replace the tags on the resource with the given set. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/users/{userName}/servicefabrics/{name} - /// - /// - /// Operation Id - /// ServiceFabrics_Get - /// - /// - /// Default Api Version - /// 2018-09-15 - /// - /// - /// 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 = _devTestLabServiceFabricServiceFabricsClientDiagnostics.CreateScope("DevTestLabServiceFabricResource.SetTags"); + using DiagnosticScope scope = _serviceFabricsClientDiagnostics.CreateScope("DevTestLabServiceFabricResource.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 = _devTestLabServiceFabricServiceFabricsRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, null, cancellationToken); - return Response.FromValue(new DevTestLabServiceFabricResource(Client, originalResponse.Value), originalResponse.GetRawResponse()); + GetTagResource().CreateOrUpdate(WaitUntil.Completed, originalTags.Value.Data, cancellationToken); + RequestContext context = new RequestContext + { + CancellationToken = cancellationToken + }; + HttpMessage message = _serviceFabricsRestClient.CreateGetRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, default, context); + Response result = Pipeline.ProcessMessage(message, context); + Response response = Response.FromValue(DevTestLabServiceFabricData.FromResponse(result), result); + return Response.FromValue(new DevTestLabServiceFabricResource(Client, response.Value), response.GetRawResponse()); } else { - var current = Get(cancellationToken: cancellationToken).Value.Data; - var patch = new DevTestLabServiceFabricPatch(); + DevTestLabServiceFabricData current = Get(cancellationToken: cancellationToken).Value.Data; + DevTestLabServiceFabricPatch patch = new DevTestLabServiceFabricPatch(); 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) @@ -894,27 +869,7 @@ public virtual Response SetTags(IDictionary - /// Removes a tag by key from the resource. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/users/{userName}/servicefabrics/{name} - /// - /// - /// Operation Id - /// ServiceFabrics_Get - /// - /// - /// Default Api Version - /// 2018-09-15 - /// - /// - /// Resource - /// - /// - /// - /// + /// Removes a tag by key from the resource. /// The key for the tag. /// The cancellation token to use. /// is null. @@ -922,29 +877,35 @@ public virtual async Task> RemoveTagAs { Argument.AssertNotNull(key, nameof(key)); - using var scope = _devTestLabServiceFabricServiceFabricsClientDiagnostics.CreateScope("DevTestLabServiceFabricResource.RemoveTag"); + using DiagnosticScope scope = _serviceFabricsClientDiagnostics.CreateScope("DevTestLabServiceFabricResource.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 _devTestLabServiceFabricServiceFabricsRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, null, cancellationToken).ConfigureAwait(false); - return Response.FromValue(new DevTestLabServiceFabricResource(Client, originalResponse.Value), originalResponse.GetRawResponse()); + await GetTagResource().CreateOrUpdateAsync(WaitUntil.Completed, originalTags.Value.Data, cancellationToken).ConfigureAwait(false); + RequestContext context = new RequestContext + { + CancellationToken = cancellationToken + }; + HttpMessage message = _serviceFabricsRestClient.CreateGetRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, default, context); + Response result = await Pipeline.ProcessMessageAsync(message, context).ConfigureAwait(false); + Response response = Response.FromValue(DevTestLabServiceFabricData.FromResponse(result), result); + return Response.FromValue(new DevTestLabServiceFabricResource(Client, response.Value), response.GetRawResponse()); } else { - var current = (await GetAsync(cancellationToken: cancellationToken).ConfigureAwait(false)).Value.Data; - var patch = new DevTestLabServiceFabricPatch(); - foreach (var tag in current.Tags) + DevTestLabServiceFabricData current = (await GetAsync(cancellationToken: cancellationToken).ConfigureAwait(false)).Value.Data; + DevTestLabServiceFabricPatch patch = new DevTestLabServiceFabricPatch(); + 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) @@ -954,27 +915,7 @@ public virtual async Task> RemoveTagAs } } - /// - /// Removes a tag by key from the resource. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/users/{userName}/servicefabrics/{name} - /// - /// - /// Operation Id - /// ServiceFabrics_Get - /// - /// - /// Default Api Version - /// 2018-09-15 - /// - /// - /// Resource - /// - /// - /// - /// + /// Removes a tag by key from the resource. /// The key for the tag. /// The cancellation token to use. /// is null. @@ -982,29 +923,35 @@ public virtual Response RemoveTag(string key, C { Argument.AssertNotNull(key, nameof(key)); - using var scope = _devTestLabServiceFabricServiceFabricsClientDiagnostics.CreateScope("DevTestLabServiceFabricResource.RemoveTag"); + using DiagnosticScope scope = _serviceFabricsClientDiagnostics.CreateScope("DevTestLabServiceFabricResource.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 = _devTestLabServiceFabricServiceFabricsRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, null, cancellationToken); - return Response.FromValue(new DevTestLabServiceFabricResource(Client, originalResponse.Value), originalResponse.GetRawResponse()); + GetTagResource().CreateOrUpdate(WaitUntil.Completed, originalTags.Value.Data, cancellationToken); + RequestContext context = new RequestContext + { + CancellationToken = cancellationToken + }; + HttpMessage message = _serviceFabricsRestClient.CreateGetRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, default, context); + Response result = Pipeline.ProcessMessage(message, context); + Response response = Response.FromValue(DevTestLabServiceFabricData.FromResponse(result), result); + return Response.FromValue(new DevTestLabServiceFabricResource(Client, response.Value), response.GetRawResponse()); } else { - var current = Get(cancellationToken: cancellationToken).Value.Data; - var patch = new DevTestLabServiceFabricPatch(); - foreach (var tag in current.Tags) + DevTestLabServiceFabricData current = Get(cancellationToken: cancellationToken).Value.Data; + DevTestLabServiceFabricPatch patch = new DevTestLabServiceFabricPatch(); + 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) @@ -1013,5 +960,40 @@ public virtual Response RemoveTag(string key, C throw; } } + + /// Gets a collection of DevTestLabServiceFabricSchedules in the . + /// An object representing collection of DevTestLabServiceFabricSchedules and their operations over a DevTestLabServiceFabricScheduleResource. + public virtual DevTestLabServiceFabricScheduleCollection GetDevTestLabServiceFabricSchedules() + { + return GetCachedClient(client => new DevTestLabServiceFabricScheduleCollection(client, Id)); + } + + /// Get schedule. + /// The name of the Schedule. + /// Specify the $expand query. Example: 'properties($select=status)'. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public virtual async Task> GetDevTestLabServiceFabricScheduleAsync(string name, string expand = default, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(name, nameof(name)); + + return await GetDevTestLabServiceFabricSchedules().GetAsync(name, expand, cancellationToken).ConfigureAwait(false); + } + + /// Get schedule. + /// The name of the Schedule. + /// Specify the $expand query. Example: 'properties($select=status)'. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public virtual Response GetDevTestLabServiceFabricSchedule(string name, string expand = default, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(name, nameof(name)); + + return GetDevTestLabServiceFabricSchedules().Get(name, expand, cancellationToken); + } } } diff --git a/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/DevTestLabServiceFabricScheduleCollection.cs b/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/DevTestLabServiceFabricScheduleCollection.cs index cf4669083bdf..6273ee70c6a8 100644 --- a/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/DevTestLabServiceFabricScheduleCollection.cs +++ b/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/DevTestLabServiceFabricScheduleCollection.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.DevTestLabs { @@ -24,75 +25,81 @@ namespace Azure.ResourceManager.DevTestLabs /// public partial class DevTestLabServiceFabricScheduleCollection : ArmCollection, IEnumerable, IAsyncEnumerable { - private readonly ClientDiagnostics _devTestLabServiceFabricScheduleServiceFabricSchedulesClientDiagnostics; - private readonly ServiceFabricSchedulesRestOperations _devTestLabServiceFabricScheduleServiceFabricSchedulesRestClient; + private readonly ClientDiagnostics _devTestLabServiceFabricSchedulesClientDiagnostics; + private readonly DevTestLabServiceFabricSchedules _devTestLabServiceFabricSchedulesRestClient; - /// Initializes a new instance of the class for mocking. + /// Initializes a new instance of DevTestLabServiceFabricScheduleCollection for mocking. protected DevTestLabServiceFabricScheduleCollection() { } - /// 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 DevTestLabServiceFabricScheduleCollection(ArmClient client, ResourceIdentifier id) : base(client, id) { - _devTestLabServiceFabricScheduleServiceFabricSchedulesClientDiagnostics = new ClientDiagnostics("Azure.ResourceManager.DevTestLabs", DevTestLabServiceFabricScheduleResource.ResourceType.Namespace, Diagnostics); - TryGetApiVersion(DevTestLabServiceFabricScheduleResource.ResourceType, out string devTestLabServiceFabricScheduleServiceFabricSchedulesApiVersion); - _devTestLabServiceFabricScheduleServiceFabricSchedulesRestClient = new ServiceFabricSchedulesRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, devTestLabServiceFabricScheduleServiceFabricSchedulesApiVersion); -#if DEBUG - ValidateResourceId(Id); -#endif + TryGetApiVersion(DevTestLabServiceFabricScheduleResource.ResourceType, out string devTestLabServiceFabricScheduleApiVersion); + _devTestLabServiceFabricSchedulesClientDiagnostics = new ClientDiagnostics("Azure.ResourceManager.DevTestLabs", DevTestLabServiceFabricScheduleResource.ResourceType.Namespace, Diagnostics); + _devTestLabServiceFabricSchedulesRestClient = new DevTestLabServiceFabricSchedules(_devTestLabServiceFabricSchedulesClientDiagnostics, Pipeline, Endpoint, devTestLabServiceFabricScheduleApiVersion ?? "2018-09-15"); + ValidateResourceId(id); } + /// + [Conditional("DEBUG")] internal static void ValidateResourceId(ResourceIdentifier id) { if (id.ResourceType != DevTestLabServiceFabricResource.ResourceType) - throw new ArgumentException(string.Format(CultureInfo.CurrentCulture, "Invalid resource type {0} expected {1}", id.ResourceType, DevTestLabServiceFabricResource.ResourceType), nameof(id)); + { + throw new ArgumentException(string.Format("Invalid resource type {0} expected {1}", id.ResourceType, DevTestLabServiceFabricResource.ResourceType), id); + } } /// /// Create or replace an existing schedule. /// /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/users/{userName}/servicefabrics/{serviceFabricName}/schedules/{name} - /// - /// - /// Operation Id - /// ServiceFabricSchedules_CreateOrUpdate + /// Request Path. + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/users/{userName}/servicefabrics/{serviceFabricName}/schedules/{name}. /// /// - /// Default Api Version - /// 2018-09-15 + /// Operation Id. + /// ServiceFabricSchedules_CreateOrUpdate. /// /// - /// Resource - /// + /// Default Api Version. + /// 2018-09-15. /// /// /// /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. - /// The name of the schedule. + /// The name of the Schedule. /// A schedule. /// 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 name, DevTestLabScheduleData data, CancellationToken cancellationToken = default) { Argument.AssertNotNullOrEmpty(name, nameof(name)); Argument.AssertNotNull(data, nameof(data)); - using var scope = _devTestLabServiceFabricScheduleServiceFabricSchedulesClientDiagnostics.CreateScope("DevTestLabServiceFabricScheduleCollection.CreateOrUpdate"); + using DiagnosticScope scope = _devTestLabServiceFabricSchedulesClientDiagnostics.CreateScope("DevTestLabServiceFabricScheduleCollection.CreateOrUpdate"); scope.Start(); try { - var response = await _devTestLabServiceFabricScheduleServiceFabricSchedulesRestClient.CreateOrUpdateAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, name, data, cancellationToken).ConfigureAwait(false); - var uri = _devTestLabServiceFabricScheduleServiceFabricSchedulesRestClient.CreateCreateOrUpdateRequestUri(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, name, data); - var rehydrationToken = NextLinkOperationImplementation.GetRehydrationToken(RequestMethod.Put, uri.ToUri(), uri.ToString(), "None", null, OperationFinalStateVia.OriginalUri.ToString()); - var operation = new DevTestLabsArmOperation(Response.FromValue(new DevTestLabServiceFabricScheduleResource(Client, response), response.GetRawResponse()), rehydrationToken); + RequestContext context = new RequestContext + { + CancellationToken = cancellationToken + }; + HttpMessage message = _devTestLabServiceFabricSchedulesRestClient.CreateCreateOrUpdateRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, name, DevTestLabScheduleData.ToRequestContent(data), context); + Response result = await Pipeline.ProcessMessageAsync(message, context).ConfigureAwait(false); + Response response = Response.FromValue(DevTestLabScheduleData.FromResponse(result), result); + RequestUriBuilder uri = message.Request.Uri; + RehydrationToken rehydrationToken = NextLinkOperationImplementation.GetRehydrationToken(RequestMethod.Put, uri.ToUri(), uri.ToString(), "None", null, OperationFinalStateVia.OriginalUri.ToString()); + DevTestLabsArmOperation operation = new DevTestLabsArmOperation(Response.FromValue(new DevTestLabServiceFabricScheduleResource(Client, response.Value), response.GetRawResponse()), rehydrationToken); if (waitUntil == WaitUntil.Completed) + { await operation.WaitForCompletionAsync(cancellationToken).ConfigureAwait(false); + } return operation; } catch (Exception e) @@ -106,44 +113,48 @@ public virtual async Task> /// Create or replace an existing schedule. /// /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/users/{userName}/servicefabrics/{serviceFabricName}/schedules/{name} + /// Request Path. + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/users/{userName}/servicefabrics/{serviceFabricName}/schedules/{name}. /// /// - /// Operation Id - /// ServiceFabricSchedules_CreateOrUpdate + /// Operation Id. + /// ServiceFabricSchedules_CreateOrUpdate. /// /// - /// Default Api Version - /// 2018-09-15 - /// - /// - /// Resource - /// + /// Default Api Version. + /// 2018-09-15. /// /// /// /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. - /// The name of the schedule. + /// The name of the Schedule. /// A schedule. /// 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 name, DevTestLabScheduleData data, CancellationToken cancellationToken = default) { Argument.AssertNotNullOrEmpty(name, nameof(name)); Argument.AssertNotNull(data, nameof(data)); - using var scope = _devTestLabServiceFabricScheduleServiceFabricSchedulesClientDiagnostics.CreateScope("DevTestLabServiceFabricScheduleCollection.CreateOrUpdate"); + using DiagnosticScope scope = _devTestLabServiceFabricSchedulesClientDiagnostics.CreateScope("DevTestLabServiceFabricScheduleCollection.CreateOrUpdate"); scope.Start(); try { - var response = _devTestLabServiceFabricScheduleServiceFabricSchedulesRestClient.CreateOrUpdate(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, name, data, cancellationToken); - var uri = _devTestLabServiceFabricScheduleServiceFabricSchedulesRestClient.CreateCreateOrUpdateRequestUri(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, name, data); - var rehydrationToken = NextLinkOperationImplementation.GetRehydrationToken(RequestMethod.Put, uri.ToUri(), uri.ToString(), "None", null, OperationFinalStateVia.OriginalUri.ToString()); - var operation = new DevTestLabsArmOperation(Response.FromValue(new DevTestLabServiceFabricScheduleResource(Client, response), response.GetRawResponse()), rehydrationToken); + RequestContext context = new RequestContext + { + CancellationToken = cancellationToken + }; + HttpMessage message = _devTestLabServiceFabricSchedulesRestClient.CreateCreateOrUpdateRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, name, DevTestLabScheduleData.ToRequestContent(data), context); + Response result = Pipeline.ProcessMessage(message, context); + Response response = Response.FromValue(DevTestLabScheduleData.FromResponse(result), result); + RequestUriBuilder uri = message.Request.Uri; + RehydrationToken rehydrationToken = NextLinkOperationImplementation.GetRehydrationToken(RequestMethod.Put, uri.ToUri(), uri.ToString(), "None", null, OperationFinalStateVia.OriginalUri.ToString()); + DevTestLabsArmOperation operation = new DevTestLabsArmOperation(Response.FromValue(new DevTestLabServiceFabricScheduleResource(Client, response.Value), response.GetRawResponse()), rehydrationToken); if (waitUntil == WaitUntil.Completed) + { operation.WaitForCompletion(cancellationToken); + } return operation; } catch (Exception e) @@ -157,39 +168,43 @@ public virtual ArmOperation CreateOrUpd /// Get schedule. /// /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/users/{userName}/servicefabrics/{serviceFabricName}/schedules/{name} + /// Request Path. + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/users/{userName}/servicefabrics/{serviceFabricName}/schedules/{name}. /// /// - /// Operation Id - /// ServiceFabricSchedules_Get + /// Operation Id. + /// ServiceFabricSchedules_Get. /// /// - /// Default Api Version - /// 2018-09-15 - /// - /// - /// Resource - /// + /// Default Api Version. + /// 2018-09-15. /// /// /// - /// The name of the schedule. + /// The name of the Schedule. /// Specify the $expand query. Example: 'properties($select=status)'. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. - public virtual async Task> GetAsync(string name, string expand = null, CancellationToken cancellationToken = default) + /// is an empty string, and was expected to be non-empty. + public virtual async Task> GetAsync(string name, string expand = default, CancellationToken cancellationToken = default) { Argument.AssertNotNullOrEmpty(name, nameof(name)); - using var scope = _devTestLabServiceFabricScheduleServiceFabricSchedulesClientDiagnostics.CreateScope("DevTestLabServiceFabricScheduleCollection.Get"); + using DiagnosticScope scope = _devTestLabServiceFabricSchedulesClientDiagnostics.CreateScope("DevTestLabServiceFabricScheduleCollection.Get"); scope.Start(); try { - var response = await _devTestLabServiceFabricScheduleServiceFabricSchedulesRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, name, expand, cancellationToken).ConfigureAwait(false); + RequestContext context = new RequestContext + { + CancellationToken = cancellationToken + }; + HttpMessage message = _devTestLabServiceFabricSchedulesRestClient.CreateGetRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, name, expand, context); + Response result = await Pipeline.ProcessMessageAsync(message, context).ConfigureAwait(false); + Response response = Response.FromValue(DevTestLabScheduleData.FromResponse(result), result); if (response.Value == null) + { throw new RequestFailedException(response.GetRawResponse()); + } return Response.FromValue(new DevTestLabServiceFabricScheduleResource(Client, response.Value), response.GetRawResponse()); } catch (Exception e) @@ -203,39 +218,43 @@ public virtual async Task> Get /// Get schedule. /// /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/users/{userName}/servicefabrics/{serviceFabricName}/schedules/{name} - /// - /// - /// Operation Id - /// ServiceFabricSchedules_Get + /// Request Path. + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/users/{userName}/servicefabrics/{serviceFabricName}/schedules/{name}. /// /// - /// Default Api Version - /// 2018-09-15 + /// Operation Id. + /// ServiceFabricSchedules_Get. /// /// - /// Resource - /// + /// Default Api Version. + /// 2018-09-15. /// /// /// - /// The name of the schedule. + /// The name of the Schedule. /// Specify the $expand query. Example: 'properties($select=status)'. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. - public virtual Response Get(string name, string expand = null, CancellationToken cancellationToken = default) + /// is an empty string, and was expected to be non-empty. + public virtual Response Get(string name, string expand = default, CancellationToken cancellationToken = default) { Argument.AssertNotNullOrEmpty(name, nameof(name)); - using var scope = _devTestLabServiceFabricScheduleServiceFabricSchedulesClientDiagnostics.CreateScope("DevTestLabServiceFabricScheduleCollection.Get"); + using DiagnosticScope scope = _devTestLabServiceFabricSchedulesClientDiagnostics.CreateScope("DevTestLabServiceFabricScheduleCollection.Get"); scope.Start(); try { - var response = _devTestLabServiceFabricScheduleServiceFabricSchedulesRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, name, expand, cancellationToken); + RequestContext context = new RequestContext + { + CancellationToken = cancellationToken + }; + HttpMessage message = _devTestLabServiceFabricSchedulesRestClient.CreateGetRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, name, expand, context); + Response result = Pipeline.ProcessMessage(message, context); + Response response = Response.FromValue(DevTestLabScheduleData.FromResponse(result), result); if (response.Value == null) + { throw new RequestFailedException(response.GetRawResponse()); + } return Response.FromValue(new DevTestLabServiceFabricScheduleResource(Client, response.Value), response.GetRawResponse()); } catch (Exception e) @@ -249,20 +268,16 @@ public virtual Response Get(string name /// List schedules in a given service fabric. /// /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/users/{userName}/servicefabrics/{serviceFabricName}/schedules + /// Request Path. + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/users/{userName}/servicefabrics/{serviceFabricName}/schedules. /// /// - /// Operation Id - /// ServiceFabricSchedules_List + /// Operation Id. + /// ServiceFabricSchedules_List. /// /// - /// Default Api Version - /// 2018-09-15 - /// - /// - /// Resource - /// + /// Default Api Version. + /// 2018-09-15. /// /// /// @@ -271,32 +286,41 @@ public virtual Response Get(string name /// The maximum number of resources to return from the operation. Example: '$top=10'. /// The ordering expression for the results, using OData notation. Example: '$orderby=name desc'. /// The cancellation token to use. - /// An async collection of that may take multiple service requests to iterate over. - public virtual AsyncPageable GetAllAsync(string expand = null, string filter = null, int? top = null, string orderby = null, CancellationToken cancellationToken = default) + /// A collection of that may take multiple service requests to iterate over. + public virtual AsyncPageable GetAllAsync(string expand = default, string filter = default, int? top = default, string @orderby = default, CancellationToken cancellationToken = default) { - HttpMessage FirstPageRequest(int? pageSizeHint) => _devTestLabServiceFabricScheduleServiceFabricSchedulesRestClient.CreateListRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, expand, filter, top, orderby); - HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _devTestLabServiceFabricScheduleServiceFabricSchedulesRestClient.CreateListNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, expand, filter, top, orderby); - return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new DevTestLabServiceFabricScheduleResource(Client, DevTestLabScheduleData.DeserializeDevTestLabScheduleData(e)), _devTestLabServiceFabricScheduleServiceFabricSchedulesClientDiagnostics, Pipeline, "DevTestLabServiceFabricScheduleCollection.GetAll", "value", "nextLink", cancellationToken); + RequestContext context = new RequestContext + { + CancellationToken = cancellationToken + }; + return new AsyncPageableWrapper(new DevTestLabServiceFabricSchedulesGetAllAsyncCollectionResultOfT( + _devTestLabServiceFabricSchedulesRestClient, + Id.SubscriptionId, + Id.ResourceGroupName, + Id.Parent.Parent.Name, + Id.Parent.Name, + Id.Name, + expand, + filter, + top, + @orderby, + context), data => new DevTestLabServiceFabricScheduleResource(Client, data)); } /// /// List schedules in a given service fabric. /// /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/users/{userName}/servicefabrics/{serviceFabricName}/schedules - /// - /// - /// Operation Id - /// ServiceFabricSchedules_List + /// Request Path. + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/users/{userName}/servicefabrics/{serviceFabricName}/schedules. /// /// - /// Default Api Version - /// 2018-09-15 + /// Operation Id. + /// ServiceFabricSchedules_List. /// /// - /// Resource - /// + /// Default Api Version. + /// 2018-09-15. /// /// /// @@ -306,48 +330,75 @@ public virtual AsyncPageable GetAllAsyn /// The ordering expression for the results, using OData notation. Example: '$orderby=name desc'. /// The cancellation token to use. /// A collection of that may take multiple service requests to iterate over. - public virtual Pageable GetAll(string expand = null, string filter = null, int? top = null, string orderby = null, CancellationToken cancellationToken = default) + public virtual Pageable GetAll(string expand = default, string filter = default, int? top = default, string @orderby = default, CancellationToken cancellationToken = default) { - HttpMessage FirstPageRequest(int? pageSizeHint) => _devTestLabServiceFabricScheduleServiceFabricSchedulesRestClient.CreateListRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, expand, filter, top, orderby); - HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _devTestLabServiceFabricScheduleServiceFabricSchedulesRestClient.CreateListNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, expand, filter, top, orderby); - return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new DevTestLabServiceFabricScheduleResource(Client, DevTestLabScheduleData.DeserializeDevTestLabScheduleData(e)), _devTestLabServiceFabricScheduleServiceFabricSchedulesClientDiagnostics, Pipeline, "DevTestLabServiceFabricScheduleCollection.GetAll", "value", "nextLink", cancellationToken); + RequestContext context = new RequestContext + { + CancellationToken = cancellationToken + }; + return new PageableWrapper(new DevTestLabServiceFabricSchedulesGetAllCollectionResultOfT( + _devTestLabServiceFabricSchedulesRestClient, + Id.SubscriptionId, + Id.ResourceGroupName, + Id.Parent.Parent.Name, + Id.Parent.Name, + Id.Name, + expand, + filter, + top, + @orderby, + context), data => new DevTestLabServiceFabricScheduleResource(Client, data)); } /// /// Checks to see if the resource exists in azure. /// /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/users/{userName}/servicefabrics/{serviceFabricName}/schedules/{name} - /// - /// - /// Operation Id - /// ServiceFabricSchedules_Get + /// Request Path. + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/users/{userName}/servicefabrics/{serviceFabricName}/schedules/{name}. /// /// - /// Default Api Version - /// 2018-09-15 + /// Operation Id. + /// ServiceFabricSchedules_Get. /// /// - /// Resource - /// + /// Default Api Version. + /// 2018-09-15. /// /// /// - /// The name of the schedule. + /// The name of the Schedule. /// Specify the $expand query. Example: 'properties($select=status)'. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. - public virtual async Task> ExistsAsync(string name, string expand = null, CancellationToken cancellationToken = default) + /// is an empty string, and was expected to be non-empty. + public virtual async Task> ExistsAsync(string name, string expand = default, CancellationToken cancellationToken = default) { Argument.AssertNotNullOrEmpty(name, nameof(name)); - using var scope = _devTestLabServiceFabricScheduleServiceFabricSchedulesClientDiagnostics.CreateScope("DevTestLabServiceFabricScheduleCollection.Exists"); + using DiagnosticScope scope = _devTestLabServiceFabricSchedulesClientDiagnostics.CreateScope("DevTestLabServiceFabricScheduleCollection.Exists"); scope.Start(); try { - var response = await _devTestLabServiceFabricScheduleServiceFabricSchedulesRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, name, expand, cancellationToken: cancellationToken).ConfigureAwait(false); + RequestContext context = new RequestContext + { + CancellationToken = cancellationToken + }; + HttpMessage message = _devTestLabServiceFabricSchedulesRestClient.CreateGetRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, name, expand, context); + await Pipeline.SendAsync(message, context.CancellationToken).ConfigureAwait(false); + Response result = message.Response; + Response response = default; + switch (result.Status) + { + case 200: + response = Response.FromValue(DevTestLabScheduleData.FromResponse(result), result); + break; + case 404: + response = Response.FromValue((DevTestLabScheduleData)null, result); + break; + default: + throw new RequestFailedException(result); + } return Response.FromValue(response.Value != null, response.GetRawResponse()); } catch (Exception e) @@ -361,37 +412,51 @@ public virtual async Task> ExistsAsync(string name, string expand /// Checks to see if the resource exists in azure. /// /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/users/{userName}/servicefabrics/{serviceFabricName}/schedules/{name} + /// Request Path. + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/users/{userName}/servicefabrics/{serviceFabricName}/schedules/{name}. /// /// - /// Operation Id - /// ServiceFabricSchedules_Get + /// Operation Id. + /// ServiceFabricSchedules_Get. /// /// - /// Default Api Version - /// 2018-09-15 - /// - /// - /// Resource - /// + /// Default Api Version. + /// 2018-09-15. /// /// /// - /// The name of the schedule. + /// The name of the Schedule. /// Specify the $expand query. Example: 'properties($select=status)'. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. - public virtual Response Exists(string name, string expand = null, CancellationToken cancellationToken = default) + /// is an empty string, and was expected to be non-empty. + public virtual Response Exists(string name, string expand = default, CancellationToken cancellationToken = default) { Argument.AssertNotNullOrEmpty(name, nameof(name)); - using var scope = _devTestLabServiceFabricScheduleServiceFabricSchedulesClientDiagnostics.CreateScope("DevTestLabServiceFabricScheduleCollection.Exists"); + using DiagnosticScope scope = _devTestLabServiceFabricSchedulesClientDiagnostics.CreateScope("DevTestLabServiceFabricScheduleCollection.Exists"); scope.Start(); try { - var response = _devTestLabServiceFabricScheduleServiceFabricSchedulesRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, name, expand, cancellationToken: cancellationToken); + RequestContext context = new RequestContext + { + CancellationToken = cancellationToken + }; + HttpMessage message = _devTestLabServiceFabricSchedulesRestClient.CreateGetRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, name, expand, context); + Pipeline.Send(message, context.CancellationToken); + Response result = message.Response; + Response response = default; + switch (result.Status) + { + case 200: + response = Response.FromValue(DevTestLabScheduleData.FromResponse(result), result); + break; + case 404: + response = Response.FromValue((DevTestLabScheduleData)null, result); + break; + default: + throw new RequestFailedException(result); + } return Response.FromValue(response.Value != null, response.GetRawResponse()); } catch (Exception e) @@ -405,39 +470,55 @@ public virtual Response Exists(string name, string expand = null, Cancella /// Tries to get details for this resource from the service. /// /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/users/{userName}/servicefabrics/{serviceFabricName}/schedules/{name} - /// - /// - /// Operation Id - /// ServiceFabricSchedules_Get + /// Request Path. + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/users/{userName}/servicefabrics/{serviceFabricName}/schedules/{name}. /// /// - /// Default Api Version - /// 2018-09-15 + /// Operation Id. + /// ServiceFabricSchedules_Get. /// /// - /// Resource - /// + /// Default Api Version. + /// 2018-09-15. /// /// /// - /// The name of the schedule. + /// The name of the Schedule. /// Specify the $expand query. Example: 'properties($select=status)'. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. - public virtual async Task> GetIfExistsAsync(string name, string expand = null, CancellationToken cancellationToken = default) + /// is an empty string, and was expected to be non-empty. + public virtual async Task> GetIfExistsAsync(string name, string expand = default, CancellationToken cancellationToken = default) { Argument.AssertNotNullOrEmpty(name, nameof(name)); - using var scope = _devTestLabServiceFabricScheduleServiceFabricSchedulesClientDiagnostics.CreateScope("DevTestLabServiceFabricScheduleCollection.GetIfExists"); + using DiagnosticScope scope = _devTestLabServiceFabricSchedulesClientDiagnostics.CreateScope("DevTestLabServiceFabricScheduleCollection.GetIfExists"); scope.Start(); try { - var response = await _devTestLabServiceFabricScheduleServiceFabricSchedulesRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, name, expand, cancellationToken: cancellationToken).ConfigureAwait(false); + RequestContext context = new RequestContext + { + CancellationToken = cancellationToken + }; + HttpMessage message = _devTestLabServiceFabricSchedulesRestClient.CreateGetRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, name, expand, context); + await Pipeline.SendAsync(message, context.CancellationToken).ConfigureAwait(false); + Response result = message.Response; + Response response = default; + switch (result.Status) + { + case 200: + response = Response.FromValue(DevTestLabScheduleData.FromResponse(result), result); + break; + case 404: + response = Response.FromValue((DevTestLabScheduleData)null, result); + break; + default: + throw new RequestFailedException(result); + } if (response.Value == null) + { return new NoValueResponse(response.GetRawResponse()); + } return Response.FromValue(new DevTestLabServiceFabricScheduleResource(Client, response.Value), response.GetRawResponse()); } catch (Exception e) @@ -451,39 +532,55 @@ public virtual async Task /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/users/{userName}/servicefabrics/{serviceFabricName}/schedules/{name} + /// Request Path. + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/users/{userName}/servicefabrics/{serviceFabricName}/schedules/{name}. /// /// - /// Operation Id - /// ServiceFabricSchedules_Get + /// Operation Id. + /// ServiceFabricSchedules_Get. /// /// - /// Default Api Version - /// 2018-09-15 - /// - /// - /// Resource - /// + /// Default Api Version. + /// 2018-09-15. /// /// /// - /// The name of the schedule. + /// The name of the Schedule. /// Specify the $expand query. Example: 'properties($select=status)'. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. - public virtual NullableResponse GetIfExists(string name, string expand = null, CancellationToken cancellationToken = default) + /// is an empty string, and was expected to be non-empty. + public virtual NullableResponse GetIfExists(string name, string expand = default, CancellationToken cancellationToken = default) { Argument.AssertNotNullOrEmpty(name, nameof(name)); - using var scope = _devTestLabServiceFabricScheduleServiceFabricSchedulesClientDiagnostics.CreateScope("DevTestLabServiceFabricScheduleCollection.GetIfExists"); + using DiagnosticScope scope = _devTestLabServiceFabricSchedulesClientDiagnostics.CreateScope("DevTestLabServiceFabricScheduleCollection.GetIfExists"); scope.Start(); try { - var response = _devTestLabServiceFabricScheduleServiceFabricSchedulesRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, name, expand, cancellationToken: cancellationToken); + RequestContext context = new RequestContext + { + CancellationToken = cancellationToken + }; + HttpMessage message = _devTestLabServiceFabricSchedulesRestClient.CreateGetRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, name, expand, context); + Pipeline.Send(message, context.CancellationToken); + Response result = message.Response; + Response response = default; + switch (result.Status) + { + case 200: + response = Response.FromValue(DevTestLabScheduleData.FromResponse(result), result); + break; + case 404: + response = Response.FromValue((DevTestLabScheduleData)null, result); + break; + default: + throw new RequestFailedException(result); + } if (response.Value == null) + { return new NoValueResponse(response.GetRawResponse()); + } return Response.FromValue(new DevTestLabServiceFabricScheduleResource(Client, response.Value), response.GetRawResponse()); } catch (Exception e) @@ -503,6 +600,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/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/DevTestLabServiceFabricScheduleResource.Serialization.cs b/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/DevTestLabServiceFabricScheduleResource.Serialization.cs index b2e6065c5dce..aa4a41540a57 100644 --- a/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/DevTestLabServiceFabricScheduleResource.Serialization.cs +++ b/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/DevTestLabServiceFabricScheduleResource.Serialization.cs @@ -11,19 +11,29 @@ namespace Azure.ResourceManager.DevTestLabs { + /// public partial class DevTestLabServiceFabricScheduleResource : IJsonModel { - private static DevTestLabScheduleData s_dataDeserializationInstance; - private static DevTestLabScheduleData DataDeserializationInstance => s_dataDeserializationInstance ??= new(); + private static IJsonModel s_dataDeserializationInstance; + private static IJsonModel DataDeserializationInstance => s_dataDeserializationInstance ??= new DevTestLabScheduleData(); + + /// 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); - DevTestLabScheduleData 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. + DevTestLabScheduleData 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, AzureResourceManagerDevTestLabsContext.Default); + /// The binary data to be processed. + /// The client options for reading and writing models. DevTestLabScheduleData IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) => ModelReaderWriter.Read(data, options, AzureResourceManagerDevTestLabsContext.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/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/DevTestLabServiceFabricScheduleResource.cs b/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/DevTestLabServiceFabricScheduleResource.cs index 6a8985ecfc1e..f429a75011c8 100644 --- a/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/DevTestLabServiceFabricScheduleResource.cs +++ b/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/DevTestLabServiceFabricScheduleResource.cs @@ -7,49 +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.DevTestLabs.Models; +using Azure.ResourceManager.Resources; namespace Azure.ResourceManager.DevTestLabs { /// - /// A Class representing a DevTestLabServiceFabricSchedule 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 GetDevTestLabServiceFabricScheduleResource method. - /// Otherwise you can get one from its parent resource using the GetDevTestLabServiceFabricSchedule method. + /// A class representing a DevTestLabServiceFabricSchedule 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 GetDevTestLabServiceFabricSchedules method. /// public partial class DevTestLabServiceFabricScheduleResource : ArmResource { - /// Generate the resource identifier of a instance. - /// The subscriptionId. - /// The resourceGroupName. - /// The labName. - /// The userName. - /// The serviceFabricName. - /// The name. - public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string labName, string userName, string serviceFabricName, string name) - { - var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/users/{userName}/servicefabrics/{serviceFabricName}/schedules/{name}"; - return new ResourceIdentifier(resourceId); - } - - private readonly ClientDiagnostics _devTestLabServiceFabricScheduleServiceFabricSchedulesClientDiagnostics; - private readonly ServiceFabricSchedulesRestOperations _devTestLabServiceFabricScheduleServiceFabricSchedulesRestClient; + private readonly ClientDiagnostics _devTestLabServiceFabricSchedulesClientDiagnostics; + private readonly DevTestLabServiceFabricSchedules _devTestLabServiceFabricSchedulesRestClient; private readonly DevTestLabScheduleData _data; - /// Gets the resource type for the operations. public static readonly ResourceType ResourceType = "Microsoft.DevTestLab/labs/users/servicefabrics/schedules"; - /// Initializes a new instance of the class for mocking. + /// Initializes a new instance of DevTestLabServiceFabricScheduleResource for mocking. protected DevTestLabServiceFabricScheduleResource() { } - /// 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 DevTestLabServiceFabricScheduleResource(ArmClient client, DevTestLabScheduleData data) : this(client, data.Id) @@ -58,72 +46,96 @@ internal DevTestLabServiceFabricScheduleResource(ArmClient client, DevTestLabSch _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 DevTestLabServiceFabricScheduleResource(ArmClient client, ResourceIdentifier id) : base(client, id) { - _devTestLabServiceFabricScheduleServiceFabricSchedulesClientDiagnostics = new ClientDiagnostics("Azure.ResourceManager.DevTestLabs", ResourceType.Namespace, Diagnostics); - TryGetApiVersion(ResourceType, out string devTestLabServiceFabricScheduleServiceFabricSchedulesApiVersion); - _devTestLabServiceFabricScheduleServiceFabricSchedulesRestClient = new ServiceFabricSchedulesRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, devTestLabServiceFabricScheduleServiceFabricSchedulesApiVersion); -#if DEBUG - ValidateResourceId(Id); -#endif + TryGetApiVersion(ResourceType, out string devTestLabServiceFabricScheduleApiVersion); + _devTestLabServiceFabricSchedulesClientDiagnostics = new ClientDiagnostics("Azure.ResourceManager.DevTestLabs", ResourceType.Namespace, Diagnostics); + _devTestLabServiceFabricSchedulesRestClient = new DevTestLabServiceFabricSchedules(_devTestLabServiceFabricSchedulesClientDiagnostics, Pipeline, Endpoint, devTestLabServiceFabricScheduleApiVersion ?? "2018-09-15"); + 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 DevTestLabScheduleData 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 labName. + /// The userName. + /// The serviceFabricName. + /// The name. + public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string labName, string userName, string serviceFabricName, string name) + { + string resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/users/{userName}/servicefabrics/{serviceFabricName}/schedules/{name}"; + 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 schedule. /// /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/users/{userName}/servicefabrics/{serviceFabricName}/schedules/{name} + /// Request Path. + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/users/{userName}/servicefabrics/{serviceFabricName}/schedules/{name}. /// /// - /// Operation Id - /// ServiceFabricSchedules_Get + /// Operation Id. + /// ServiceFabricSchedules_Get. /// /// - /// Default Api Version - /// 2018-09-15 + /// Default Api Version. + /// 2018-09-15. /// /// - /// Resource - /// + /// Resource. + /// . /// /// /// /// Specify the $expand query. Example: 'properties($select=status)'. /// The cancellation token to use. - public virtual async Task> GetAsync(string expand = null, CancellationToken cancellationToken = default) + public virtual async Task> GetAsync(string expand = default, CancellationToken cancellationToken = default) { - using var scope = _devTestLabServiceFabricScheduleServiceFabricSchedulesClientDiagnostics.CreateScope("DevTestLabServiceFabricScheduleResource.Get"); + using DiagnosticScope scope = _devTestLabServiceFabricSchedulesClientDiagnostics.CreateScope("DevTestLabServiceFabricScheduleResource.Get"); scope.Start(); try { - var response = await _devTestLabServiceFabricScheduleServiceFabricSchedulesRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Parent.Name, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, expand, cancellationToken).ConfigureAwait(false); + RequestContext context = new RequestContext + { + CancellationToken = cancellationToken + }; + HttpMessage message = _devTestLabServiceFabricSchedulesRestClient.CreateGetRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Parent.Name, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, expand, context); + Response result = await Pipeline.ProcessMessageAsync(message, context).ConfigureAwait(false); + Response response = Response.FromValue(DevTestLabScheduleData.FromResponse(result), result); if (response.Value == null) + { throw new RequestFailedException(response.GetRawResponse()); + } return Response.FromValue(new DevTestLabServiceFabricScheduleResource(Client, response.Value), response.GetRawResponse()); } catch (Exception e) @@ -137,34 +149,42 @@ public virtual async Task> Get /// Get schedule. /// /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/users/{userName}/servicefabrics/{serviceFabricName}/schedules/{name} + /// Request Path. + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/users/{userName}/servicefabrics/{serviceFabricName}/schedules/{name}. /// /// - /// Operation Id - /// ServiceFabricSchedules_Get + /// Operation Id. + /// ServiceFabricSchedules_Get. /// /// - /// Default Api Version - /// 2018-09-15 + /// Default Api Version. + /// 2018-09-15. /// /// - /// Resource - /// + /// Resource. + /// . /// /// /// /// Specify the $expand query. Example: 'properties($select=status)'. /// The cancellation token to use. - public virtual Response Get(string expand = null, CancellationToken cancellationToken = default) + public virtual Response Get(string expand = default, CancellationToken cancellationToken = default) { - using var scope = _devTestLabServiceFabricScheduleServiceFabricSchedulesClientDiagnostics.CreateScope("DevTestLabServiceFabricScheduleResource.Get"); + using DiagnosticScope scope = _devTestLabServiceFabricSchedulesClientDiagnostics.CreateScope("DevTestLabServiceFabricScheduleResource.Get"); scope.Start(); try { - var response = _devTestLabServiceFabricScheduleServiceFabricSchedulesRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Parent.Name, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, expand, cancellationToken); + RequestContext context = new RequestContext + { + CancellationToken = cancellationToken + }; + HttpMessage message = _devTestLabServiceFabricSchedulesRestClient.CreateGetRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Parent.Name, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, expand, context); + Response result = Pipeline.ProcessMessage(message, context); + Response response = Response.FromValue(DevTestLabScheduleData.FromResponse(result), result); if (response.Value == null) + { throw new RequestFailedException(response.GetRawResponse()); + } return Response.FromValue(new DevTestLabServiceFabricScheduleResource(Client, response.Value), response.GetRawResponse()); } catch (Exception e) @@ -175,41 +195,49 @@ public virtual Response Get(string expa } /// - /// Delete schedule. + /// Allows modifying tags of schedules. All other properties will be ignored. /// /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/users/{userName}/servicefabrics/{serviceFabricName}/schedules/{name} + /// Request Path. + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/users/{userName}/servicefabrics/{serviceFabricName}/schedules/{name}. /// /// - /// Operation Id - /// ServiceFabricSchedules_Delete + /// Operation Id. + /// ServiceFabricSchedules_Update. /// /// - /// Default Api Version - /// 2018-09-15 + /// Default Api Version. + /// 2018-09-15. /// /// - /// Resource - /// + /// Resource. + /// . /// /// /// - /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. + /// A schedule. /// The cancellation token to use. - public virtual async Task DeleteAsync(WaitUntil waitUntil, CancellationToken cancellationToken = default) + /// is null. + public virtual async Task> UpdateAsync(DevTestLabSchedulePatch patch, CancellationToken cancellationToken = default) { - using var scope = _devTestLabServiceFabricScheduleServiceFabricSchedulesClientDiagnostics.CreateScope("DevTestLabServiceFabricScheduleResource.Delete"); + Argument.AssertNotNull(patch, nameof(patch)); + + using DiagnosticScope scope = _devTestLabServiceFabricSchedulesClientDiagnostics.CreateScope("DevTestLabServiceFabricScheduleResource.Update"); scope.Start(); try { - var response = await _devTestLabServiceFabricScheduleServiceFabricSchedulesRestClient.DeleteAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Parent.Name, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, cancellationToken).ConfigureAwait(false); - var uri = _devTestLabServiceFabricScheduleServiceFabricSchedulesRestClient.CreateDeleteRequestUri(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Parent.Name, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name); - var rehydrationToken = NextLinkOperationImplementation.GetRehydrationToken(RequestMethod.Delete, uri.ToUri(), uri.ToString(), "None", null, OperationFinalStateVia.OriginalUri.ToString()); - var operation = new DevTestLabsArmOperation(response, rehydrationToken); - if (waitUntil == WaitUntil.Completed) - await operation.WaitForCompletionResponseAsync(cancellationToken).ConfigureAwait(false); - return operation; + RequestContext context = new RequestContext + { + CancellationToken = cancellationToken + }; + HttpMessage message = _devTestLabServiceFabricSchedulesRestClient.CreateUpdateRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Parent.Name, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, DevTestLabSchedulePatch.ToRequestContent(patch), context); + Response result = await Pipeline.ProcessMessageAsync(message, context).ConfigureAwait(false); + Response response = Response.FromValue(DevTestLabScheduleData.FromResponse(result), result); + if (response.Value == null) + { + throw new RequestFailedException(response.GetRawResponse()); + } + return Response.FromValue(new DevTestLabServiceFabricScheduleResource(Client, response.Value), response.GetRawResponse()); } catch (Exception e) { @@ -219,41 +247,49 @@ public virtual async Task DeleteAsync(WaitUntil waitUntil, Cancell } /// - /// Delete schedule. + /// Allows modifying tags of schedules. All other properties will be ignored. /// /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/users/{userName}/servicefabrics/{serviceFabricName}/schedules/{name} + /// Request Path. + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/users/{userName}/servicefabrics/{serviceFabricName}/schedules/{name}. /// /// - /// Operation Id - /// ServiceFabricSchedules_Delete + /// Operation Id. + /// ServiceFabricSchedules_Update. /// /// - /// Default Api Version - /// 2018-09-15 + /// Default Api Version. + /// 2018-09-15. /// /// - /// Resource - /// + /// Resource. + /// . /// /// /// - /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. + /// A schedule. /// The cancellation token to use. - public virtual ArmOperation Delete(WaitUntil waitUntil, CancellationToken cancellationToken = default) + /// is null. + public virtual Response Update(DevTestLabSchedulePatch patch, CancellationToken cancellationToken = default) { - using var scope = _devTestLabServiceFabricScheduleServiceFabricSchedulesClientDiagnostics.CreateScope("DevTestLabServiceFabricScheduleResource.Delete"); + Argument.AssertNotNull(patch, nameof(patch)); + + using DiagnosticScope scope = _devTestLabServiceFabricSchedulesClientDiagnostics.CreateScope("DevTestLabServiceFabricScheduleResource.Update"); scope.Start(); try { - var response = _devTestLabServiceFabricScheduleServiceFabricSchedulesRestClient.Delete(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Parent.Name, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, cancellationToken); - var uri = _devTestLabServiceFabricScheduleServiceFabricSchedulesRestClient.CreateDeleteRequestUri(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Parent.Name, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name); - var rehydrationToken = NextLinkOperationImplementation.GetRehydrationToken(RequestMethod.Delete, uri.ToUri(), uri.ToString(), "None", null, OperationFinalStateVia.OriginalUri.ToString()); - var operation = new DevTestLabsArmOperation(response, rehydrationToken); - if (waitUntil == WaitUntil.Completed) - operation.WaitForCompletionResponse(cancellationToken); - return operation; + RequestContext context = new RequestContext + { + CancellationToken = cancellationToken + }; + HttpMessage message = _devTestLabServiceFabricSchedulesRestClient.CreateUpdateRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Parent.Name, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, DevTestLabSchedulePatch.ToRequestContent(patch), context); + Response result = Pipeline.ProcessMessage(message, context); + Response response = Response.FromValue(DevTestLabScheduleData.FromResponse(result), result); + if (response.Value == null) + { + throw new RequestFailedException(response.GetRawResponse()); + } + return Response.FromValue(new DevTestLabServiceFabricScheduleResource(Client, response.Value), response.GetRawResponse()); } catch (Exception e) { @@ -263,39 +299,48 @@ public virtual ArmOperation Delete(WaitUntil waitUntil, CancellationToken cancel } /// - /// Allows modifying tags of schedules. All other properties will be ignored. + /// Delete schedule. /// /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/users/{userName}/servicefabrics/{serviceFabricName}/schedules/{name} + /// Request Path. + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/users/{userName}/servicefabrics/{serviceFabricName}/schedules/{name}. /// /// - /// Operation Id - /// ServiceFabricSchedules_Update + /// Operation Id. + /// ServiceFabricSchedules_Delete. /// /// - /// Default Api Version - /// 2018-09-15 + /// Default Api Version. + /// 2018-09-15. /// /// - /// Resource - /// + /// Resource. + /// . /// /// /// - /// A schedule. + /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. /// The cancellation token to use. - /// is null. - public virtual async Task> UpdateAsync(DevTestLabSchedulePatch patch, CancellationToken cancellationToken = default) + public virtual async Task DeleteAsync(WaitUntil waitUntil, CancellationToken cancellationToken = default) { - Argument.AssertNotNull(patch, nameof(patch)); - - using var scope = _devTestLabServiceFabricScheduleServiceFabricSchedulesClientDiagnostics.CreateScope("DevTestLabServiceFabricScheduleResource.Update"); + using DiagnosticScope scope = _devTestLabServiceFabricSchedulesClientDiagnostics.CreateScope("DevTestLabServiceFabricScheduleResource.Delete"); scope.Start(); try { - var response = await _devTestLabServiceFabricScheduleServiceFabricSchedulesRestClient.UpdateAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Parent.Name, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, patch, cancellationToken).ConfigureAwait(false); - return Response.FromValue(new DevTestLabServiceFabricScheduleResource(Client, response.Value), response.GetRawResponse()); + RequestContext context = new RequestContext + { + CancellationToken = cancellationToken + }; + HttpMessage message = _devTestLabServiceFabricSchedulesRestClient.CreateDeleteRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Parent.Name, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, context); + Response response = await Pipeline.ProcessMessageAsync(message, context).ConfigureAwait(false); + RequestUriBuilder uri = message.Request.Uri; + RehydrationToken rehydrationToken = NextLinkOperationImplementation.GetRehydrationToken(RequestMethod.Delete, uri.ToUri(), uri.ToString(), "None", null, OperationFinalStateVia.OriginalUri.ToString()); + DevTestLabsArmOperation operation = new DevTestLabsArmOperation(response, rehydrationToken); + if (waitUntil == WaitUntil.Completed) + { + await operation.WaitForCompletionResponseAsync(cancellationToken).ConfigureAwait(false); + } + return operation; } catch (Exception e) { @@ -305,39 +350,48 @@ public virtual async Task> Upd } /// - /// Allows modifying tags of schedules. All other properties will be ignored. + /// Delete schedule. /// /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/users/{userName}/servicefabrics/{serviceFabricName}/schedules/{name} + /// Request Path. + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/users/{userName}/servicefabrics/{serviceFabricName}/schedules/{name}. /// /// - /// Operation Id - /// ServiceFabricSchedules_Update + /// Operation Id. + /// ServiceFabricSchedules_Delete. /// /// - /// Default Api Version - /// 2018-09-15 + /// Default Api Version. + /// 2018-09-15. /// /// - /// Resource - /// + /// Resource. + /// . /// /// /// - /// A schedule. + /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. /// The cancellation token to use. - /// is null. - public virtual Response Update(DevTestLabSchedulePatch patch, CancellationToken cancellationToken = default) + public virtual ArmOperation Delete(WaitUntil waitUntil, CancellationToken cancellationToken = default) { - Argument.AssertNotNull(patch, nameof(patch)); - - using var scope = _devTestLabServiceFabricScheduleServiceFabricSchedulesClientDiagnostics.CreateScope("DevTestLabServiceFabricScheduleResource.Update"); + using DiagnosticScope scope = _devTestLabServiceFabricSchedulesClientDiagnostics.CreateScope("DevTestLabServiceFabricScheduleResource.Delete"); scope.Start(); try { - var response = _devTestLabServiceFabricScheduleServiceFabricSchedulesRestClient.Update(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Parent.Name, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, patch, cancellationToken); - return Response.FromValue(new DevTestLabServiceFabricScheduleResource(Client, response.Value), response.GetRawResponse()); + RequestContext context = new RequestContext + { + CancellationToken = cancellationToken + }; + HttpMessage message = _devTestLabServiceFabricSchedulesRestClient.CreateDeleteRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Parent.Name, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, context); + Response response = Pipeline.ProcessMessage(message, context); + RequestUriBuilder uri = message.Request.Uri; + RehydrationToken rehydrationToken = NextLinkOperationImplementation.GetRehydrationToken(RequestMethod.Delete, uri.ToUri(), uri.ToString(), "None", null, OperationFinalStateVia.OriginalUri.ToString()); + DevTestLabsArmOperation operation = new DevTestLabsArmOperation(response, rehydrationToken); + if (waitUntil == WaitUntil.Completed) + { + operation.WaitForCompletionResponse(cancellationToken); + } + return operation; } catch (Exception e) { @@ -350,20 +404,20 @@ public virtual Response Update(DevTestL /// Execute a schedule. This operation can take a while to complete. /// /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/users/{userName}/servicefabrics/{serviceFabricName}/schedules/{name}/execute + /// Request Path. + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/users/{userName}/servicefabrics/{serviceFabricName}/schedules/{name}/execute. /// /// - /// Operation Id - /// ServiceFabricSchedules_Execute + /// Operation Id. + /// ServiceFabricSchedules_Execute. /// /// - /// Default Api Version - /// 2018-09-15 + /// Default Api Version. + /// 2018-09-15. /// /// - /// Resource - /// + /// Resource. + /// . /// /// /// @@ -371,14 +425,21 @@ public virtual Response Update(DevTestL /// The cancellation token to use. public virtual async Task ExecuteAsync(WaitUntil waitUntil, CancellationToken cancellationToken = default) { - using var scope = _devTestLabServiceFabricScheduleServiceFabricSchedulesClientDiagnostics.CreateScope("DevTestLabServiceFabricScheduleResource.Execute"); + using DiagnosticScope scope = _devTestLabServiceFabricSchedulesClientDiagnostics.CreateScope("DevTestLabServiceFabricScheduleResource.Execute"); scope.Start(); try { - var response = await _devTestLabServiceFabricScheduleServiceFabricSchedulesRestClient.ExecuteAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Parent.Name, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, cancellationToken).ConfigureAwait(false); - var operation = new DevTestLabsArmOperation(_devTestLabServiceFabricScheduleServiceFabricSchedulesClientDiagnostics, Pipeline, _devTestLabServiceFabricScheduleServiceFabricSchedulesRestClient.CreateExecuteRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Parent.Name, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name).Request, response, OperationFinalStateVia.Location); + RequestContext context = new RequestContext + { + CancellationToken = cancellationToken + }; + HttpMessage message = _devTestLabServiceFabricSchedulesRestClient.CreateExecuteRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Parent.Name, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, context); + Response response = await Pipeline.ProcessMessageAsync(message, context).ConfigureAwait(false); + DevTestLabsArmOperation operation = new DevTestLabsArmOperation(_devTestLabServiceFabricSchedulesClientDiagnostics, Pipeline, message.Request, response, OperationFinalStateVia.Location); if (waitUntil == WaitUntil.Completed) + { await operation.WaitForCompletionResponseAsync(cancellationToken).ConfigureAwait(false); + } return operation; } catch (Exception e) @@ -392,20 +453,20 @@ public virtual async Task ExecuteAsync(WaitUntil waitUntil, Cancel /// Execute a schedule. This operation can take a while to complete. /// /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/users/{userName}/servicefabrics/{serviceFabricName}/schedules/{name}/execute + /// Request Path. + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/users/{userName}/servicefabrics/{serviceFabricName}/schedules/{name}/execute. /// /// - /// Operation Id - /// ServiceFabricSchedules_Execute + /// Operation Id. + /// ServiceFabricSchedules_Execute. /// /// - /// Default Api Version - /// 2018-09-15 + /// Default Api Version. + /// 2018-09-15. /// /// - /// Resource - /// + /// Resource. + /// . /// /// /// @@ -413,14 +474,21 @@ public virtual async Task ExecuteAsync(WaitUntil waitUntil, Cancel /// The cancellation token to use. public virtual ArmOperation Execute(WaitUntil waitUntil, CancellationToken cancellationToken = default) { - using var scope = _devTestLabServiceFabricScheduleServiceFabricSchedulesClientDiagnostics.CreateScope("DevTestLabServiceFabricScheduleResource.Execute"); + using DiagnosticScope scope = _devTestLabServiceFabricSchedulesClientDiagnostics.CreateScope("DevTestLabServiceFabricScheduleResource.Execute"); scope.Start(); try { - var response = _devTestLabServiceFabricScheduleServiceFabricSchedulesRestClient.Execute(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Parent.Name, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, cancellationToken); - var operation = new DevTestLabsArmOperation(_devTestLabServiceFabricScheduleServiceFabricSchedulesClientDiagnostics, Pipeline, _devTestLabServiceFabricScheduleServiceFabricSchedulesRestClient.CreateExecuteRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Parent.Name, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name).Request, response, OperationFinalStateVia.Location); + RequestContext context = new RequestContext + { + CancellationToken = cancellationToken + }; + HttpMessage message = _devTestLabServiceFabricSchedulesRestClient.CreateExecuteRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Parent.Name, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, context); + Response response = Pipeline.ProcessMessage(message, context); + DevTestLabsArmOperation operation = new DevTestLabsArmOperation(_devTestLabServiceFabricSchedulesClientDiagnostics, Pipeline, message.Request, response, OperationFinalStateVia.Location); if (waitUntil == WaitUntil.Completed) + { operation.WaitForCompletionResponse(cancellationToken); + } return operation; } catch (Exception e) @@ -430,27 +498,7 @@ public virtual ArmOperation Execute(WaitUntil waitUntil, CancellationToken cance } } - /// - /// Add a tag to the current resource. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/users/{userName}/servicefabrics/{serviceFabricName}/schedules/{name} - /// - /// - /// Operation Id - /// ServiceFabricSchedules_Get - /// - /// - /// Default Api Version - /// 2018-09-15 - /// - /// - /// Resource - /// - /// - /// - /// + /// Add a tag to the current resource. /// The key for the tag. /// The value for the tag. /// The cancellation token to use. @@ -460,29 +508,35 @@ public virtual async Task> Add Argument.AssertNotNull(key, nameof(key)); Argument.AssertNotNull(value, nameof(value)); - using var scope = _devTestLabServiceFabricScheduleServiceFabricSchedulesClientDiagnostics.CreateScope("DevTestLabServiceFabricScheduleResource.AddTag"); + using DiagnosticScope scope = _devTestLabServiceFabricSchedulesClientDiagnostics.CreateScope("DevTestLabServiceFabricScheduleResource.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 _devTestLabServiceFabricScheduleServiceFabricSchedulesRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Parent.Name, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, null, cancellationToken).ConfigureAwait(false); - return Response.FromValue(new DevTestLabServiceFabricScheduleResource(Client, originalResponse.Value), originalResponse.GetRawResponse()); + await GetTagResource().CreateOrUpdateAsync(WaitUntil.Completed, originalTags.Value.Data, cancellationToken).ConfigureAwait(false); + RequestContext context = new RequestContext + { + CancellationToken = cancellationToken + }; + HttpMessage message = _devTestLabServiceFabricSchedulesRestClient.CreateGetRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Parent.Name, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, default, context); + Response result = await Pipeline.ProcessMessageAsync(message, context).ConfigureAwait(false); + Response response = Response.FromValue(DevTestLabScheduleData.FromResponse(result), result); + return Response.FromValue(new DevTestLabServiceFabricScheduleResource(Client, response.Value), response.GetRawResponse()); } else { - var current = (await GetAsync(cancellationToken: cancellationToken).ConfigureAwait(false)).Value.Data; - var patch = new DevTestLabSchedulePatch(); - foreach (var tag in current.Tags) + DevTestLabScheduleData current = (await GetAsync(cancellationToken: cancellationToken).ConfigureAwait(false)).Value.Data; + DevTestLabSchedulePatch patch = new DevTestLabSchedulePatch(); + 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) @@ -492,27 +546,7 @@ public virtual async Task> Add } } - /// - /// Add a tag to the current resource. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/users/{userName}/servicefabrics/{serviceFabricName}/schedules/{name} - /// - /// - /// Operation Id - /// ServiceFabricSchedules_Get - /// - /// - /// Default Api Version - /// 2018-09-15 - /// - /// - /// Resource - /// - /// - /// - /// + /// Add a tag to the current resource. /// The key for the tag. /// The value for the tag. /// The cancellation token to use. @@ -522,29 +556,35 @@ public virtual Response AddTag(string k Argument.AssertNotNull(key, nameof(key)); Argument.AssertNotNull(value, nameof(value)); - using var scope = _devTestLabServiceFabricScheduleServiceFabricSchedulesClientDiagnostics.CreateScope("DevTestLabServiceFabricScheduleResource.AddTag"); + using DiagnosticScope scope = _devTestLabServiceFabricSchedulesClientDiagnostics.CreateScope("DevTestLabServiceFabricScheduleResource.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 = _devTestLabServiceFabricScheduleServiceFabricSchedulesRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Parent.Name, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, null, cancellationToken); - return Response.FromValue(new DevTestLabServiceFabricScheduleResource(Client, originalResponse.Value), originalResponse.GetRawResponse()); + GetTagResource().CreateOrUpdate(WaitUntil.Completed, originalTags.Value.Data, cancellationToken); + RequestContext context = new RequestContext + { + CancellationToken = cancellationToken + }; + HttpMessage message = _devTestLabServiceFabricSchedulesRestClient.CreateGetRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Parent.Name, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, default, context); + Response result = Pipeline.ProcessMessage(message, context); + Response response = Response.FromValue(DevTestLabScheduleData.FromResponse(result), result); + return Response.FromValue(new DevTestLabServiceFabricScheduleResource(Client, response.Value), response.GetRawResponse()); } else { - var current = Get(cancellationToken: cancellationToken).Value.Data; - var patch = new DevTestLabSchedulePatch(); - foreach (var tag in current.Tags) + DevTestLabScheduleData current = Get(cancellationToken: cancellationToken).Value.Data; + DevTestLabSchedulePatch patch = new DevTestLabSchedulePatch(); + 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) @@ -554,54 +594,40 @@ public virtual Response AddTag(string k } } - /// - /// Replace the tags on the resource with the given set. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/users/{userName}/servicefabrics/{serviceFabricName}/schedules/{name} - /// - /// - /// Operation Id - /// ServiceFabricSchedules_Get - /// - /// - /// Default Api Version - /// 2018-09-15 - /// - /// - /// 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 = _devTestLabServiceFabricScheduleServiceFabricSchedulesClientDiagnostics.CreateScope("DevTestLabServiceFabricScheduleResource.SetTags"); + using DiagnosticScope scope = _devTestLabServiceFabricSchedulesClientDiagnostics.CreateScope("DevTestLabServiceFabricScheduleResource.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 _devTestLabServiceFabricScheduleServiceFabricSchedulesRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Parent.Name, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, null, cancellationToken).ConfigureAwait(false); - return Response.FromValue(new DevTestLabServiceFabricScheduleResource(Client, originalResponse.Value), originalResponse.GetRawResponse()); + await GetTagResource().CreateOrUpdateAsync(WaitUntil.Completed, originalTags.Value.Data, cancellationToken).ConfigureAwait(false); + RequestContext context = new RequestContext + { + CancellationToken = cancellationToken + }; + HttpMessage message = _devTestLabServiceFabricSchedulesRestClient.CreateGetRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Parent.Name, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, default, context); + Response result = await Pipeline.ProcessMessageAsync(message, context).ConfigureAwait(false); + Response response = Response.FromValue(DevTestLabScheduleData.FromResponse(result), result); + return Response.FromValue(new DevTestLabServiceFabricScheduleResource(Client, response.Value), response.GetRawResponse()); } else { - var current = (await GetAsync(cancellationToken: cancellationToken).ConfigureAwait(false)).Value.Data; - var patch = new DevTestLabSchedulePatch(); + DevTestLabScheduleData current = (await GetAsync(cancellationToken: cancellationToken).ConfigureAwait(false)).Value.Data; + DevTestLabSchedulePatch patch = new DevTestLabSchedulePatch(); 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) @@ -611,54 +637,40 @@ public virtual async Task> Set } } - /// - /// Replace the tags on the resource with the given set. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/users/{userName}/servicefabrics/{serviceFabricName}/schedules/{name} - /// - /// - /// Operation Id - /// ServiceFabricSchedules_Get - /// - /// - /// Default Api Version - /// 2018-09-15 - /// - /// - /// 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 = _devTestLabServiceFabricScheduleServiceFabricSchedulesClientDiagnostics.CreateScope("DevTestLabServiceFabricScheduleResource.SetTags"); + using DiagnosticScope scope = _devTestLabServiceFabricSchedulesClientDiagnostics.CreateScope("DevTestLabServiceFabricScheduleResource.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 = _devTestLabServiceFabricScheduleServiceFabricSchedulesRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Parent.Name, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, null, cancellationToken); - return Response.FromValue(new DevTestLabServiceFabricScheduleResource(Client, originalResponse.Value), originalResponse.GetRawResponse()); + GetTagResource().CreateOrUpdate(WaitUntil.Completed, originalTags.Value.Data, cancellationToken); + RequestContext context = new RequestContext + { + CancellationToken = cancellationToken + }; + HttpMessage message = _devTestLabServiceFabricSchedulesRestClient.CreateGetRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Parent.Name, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, default, context); + Response result = Pipeline.ProcessMessage(message, context); + Response response = Response.FromValue(DevTestLabScheduleData.FromResponse(result), result); + return Response.FromValue(new DevTestLabServiceFabricScheduleResource(Client, response.Value), response.GetRawResponse()); } else { - var current = Get(cancellationToken: cancellationToken).Value.Data; - var patch = new DevTestLabSchedulePatch(); + DevTestLabScheduleData current = Get(cancellationToken: cancellationToken).Value.Data; + DevTestLabSchedulePatch patch = new DevTestLabSchedulePatch(); 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) @@ -668,27 +680,7 @@ public virtual Response SetTags(IDictio } } - /// - /// Removes a tag by key from the resource. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/users/{userName}/servicefabrics/{serviceFabricName}/schedules/{name} - /// - /// - /// Operation Id - /// ServiceFabricSchedules_Get - /// - /// - /// Default Api Version - /// 2018-09-15 - /// - /// - /// Resource - /// - /// - /// - /// + /// Removes a tag by key from the resource. /// The key for the tag. /// The cancellation token to use. /// is null. @@ -696,29 +688,35 @@ public virtual async Task> Rem { Argument.AssertNotNull(key, nameof(key)); - using var scope = _devTestLabServiceFabricScheduleServiceFabricSchedulesClientDiagnostics.CreateScope("DevTestLabServiceFabricScheduleResource.RemoveTag"); + using DiagnosticScope scope = _devTestLabServiceFabricSchedulesClientDiagnostics.CreateScope("DevTestLabServiceFabricScheduleResource.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 _devTestLabServiceFabricScheduleServiceFabricSchedulesRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Parent.Name, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, null, cancellationToken).ConfigureAwait(false); - return Response.FromValue(new DevTestLabServiceFabricScheduleResource(Client, originalResponse.Value), originalResponse.GetRawResponse()); + await GetTagResource().CreateOrUpdateAsync(WaitUntil.Completed, originalTags.Value.Data, cancellationToken).ConfigureAwait(false); + RequestContext context = new RequestContext + { + CancellationToken = cancellationToken + }; + HttpMessage message = _devTestLabServiceFabricSchedulesRestClient.CreateGetRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Parent.Name, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, default, context); + Response result = await Pipeline.ProcessMessageAsync(message, context).ConfigureAwait(false); + Response response = Response.FromValue(DevTestLabScheduleData.FromResponse(result), result); + return Response.FromValue(new DevTestLabServiceFabricScheduleResource(Client, response.Value), response.GetRawResponse()); } else { - var current = (await GetAsync(cancellationToken: cancellationToken).ConfigureAwait(false)).Value.Data; - var patch = new DevTestLabSchedulePatch(); - foreach (var tag in current.Tags) + DevTestLabScheduleData current = (await GetAsync(cancellationToken: cancellationToken).ConfigureAwait(false)).Value.Data; + DevTestLabSchedulePatch patch = new DevTestLabSchedulePatch(); + 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) @@ -728,27 +726,7 @@ public virtual async Task> Rem } } - /// - /// Removes a tag by key from the resource. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/users/{userName}/servicefabrics/{serviceFabricName}/schedules/{name} - /// - /// - /// Operation Id - /// ServiceFabricSchedules_Get - /// - /// - /// Default Api Version - /// 2018-09-15 - /// - /// - /// Resource - /// - /// - /// - /// + /// Removes a tag by key from the resource. /// The key for the tag. /// The cancellation token to use. /// is null. @@ -756,29 +734,35 @@ public virtual Response RemoveTag(strin { Argument.AssertNotNull(key, nameof(key)); - using var scope = _devTestLabServiceFabricScheduleServiceFabricSchedulesClientDiagnostics.CreateScope("DevTestLabServiceFabricScheduleResource.RemoveTag"); + using DiagnosticScope scope = _devTestLabServiceFabricSchedulesClientDiagnostics.CreateScope("DevTestLabServiceFabricScheduleResource.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 = _devTestLabServiceFabricScheduleServiceFabricSchedulesRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Parent.Name, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, null, cancellationToken); - return Response.FromValue(new DevTestLabServiceFabricScheduleResource(Client, originalResponse.Value), originalResponse.GetRawResponse()); + GetTagResource().CreateOrUpdate(WaitUntil.Completed, originalTags.Value.Data, cancellationToken); + RequestContext context = new RequestContext + { + CancellationToken = cancellationToken + }; + HttpMessage message = _devTestLabServiceFabricSchedulesRestClient.CreateGetRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Parent.Name, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, default, context); + Response result = Pipeline.ProcessMessage(message, context); + Response response = Response.FromValue(DevTestLabScheduleData.FromResponse(result), result); + return Response.FromValue(new DevTestLabServiceFabricScheduleResource(Client, response.Value), response.GetRawResponse()); } else { - var current = Get(cancellationToken: cancellationToken).Value.Data; - var patch = new DevTestLabSchedulePatch(); - foreach (var tag in current.Tags) + DevTestLabScheduleData current = Get(cancellationToken: cancellationToken).Value.Data; + DevTestLabSchedulePatch patch = new DevTestLabSchedulePatch(); + 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) diff --git a/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/DevTestLabServiceRunnerCollection.cs b/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/DevTestLabServiceRunnerCollection.cs index b1792602ed78..472594ec7ff8 100644 --- a/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/DevTestLabServiceRunnerCollection.cs +++ b/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/DevTestLabServiceRunnerCollection.cs @@ -6,11 +6,13 @@ #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.DevTestLabs { @@ -21,51 +23,49 @@ namespace Azure.ResourceManager.DevTestLabs /// public partial class DevTestLabServiceRunnerCollection : ArmCollection { - private readonly ClientDiagnostics _devTestLabServiceRunnerServiceRunnersClientDiagnostics; - private readonly ServiceRunnersRestOperations _devTestLabServiceRunnerServiceRunnersRestClient; + private readonly ClientDiagnostics _serviceRunnersClientDiagnostics; + private readonly ServiceRunners _serviceRunnersRestClient; - /// Initializes a new instance of the class for mocking. + /// Initializes a new instance of DevTestLabServiceRunnerCollection for mocking. protected DevTestLabServiceRunnerCollection() { } - /// 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 DevTestLabServiceRunnerCollection(ArmClient client, ResourceIdentifier id) : base(client, id) { - _devTestLabServiceRunnerServiceRunnersClientDiagnostics = new ClientDiagnostics("Azure.ResourceManager.DevTestLabs", DevTestLabServiceRunnerResource.ResourceType.Namespace, Diagnostics); - TryGetApiVersion(DevTestLabServiceRunnerResource.ResourceType, out string devTestLabServiceRunnerServiceRunnersApiVersion); - _devTestLabServiceRunnerServiceRunnersRestClient = new ServiceRunnersRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, devTestLabServiceRunnerServiceRunnersApiVersion); -#if DEBUG - ValidateResourceId(Id); -#endif + TryGetApiVersion(DevTestLabServiceRunnerResource.ResourceType, out string devTestLabServiceRunnerApiVersion); + _serviceRunnersClientDiagnostics = new ClientDiagnostics("Azure.ResourceManager.DevTestLabs", DevTestLabServiceRunnerResource.ResourceType.Namespace, Diagnostics); + _serviceRunnersRestClient = new ServiceRunners(_serviceRunnersClientDiagnostics, Pipeline, Endpoint, devTestLabServiceRunnerApiVersion ?? "2018-09-15"); + ValidateResourceId(id); } + /// + [Conditional("DEBUG")] internal static void ValidateResourceId(ResourceIdentifier id) { if (id.ResourceType != DevTestLabResource.ResourceType) - throw new ArgumentException(string.Format(CultureInfo.CurrentCulture, "Invalid resource type {0} expected {1}", id.ResourceType, DevTestLabResource.ResourceType), nameof(id)); + { + throw new ArgumentException(string.Format("Invalid resource type {0} expected {1}", id.ResourceType, DevTestLabResource.ResourceType), id); + } } /// /// Create or replace an existing service runner. /// /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/servicerunners/{name} + /// Request Path. + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/servicerunners/{name}. /// /// - /// Operation Id - /// ServiceRunners_CreateOrUpdate + /// Operation Id. + /// ServiceRunners_CreateOrUpdate. /// /// - /// Default Api Version - /// 2018-09-15 - /// - /// - /// Resource - /// + /// Default Api Version. + /// 2018-09-15. /// /// /// @@ -73,23 +73,31 @@ internal static void ValidateResourceId(ResourceIdentifier id) /// The name of the service runner. /// A container for a managed identity to execute DevTest lab services. /// 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 name, DevTestLabServiceRunnerData data, CancellationToken cancellationToken = default) { Argument.AssertNotNullOrEmpty(name, nameof(name)); Argument.AssertNotNull(data, nameof(data)); - using var scope = _devTestLabServiceRunnerServiceRunnersClientDiagnostics.CreateScope("DevTestLabServiceRunnerCollection.CreateOrUpdate"); + using DiagnosticScope scope = _serviceRunnersClientDiagnostics.CreateScope("DevTestLabServiceRunnerCollection.CreateOrUpdate"); scope.Start(); try { - var response = await _devTestLabServiceRunnerServiceRunnersRestClient.CreateOrUpdateAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, name, data, cancellationToken).ConfigureAwait(false); - var uri = _devTestLabServiceRunnerServiceRunnersRestClient.CreateCreateOrUpdateRequestUri(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, name, data); - var rehydrationToken = NextLinkOperationImplementation.GetRehydrationToken(RequestMethod.Put, uri.ToUri(), uri.ToString(), "None", null, OperationFinalStateVia.OriginalUri.ToString()); - var operation = new DevTestLabsArmOperation(Response.FromValue(new DevTestLabServiceRunnerResource(Client, response), response.GetRawResponse()), rehydrationToken); + RequestContext context = new RequestContext + { + CancellationToken = cancellationToken + }; + HttpMessage message = _serviceRunnersRestClient.CreateCreateOrUpdateRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, name, DevTestLabServiceRunnerData.ToRequestContent(data), context); + Response result = await Pipeline.ProcessMessageAsync(message, context).ConfigureAwait(false); + Response response = Response.FromValue(DevTestLabServiceRunnerData.FromResponse(result), result); + RequestUriBuilder uri = message.Request.Uri; + RehydrationToken rehydrationToken = NextLinkOperationImplementation.GetRehydrationToken(RequestMethod.Put, uri.ToUri(), uri.ToString(), "None", null, OperationFinalStateVia.OriginalUri.ToString()); + DevTestLabsArmOperation operation = new DevTestLabsArmOperation(Response.FromValue(new DevTestLabServiceRunnerResource(Client, response.Value), response.GetRawResponse()), rehydrationToken); if (waitUntil == WaitUntil.Completed) + { await operation.WaitForCompletionAsync(cancellationToken).ConfigureAwait(false); + } return operation; } catch (Exception e) @@ -103,20 +111,16 @@ public virtual async Task> CreateO /// Create or replace an existing service runner. /// /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/servicerunners/{name} - /// - /// - /// Operation Id - /// ServiceRunners_CreateOrUpdate + /// Request Path. + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/servicerunners/{name}. /// /// - /// Default Api Version - /// 2018-09-15 + /// Operation Id. + /// ServiceRunners_CreateOrUpdate. /// /// - /// Resource - /// + /// Default Api Version. + /// 2018-09-15. /// /// /// @@ -124,23 +128,31 @@ public virtual async Task> CreateO /// The name of the service runner. /// A container for a managed identity to execute DevTest lab services. /// 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 name, DevTestLabServiceRunnerData data, CancellationToken cancellationToken = default) { Argument.AssertNotNullOrEmpty(name, nameof(name)); Argument.AssertNotNull(data, nameof(data)); - using var scope = _devTestLabServiceRunnerServiceRunnersClientDiagnostics.CreateScope("DevTestLabServiceRunnerCollection.CreateOrUpdate"); + using DiagnosticScope scope = _serviceRunnersClientDiagnostics.CreateScope("DevTestLabServiceRunnerCollection.CreateOrUpdate"); scope.Start(); try { - var response = _devTestLabServiceRunnerServiceRunnersRestClient.CreateOrUpdate(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, name, data, cancellationToken); - var uri = _devTestLabServiceRunnerServiceRunnersRestClient.CreateCreateOrUpdateRequestUri(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, name, data); - var rehydrationToken = NextLinkOperationImplementation.GetRehydrationToken(RequestMethod.Put, uri.ToUri(), uri.ToString(), "None", null, OperationFinalStateVia.OriginalUri.ToString()); - var operation = new DevTestLabsArmOperation(Response.FromValue(new DevTestLabServiceRunnerResource(Client, response), response.GetRawResponse()), rehydrationToken); + RequestContext context = new RequestContext + { + CancellationToken = cancellationToken + }; + HttpMessage message = _serviceRunnersRestClient.CreateCreateOrUpdateRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, name, DevTestLabServiceRunnerData.ToRequestContent(data), context); + Response result = Pipeline.ProcessMessage(message, context); + Response response = Response.FromValue(DevTestLabServiceRunnerData.FromResponse(result), result); + RequestUriBuilder uri = message.Request.Uri; + RehydrationToken rehydrationToken = NextLinkOperationImplementation.GetRehydrationToken(RequestMethod.Put, uri.ToUri(), uri.ToString(), "None", null, OperationFinalStateVia.OriginalUri.ToString()); + DevTestLabsArmOperation operation = new DevTestLabsArmOperation(Response.FromValue(new DevTestLabServiceRunnerResource(Client, response.Value), response.GetRawResponse()), rehydrationToken); if (waitUntil == WaitUntil.Completed) + { operation.WaitForCompletion(cancellationToken); + } return operation; } catch (Exception e) @@ -154,38 +166,42 @@ public virtual ArmOperation CreateOrUpdate(Wait /// Get service runner. /// /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/servicerunners/{name} - /// - /// - /// Operation Id - /// ServiceRunners_Get + /// Request Path. + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/servicerunners/{name}. /// /// - /// Default Api Version - /// 2018-09-15 + /// Operation Id. + /// ServiceRunners_Get. /// /// - /// Resource - /// + /// Default Api Version. + /// 2018-09-15. /// /// /// /// The name of the service runner. /// 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 name, CancellationToken cancellationToken = default) { Argument.AssertNotNullOrEmpty(name, nameof(name)); - using var scope = _devTestLabServiceRunnerServiceRunnersClientDiagnostics.CreateScope("DevTestLabServiceRunnerCollection.Get"); + using DiagnosticScope scope = _serviceRunnersClientDiagnostics.CreateScope("DevTestLabServiceRunnerCollection.Get"); scope.Start(); try { - var response = await _devTestLabServiceRunnerServiceRunnersRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, name, cancellationToken).ConfigureAwait(false); + RequestContext context = new RequestContext + { + CancellationToken = cancellationToken + }; + HttpMessage message = _serviceRunnersRestClient.CreateGetRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, name, context); + Response result = await Pipeline.ProcessMessageAsync(message, context).ConfigureAwait(false); + Response response = Response.FromValue(DevTestLabServiceRunnerData.FromResponse(result), result); if (response.Value == null) + { throw new RequestFailedException(response.GetRawResponse()); + } return Response.FromValue(new DevTestLabServiceRunnerResource(Client, response.Value), response.GetRawResponse()); } catch (Exception e) @@ -199,38 +215,42 @@ public virtual async Task> GetAsync(st /// Get service runner. /// /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/servicerunners/{name} - /// - /// - /// Operation Id - /// ServiceRunners_Get + /// Request Path. + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/servicerunners/{name}. /// /// - /// Default Api Version - /// 2018-09-15 + /// Operation Id. + /// ServiceRunners_Get. /// /// - /// Resource - /// + /// Default Api Version. + /// 2018-09-15. /// /// /// /// The name of the service runner. /// 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 name, CancellationToken cancellationToken = default) { Argument.AssertNotNullOrEmpty(name, nameof(name)); - using var scope = _devTestLabServiceRunnerServiceRunnersClientDiagnostics.CreateScope("DevTestLabServiceRunnerCollection.Get"); + using DiagnosticScope scope = _serviceRunnersClientDiagnostics.CreateScope("DevTestLabServiceRunnerCollection.Get"); scope.Start(); try { - var response = _devTestLabServiceRunnerServiceRunnersRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, name, cancellationToken); + RequestContext context = new RequestContext + { + CancellationToken = cancellationToken + }; + HttpMessage message = _serviceRunnersRestClient.CreateGetRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, name, context); + Response result = Pipeline.ProcessMessage(message, context); + Response response = Response.FromValue(DevTestLabServiceRunnerData.FromResponse(result), result); if (response.Value == null) + { throw new RequestFailedException(response.GetRawResponse()); + } return Response.FromValue(new DevTestLabServiceRunnerResource(Client, response.Value), response.GetRawResponse()); } catch (Exception e) @@ -244,36 +264,50 @@ public virtual Response Get(string name, Cancel /// Checks to see if the resource exists in azure. /// /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/servicerunners/{name} - /// - /// - /// Operation Id - /// ServiceRunners_Get + /// Request Path. + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/servicerunners/{name}. /// /// - /// Default Api Version - /// 2018-09-15 + /// Operation Id. + /// ServiceRunners_Get. /// /// - /// Resource - /// + /// Default Api Version. + /// 2018-09-15. /// /// /// /// The name of the service runner. /// 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 name, CancellationToken cancellationToken = default) { Argument.AssertNotNullOrEmpty(name, nameof(name)); - using var scope = _devTestLabServiceRunnerServiceRunnersClientDiagnostics.CreateScope("DevTestLabServiceRunnerCollection.Exists"); + using DiagnosticScope scope = _serviceRunnersClientDiagnostics.CreateScope("DevTestLabServiceRunnerCollection.Exists"); scope.Start(); try { - var response = await _devTestLabServiceRunnerServiceRunnersRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, name, cancellationToken: cancellationToken).ConfigureAwait(false); + RequestContext context = new RequestContext + { + CancellationToken = cancellationToken + }; + HttpMessage message = _serviceRunnersRestClient.CreateGetRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, name, context); + await Pipeline.SendAsync(message, context.CancellationToken).ConfigureAwait(false); + Response result = message.Response; + Response response = default; + switch (result.Status) + { + case 200: + response = Response.FromValue(DevTestLabServiceRunnerData.FromResponse(result), result); + break; + case 404: + response = Response.FromValue((DevTestLabServiceRunnerData)null, result); + break; + default: + throw new RequestFailedException(result); + } return Response.FromValue(response.Value != null, response.GetRawResponse()); } catch (Exception e) @@ -287,36 +321,50 @@ public virtual async Task> ExistsAsync(string name, CancellationT /// Checks to see if the resource exists in azure. /// /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/servicerunners/{name} + /// Request Path. + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/servicerunners/{name}. /// /// - /// Operation Id - /// ServiceRunners_Get + /// Operation Id. + /// ServiceRunners_Get. /// /// - /// Default Api Version - /// 2018-09-15 - /// - /// - /// Resource - /// + /// Default Api Version. + /// 2018-09-15. /// /// /// /// The name of the service runner. /// 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 name, CancellationToken cancellationToken = default) { Argument.AssertNotNullOrEmpty(name, nameof(name)); - using var scope = _devTestLabServiceRunnerServiceRunnersClientDiagnostics.CreateScope("DevTestLabServiceRunnerCollection.Exists"); + using DiagnosticScope scope = _serviceRunnersClientDiagnostics.CreateScope("DevTestLabServiceRunnerCollection.Exists"); scope.Start(); try { - var response = _devTestLabServiceRunnerServiceRunnersRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, name, cancellationToken: cancellationToken); + RequestContext context = new RequestContext + { + CancellationToken = cancellationToken + }; + HttpMessage message = _serviceRunnersRestClient.CreateGetRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, name, context); + Pipeline.Send(message, context.CancellationToken); + Response result = message.Response; + Response response = default; + switch (result.Status) + { + case 200: + response = Response.FromValue(DevTestLabServiceRunnerData.FromResponse(result), result); + break; + case 404: + response = Response.FromValue((DevTestLabServiceRunnerData)null, result); + break; + default: + throw new RequestFailedException(result); + } return Response.FromValue(response.Value != null, response.GetRawResponse()); } catch (Exception e) @@ -330,38 +378,54 @@ public virtual Response Exists(string name, CancellationToken cancellation /// Tries to get details for this resource from the service. /// /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/servicerunners/{name} + /// Request Path. + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/servicerunners/{name}. /// /// - /// Operation Id - /// ServiceRunners_Get + /// Operation Id. + /// ServiceRunners_Get. /// /// - /// Default Api Version - /// 2018-09-15 - /// - /// - /// Resource - /// + /// Default Api Version. + /// 2018-09-15. /// /// /// /// The name of the service runner. /// 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 name, CancellationToken cancellationToken = default) { Argument.AssertNotNullOrEmpty(name, nameof(name)); - using var scope = _devTestLabServiceRunnerServiceRunnersClientDiagnostics.CreateScope("DevTestLabServiceRunnerCollection.GetIfExists"); + using DiagnosticScope scope = _serviceRunnersClientDiagnostics.CreateScope("DevTestLabServiceRunnerCollection.GetIfExists"); scope.Start(); try { - var response = await _devTestLabServiceRunnerServiceRunnersRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, name, cancellationToken: cancellationToken).ConfigureAwait(false); + RequestContext context = new RequestContext + { + CancellationToken = cancellationToken + }; + HttpMessage message = _serviceRunnersRestClient.CreateGetRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, name, context); + await Pipeline.SendAsync(message, context.CancellationToken).ConfigureAwait(false); + Response result = message.Response; + Response response = default; + switch (result.Status) + { + case 200: + response = Response.FromValue(DevTestLabServiceRunnerData.FromResponse(result), result); + break; + case 404: + response = Response.FromValue((DevTestLabServiceRunnerData)null, result); + break; + default: + throw new RequestFailedException(result); + } if (response.Value == null) + { return new NoValueResponse(response.GetRawResponse()); + } return Response.FromValue(new DevTestLabServiceRunnerResource(Client, response.Value), response.GetRawResponse()); } catch (Exception e) @@ -375,38 +439,54 @@ public virtual async Task> Get /// Tries to get details for this resource from the service. /// /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/servicerunners/{name} + /// Request Path. + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/servicerunners/{name}. /// /// - /// Operation Id - /// ServiceRunners_Get + /// Operation Id. + /// ServiceRunners_Get. /// /// - /// Default Api Version - /// 2018-09-15 - /// - /// - /// Resource - /// + /// Default Api Version. + /// 2018-09-15. /// /// /// /// The name of the service runner. /// 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 name, CancellationToken cancellationToken = default) { Argument.AssertNotNullOrEmpty(name, nameof(name)); - using var scope = _devTestLabServiceRunnerServiceRunnersClientDiagnostics.CreateScope("DevTestLabServiceRunnerCollection.GetIfExists"); + using DiagnosticScope scope = _serviceRunnersClientDiagnostics.CreateScope("DevTestLabServiceRunnerCollection.GetIfExists"); scope.Start(); try { - var response = _devTestLabServiceRunnerServiceRunnersRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, name, cancellationToken: cancellationToken); + RequestContext context = new RequestContext + { + CancellationToken = cancellationToken + }; + HttpMessage message = _serviceRunnersRestClient.CreateGetRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, name, context); + Pipeline.Send(message, context.CancellationToken); + Response result = message.Response; + Response response = default; + switch (result.Status) + { + case 200: + response = Response.FromValue(DevTestLabServiceRunnerData.FromResponse(result), result); + break; + case 404: + response = Response.FromValue((DevTestLabServiceRunnerData)null, result); + break; + default: + throw new RequestFailedException(result); + } if (response.Value == null) + { return new NoValueResponse(response.GetRawResponse()); + } return Response.FromValue(new DevTestLabServiceRunnerResource(Client, response.Value), response.GetRawResponse()); } catch (Exception e) diff --git a/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/DevTestLabServiceRunnerData.Serialization.cs b/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/DevTestLabServiceRunnerData.Serialization.cs index a74f486d133a..e793fd1c504d 100644 --- a/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/DevTestLabServiceRunnerData.Serialization.cs +++ b/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/DevTestLabServiceRunnerData.Serialization.cs @@ -10,16 +10,47 @@ using System.Collections.Generic; using System.Text; using System.Text.Json; +using Azure; using Azure.Core; using Azure.ResourceManager.DevTestLabs.Models; using Azure.ResourceManager.Models; namespace Azure.ResourceManager.DevTestLabs { - public partial class DevTestLabServiceRunnerData : IUtf8JsonSerializable, IJsonModel + /// A container for a managed identity to execute DevTest lab services. + public partial class DevTestLabServiceRunnerData : TrackedResourceData, IJsonModel { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + /// Initializes a new instance of for deserialization. + internal DevTestLabServiceRunnerData() + { + } + /// 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)) + { + return DeserializeDevTestLabServiceRunnerData(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(DevTestLabServiceRunnerData)} does not support reading '{options.Format}' format."); + } + } + + /// The to deserialize the from. + internal static DevTestLabServiceRunnerData FromResponse(Response response) + { + using JsonDocument document = JsonDocument.Parse(response.Content, ModelSerializationExtensions.JsonDocumentOptions); + return DeserializeDevTestLabServiceRunnerData(document.RootElement, ModelSerializationExtensions.WireOptions); + } + + /// The JSON writer. + /// The client options for reading and writing models. void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) { writer.WriteStartObject(); @@ -31,13 +62,28 @@ void IJsonModel.Write(Utf8JsonWriter writer, ModelR /// 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(DevTestLabServiceRunnerData)} does not support writing '{format}' format."); } - base.JsonModelWriteCore(writer, options); + if (Optional.IsCollectionDefined(Tags)) + { + writer.WritePropertyName("tags"u8); + writer.WriteStartObject(); + foreach (var item in Tags) + { + writer.WritePropertyName(item.Key); + if (item.Value == null) + { + writer.WriteNullValue(); + continue; + } + writer.WriteStringValue(item.Value); + } + writer.WriteEndObject(); + } if (Optional.IsDefined(Identity)) { writer.WritePropertyName("identity"u8); @@ -45,110 +91,131 @@ protected override void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWri } } - DevTestLabServiceRunnerData IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + /// The JSON reader. + /// The client options for reading and writing models. + DevTestLabServiceRunnerData IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) => (DevTestLabServiceRunnerData)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(DevTestLabServiceRunnerData)} does not support reading '{format}' format."); } - using JsonDocument document = JsonDocument.ParseValue(ref reader); return DeserializeDevTestLabServiceRunnerData(document.RootElement, options); } - internal static DevTestLabServiceRunnerData DeserializeDevTestLabServiceRunnerData(JsonElement element, ModelReaderWriterOptions options = null) + /// The JSON element to deserialize. + /// The client options for reading and writing models. + internal static DevTestLabServiceRunnerData DeserializeDevTestLabServiceRunnerData(JsonElement element, ModelReaderWriterOptions options) { - options ??= ModelSerializationExtensions.WireOptions; - if (element.ValueKind == JsonValueKind.Null) { return null; } - DevTestLabManagedIdentity identity = 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(); + AzureLocation location = default; + IDictionary tags = default; + DevTestLabManagedIdentity identity = default; + foreach (var prop in element.EnumerateObject()) { - if (property.NameEquals("identity"u8)) + if (prop.NameEquals("id"u8)) { - if (property.Value.ValueKind == JsonValueKind.Null) + if (prop.Value.ValueKind == JsonValueKind.Null) { continue; } - identity = DevTestLabManagedIdentity.DeserializeDevTestLabManagedIdentity(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, AzureResourceManagerDevTestLabsContext.Default); continue; } - if (property.NameEquals("name"u8)) + if (prop.NameEquals("location"u8)) { - name = property.Value.GetString(); + location = new AzureLocation(prop.Value.GetString()); continue; } - if (property.NameEquals("type"u8)) + if (prop.NameEquals("tags"u8)) { - type = new ResourceType(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("systemData"u8)) + if (prop.NameEquals("identity"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, AzureResourceManagerDevTestLabsContext.Default); + identity = DevTestLabManagedIdentity.DeserializeDevTestLabManagedIdentity(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 DevTestLabServiceRunnerData( id, name, - type, + resourceType, systemData, - tags ?? new ChangeTrackingDictionary(), + additionalBinaryDataProperties, location, - identity, - serializedAdditionalRawData); + tags ?? new ChangeTrackingDictionary(), + identity); } - 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,22 +225,23 @@ BinaryData IPersistableModel.Write(ModelReaderWrite } } - DevTestLabServiceRunnerData 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. + DevTestLabServiceRunnerData IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) => (DevTestLabServiceRunnerData)PersistableModelCreateCore(data, options); - switch (format) + /// The client options for reading and writing models. + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + + /// The to serialize into . + internal static RequestContent ToRequestContent(DevTestLabServiceRunnerData devTestLabServiceRunnerData) + { + if (devTestLabServiceRunnerData == null) { - case "J": - { - using JsonDocument document = JsonDocument.Parse(data, ModelSerializationExtensions.JsonDocumentOptions); - return DeserializeDevTestLabServiceRunnerData(document.RootElement, options); - } - default: - throw new FormatException($"The model {nameof(DevTestLabServiceRunnerData)} does not support reading '{options.Format}' format."); + return null; } + Utf8JsonRequestContent content = new Utf8JsonRequestContent(); + content.JsonWriter.WriteObjectValue(devTestLabServiceRunnerData, ModelSerializationExtensions.WireOptions); + return content; } - - string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; } } diff --git a/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/DevTestLabServiceRunnerData.cs b/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/DevTestLabServiceRunnerData.cs index bfa4d8fcca1f..e39bbcd04b9b 100644 --- a/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/DevTestLabServiceRunnerData.cs +++ b/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/DevTestLabServiceRunnerData.cs @@ -13,68 +13,31 @@ namespace Azure.ResourceManager.DevTestLabs { - /// - /// A class representing the DevTestLabServiceRunner data model. - /// A container for a managed identity to execute DevTest lab services. - /// + /// A container for a managed identity to execute DevTest lab services. public partial class DevTestLabServiceRunnerData : 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 DevTestLabServiceRunnerData(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. + /// The geo-location where the resource lives. + /// Resource tags. /// The identity of the resource. - /// Keeps track of any properties unknown to the library. - internal DevTestLabServiceRunnerData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, IDictionary tags, AzureLocation location, DevTestLabManagedIdentity identity, IDictionary serializedAdditionalRawData) : base(id, name, resourceType, systemData, tags, location) + internal DevTestLabServiceRunnerData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, IDictionary additionalBinaryDataProperties, AzureLocation location, IDictionary tags, DevTestLabManagedIdentity identity) : base(id, name, resourceType, systemData, tags, location) { + _additionalBinaryDataProperties = additionalBinaryDataProperties; Identity = identity; - _serializedAdditionalRawData = serializedAdditionalRawData; - } - - /// Initializes a new instance of for deserialization. - internal DevTestLabServiceRunnerData() - { } /// The identity of the resource. diff --git a/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/DevTestLabServiceRunnerResource.Serialization.cs b/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/DevTestLabServiceRunnerResource.Serialization.cs index de4a757fa61a..5c7a90d900c5 100644 --- a/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/DevTestLabServiceRunnerResource.Serialization.cs +++ b/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/DevTestLabServiceRunnerResource.Serialization.cs @@ -11,19 +11,29 @@ namespace Azure.ResourceManager.DevTestLabs { + /// public partial class DevTestLabServiceRunnerResource : IJsonModel { - private static DevTestLabServiceRunnerData s_dataDeserializationInstance; - private static DevTestLabServiceRunnerData DataDeserializationInstance => s_dataDeserializationInstance ??= new(); + private static IJsonModel s_dataDeserializationInstance; + private static IJsonModel DataDeserializationInstance => s_dataDeserializationInstance ??= new DevTestLabServiceRunnerData(); + + /// 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); - DevTestLabServiceRunnerData 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. + DevTestLabServiceRunnerData 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, AzureResourceManagerDevTestLabsContext.Default); + /// The binary data to be processed. + /// The client options for reading and writing models. DevTestLabServiceRunnerData IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) => ModelReaderWriter.Read(data, options, AzureResourceManagerDevTestLabsContext.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/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/DevTestLabServiceRunnerResource.cs b/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/DevTestLabServiceRunnerResource.cs index 2f885733af6a..485ac5fac7d7 100644 --- a/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/DevTestLabServiceRunnerResource.cs +++ b/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/DevTestLabServiceRunnerResource.cs @@ -7,46 +7,36 @@ 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; namespace Azure.ResourceManager.DevTestLabs { /// - /// A Class representing a DevTestLabServiceRunner 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 GetDevTestLabServiceRunnerResource method. - /// Otherwise you can get one from its parent resource using the GetDevTestLabServiceRunner method. + /// A class representing a DevTestLabServiceRunner 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 GetDevTestLabServiceRunners method. /// public partial class DevTestLabServiceRunnerResource : ArmResource { - /// Generate the resource identifier of a instance. - /// The subscriptionId. - /// The resourceGroupName. - /// The labName. - /// The name. - public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string labName, string name) - { - var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/servicerunners/{name}"; - return new ResourceIdentifier(resourceId); - } - - private readonly ClientDiagnostics _devTestLabServiceRunnerServiceRunnersClientDiagnostics; - private readonly ServiceRunnersRestOperations _devTestLabServiceRunnerServiceRunnersRestClient; + private readonly ClientDiagnostics _serviceRunnersClientDiagnostics; + private readonly ServiceRunners _serviceRunnersRestClient; private readonly DevTestLabServiceRunnerData _data; - /// Gets the resource type for the operations. public static readonly ResourceType ResourceType = "Microsoft.DevTestLab/labs/servicerunners"; - /// Initializes a new instance of the class for mocking. + /// Initializes a new instance of DevTestLabServiceRunnerResource for mocking. protected DevTestLabServiceRunnerResource() { } - /// 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 DevTestLabServiceRunnerResource(ArmClient client, DevTestLabServiceRunnerData data) : this(client, data.Id) @@ -55,71 +45,93 @@ internal DevTestLabServiceRunnerResource(ArmClient client, DevTestLabServiceRunn _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 DevTestLabServiceRunnerResource(ArmClient client, ResourceIdentifier id) : base(client, id) { - _devTestLabServiceRunnerServiceRunnersClientDiagnostics = new ClientDiagnostics("Azure.ResourceManager.DevTestLabs", ResourceType.Namespace, Diagnostics); - TryGetApiVersion(ResourceType, out string devTestLabServiceRunnerServiceRunnersApiVersion); - _devTestLabServiceRunnerServiceRunnersRestClient = new ServiceRunnersRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, devTestLabServiceRunnerServiceRunnersApiVersion); -#if DEBUG - ValidateResourceId(Id); -#endif + TryGetApiVersion(ResourceType, out string devTestLabServiceRunnerApiVersion); + _serviceRunnersClientDiagnostics = new ClientDiagnostics("Azure.ResourceManager.DevTestLabs", ResourceType.Namespace, Diagnostics); + _serviceRunnersRestClient = new ServiceRunners(_serviceRunnersClientDiagnostics, Pipeline, Endpoint, devTestLabServiceRunnerApiVersion ?? "2018-09-15"); + 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 DevTestLabServiceRunnerData 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 labName. + /// The name. + public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string labName, string name) + { + string resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/servicerunners/{name}"; + 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 service runner. /// /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/servicerunners/{name} + /// Request Path. + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/servicerunners/{name}. /// /// - /// Operation Id - /// ServiceRunners_Get + /// Operation Id. + /// ServiceRunners_Get. /// /// - /// Default Api Version - /// 2018-09-15 + /// Default Api Version. + /// 2018-09-15. /// /// - /// Resource - /// + /// Resource. + /// . /// /// /// /// The cancellation token to use. public virtual async Task> GetAsync(CancellationToken cancellationToken = default) { - using var scope = _devTestLabServiceRunnerServiceRunnersClientDiagnostics.CreateScope("DevTestLabServiceRunnerResource.Get"); + using DiagnosticScope scope = _serviceRunnersClientDiagnostics.CreateScope("DevTestLabServiceRunnerResource.Get"); scope.Start(); try { - var response = await _devTestLabServiceRunnerServiceRunnersRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, cancellationToken).ConfigureAwait(false); + RequestContext context = new RequestContext + { + CancellationToken = cancellationToken + }; + HttpMessage message = _serviceRunnersRestClient.CreateGetRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, context); + Response result = await Pipeline.ProcessMessageAsync(message, context).ConfigureAwait(false); + Response response = Response.FromValue(DevTestLabServiceRunnerData.FromResponse(result), result); if (response.Value == null) + { throw new RequestFailedException(response.GetRawResponse()); + } return Response.FromValue(new DevTestLabServiceRunnerResource(Client, response.Value), response.GetRawResponse()); } catch (Exception e) @@ -133,33 +145,41 @@ public virtual async Task> GetAsync(Ca /// Get service runner. /// /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/servicerunners/{name} + /// Request Path. + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/servicerunners/{name}. /// /// - /// Operation Id - /// ServiceRunners_Get + /// Operation Id. + /// ServiceRunners_Get. /// /// - /// Default Api Version - /// 2018-09-15 + /// Default Api Version. + /// 2018-09-15. /// /// - /// Resource - /// + /// Resource. + /// . /// /// /// /// The cancellation token to use. public virtual Response Get(CancellationToken cancellationToken = default) { - using var scope = _devTestLabServiceRunnerServiceRunnersClientDiagnostics.CreateScope("DevTestLabServiceRunnerResource.Get"); + using DiagnosticScope scope = _serviceRunnersClientDiagnostics.CreateScope("DevTestLabServiceRunnerResource.Get"); scope.Start(); try { - var response = _devTestLabServiceRunnerServiceRunnersRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, cancellationToken); + RequestContext context = new RequestContext + { + CancellationToken = cancellationToken + }; + HttpMessage message = _serviceRunnersRestClient.CreateGetRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, context); + Response result = Pipeline.ProcessMessage(message, context); + Response response = Response.FromValue(DevTestLabServiceRunnerData.FromResponse(result), result); if (response.Value == null) + { throw new RequestFailedException(response.GetRawResponse()); + } return Response.FromValue(new DevTestLabServiceRunnerResource(Client, response.Value), response.GetRawResponse()); } catch (Exception e) @@ -173,20 +193,20 @@ public virtual Response Get(CancellationToken c /// Delete service runner. /// /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/servicerunners/{name} + /// Request Path. + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/servicerunners/{name}. /// /// - /// Operation Id - /// ServiceRunners_Delete + /// Operation Id. + /// ServiceRunners_Delete. /// /// - /// Default Api Version - /// 2018-09-15 + /// Default Api Version. + /// 2018-09-15. /// /// - /// Resource - /// + /// Resource. + /// . /// /// /// @@ -194,16 +214,23 @@ public virtual Response Get(CancellationToken c /// The cancellation token to use. public virtual async Task DeleteAsync(WaitUntil waitUntil, CancellationToken cancellationToken = default) { - using var scope = _devTestLabServiceRunnerServiceRunnersClientDiagnostics.CreateScope("DevTestLabServiceRunnerResource.Delete"); + using DiagnosticScope scope = _serviceRunnersClientDiagnostics.CreateScope("DevTestLabServiceRunnerResource.Delete"); scope.Start(); try { - var response = await _devTestLabServiceRunnerServiceRunnersRestClient.DeleteAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, cancellationToken).ConfigureAwait(false); - var uri = _devTestLabServiceRunnerServiceRunnersRestClient.CreateDeleteRequestUri(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name); - var rehydrationToken = NextLinkOperationImplementation.GetRehydrationToken(RequestMethod.Delete, uri.ToUri(), uri.ToString(), "None", null, OperationFinalStateVia.OriginalUri.ToString()); - var operation = new DevTestLabsArmOperation(response, rehydrationToken); + RequestContext context = new RequestContext + { + CancellationToken = cancellationToken + }; + HttpMessage message = _serviceRunnersRestClient.CreateDeleteRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, context); + Response response = await Pipeline.ProcessMessageAsync(message, context).ConfigureAwait(false); + RequestUriBuilder uri = message.Request.Uri; + RehydrationToken rehydrationToken = NextLinkOperationImplementation.GetRehydrationToken(RequestMethod.Delete, uri.ToUri(), uri.ToString(), "None", null, OperationFinalStateVia.OriginalUri.ToString()); + DevTestLabsArmOperation operation = new DevTestLabsArmOperation(response, rehydrationToken); if (waitUntil == WaitUntil.Completed) + { await operation.WaitForCompletionResponseAsync(cancellationToken).ConfigureAwait(false); + } return operation; } catch (Exception e) @@ -217,20 +244,20 @@ public virtual async Task DeleteAsync(WaitUntil waitUntil, Cancell /// Delete service runner. /// /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/servicerunners/{name} + /// Request Path. + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/servicerunners/{name}. /// /// - /// Operation Id - /// ServiceRunners_Delete + /// Operation Id. + /// ServiceRunners_Delete. /// /// - /// Default Api Version - /// 2018-09-15 + /// Default Api Version. + /// 2018-09-15. /// /// - /// Resource - /// + /// Resource. + /// . /// /// /// @@ -238,16 +265,23 @@ 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 = _devTestLabServiceRunnerServiceRunnersClientDiagnostics.CreateScope("DevTestLabServiceRunnerResource.Delete"); + using DiagnosticScope scope = _serviceRunnersClientDiagnostics.CreateScope("DevTestLabServiceRunnerResource.Delete"); scope.Start(); try { - var response = _devTestLabServiceRunnerServiceRunnersRestClient.Delete(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, cancellationToken); - var uri = _devTestLabServiceRunnerServiceRunnersRestClient.CreateDeleteRequestUri(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name); - var rehydrationToken = NextLinkOperationImplementation.GetRehydrationToken(RequestMethod.Delete, uri.ToUri(), uri.ToString(), "None", null, OperationFinalStateVia.OriginalUri.ToString()); - var operation = new DevTestLabsArmOperation(response, rehydrationToken); + RequestContext context = new RequestContext + { + CancellationToken = cancellationToken + }; + HttpMessage message = _serviceRunnersRestClient.CreateDeleteRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, context); + Response response = Pipeline.ProcessMessage(message, context); + RequestUriBuilder uri = message.Request.Uri; + RehydrationToken rehydrationToken = NextLinkOperationImplementation.GetRehydrationToken(RequestMethod.Delete, uri.ToUri(), uri.ToString(), "None", null, OperationFinalStateVia.OriginalUri.ToString()); + DevTestLabsArmOperation operation = new DevTestLabsArmOperation(response, rehydrationToken); if (waitUntil == WaitUntil.Completed) + { operation.WaitForCompletionResponse(cancellationToken); + } return operation; } catch (Exception e) @@ -258,23 +292,23 @@ public virtual ArmOperation Delete(WaitUntil waitUntil, CancellationToken cancel } /// - /// Create or replace an existing service runner. + /// Update a DevTestLabServiceRunner. /// /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/servicerunners/{name} + /// Request Path. + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/servicerunners/{name}. /// /// - /// Operation Id - /// ServiceRunners_CreateOrUpdate + /// Operation Id. + /// ServiceRunners_CreateOrUpdate. /// /// - /// Default Api Version - /// 2018-09-15 + /// Default Api Version. + /// 2018-09-15. /// /// - /// Resource - /// + /// Resource. + /// . /// /// /// @@ -286,16 +320,24 @@ public virtual async Task> UpdateA { Argument.AssertNotNull(data, nameof(data)); - using var scope = _devTestLabServiceRunnerServiceRunnersClientDiagnostics.CreateScope("DevTestLabServiceRunnerResource.Update"); + using DiagnosticScope scope = _serviceRunnersClientDiagnostics.CreateScope("DevTestLabServiceRunnerResource.Update"); scope.Start(); try { - var response = await _devTestLabServiceRunnerServiceRunnersRestClient.CreateOrUpdateAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, data, cancellationToken).ConfigureAwait(false); - var uri = _devTestLabServiceRunnerServiceRunnersRestClient.CreateCreateOrUpdateRequestUri(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, data); - var rehydrationToken = NextLinkOperationImplementation.GetRehydrationToken(RequestMethod.Put, uri.ToUri(), uri.ToString(), "None", null, OperationFinalStateVia.OriginalUri.ToString()); - var operation = new DevTestLabsArmOperation(Response.FromValue(new DevTestLabServiceRunnerResource(Client, response), response.GetRawResponse()), rehydrationToken); + RequestContext context = new RequestContext + { + CancellationToken = cancellationToken + }; + HttpMessage message = _serviceRunnersRestClient.CreateCreateOrUpdateRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, DevTestLabServiceRunnerData.ToRequestContent(data), context); + Response result = await Pipeline.ProcessMessageAsync(message, context).ConfigureAwait(false); + Response response = Response.FromValue(DevTestLabServiceRunnerData.FromResponse(result), result); + RequestUriBuilder uri = message.Request.Uri; + RehydrationToken rehydrationToken = NextLinkOperationImplementation.GetRehydrationToken(RequestMethod.Put, uri.ToUri(), uri.ToString(), "None", null, OperationFinalStateVia.OriginalUri.ToString()); + DevTestLabsArmOperation operation = new DevTestLabsArmOperation(Response.FromValue(new DevTestLabServiceRunnerResource(Client, response.Value), response.GetRawResponse()), rehydrationToken); if (waitUntil == WaitUntil.Completed) + { await operation.WaitForCompletionAsync(cancellationToken).ConfigureAwait(false); + } return operation; } catch (Exception e) @@ -306,23 +348,23 @@ public virtual async Task> UpdateA } /// - /// Create or replace an existing service runner. + /// Update a DevTestLabServiceRunner. /// /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/servicerunners/{name} + /// Request Path. + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/servicerunners/{name}. /// /// - /// Operation Id - /// ServiceRunners_CreateOrUpdate + /// Operation Id. + /// ServiceRunners_CreateOrUpdate. /// /// - /// Default Api Version - /// 2018-09-15 + /// Default Api Version. + /// 2018-09-15. /// /// - /// Resource - /// + /// Resource. + /// . /// /// /// @@ -334,16 +376,24 @@ public virtual ArmOperation Update(WaitUntil wa { Argument.AssertNotNull(data, nameof(data)); - using var scope = _devTestLabServiceRunnerServiceRunnersClientDiagnostics.CreateScope("DevTestLabServiceRunnerResource.Update"); + using DiagnosticScope scope = _serviceRunnersClientDiagnostics.CreateScope("DevTestLabServiceRunnerResource.Update"); scope.Start(); try { - var response = _devTestLabServiceRunnerServiceRunnersRestClient.CreateOrUpdate(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, data, cancellationToken); - var uri = _devTestLabServiceRunnerServiceRunnersRestClient.CreateCreateOrUpdateRequestUri(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, data); - var rehydrationToken = NextLinkOperationImplementation.GetRehydrationToken(RequestMethod.Put, uri.ToUri(), uri.ToString(), "None", null, OperationFinalStateVia.OriginalUri.ToString()); - var operation = new DevTestLabsArmOperation(Response.FromValue(new DevTestLabServiceRunnerResource(Client, response), response.GetRawResponse()), rehydrationToken); + RequestContext context = new RequestContext + { + CancellationToken = cancellationToken + }; + HttpMessage message = _serviceRunnersRestClient.CreateCreateOrUpdateRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, DevTestLabServiceRunnerData.ToRequestContent(data), context); + Response result = Pipeline.ProcessMessage(message, context); + Response response = Response.FromValue(DevTestLabServiceRunnerData.FromResponse(result), result); + RequestUriBuilder uri = message.Request.Uri; + RehydrationToken rehydrationToken = NextLinkOperationImplementation.GetRehydrationToken(RequestMethod.Put, uri.ToUri(), uri.ToString(), "None", null, OperationFinalStateVia.OriginalUri.ToString()); + DevTestLabsArmOperation operation = new DevTestLabsArmOperation(Response.FromValue(new DevTestLabServiceRunnerResource(Client, response.Value), response.GetRawResponse()), rehydrationToken); if (waitUntil == WaitUntil.Completed) + { operation.WaitForCompletion(cancellationToken); + } return operation; } catch (Exception e) @@ -353,27 +403,7 @@ public virtual ArmOperation Update(WaitUntil wa } } - /// - /// Add a tag to the current resource. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/servicerunners/{name} - /// - /// - /// Operation Id - /// ServiceRunners_Get - /// - /// - /// Default Api Version - /// 2018-09-15 - /// - /// - /// Resource - /// - /// - /// - /// + /// Add a tag to the current resource. /// The key for the tag. /// The value for the tag. /// The cancellation token to use. @@ -383,23 +413,29 @@ public virtual async Task> AddTagAsync Argument.AssertNotNull(key, nameof(key)); Argument.AssertNotNull(value, nameof(value)); - using var scope = _devTestLabServiceRunnerServiceRunnersClientDiagnostics.CreateScope("DevTestLabServiceRunnerResource.AddTag"); + using DiagnosticScope scope = _serviceRunnersClientDiagnostics.CreateScope("DevTestLabServiceRunnerResource.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 _devTestLabServiceRunnerServiceRunnersRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, cancellationToken).ConfigureAwait(false); - return Response.FromValue(new DevTestLabServiceRunnerResource(Client, originalResponse.Value), originalResponse.GetRawResponse()); + await GetTagResource().CreateOrUpdateAsync(WaitUntil.Completed, originalTags.Value.Data, cancellationToken).ConfigureAwait(false); + RequestContext context = new RequestContext + { + CancellationToken = cancellationToken + }; + HttpMessage message = _serviceRunnersRestClient.CreateGetRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, context); + Response result = await Pipeline.ProcessMessageAsync(message, context).ConfigureAwait(false); + Response response = Response.FromValue(DevTestLabServiceRunnerData.FromResponse(result), result); + return Response.FromValue(new DevTestLabServiceRunnerResource(Client, response.Value), response.GetRawResponse()); } else { - var current = (await GetAsync(cancellationToken: cancellationToken).ConfigureAwait(false)).Value.Data; + DevTestLabServiceRunnerData current = (await GetAsync(cancellationToken: cancellationToken).ConfigureAwait(false)).Value.Data; current.Tags[key] = value; - var result = await UpdateAsync(WaitUntil.Completed, current, cancellationToken: cancellationToken).ConfigureAwait(false); + ArmOperation result = await UpdateAsync(WaitUntil.Completed, current, cancellationToken: cancellationToken).ConfigureAwait(false); return Response.FromValue(result.Value, result.GetRawResponse()); } } @@ -410,27 +446,7 @@ public virtual async Task> AddTagAsync } } - /// - /// Add a tag to the current resource. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/servicerunners/{name} - /// - /// - /// Operation Id - /// ServiceRunners_Get - /// - /// - /// Default Api Version - /// 2018-09-15 - /// - /// - /// Resource - /// - /// - /// - /// + /// Add a tag to the current resource. /// The key for the tag. /// The value for the tag. /// The cancellation token to use. @@ -440,23 +456,29 @@ public virtual Response AddTag(string key, stri Argument.AssertNotNull(key, nameof(key)); Argument.AssertNotNull(value, nameof(value)); - using var scope = _devTestLabServiceRunnerServiceRunnersClientDiagnostics.CreateScope("DevTestLabServiceRunnerResource.AddTag"); + using DiagnosticScope scope = _serviceRunnersClientDiagnostics.CreateScope("DevTestLabServiceRunnerResource.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 = _devTestLabServiceRunnerServiceRunnersRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, cancellationToken); - return Response.FromValue(new DevTestLabServiceRunnerResource(Client, originalResponse.Value), originalResponse.GetRawResponse()); + GetTagResource().CreateOrUpdate(WaitUntil.Completed, originalTags.Value.Data, cancellationToken); + RequestContext context = new RequestContext + { + CancellationToken = cancellationToken + }; + HttpMessage message = _serviceRunnersRestClient.CreateGetRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, context); + Response result = Pipeline.ProcessMessage(message, context); + Response response = Response.FromValue(DevTestLabServiceRunnerData.FromResponse(result), result); + return Response.FromValue(new DevTestLabServiceRunnerResource(Client, response.Value), response.GetRawResponse()); } else { - var current = Get(cancellationToken: cancellationToken).Value.Data; + DevTestLabServiceRunnerData current = Get(cancellationToken: cancellationToken).Value.Data; current.Tags[key] = value; - var result = Update(WaitUntil.Completed, current, cancellationToken: cancellationToken); + ArmOperation result = Update(WaitUntil.Completed, current, cancellationToken: cancellationToken); return Response.FromValue(result.Value, result.GetRawResponse()); } } @@ -467,52 +489,38 @@ public virtual Response AddTag(string key, stri } } - /// - /// Replace the tags on the resource with the given set. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/servicerunners/{name} - /// - /// - /// Operation Id - /// ServiceRunners_Get - /// - /// - /// Default Api Version - /// 2018-09-15 - /// - /// - /// 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 = _devTestLabServiceRunnerServiceRunnersClientDiagnostics.CreateScope("DevTestLabServiceRunnerResource.SetTags"); + using DiagnosticScope scope = _serviceRunnersClientDiagnostics.CreateScope("DevTestLabServiceRunnerResource.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 _devTestLabServiceRunnerServiceRunnersRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, cancellationToken).ConfigureAwait(false); - return Response.FromValue(new DevTestLabServiceRunnerResource(Client, originalResponse.Value), originalResponse.GetRawResponse()); + await GetTagResource().CreateOrUpdateAsync(WaitUntil.Completed, originalTags.Value.Data, cancellationToken).ConfigureAwait(false); + RequestContext context = new RequestContext + { + CancellationToken = cancellationToken + }; + HttpMessage message = _serviceRunnersRestClient.CreateGetRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, context); + Response result = await Pipeline.ProcessMessageAsync(message, context).ConfigureAwait(false); + Response response = Response.FromValue(DevTestLabServiceRunnerData.FromResponse(result), result); + return Response.FromValue(new DevTestLabServiceRunnerResource(Client, response.Value), response.GetRawResponse()); } else { - var current = (await GetAsync(cancellationToken: cancellationToken).ConfigureAwait(false)).Value.Data; + DevTestLabServiceRunnerData current = (await GetAsync(cancellationToken: cancellationToken).ConfigureAwait(false)).Value.Data; current.Tags.ReplaceWith(tags); - var result = await UpdateAsync(WaitUntil.Completed, current, cancellationToken: cancellationToken).ConfigureAwait(false); + ArmOperation result = await UpdateAsync(WaitUntil.Completed, current, cancellationToken: cancellationToken).ConfigureAwait(false); return Response.FromValue(result.Value, result.GetRawResponse()); } } @@ -523,52 +531,38 @@ public virtual async Task> SetTagsAsyn } } - /// - /// Replace the tags on the resource with the given set. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/servicerunners/{name} - /// - /// - /// Operation Id - /// ServiceRunners_Get - /// - /// - /// Default Api Version - /// 2018-09-15 - /// - /// - /// 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 = _devTestLabServiceRunnerServiceRunnersClientDiagnostics.CreateScope("DevTestLabServiceRunnerResource.SetTags"); + using DiagnosticScope scope = _serviceRunnersClientDiagnostics.CreateScope("DevTestLabServiceRunnerResource.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 = _devTestLabServiceRunnerServiceRunnersRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, cancellationToken); - return Response.FromValue(new DevTestLabServiceRunnerResource(Client, originalResponse.Value), originalResponse.GetRawResponse()); + GetTagResource().CreateOrUpdate(WaitUntil.Completed, originalTags.Value.Data, cancellationToken); + RequestContext context = new RequestContext + { + CancellationToken = cancellationToken + }; + HttpMessage message = _serviceRunnersRestClient.CreateGetRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, context); + Response result = Pipeline.ProcessMessage(message, context); + Response response = Response.FromValue(DevTestLabServiceRunnerData.FromResponse(result), result); + return Response.FromValue(new DevTestLabServiceRunnerResource(Client, response.Value), response.GetRawResponse()); } else { - var current = Get(cancellationToken: cancellationToken).Value.Data; + DevTestLabServiceRunnerData current = Get(cancellationToken: cancellationToken).Value.Data; current.Tags.ReplaceWith(tags); - var result = Update(WaitUntil.Completed, current, cancellationToken: cancellationToken); + ArmOperation result = Update(WaitUntil.Completed, current, cancellationToken: cancellationToken); return Response.FromValue(result.Value, result.GetRawResponse()); } } @@ -579,27 +573,7 @@ public virtual Response SetTags(IDictionary - /// Removes a tag by key from the resource. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/servicerunners/{name} - /// - /// - /// Operation Id - /// ServiceRunners_Get - /// - /// - /// Default Api Version - /// 2018-09-15 - /// - /// - /// Resource - /// - /// - /// - /// + /// Removes a tag by key from the resource. /// The key for the tag. /// The cancellation token to use. /// is null. @@ -607,23 +581,29 @@ public virtual async Task> RemoveTagAs { Argument.AssertNotNull(key, nameof(key)); - using var scope = _devTestLabServiceRunnerServiceRunnersClientDiagnostics.CreateScope("DevTestLabServiceRunnerResource.RemoveTag"); + using DiagnosticScope scope = _serviceRunnersClientDiagnostics.CreateScope("DevTestLabServiceRunnerResource.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 _devTestLabServiceRunnerServiceRunnersRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, cancellationToken).ConfigureAwait(false); - return Response.FromValue(new DevTestLabServiceRunnerResource(Client, originalResponse.Value), originalResponse.GetRawResponse()); + await GetTagResource().CreateOrUpdateAsync(WaitUntil.Completed, originalTags.Value.Data, cancellationToken).ConfigureAwait(false); + RequestContext context = new RequestContext + { + CancellationToken = cancellationToken + }; + HttpMessage message = _serviceRunnersRestClient.CreateGetRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, context); + Response result = await Pipeline.ProcessMessageAsync(message, context).ConfigureAwait(false); + Response response = Response.FromValue(DevTestLabServiceRunnerData.FromResponse(result), result); + return Response.FromValue(new DevTestLabServiceRunnerResource(Client, response.Value), response.GetRawResponse()); } else { - var current = (await GetAsync(cancellationToken: cancellationToken).ConfigureAwait(false)).Value.Data; + DevTestLabServiceRunnerData current = (await GetAsync(cancellationToken: cancellationToken).ConfigureAwait(false)).Value.Data; current.Tags.Remove(key); - var result = await UpdateAsync(WaitUntil.Completed, current, cancellationToken: cancellationToken).ConfigureAwait(false); + ArmOperation result = await UpdateAsync(WaitUntil.Completed, current, cancellationToken: cancellationToken).ConfigureAwait(false); return Response.FromValue(result.Value, result.GetRawResponse()); } } @@ -634,27 +614,7 @@ public virtual async Task> RemoveTagAs } } - /// - /// Removes a tag by key from the resource. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/servicerunners/{name} - /// - /// - /// Operation Id - /// ServiceRunners_Get - /// - /// - /// Default Api Version - /// 2018-09-15 - /// - /// - /// Resource - /// - /// - /// - /// + /// Removes a tag by key from the resource. /// The key for the tag. /// The cancellation token to use. /// is null. @@ -662,23 +622,29 @@ public virtual Response RemoveTag(string key, C { Argument.AssertNotNull(key, nameof(key)); - using var scope = _devTestLabServiceRunnerServiceRunnersClientDiagnostics.CreateScope("DevTestLabServiceRunnerResource.RemoveTag"); + using DiagnosticScope scope = _serviceRunnersClientDiagnostics.CreateScope("DevTestLabServiceRunnerResource.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 = _devTestLabServiceRunnerServiceRunnersRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, cancellationToken); - return Response.FromValue(new DevTestLabServiceRunnerResource(Client, originalResponse.Value), originalResponse.GetRawResponse()); + GetTagResource().CreateOrUpdate(WaitUntil.Completed, originalTags.Value.Data, cancellationToken); + RequestContext context = new RequestContext + { + CancellationToken = cancellationToken + }; + HttpMessage message = _serviceRunnersRestClient.CreateGetRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, context); + Response result = Pipeline.ProcessMessage(message, context); + Response response = Response.FromValue(DevTestLabServiceRunnerData.FromResponse(result), result); + return Response.FromValue(new DevTestLabServiceRunnerResource(Client, response.Value), response.GetRawResponse()); } else { - var current = Get(cancellationToken: cancellationToken).Value.Data; + DevTestLabServiceRunnerData current = Get(cancellationToken: cancellationToken).Value.Data; current.Tags.Remove(key); - var result = Update(WaitUntil.Completed, current, cancellationToken: cancellationToken); + ArmOperation result = Update(WaitUntil.Completed, current, cancellationToken: cancellationToken); return Response.FromValue(result.Value, result.GetRawResponse()); } } diff --git a/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/DevTestLabUserCollection.cs b/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/DevTestLabUserCollection.cs index 3a1db402dc72..add6a678383a 100644 --- a/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/DevTestLabUserCollection.cs +++ b/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/DevTestLabUserCollection.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.DevTestLabs { @@ -24,51 +25,49 @@ namespace Azure.ResourceManager.DevTestLabs /// public partial class DevTestLabUserCollection : ArmCollection, IEnumerable, IAsyncEnumerable { - private readonly ClientDiagnostics _devTestLabUserUsersClientDiagnostics; - private readonly UsersRestOperations _devTestLabUserUsersRestClient; + private readonly ClientDiagnostics _usersClientDiagnostics; + private readonly Users _usersRestClient; - /// Initializes a new instance of the class for mocking. + /// Initializes a new instance of DevTestLabUserCollection for mocking. protected DevTestLabUserCollection() { } - /// 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 DevTestLabUserCollection(ArmClient client, ResourceIdentifier id) : base(client, id) { - _devTestLabUserUsersClientDiagnostics = new ClientDiagnostics("Azure.ResourceManager.DevTestLabs", DevTestLabUserResource.ResourceType.Namespace, Diagnostics); - TryGetApiVersion(DevTestLabUserResource.ResourceType, out string devTestLabUserUsersApiVersion); - _devTestLabUserUsersRestClient = new UsersRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, devTestLabUserUsersApiVersion); -#if DEBUG - ValidateResourceId(Id); -#endif + TryGetApiVersion(DevTestLabUserResource.ResourceType, out string devTestLabUserApiVersion); + _usersClientDiagnostics = new ClientDiagnostics("Azure.ResourceManager.DevTestLabs", DevTestLabUserResource.ResourceType.Namespace, Diagnostics); + _usersRestClient = new Users(_usersClientDiagnostics, Pipeline, Endpoint, devTestLabUserApiVersion ?? "2018-09-15"); + ValidateResourceId(id); } + /// + [Conditional("DEBUG")] internal static void ValidateResourceId(ResourceIdentifier id) { if (id.ResourceType != DevTestLabResource.ResourceType) - throw new ArgumentException(string.Format(CultureInfo.CurrentCulture, "Invalid resource type {0} expected {1}", id.ResourceType, DevTestLabResource.ResourceType), nameof(id)); + { + throw new ArgumentException(string.Format("Invalid resource type {0} expected {1}", id.ResourceType, DevTestLabResource.ResourceType), id); + } } /// /// Create or replace an existing user profile. This operation can take a while to complete. /// /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/users/{name} - /// - /// - /// Operation Id - /// Users_CreateOrUpdate + /// Request Path. + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/users/{name}. /// /// - /// Default Api Version - /// 2018-09-15 + /// Operation Id. + /// Users_CreateOrUpdate. /// /// - /// Resource - /// + /// Default Api Version. + /// 2018-09-15. /// /// /// @@ -76,21 +75,34 @@ internal static void ValidateResourceId(ResourceIdentifier id) /// The name of the user profile. /// Profile of a lab user. /// 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 name, DevTestLabUserData data, CancellationToken cancellationToken = default) { Argument.AssertNotNullOrEmpty(name, nameof(name)); Argument.AssertNotNull(data, nameof(data)); - using var scope = _devTestLabUserUsersClientDiagnostics.CreateScope("DevTestLabUserCollection.CreateOrUpdate"); + using DiagnosticScope scope = _usersClientDiagnostics.CreateScope("DevTestLabUserCollection.CreateOrUpdate"); scope.Start(); try { - var response = await _devTestLabUserUsersRestClient.CreateOrUpdateAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, name, data, cancellationToken).ConfigureAwait(false); - var operation = new DevTestLabsArmOperation(new DevTestLabUserOperationSource(Client), _devTestLabUserUsersClientDiagnostics, Pipeline, _devTestLabUserUsersRestClient.CreateCreateOrUpdateRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, name, data).Request, response, OperationFinalStateVia.Location); + RequestContext context = new RequestContext + { + CancellationToken = cancellationToken + }; + HttpMessage message = _usersRestClient.CreateCreateOrUpdateRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, name, DevTestLabUserData.ToRequestContent(data), context); + Response response = await Pipeline.ProcessMessageAsync(message, context).ConfigureAwait(false); + DevTestLabsArmOperation operation = new DevTestLabsArmOperation( + new DevTestLabUserOperationSource(Client), + _usersClientDiagnostics, + Pipeline, + message.Request, + response, + OperationFinalStateVia.Location); if (waitUntil == WaitUntil.Completed) + { await operation.WaitForCompletionAsync(cancellationToken).ConfigureAwait(false); + } return operation; } catch (Exception e) @@ -104,20 +116,16 @@ public virtual async Task> CreateOrUpdateAs /// Create or replace an existing user profile. This operation can take a while to complete. /// /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/users/{name} + /// Request Path. + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/users/{name}. /// /// - /// Operation Id - /// Users_CreateOrUpdate + /// Operation Id. + /// Users_CreateOrUpdate. /// /// - /// Default Api Version - /// 2018-09-15 - /// - /// - /// Resource - /// + /// Default Api Version. + /// 2018-09-15. /// /// /// @@ -125,21 +133,34 @@ public virtual async Task> CreateOrUpdateAs /// The name of the user profile. /// Profile of a lab user. /// 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 name, DevTestLabUserData data, CancellationToken cancellationToken = default) { Argument.AssertNotNullOrEmpty(name, nameof(name)); Argument.AssertNotNull(data, nameof(data)); - using var scope = _devTestLabUserUsersClientDiagnostics.CreateScope("DevTestLabUserCollection.CreateOrUpdate"); + using DiagnosticScope scope = _usersClientDiagnostics.CreateScope("DevTestLabUserCollection.CreateOrUpdate"); scope.Start(); try { - var response = _devTestLabUserUsersRestClient.CreateOrUpdate(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, name, data, cancellationToken); - var operation = new DevTestLabsArmOperation(new DevTestLabUserOperationSource(Client), _devTestLabUserUsersClientDiagnostics, Pipeline, _devTestLabUserUsersRestClient.CreateCreateOrUpdateRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, name, data).Request, response, OperationFinalStateVia.Location); + RequestContext context = new RequestContext + { + CancellationToken = cancellationToken + }; + HttpMessage message = _usersRestClient.CreateCreateOrUpdateRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, name, DevTestLabUserData.ToRequestContent(data), context); + Response response = Pipeline.ProcessMessage(message, context); + DevTestLabsArmOperation operation = new DevTestLabsArmOperation( + new DevTestLabUserOperationSource(Client), + _usersClientDiagnostics, + Pipeline, + message.Request, + response, + OperationFinalStateVia.Location); if (waitUntil == WaitUntil.Completed) + { operation.WaitForCompletion(cancellationToken); + } return operation; } catch (Exception e) @@ -153,39 +174,43 @@ public virtual ArmOperation CreateOrUpdate(WaitUntil wai /// Get user profile. /// /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/users/{name} + /// Request Path. + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/users/{name}. /// /// - /// Operation Id - /// Users_Get + /// Operation Id. + /// Users_Get. /// /// - /// Default Api Version - /// 2018-09-15 - /// - /// - /// Resource - /// + /// Default Api Version. + /// 2018-09-15. /// /// /// /// The name of the user profile. /// Specify the $expand query. Example: 'properties($select=identity)'. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. - public virtual async Task> GetAsync(string name, string expand = null, CancellationToken cancellationToken = default) + /// is an empty string, and was expected to be non-empty. + public virtual async Task> GetAsync(string name, string expand = default, CancellationToken cancellationToken = default) { Argument.AssertNotNullOrEmpty(name, nameof(name)); - using var scope = _devTestLabUserUsersClientDiagnostics.CreateScope("DevTestLabUserCollection.Get"); + using DiagnosticScope scope = _usersClientDiagnostics.CreateScope("DevTestLabUserCollection.Get"); scope.Start(); try { - var response = await _devTestLabUserUsersRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, name, expand, cancellationToken).ConfigureAwait(false); + RequestContext context = new RequestContext + { + CancellationToken = cancellationToken + }; + HttpMessage message = _usersRestClient.CreateGetRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, name, expand, context); + Response result = await Pipeline.ProcessMessageAsync(message, context).ConfigureAwait(false); + Response response = Response.FromValue(DevTestLabUserData.FromResponse(result), result); if (response.Value == null) + { throw new RequestFailedException(response.GetRawResponse()); + } return Response.FromValue(new DevTestLabUserResource(Client, response.Value), response.GetRawResponse()); } catch (Exception e) @@ -199,39 +224,43 @@ public virtual async Task> GetAsync(string name /// Get user profile. /// /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/users/{name} - /// - /// - /// Operation Id - /// Users_Get + /// Request Path. + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/users/{name}. /// /// - /// Default Api Version - /// 2018-09-15 + /// Operation Id. + /// Users_Get. /// /// - /// Resource - /// + /// Default Api Version. + /// 2018-09-15. /// /// /// /// The name of the user profile. /// Specify the $expand query. Example: 'properties($select=identity)'. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. - public virtual Response Get(string name, string expand = null, CancellationToken cancellationToken = default) + /// is an empty string, and was expected to be non-empty. + public virtual Response Get(string name, string expand = default, CancellationToken cancellationToken = default) { Argument.AssertNotNullOrEmpty(name, nameof(name)); - using var scope = _devTestLabUserUsersClientDiagnostics.CreateScope("DevTestLabUserCollection.Get"); + using DiagnosticScope scope = _usersClientDiagnostics.CreateScope("DevTestLabUserCollection.Get"); scope.Start(); try { - var response = _devTestLabUserUsersRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, name, expand, cancellationToken); + RequestContext context = new RequestContext + { + CancellationToken = cancellationToken + }; + HttpMessage message = _usersRestClient.CreateGetRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, name, expand, context); + Response result = Pipeline.ProcessMessage(message, context); + Response response = Response.FromValue(DevTestLabUserData.FromResponse(result), result); if (response.Value == null) + { throw new RequestFailedException(response.GetRawResponse()); + } return Response.FromValue(new DevTestLabUserResource(Client, response.Value), response.GetRawResponse()); } catch (Exception e) @@ -245,20 +274,16 @@ public virtual Response Get(string name, string expand = /// List user profiles in a given lab. /// /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/users + /// Request Path. + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/users. /// /// - /// Operation Id - /// Users_List + /// Operation Id. + /// Users_List. /// /// - /// Default Api Version - /// 2018-09-15 - /// - /// - /// Resource - /// + /// Default Api Version. + /// 2018-09-15. /// /// /// @@ -267,32 +292,39 @@ public virtual Response Get(string name, string expand = /// The maximum number of resources to return from the operation. Example: '$top=10'. /// The ordering expression for the results, using OData notation. Example: '$orderby=name desc'. /// The cancellation token to use. - /// An async collection of that may take multiple service requests to iterate over. - public virtual AsyncPageable GetAllAsync(string expand = null, string filter = null, int? top = null, string orderby = null, CancellationToken cancellationToken = default) + /// A collection of that may take multiple service requests to iterate over. + public virtual AsyncPageable GetAllAsync(string expand = default, string filter = default, int? top = default, string @orderby = default, CancellationToken cancellationToken = default) { - HttpMessage FirstPageRequest(int? pageSizeHint) => _devTestLabUserUsersRestClient.CreateListRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, expand, filter, top, orderby); - HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _devTestLabUserUsersRestClient.CreateListNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName, Id.Name, expand, filter, top, orderby); - return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new DevTestLabUserResource(Client, DevTestLabUserData.DeserializeDevTestLabUserData(e)), _devTestLabUserUsersClientDiagnostics, Pipeline, "DevTestLabUserCollection.GetAll", "value", "nextLink", cancellationToken); + RequestContext context = new RequestContext + { + CancellationToken = cancellationToken + }; + return new AsyncPageableWrapper(new UsersGetAllAsyncCollectionResultOfT( + _usersRestClient, + Id.SubscriptionId, + Id.ResourceGroupName, + Id.Name, + expand, + filter, + top, + @orderby, + context), data => new DevTestLabUserResource(Client, data)); } /// /// List user profiles in a given lab. /// /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/users - /// - /// - /// Operation Id - /// Users_List + /// Request Path. + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/users. /// /// - /// Default Api Version - /// 2018-09-15 + /// Operation Id. + /// Users_List. /// /// - /// Resource - /// + /// Default Api Version. + /// 2018-09-15. /// /// /// @@ -302,48 +334,73 @@ public virtual AsyncPageable GetAllAsync(string expand = /// The ordering expression for the results, using OData notation. Example: '$orderby=name desc'. /// The cancellation token to use. /// A collection of that may take multiple service requests to iterate over. - public virtual Pageable GetAll(string expand = null, string filter = null, int? top = null, string orderby = null, CancellationToken cancellationToken = default) + public virtual Pageable GetAll(string expand = default, string filter = default, int? top = default, string @orderby = default, CancellationToken cancellationToken = default) { - HttpMessage FirstPageRequest(int? pageSizeHint) => _devTestLabUserUsersRestClient.CreateListRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, expand, filter, top, orderby); - HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _devTestLabUserUsersRestClient.CreateListNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName, Id.Name, expand, filter, top, orderby); - return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new DevTestLabUserResource(Client, DevTestLabUserData.DeserializeDevTestLabUserData(e)), _devTestLabUserUsersClientDiagnostics, Pipeline, "DevTestLabUserCollection.GetAll", "value", "nextLink", cancellationToken); + RequestContext context = new RequestContext + { + CancellationToken = cancellationToken + }; + return new PageableWrapper(new UsersGetAllCollectionResultOfT( + _usersRestClient, + Id.SubscriptionId, + Id.ResourceGroupName, + Id.Name, + expand, + filter, + top, + @orderby, + context), data => new DevTestLabUserResource(Client, data)); } /// /// Checks to see if the resource exists in azure. /// /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/users/{name} - /// - /// - /// Operation Id - /// Users_Get + /// Request Path. + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/users/{name}. /// /// - /// Default Api Version - /// 2018-09-15 + /// Operation Id. + /// Users_Get. /// /// - /// Resource - /// + /// Default Api Version. + /// 2018-09-15. /// /// /// /// The name of the user profile. /// Specify the $expand query. Example: 'properties($select=identity)'. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. - public virtual async Task> ExistsAsync(string name, string expand = null, CancellationToken cancellationToken = default) + /// is an empty string, and was expected to be non-empty. + public virtual async Task> ExistsAsync(string name, string expand = default, CancellationToken cancellationToken = default) { Argument.AssertNotNullOrEmpty(name, nameof(name)); - using var scope = _devTestLabUserUsersClientDiagnostics.CreateScope("DevTestLabUserCollection.Exists"); + using DiagnosticScope scope = _usersClientDiagnostics.CreateScope("DevTestLabUserCollection.Exists"); scope.Start(); try { - var response = await _devTestLabUserUsersRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, name, expand, cancellationToken: cancellationToken).ConfigureAwait(false); + RequestContext context = new RequestContext + { + CancellationToken = cancellationToken + }; + HttpMessage message = _usersRestClient.CreateGetRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, name, expand, context); + await Pipeline.SendAsync(message, context.CancellationToken).ConfigureAwait(false); + Response result = message.Response; + Response response = default; + switch (result.Status) + { + case 200: + response = Response.FromValue(DevTestLabUserData.FromResponse(result), result); + break; + case 404: + response = Response.FromValue((DevTestLabUserData)null, result); + break; + default: + throw new RequestFailedException(result); + } return Response.FromValue(response.Value != null, response.GetRawResponse()); } catch (Exception e) @@ -357,37 +414,51 @@ public virtual async Task> ExistsAsync(string name, string expand /// Checks to see if the resource exists in azure. /// /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/users/{name} + /// Request Path. + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/users/{name}. /// /// - /// Operation Id - /// Users_Get + /// Operation Id. + /// Users_Get. /// /// - /// Default Api Version - /// 2018-09-15 - /// - /// - /// Resource - /// + /// Default Api Version. + /// 2018-09-15. /// /// /// /// The name of the user profile. /// Specify the $expand query. Example: 'properties($select=identity)'. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. - public virtual Response Exists(string name, string expand = null, CancellationToken cancellationToken = default) + /// is an empty string, and was expected to be non-empty. + public virtual Response Exists(string name, string expand = default, CancellationToken cancellationToken = default) { Argument.AssertNotNullOrEmpty(name, nameof(name)); - using var scope = _devTestLabUserUsersClientDiagnostics.CreateScope("DevTestLabUserCollection.Exists"); + using DiagnosticScope scope = _usersClientDiagnostics.CreateScope("DevTestLabUserCollection.Exists"); scope.Start(); try { - var response = _devTestLabUserUsersRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, name, expand, cancellationToken: cancellationToken); + RequestContext context = new RequestContext + { + CancellationToken = cancellationToken + }; + HttpMessage message = _usersRestClient.CreateGetRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, name, expand, context); + Pipeline.Send(message, context.CancellationToken); + Response result = message.Response; + Response response = default; + switch (result.Status) + { + case 200: + response = Response.FromValue(DevTestLabUserData.FromResponse(result), result); + break; + case 404: + response = Response.FromValue((DevTestLabUserData)null, result); + break; + default: + throw new RequestFailedException(result); + } return Response.FromValue(response.Value != null, response.GetRawResponse()); } catch (Exception e) @@ -401,39 +472,55 @@ public virtual Response Exists(string name, string expand = null, Cancella /// Tries to get details for this resource from the service. /// /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/users/{name} - /// - /// - /// Operation Id - /// Users_Get + /// Request Path. + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/users/{name}. /// /// - /// Default Api Version - /// 2018-09-15 + /// Operation Id. + /// Users_Get. /// /// - /// Resource - /// + /// Default Api Version. + /// 2018-09-15. /// /// /// /// The name of the user profile. /// Specify the $expand query. Example: 'properties($select=identity)'. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. - public virtual async Task> GetIfExistsAsync(string name, string expand = null, CancellationToken cancellationToken = default) + /// is an empty string, and was expected to be non-empty. + public virtual async Task> GetIfExistsAsync(string name, string expand = default, CancellationToken cancellationToken = default) { Argument.AssertNotNullOrEmpty(name, nameof(name)); - using var scope = _devTestLabUserUsersClientDiagnostics.CreateScope("DevTestLabUserCollection.GetIfExists"); + using DiagnosticScope scope = _usersClientDiagnostics.CreateScope("DevTestLabUserCollection.GetIfExists"); scope.Start(); try { - var response = await _devTestLabUserUsersRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, name, expand, cancellationToken: cancellationToken).ConfigureAwait(false); + RequestContext context = new RequestContext + { + CancellationToken = cancellationToken + }; + HttpMessage message = _usersRestClient.CreateGetRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, name, expand, context); + await Pipeline.SendAsync(message, context.CancellationToken).ConfigureAwait(false); + Response result = message.Response; + Response response = default; + switch (result.Status) + { + case 200: + response = Response.FromValue(DevTestLabUserData.FromResponse(result), result); + break; + case 404: + response = Response.FromValue((DevTestLabUserData)null, result); + break; + default: + throw new RequestFailedException(result); + } if (response.Value == null) + { return new NoValueResponse(response.GetRawResponse()); + } return Response.FromValue(new DevTestLabUserResource(Client, response.Value), response.GetRawResponse()); } catch (Exception e) @@ -447,39 +534,55 @@ public virtual async Task> GetIfExistsA /// Tries to get details for this resource from the service. /// /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/users/{name} + /// Request Path. + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/users/{name}. /// /// - /// Operation Id - /// Users_Get + /// Operation Id. + /// Users_Get. /// /// - /// Default Api Version - /// 2018-09-15 - /// - /// - /// Resource - /// + /// Default Api Version. + /// 2018-09-15. /// /// /// /// The name of the user profile. /// Specify the $expand query. Example: 'properties($select=identity)'. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. - public virtual NullableResponse GetIfExists(string name, string expand = null, CancellationToken cancellationToken = default) + /// is an empty string, and was expected to be non-empty. + public virtual NullableResponse GetIfExists(string name, string expand = default, CancellationToken cancellationToken = default) { Argument.AssertNotNullOrEmpty(name, nameof(name)); - using var scope = _devTestLabUserUsersClientDiagnostics.CreateScope("DevTestLabUserCollection.GetIfExists"); + using DiagnosticScope scope = _usersClientDiagnostics.CreateScope("DevTestLabUserCollection.GetIfExists"); scope.Start(); try { - var response = _devTestLabUserUsersRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, name, expand, cancellationToken: cancellationToken); + RequestContext context = new RequestContext + { + CancellationToken = cancellationToken + }; + HttpMessage message = _usersRestClient.CreateGetRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, name, expand, context); + Pipeline.Send(message, context.CancellationToken); + Response result = message.Response; + Response response = default; + switch (result.Status) + { + case 200: + response = Response.FromValue(DevTestLabUserData.FromResponse(result), result); + break; + case 404: + response = Response.FromValue((DevTestLabUserData)null, result); + break; + default: + throw new RequestFailedException(result); + } if (response.Value == null) + { return new NoValueResponse(response.GetRawResponse()); + } return Response.FromValue(new DevTestLabUserResource(Client, response.Value), response.GetRawResponse()); } catch (Exception e) @@ -499,6 +602,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/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/DevTestLabUserData.Serialization.cs b/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/DevTestLabUserData.Serialization.cs index fb7b37fb56fb..fd4b191ec35d 100644 --- a/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/DevTestLabUserData.Serialization.cs +++ b/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/DevTestLabUserData.Serialization.cs @@ -10,16 +10,47 @@ using System.Collections.Generic; using System.Text; using System.Text.Json; +using Azure; using Azure.Core; using Azure.ResourceManager.DevTestLabs.Models; using Azure.ResourceManager.Models; namespace Azure.ResourceManager.DevTestLabs { - public partial class DevTestLabUserData : IUtf8JsonSerializable, IJsonModel + /// A user profile. + public partial class DevTestLabUserData : TrackedResourceData, IJsonModel { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + /// Initializes a new instance of for deserialization. + internal DevTestLabUserData() + { + } + + /// 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)) + { + return DeserializeDevTestLabUserData(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(DevTestLabUserData)} does not support reading '{options.Format}' format."); + } + } + /// The to deserialize the from. + internal static DevTestLabUserData FromResponse(Response response) + { + using JsonDocument document = JsonDocument.Parse(response.Content, ModelSerializationExtensions.JsonDocumentOptions); + return DeserializeDevTestLabUserData(document.RootElement, ModelSerializationExtensions.WireOptions); + } + + /// The JSON writer. + /// The client options for reading and writing models. void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) { writer.WriteStartObject(); @@ -31,199 +62,153 @@ void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWrit /// 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(DevTestLabUserData)} does not support writing '{format}' format."); } - base.JsonModelWriteCore(writer, options); writer.WritePropertyName("properties"u8); - writer.WriteStartObject(); - if (Optional.IsDefined(Identity)) + writer.WriteObjectValue(Properties, options); + if (Optional.IsCollectionDefined(Tags)) { - writer.WritePropertyName("identity"u8); - writer.WriteObjectValue(Identity, options); - } - if (Optional.IsDefined(SecretStore)) - { - writer.WritePropertyName("secretStore"u8); - writer.WriteObjectValue(SecretStore, options); - } - if (options.Format != "W" && Optional.IsDefined(CreatedOn)) - { - writer.WritePropertyName("createdDate"u8); - writer.WriteStringValue(CreatedOn.Value, "O"); - } - if (options.Format != "W" && Optional.IsDefined(ProvisioningState)) - { - writer.WritePropertyName("provisioningState"u8); - writer.WriteStringValue(ProvisioningState); - } - if (options.Format != "W" && Optional.IsDefined(UniqueIdentifier)) - { - writer.WritePropertyName("uniqueIdentifier"u8); - writer.WriteStringValue(UniqueIdentifier.Value); + writer.WritePropertyName("tags"u8); + writer.WriteStartObject(); + foreach (var item in Tags) + { + writer.WritePropertyName(item.Key); + if (item.Value == null) + { + writer.WriteNullValue(); + continue; + } + writer.WriteStringValue(item.Value); + } + writer.WriteEndObject(); } - writer.WriteEndObject(); } - DevTestLabUserData IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + /// The JSON reader. + /// The client options for reading and writing models. + DevTestLabUserData IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) => (DevTestLabUserData)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(DevTestLabUserData)} does not support reading '{format}' format."); } - using JsonDocument document = JsonDocument.ParseValue(ref reader); return DeserializeDevTestLabUserData(document.RootElement, options); } - internal static DevTestLabUserData DeserializeDevTestLabUserData(JsonElement element, ModelReaderWriterOptions options = null) + /// The JSON element to deserialize. + /// The client options for reading and writing models. + internal static DevTestLabUserData DeserializeDevTestLabUserData(JsonElement element, ModelReaderWriterOptions options) { - options ??= ModelSerializationExtensions.WireOptions; - if (element.ValueKind == JsonValueKind.Null) { return null; } - IDictionary tags = default; - AzureLocation location = default; ResourceIdentifier id = default; string name = default; - ResourceType type = default; + ResourceType resourceType = default; SystemData systemData = default; - DevTestLabUserIdentity identity = default; - DevTestLabUserSecretStore secretStore = default; - DateTimeOffset? createdDate = default; - string provisioningState = default; - Guid? uniqueIdentifier = default; - IDictionary serializedAdditionalRawData = default; - Dictionary rawDataDictionary = new Dictionary(); - foreach (var property in element.EnumerateObject()) + IDictionary additionalBinaryDataProperties = new ChangeTrackingDictionary(); + AzureLocation location = default; + UserProperties properties = default; + IDictionary tags = default; + foreach (var prop in element.EnumerateObject()) { - if (property.NameEquals("tags"u8)) + if (prop.NameEquals("id"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()) - { - dictionary.Add(property0.Name, property0.Value.GetString()); - } - tags = dictionary; + id = new ResourceIdentifier(prop.Value.GetString()); continue; } - if (property.NameEquals("location"u8)) + if (prop.NameEquals("name"u8)) { - location = new AzureLocation(property.Value.GetString()); + name = prop.Value.GetString(); continue; } - if (property.NameEquals("id"u8)) + if (prop.NameEquals("type"u8)) { - id = new ResourceIdentifier(property.Value.GetString()); + if (prop.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + resourceType = new ResourceType(prop.Value.GetString()); continue; } - if (property.NameEquals("name"u8)) + if (prop.NameEquals("systemData"u8)) { - name = property.Value.GetString(); + if (prop.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + systemData = ModelReaderWriter.Read(new BinaryData(Encoding.UTF8.GetBytes(prop.Value.GetRawText())), ModelSerializationExtensions.WireOptions, AzureResourceManagerDevTestLabsContext.Default); 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) - { - continue; - } - systemData = ModelReaderWriter.Read(new BinaryData(Encoding.UTF8.GetBytes(property.Value.GetRawText())), ModelSerializationExtensions.WireOptions, AzureResourceManagerDevTestLabsContext.Default); + properties = UserProperties.DeserializeUserProperties(prop.Value, options); continue; } - if (property.NameEquals("properties"u8)) + if (prop.NameEquals("tags"u8)) { - if (property.Value.ValueKind == JsonValueKind.Null) + if (prop.Value.ValueKind == JsonValueKind.Null) { - property.ThrowNonNullablePropertyIsNull(); continue; } - foreach (var property0 in property.Value.EnumerateObject()) + Dictionary dictionary = new Dictionary(); + foreach (var prop0 in prop.Value.EnumerateObject()) { - if (property0.NameEquals("identity"u8)) - { - if (property0.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - identity = DevTestLabUserIdentity.DeserializeDevTestLabUserIdentity(property0.Value, options); - continue; - } - if (property0.NameEquals("secretStore"u8)) - { - if (property0.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - secretStore = DevTestLabUserSecretStore.DeserializeDevTestLabUserSecretStore(property0.Value, options); - continue; - } - if (property0.NameEquals("createdDate"u8)) - { - if (property0.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - createdDate = property0.Value.GetDateTimeOffset("O"); - continue; - } - if (property0.NameEquals("provisioningState"u8)) + if (prop0.Value.ValueKind == JsonValueKind.Null) { - provisioningState = property0.Value.GetString(); - continue; + dictionary.Add(prop0.Name, null); } - if (property0.NameEquals("uniqueIdentifier"u8)) + else { - if (property0.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - uniqueIdentifier = property0.Value.GetGuid(); - continue; + dictionary.Add(prop0.Name, prop0.Value.GetString()); } } + tags = dictionary; 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 DevTestLabUserData( id, name, - type, + resourceType, systemData, - tags ?? new ChangeTrackingDictionary(), + additionalBinaryDataProperties, location, - identity, - secretStore, - createdDate, - provisioningState, - uniqueIdentifier, - serializedAdditionalRawData); + properties, + tags ?? new ChangeTrackingDictionary()); } - 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": @@ -233,22 +218,23 @@ BinaryData IPersistableModel.Write(ModelReaderWriterOptions } } - DevTestLabUserData 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. + DevTestLabUserData IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) => (DevTestLabUserData)PersistableModelCreateCore(data, options); - switch (format) + /// The client options for reading and writing models. + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + + /// The to serialize into . + internal static RequestContent ToRequestContent(DevTestLabUserData devTestLabUserData) + { + if (devTestLabUserData == null) { - case "J": - { - using JsonDocument document = JsonDocument.Parse(data, ModelSerializationExtensions.JsonDocumentOptions); - return DeserializeDevTestLabUserData(document.RootElement, options); - } - default: - throw new FormatException($"The model {nameof(DevTestLabUserData)} does not support reading '{options.Format}' format."); + return null; } + Utf8JsonRequestContent content = new Utf8JsonRequestContent(); + content.JsonWriter.WriteObjectValue(devTestLabUserData, ModelSerializationExtensions.WireOptions); + return content; } - - string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; } } diff --git a/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/DevTestLabUserData.cs b/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/DevTestLabUserData.cs index 633906d1ac8f..686c1cddbe2d 100644 --- a/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/DevTestLabUserData.cs +++ b/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/DevTestLabUserData.cs @@ -13,87 +13,96 @@ namespace Azure.ResourceManager.DevTestLabs { - /// - /// A class representing the DevTestLabUser data model. - /// Profile of a lab user. - /// + /// A user profile. public partial class DevTestLabUserData : 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 DevTestLabUserData(AzureLocation location) : base(location) { + } /// Initializes a new instance of . - /// The id. - /// The name. - /// The resourceType. - /// The systemData. - /// The tags. - /// The location. - /// The identity of the user. - /// The secret store of the user. - /// The creation date of the user profile. - /// The provisioning status of the resource. - /// The unique immutable identifier of a resource (Guid). - /// Keeps track of any properties unknown to the library. - internal DevTestLabUserData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, IDictionary tags, AzureLocation location, DevTestLabUserIdentity identity, DevTestLabUserSecretStore secretStore, DateTimeOffset? createdOn, string provisioningState, Guid? uniqueIdentifier, IDictionary serializedAdditionalRawData) : base(id, name, resourceType, systemData, tags, 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. + /// The geo-location where the resource lives. + /// The properties of the resource. + /// Resource tags. + internal DevTestLabUserData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, IDictionary additionalBinaryDataProperties, AzureLocation location, UserProperties properties, IDictionary tags) : base(id, name, resourceType, systemData, tags, location) { - Identity = identity; - SecretStore = secretStore; - CreatedOn = createdOn; - ProvisioningState = provisioningState; - UniqueIdentifier = uniqueIdentifier; - _serializedAdditionalRawData = serializedAdditionalRawData; + _additionalBinaryDataProperties = additionalBinaryDataProperties; + Properties = properties; } - /// Initializes a new instance of for deserialization. - internal DevTestLabUserData() + /// The properties of the resource. + internal UserProperties Properties { get; set; } + + /// The identity of the user. + public DevTestLabUserIdentity Identity { + get + { + return Properties is null ? default : Properties.Identity; + } + set + { + if (Properties is null) + { + Properties = new UserProperties(); + } + Properties.Identity = value; + } } - /// The identity of the user. - public DevTestLabUserIdentity Identity { get; set; } /// The secret store of the user. - public DevTestLabUserSecretStore SecretStore { get; set; } + public DevTestLabUserSecretStore SecretStore + { + get + { + return Properties is null ? default : Properties.SecretStore; + } + set + { + if (Properties is null) + { + Properties = new UserProperties(); + } + Properties.SecretStore = value; + } + } + /// The creation date of the user profile. - public DateTimeOffset? CreatedOn { get; } + public DateTimeOffset? CreatedOn + { + get + { + return Properties is null ? default : Properties.CreatedOn; + } + } + /// The provisioning status of the resource. - public string ProvisioningState { get; } + public string ProvisioningState + { + get + { + return Properties is null ? default : Properties.ProvisioningState; + } + } + /// The unique immutable identifier of a resource (Guid). - public Guid? UniqueIdentifier { get; } + public Guid? UniqueIdentifier + { + get + { + return Properties is null ? default : Properties.UniqueIdentifier; + } + } } } diff --git a/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/DevTestLabUserResource.Serialization.cs b/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/DevTestLabUserResource.Serialization.cs index 3dc3549aa831..f7bc6a98f623 100644 --- a/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/DevTestLabUserResource.Serialization.cs +++ b/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/DevTestLabUserResource.Serialization.cs @@ -11,19 +11,29 @@ namespace Azure.ResourceManager.DevTestLabs { + /// public partial class DevTestLabUserResource : IJsonModel { - private static DevTestLabUserData s_dataDeserializationInstance; - private static DevTestLabUserData DataDeserializationInstance => s_dataDeserializationInstance ??= new(); + private static IJsonModel s_dataDeserializationInstance; + private static IJsonModel DataDeserializationInstance => s_dataDeserializationInstance ??= new DevTestLabUserData(); + + /// 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); - DevTestLabUserData 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. + DevTestLabUserData 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, AzureResourceManagerDevTestLabsContext.Default); + /// The binary data to be processed. + /// The client options for reading and writing models. DevTestLabUserData IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) => ModelReaderWriter.Read(data, options, AzureResourceManagerDevTestLabsContext.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/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/DevTestLabUserResource.cs b/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/DevTestLabUserResource.cs index 6da7f534b3ca..180910e600b8 100644 --- a/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/DevTestLabUserResource.cs +++ b/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/DevTestLabUserResource.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.DevTestLabs.Models; +using Azure.ResourceManager.Resources; namespace Azure.ResourceManager.DevTestLabs { /// - /// A Class representing a DevTestLabUser 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 GetDevTestLabUserResource method. - /// Otherwise you can get one from its parent resource using the GetDevTestLabUser method. + /// A class representing a DevTestLabUser 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 GetDevTestLabUsers method. /// public partial class DevTestLabUserResource : ArmResource { - /// Generate the resource identifier of a instance. - /// The subscriptionId. - /// The resourceGroupName. - /// The labName. - /// The name. - public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string labName, string name) - { - var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/users/{name}"; - return new ResourceIdentifier(resourceId); - } - - private readonly ClientDiagnostics _devTestLabUserUsersClientDiagnostics; - private readonly UsersRestOperations _devTestLabUserUsersRestClient; + private readonly ClientDiagnostics _usersClientDiagnostics; + private readonly Users _usersRestClient; private readonly DevTestLabUserData _data; - /// Gets the resource type for the operations. public static readonly ResourceType ResourceType = "Microsoft.DevTestLab/labs/users"; - /// Initializes a new instance of the class for mocking. + /// Initializes a new instance of DevTestLabUserResource for mocking. protected DevTestLabUserResource() { } - /// 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 DevTestLabUserResource(ArmClient client, DevTestLabUserData data) : this(client, data.Id) @@ -56,356 +46,94 @@ internal DevTestLabUserResource(ArmClient client, DevTestLabUserData data) : thi _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 DevTestLabUserResource(ArmClient client, ResourceIdentifier id) : base(client, id) { - _devTestLabUserUsersClientDiagnostics = new ClientDiagnostics("Azure.ResourceManager.DevTestLabs", ResourceType.Namespace, Diagnostics); - TryGetApiVersion(ResourceType, out string devTestLabUserUsersApiVersion); - _devTestLabUserUsersRestClient = new UsersRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, devTestLabUserUsersApiVersion); -#if DEBUG - ValidateResourceId(Id); -#endif + TryGetApiVersion(ResourceType, out string devTestLabUserApiVersion); + _usersClientDiagnostics = new ClientDiagnostics("Azure.ResourceManager.DevTestLabs", ResourceType.Namespace, Diagnostics); + _usersRestClient = new Users(_usersClientDiagnostics, Pipeline, Endpoint, devTestLabUserApiVersion ?? "2018-09-15"); + 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 DevTestLabUserData 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 DevTestLabDiskResources in the DevTestLabUser. - /// An object representing collection of DevTestLabDiskResources and their operations over a DevTestLabDiskResource. - public virtual DevTestLabDiskCollection GetDevTestLabDisks() - { - return GetCachedClient(client => new DevTestLabDiskCollection(client, Id)); - } - - /// - /// Get disk. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/users/{userName}/disks/{name} - /// - /// - /// Operation Id - /// Disks_Get - /// - /// - /// Default Api Version - /// 2018-09-15 - /// - /// - /// Resource - /// - /// - /// - /// - /// The name of the disk. - /// Specify the $expand query. Example: 'properties($select=diskType)'. - /// The cancellation token to use. - /// is null. - /// is an empty string, and was expected to be non-empty. - [ForwardsClientCalls] - public virtual async Task> GetDevTestLabDiskAsync(string name, string expand = null, CancellationToken cancellationToken = default) - { - return await GetDevTestLabDisks().GetAsync(name, expand, cancellationToken).ConfigureAwait(false); - } - - /// - /// Get disk. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/users/{userName}/disks/{name} - /// - /// - /// Operation Id - /// Disks_Get - /// - /// - /// Default Api Version - /// 2018-09-15 - /// - /// - /// Resource - /// - /// - /// - /// - /// The name of the disk. - /// Specify the $expand query. Example: 'properties($select=diskType)'. - /// The cancellation token to use. - /// is null. - /// is an empty string, and was expected to be non-empty. - [ForwardsClientCalls] - public virtual Response GetDevTestLabDisk(string name, string expand = null, CancellationToken cancellationToken = default) - { - return GetDevTestLabDisks().Get(name, expand, cancellationToken); - } - - /// Gets a collection of DevTestLabEnvironmentResources in the DevTestLabUser. - /// An object representing collection of DevTestLabEnvironmentResources and their operations over a DevTestLabEnvironmentResource. - public virtual DevTestLabEnvironmentCollection GetDevTestLabEnvironments() - { - return GetCachedClient(client => new DevTestLabEnvironmentCollection(client, Id)); - } - - /// - /// Get environment. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/users/{userName}/environments/{name} - /// - /// - /// Operation Id - /// Environments_Get - /// - /// - /// Default Api Version - /// 2018-09-15 - /// - /// - /// Resource - /// - /// - /// - /// - /// The name of the environment. - /// Specify the $expand query. Example: 'properties($select=deploymentProperties)'. - /// The cancellation token to use. - /// is null. - /// is an empty string, and was expected to be non-empty. - [ForwardsClientCalls] - public virtual async Task> GetDevTestLabEnvironmentAsync(string name, string expand = null, CancellationToken cancellationToken = default) - { - return await GetDevTestLabEnvironments().GetAsync(name, expand, cancellationToken).ConfigureAwait(false); - } - - /// - /// Get environment. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/users/{userName}/environments/{name} - /// - /// - /// Operation Id - /// Environments_Get - /// - /// - /// Default Api Version - /// 2018-09-15 - /// - /// - /// Resource - /// - /// - /// - /// - /// The name of the environment. - /// Specify the $expand query. Example: 'properties($select=deploymentProperties)'. - /// The cancellation token to use. - /// is null. - /// is an empty string, and was expected to be non-empty. - [ForwardsClientCalls] - public virtual Response GetDevTestLabEnvironment(string name, string expand = null, CancellationToken cancellationToken = default) - { - return GetDevTestLabEnvironments().Get(name, expand, cancellationToken); - } - - /// Gets a collection of DevTestLabSecretResources in the DevTestLabUser. - /// An object representing collection of DevTestLabSecretResources and their operations over a DevTestLabSecretResource. - public virtual DevTestLabSecretCollection GetDevTestLabSecrets() - { - return GetCachedClient(client => new DevTestLabSecretCollection(client, Id)); - } - - /// - /// Get secret. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/users/{userName}/secrets/{name} - /// - /// - /// Operation Id - /// Secrets_Get - /// - /// - /// Default Api Version - /// 2018-09-15 - /// - /// - /// Resource - /// - /// - /// - /// - /// The name of the secret. - /// Specify the $expand query. Example: 'properties($select=value)'. - /// The cancellation token to use. - /// is null. - /// is an empty string, and was expected to be non-empty. - [ForwardsClientCalls] - public virtual async Task> GetDevTestLabSecretAsync(string name, string expand = null, CancellationToken cancellationToken = default) - { - return await GetDevTestLabSecrets().GetAsync(name, expand, cancellationToken).ConfigureAwait(false); - } - - /// - /// Get secret. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/users/{userName}/secrets/{name} - /// - /// - /// Operation Id - /// Secrets_Get - /// - /// - /// Default Api Version - /// 2018-09-15 - /// - /// - /// Resource - /// - /// - /// - /// - /// The name of the secret. - /// Specify the $expand query. Example: 'properties($select=value)'. - /// The cancellation token to use. - /// is null. - /// is an empty string, and was expected to be non-empty. - [ForwardsClientCalls] - public virtual Response GetDevTestLabSecret(string name, string expand = null, CancellationToken cancellationToken = default) - { - return GetDevTestLabSecrets().Get(name, expand, cancellationToken); - } - - /// Gets a collection of DevTestLabServiceFabricResources in the DevTestLabUser. - /// An object representing collection of DevTestLabServiceFabricResources and their operations over a DevTestLabServiceFabricResource. - public virtual DevTestLabServiceFabricCollection GetDevTestLabServiceFabrics() - { - return GetCachedClient(client => new DevTestLabServiceFabricCollection(client, Id)); - } - - /// - /// Get service fabric. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/users/{userName}/servicefabrics/{name} - /// - /// - /// Operation Id - /// ServiceFabrics_Get - /// - /// - /// Default Api Version - /// 2018-09-15 - /// - /// - /// Resource - /// - /// - /// - /// - /// The name of the service fabric. - /// Specify the $expand query. Example: 'properties($expand=applicableSchedule)'. - /// The cancellation token to use. - /// is null. - /// is an empty string, and was expected to be non-empty. - [ForwardsClientCalls] - public virtual async Task> GetDevTestLabServiceFabricAsync(string name, string expand = null, CancellationToken cancellationToken = default) + /// Generate the resource identifier for this resource. + /// The subscriptionId. + /// The resourceGroupName. + /// The labName. + /// The name. + public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string labName, string name) { - return await GetDevTestLabServiceFabrics().GetAsync(name, expand, cancellationToken).ConfigureAwait(false); + string resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/users/{name}"; + return new ResourceIdentifier(resourceId); } - /// - /// Get service fabric. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/users/{userName}/servicefabrics/{name} - /// - /// - /// Operation Id - /// ServiceFabrics_Get - /// - /// - /// Default Api Version - /// 2018-09-15 - /// - /// - /// Resource - /// - /// - /// - /// - /// The name of the service fabric. - /// Specify the $expand query. Example: 'properties($expand=applicableSchedule)'. - /// The cancellation token to use. - /// is null. - /// is an empty string, and was expected to be non-empty. - [ForwardsClientCalls] - public virtual Response GetDevTestLabServiceFabric(string name, string expand = null, CancellationToken cancellationToken = default) + /// + [Conditional("DEBUG")] + internal static void ValidateResourceId(ResourceIdentifier id) { - return GetDevTestLabServiceFabrics().Get(name, expand, cancellationToken); + if (id.ResourceType != ResourceType) + { + throw new ArgumentException(string.Format("Invalid resource type {0} expected {1}", id.ResourceType, ResourceType), id); + } } /// /// Get user profile. /// /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/users/{name} + /// Request Path. + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/users/{name}. /// /// - /// Operation Id - /// Users_Get + /// Operation Id. + /// Users_Get. /// /// - /// Default Api Version - /// 2018-09-15 + /// Default Api Version. + /// 2018-09-15. /// /// - /// Resource - /// + /// Resource. + /// . /// /// /// /// Specify the $expand query. Example: 'properties($select=identity)'. /// The cancellation token to use. - public virtual async Task> GetAsync(string expand = null, CancellationToken cancellationToken = default) + public virtual async Task> GetAsync(string expand = default, CancellationToken cancellationToken = default) { - using var scope = _devTestLabUserUsersClientDiagnostics.CreateScope("DevTestLabUserResource.Get"); + using DiagnosticScope scope = _usersClientDiagnostics.CreateScope("DevTestLabUserResource.Get"); scope.Start(); try { - var response = await _devTestLabUserUsersRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, expand, cancellationToken).ConfigureAwait(false); + RequestContext context = new RequestContext + { + CancellationToken = cancellationToken + }; + HttpMessage message = _usersRestClient.CreateGetRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, expand, context); + Response result = await Pipeline.ProcessMessageAsync(message, context).ConfigureAwait(false); + Response response = Response.FromValue(DevTestLabUserData.FromResponse(result), result); if (response.Value == null) + { throw new RequestFailedException(response.GetRawResponse()); + } return Response.FromValue(new DevTestLabUserResource(Client, response.Value), response.GetRawResponse()); } catch (Exception e) @@ -419,34 +147,42 @@ public virtual async Task> GetAsync(string expa /// Get user profile. /// /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/users/{name} + /// Request Path. + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/users/{name}. /// /// - /// Operation Id - /// Users_Get + /// Operation Id. + /// Users_Get. /// /// - /// Default Api Version - /// 2018-09-15 + /// Default Api Version. + /// 2018-09-15. /// /// - /// Resource - /// + /// Resource. + /// . /// /// /// /// Specify the $expand query. Example: 'properties($select=identity)'. /// The cancellation token to use. - public virtual Response Get(string expand = null, CancellationToken cancellationToken = default) + public virtual Response Get(string expand = default, CancellationToken cancellationToken = default) { - using var scope = _devTestLabUserUsersClientDiagnostics.CreateScope("DevTestLabUserResource.Get"); + using DiagnosticScope scope = _usersClientDiagnostics.CreateScope("DevTestLabUserResource.Get"); scope.Start(); try { - var response = _devTestLabUserUsersRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, expand, cancellationToken); + RequestContext context = new RequestContext + { + CancellationToken = cancellationToken + }; + HttpMessage message = _usersRestClient.CreateGetRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, expand, context); + Response result = Pipeline.ProcessMessage(message, context); + Response response = Response.FromValue(DevTestLabUserData.FromResponse(result), result); if (response.Value == null) + { throw new RequestFailedException(response.GetRawResponse()); + } return Response.FromValue(new DevTestLabUserResource(Client, response.Value), response.GetRawResponse()); } catch (Exception e) @@ -457,39 +193,49 @@ public virtual Response Get(string expand = null, Cancel } /// - /// Delete user profile. This operation can take a while to complete. + /// Allows modifying tags of user profiles. All other properties will be ignored. /// /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/users/{name} + /// Request Path. + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/users/{name}. /// /// - /// Operation Id - /// Users_Delete + /// Operation Id. + /// Users_Update. /// /// - /// Default Api Version - /// 2018-09-15 + /// Default Api Version. + /// 2018-09-15. /// /// - /// Resource - /// + /// Resource. + /// . /// /// /// - /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. + /// Profile of a lab user. /// The cancellation token to use. - public virtual async Task DeleteAsync(WaitUntil waitUntil, CancellationToken cancellationToken = default) + /// is null. + public virtual async Task> UpdateAsync(DevTestLabUserPatch patch, CancellationToken cancellationToken = default) { - using var scope = _devTestLabUserUsersClientDiagnostics.CreateScope("DevTestLabUserResource.Delete"); + Argument.AssertNotNull(patch, nameof(patch)); + + using DiagnosticScope scope = _usersClientDiagnostics.CreateScope("DevTestLabUserResource.Update"); scope.Start(); try { - var response = await _devTestLabUserUsersRestClient.DeleteAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, cancellationToken).ConfigureAwait(false); - var operation = new DevTestLabsArmOperation(_devTestLabUserUsersClientDiagnostics, Pipeline, _devTestLabUserUsersRestClient.CreateDeleteRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name).Request, response, OperationFinalStateVia.Location); - if (waitUntil == WaitUntil.Completed) - await operation.WaitForCompletionResponseAsync(cancellationToken).ConfigureAwait(false); - return operation; + RequestContext context = new RequestContext + { + CancellationToken = cancellationToken + }; + HttpMessage message = _usersRestClient.CreateUpdateRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, DevTestLabUserPatch.ToRequestContent(patch), context); + Response result = await Pipeline.ProcessMessageAsync(message, context).ConfigureAwait(false); + Response response = Response.FromValue(DevTestLabUserData.FromResponse(result), result); + if (response.Value == null) + { + throw new RequestFailedException(response.GetRawResponse()); + } + return Response.FromValue(new DevTestLabUserResource(Client, response.Value), response.GetRawResponse()); } catch (Exception e) { @@ -499,39 +245,49 @@ public virtual async Task DeleteAsync(WaitUntil waitUntil, Cancell } /// - /// Delete user profile. This operation can take a while to complete. + /// Allows modifying tags of user profiles. All other properties will be ignored. /// /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/users/{name} + /// Request Path. + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/users/{name}. /// /// - /// Operation Id - /// Users_Delete + /// Operation Id. + /// Users_Update. /// /// - /// Default Api Version - /// 2018-09-15 + /// Default Api Version. + /// 2018-09-15. /// /// - /// Resource - /// + /// Resource. + /// . /// /// /// - /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. + /// Profile of a lab user. /// The cancellation token to use. - public virtual ArmOperation Delete(WaitUntil waitUntil, CancellationToken cancellationToken = default) + /// is null. + public virtual Response Update(DevTestLabUserPatch patch, CancellationToken cancellationToken = default) { - using var scope = _devTestLabUserUsersClientDiagnostics.CreateScope("DevTestLabUserResource.Delete"); + Argument.AssertNotNull(patch, nameof(patch)); + + using DiagnosticScope scope = _usersClientDiagnostics.CreateScope("DevTestLabUserResource.Update"); scope.Start(); try { - var response = _devTestLabUserUsersRestClient.Delete(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, cancellationToken); - var operation = new DevTestLabsArmOperation(_devTestLabUserUsersClientDiagnostics, Pipeline, _devTestLabUserUsersRestClient.CreateDeleteRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name).Request, response, OperationFinalStateVia.Location); - if (waitUntil == WaitUntil.Completed) - operation.WaitForCompletionResponse(cancellationToken); - return operation; + RequestContext context = new RequestContext + { + CancellationToken = cancellationToken + }; + HttpMessage message = _usersRestClient.CreateUpdateRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, DevTestLabUserPatch.ToRequestContent(patch), context); + Response result = Pipeline.ProcessMessage(message, context); + Response response = Response.FromValue(DevTestLabUserData.FromResponse(result), result); + if (response.Value == null) + { + throw new RequestFailedException(response.GetRawResponse()); + } + return Response.FromValue(new DevTestLabUserResource(Client, response.Value), response.GetRawResponse()); } catch (Exception e) { @@ -541,39 +297,46 @@ public virtual ArmOperation Delete(WaitUntil waitUntil, CancellationToken cancel } /// - /// Allows modifying tags of user profiles. All other properties will be ignored. + /// Delete user profile. This operation can take a while to complete. /// /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/users/{name} + /// Request Path. + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/users/{name}. /// /// - /// Operation Id - /// Users_Update + /// Operation Id. + /// Users_Delete. /// /// - /// Default Api Version - /// 2018-09-15 + /// Default Api Version. + /// 2018-09-15. /// /// - /// Resource - /// + /// Resource. + /// . /// /// /// - /// Profile of a lab user. + /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. /// The cancellation token to use. - /// is null. - public virtual async Task> UpdateAsync(DevTestLabUserPatch patch, CancellationToken cancellationToken = default) + public virtual async Task DeleteAsync(WaitUntil waitUntil, CancellationToken cancellationToken = default) { - Argument.AssertNotNull(patch, nameof(patch)); - - using var scope = _devTestLabUserUsersClientDiagnostics.CreateScope("DevTestLabUserResource.Update"); + using DiagnosticScope scope = _usersClientDiagnostics.CreateScope("DevTestLabUserResource.Delete"); scope.Start(); try { - var response = await _devTestLabUserUsersRestClient.UpdateAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, patch, cancellationToken).ConfigureAwait(false); - return Response.FromValue(new DevTestLabUserResource(Client, response.Value), response.GetRawResponse()); + RequestContext context = new RequestContext + { + CancellationToken = cancellationToken + }; + HttpMessage message = _usersRestClient.CreateDeleteRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, context); + Response response = await Pipeline.ProcessMessageAsync(message, context).ConfigureAwait(false); + DevTestLabsArmOperation operation = new DevTestLabsArmOperation(_usersClientDiagnostics, Pipeline, message.Request, response, OperationFinalStateVia.Location); + if (waitUntil == WaitUntil.Completed) + { + await operation.WaitForCompletionResponseAsync(cancellationToken).ConfigureAwait(false); + } + return operation; } catch (Exception e) { @@ -583,39 +346,46 @@ public virtual async Task> UpdateAsync(DevTestL } /// - /// Allows modifying tags of user profiles. All other properties will be ignored. + /// Delete user profile. This operation can take a while to complete. /// /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/users/{name} + /// Request Path. + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/users/{name}. /// /// - /// Operation Id - /// Users_Update + /// Operation Id. + /// Users_Delete. /// /// - /// Default Api Version - /// 2018-09-15 + /// Default Api Version. + /// 2018-09-15. /// /// - /// Resource - /// + /// Resource. + /// . /// /// /// - /// Profile of a lab user. + /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. /// The cancellation token to use. - /// is null. - public virtual Response Update(DevTestLabUserPatch patch, CancellationToken cancellationToken = default) + public virtual ArmOperation Delete(WaitUntil waitUntil, CancellationToken cancellationToken = default) { - Argument.AssertNotNull(patch, nameof(patch)); - - using var scope = _devTestLabUserUsersClientDiagnostics.CreateScope("DevTestLabUserResource.Update"); + using DiagnosticScope scope = _usersClientDiagnostics.CreateScope("DevTestLabUserResource.Delete"); scope.Start(); try { - var response = _devTestLabUserUsersRestClient.Update(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, patch, cancellationToken); - return Response.FromValue(new DevTestLabUserResource(Client, response.Value), response.GetRawResponse()); + RequestContext context = new RequestContext + { + CancellationToken = cancellationToken + }; + HttpMessage message = _usersRestClient.CreateDeleteRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, context); + Response response = Pipeline.ProcessMessage(message, context); + DevTestLabsArmOperation operation = new DevTestLabsArmOperation(_usersClientDiagnostics, Pipeline, message.Request, response, OperationFinalStateVia.Location); + if (waitUntil == WaitUntil.Completed) + { + operation.WaitForCompletionResponse(cancellationToken); + } + return operation; } catch (Exception e) { @@ -624,27 +394,7 @@ public virtual Response Update(DevTestLabUserPatch patch } } - /// - /// Add a tag to the current resource. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/users/{name} - /// - /// - /// Operation Id - /// Users_Get - /// - /// - /// Default Api Version - /// 2018-09-15 - /// - /// - /// Resource - /// - /// - /// - /// + /// Add a tag to the current resource. /// The key for the tag. /// The value for the tag. /// The cancellation token to use. @@ -654,29 +404,35 @@ public virtual async Task> AddTagAsync(string k Argument.AssertNotNull(key, nameof(key)); Argument.AssertNotNull(value, nameof(value)); - using var scope = _devTestLabUserUsersClientDiagnostics.CreateScope("DevTestLabUserResource.AddTag"); + using DiagnosticScope scope = _usersClientDiagnostics.CreateScope("DevTestLabUserResource.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 _devTestLabUserUsersRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, null, cancellationToken).ConfigureAwait(false); - return Response.FromValue(new DevTestLabUserResource(Client, originalResponse.Value), originalResponse.GetRawResponse()); + await GetTagResource().CreateOrUpdateAsync(WaitUntil.Completed, originalTags.Value.Data, cancellationToken).ConfigureAwait(false); + RequestContext context = new RequestContext + { + CancellationToken = cancellationToken + }; + HttpMessage message = _usersRestClient.CreateGetRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, default, context); + Response result = await Pipeline.ProcessMessageAsync(message, context).ConfigureAwait(false); + Response response = Response.FromValue(DevTestLabUserData.FromResponse(result), result); + return Response.FromValue(new DevTestLabUserResource(Client, response.Value), response.GetRawResponse()); } else { - var current = (await GetAsync(cancellationToken: cancellationToken).ConfigureAwait(false)).Value.Data; - var patch = new DevTestLabUserPatch(); - foreach (var tag in current.Tags) + DevTestLabUserData current = (await GetAsync(cancellationToken: cancellationToken).ConfigureAwait(false)).Value.Data; + DevTestLabUserPatch patch = new DevTestLabUserPatch(); + 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) @@ -686,27 +442,7 @@ public virtual async Task> AddTagAsync(string k } } - /// - /// Add a tag to the current resource. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/users/{name} - /// - /// - /// Operation Id - /// Users_Get - /// - /// - /// Default Api Version - /// 2018-09-15 - /// - /// - /// Resource - /// - /// - /// - /// + /// Add a tag to the current resource. /// The key for the tag. /// The value for the tag. /// The cancellation token to use. @@ -716,29 +452,35 @@ public virtual Response AddTag(string key, string value, Argument.AssertNotNull(key, nameof(key)); Argument.AssertNotNull(value, nameof(value)); - using var scope = _devTestLabUserUsersClientDiagnostics.CreateScope("DevTestLabUserResource.AddTag"); + using DiagnosticScope scope = _usersClientDiagnostics.CreateScope("DevTestLabUserResource.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 = _devTestLabUserUsersRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, null, cancellationToken); - return Response.FromValue(new DevTestLabUserResource(Client, originalResponse.Value), originalResponse.GetRawResponse()); + GetTagResource().CreateOrUpdate(WaitUntil.Completed, originalTags.Value.Data, cancellationToken); + RequestContext context = new RequestContext + { + CancellationToken = cancellationToken + }; + HttpMessage message = _usersRestClient.CreateGetRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, default, context); + Response result = Pipeline.ProcessMessage(message, context); + Response response = Response.FromValue(DevTestLabUserData.FromResponse(result), result); + return Response.FromValue(new DevTestLabUserResource(Client, response.Value), response.GetRawResponse()); } else { - var current = Get(cancellationToken: cancellationToken).Value.Data; - var patch = new DevTestLabUserPatch(); - foreach (var tag in current.Tags) + DevTestLabUserData current = Get(cancellationToken: cancellationToken).Value.Data; + DevTestLabUserPatch patch = new DevTestLabUserPatch(); + 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) @@ -748,54 +490,40 @@ public virtual Response AddTag(string key, string value, } } - /// - /// Replace the tags on the resource with the given set. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/users/{name} - /// - /// - /// Operation Id - /// Users_Get - /// - /// - /// Default Api Version - /// 2018-09-15 - /// - /// - /// 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 = _devTestLabUserUsersClientDiagnostics.CreateScope("DevTestLabUserResource.SetTags"); + using DiagnosticScope scope = _usersClientDiagnostics.CreateScope("DevTestLabUserResource.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 _devTestLabUserUsersRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, null, cancellationToken).ConfigureAwait(false); - return Response.FromValue(new DevTestLabUserResource(Client, originalResponse.Value), originalResponse.GetRawResponse()); + await GetTagResource().CreateOrUpdateAsync(WaitUntil.Completed, originalTags.Value.Data, cancellationToken).ConfigureAwait(false); + RequestContext context = new RequestContext + { + CancellationToken = cancellationToken + }; + HttpMessage message = _usersRestClient.CreateGetRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, default, context); + Response result = await Pipeline.ProcessMessageAsync(message, context).ConfigureAwait(false); + Response response = Response.FromValue(DevTestLabUserData.FromResponse(result), result); + return Response.FromValue(new DevTestLabUserResource(Client, response.Value), response.GetRawResponse()); } else { - var current = (await GetAsync(cancellationToken: cancellationToken).ConfigureAwait(false)).Value.Data; - var patch = new DevTestLabUserPatch(); + DevTestLabUserData current = (await GetAsync(cancellationToken: cancellationToken).ConfigureAwait(false)).Value.Data; + DevTestLabUserPatch patch = new DevTestLabUserPatch(); 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) @@ -805,54 +533,40 @@ public virtual async Task> SetTagsAsync(IDictio } } - /// - /// Replace the tags on the resource with the given set. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/users/{name} - /// - /// - /// Operation Id - /// Users_Get - /// - /// - /// Default Api Version - /// 2018-09-15 - /// - /// - /// 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 = _devTestLabUserUsersClientDiagnostics.CreateScope("DevTestLabUserResource.SetTags"); + using DiagnosticScope scope = _usersClientDiagnostics.CreateScope("DevTestLabUserResource.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 = _devTestLabUserUsersRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, null, cancellationToken); - return Response.FromValue(new DevTestLabUserResource(Client, originalResponse.Value), originalResponse.GetRawResponse()); + GetTagResource().CreateOrUpdate(WaitUntil.Completed, originalTags.Value.Data, cancellationToken); + RequestContext context = new RequestContext + { + CancellationToken = cancellationToken + }; + HttpMessage message = _usersRestClient.CreateGetRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, default, context); + Response result = Pipeline.ProcessMessage(message, context); + Response response = Response.FromValue(DevTestLabUserData.FromResponse(result), result); + return Response.FromValue(new DevTestLabUserResource(Client, response.Value), response.GetRawResponse()); } else { - var current = Get(cancellationToken: cancellationToken).Value.Data; - var patch = new DevTestLabUserPatch(); + DevTestLabUserData current = Get(cancellationToken: cancellationToken).Value.Data; + DevTestLabUserPatch patch = new DevTestLabUserPatch(); 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) @@ -862,27 +576,7 @@ public virtual Response SetTags(IDictionary - /// Removes a tag by key from the resource. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/users/{name} - /// - /// - /// Operation Id - /// Users_Get - /// - /// - /// Default Api Version - /// 2018-09-15 - /// - /// - /// Resource - /// - /// - /// - /// + /// Removes a tag by key from the resource. /// The key for the tag. /// The cancellation token to use. /// is null. @@ -890,29 +584,35 @@ public virtual async Task> RemoveTagAsync(strin { Argument.AssertNotNull(key, nameof(key)); - using var scope = _devTestLabUserUsersClientDiagnostics.CreateScope("DevTestLabUserResource.RemoveTag"); + using DiagnosticScope scope = _usersClientDiagnostics.CreateScope("DevTestLabUserResource.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 _devTestLabUserUsersRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, null, cancellationToken).ConfigureAwait(false); - return Response.FromValue(new DevTestLabUserResource(Client, originalResponse.Value), originalResponse.GetRawResponse()); + await GetTagResource().CreateOrUpdateAsync(WaitUntil.Completed, originalTags.Value.Data, cancellationToken).ConfigureAwait(false); + RequestContext context = new RequestContext + { + CancellationToken = cancellationToken + }; + HttpMessage message = _usersRestClient.CreateGetRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, default, context); + Response result = await Pipeline.ProcessMessageAsync(message, context).ConfigureAwait(false); + Response response = Response.FromValue(DevTestLabUserData.FromResponse(result), result); + return Response.FromValue(new DevTestLabUserResource(Client, response.Value), response.GetRawResponse()); } else { - var current = (await GetAsync(cancellationToken: cancellationToken).ConfigureAwait(false)).Value.Data; - var patch = new DevTestLabUserPatch(); - foreach (var tag in current.Tags) + DevTestLabUserData current = (await GetAsync(cancellationToken: cancellationToken).ConfigureAwait(false)).Value.Data; + DevTestLabUserPatch patch = new DevTestLabUserPatch(); + 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) @@ -922,27 +622,7 @@ public virtual async Task> RemoveTagAsync(strin } } - /// - /// Removes a tag by key from the resource. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/users/{name} - /// - /// - /// Operation Id - /// Users_Get - /// - /// - /// Default Api Version - /// 2018-09-15 - /// - /// - /// Resource - /// - /// - /// - /// + /// Removes a tag by key from the resource. /// The key for the tag. /// The cancellation token to use. /// is null. @@ -950,29 +630,35 @@ public virtual Response RemoveTag(string key, Cancellati { Argument.AssertNotNull(key, nameof(key)); - using var scope = _devTestLabUserUsersClientDiagnostics.CreateScope("DevTestLabUserResource.RemoveTag"); + using DiagnosticScope scope = _usersClientDiagnostics.CreateScope("DevTestLabUserResource.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 = _devTestLabUserUsersRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, null, cancellationToken); - return Response.FromValue(new DevTestLabUserResource(Client, originalResponse.Value), originalResponse.GetRawResponse()); + GetTagResource().CreateOrUpdate(WaitUntil.Completed, originalTags.Value.Data, cancellationToken); + RequestContext context = new RequestContext + { + CancellationToken = cancellationToken + }; + HttpMessage message = _usersRestClient.CreateGetRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, default, context); + Response result = Pipeline.ProcessMessage(message, context); + Response response = Response.FromValue(DevTestLabUserData.FromResponse(result), result); + return Response.FromValue(new DevTestLabUserResource(Client, response.Value), response.GetRawResponse()); } else { - var current = Get(cancellationToken: cancellationToken).Value.Data; - var patch = new DevTestLabUserPatch(); - foreach (var tag in current.Tags) + DevTestLabUserData current = Get(cancellationToken: cancellationToken).Value.Data; + DevTestLabUserPatch patch = new DevTestLabUserPatch(); + 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) @@ -981,5 +667,145 @@ public virtual Response RemoveTag(string key, Cancellati throw; } } + + /// Gets a collection of DevTestLabDisks in the . + /// An object representing collection of DevTestLabDisks and their operations over a DevTestLabDiskResource. + public virtual DevTestLabDiskCollection GetDevTestLabDisks() + { + return GetCachedClient(client => new DevTestLabDiskCollection(client, Id)); + } + + /// Get disk. + /// The name of the disk. + /// Specify the $expand query. Example: 'properties($select=diskType)'. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public virtual async Task> GetDevTestLabDiskAsync(string name, string expand = default, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(name, nameof(name)); + + return await GetDevTestLabDisks().GetAsync(name, expand, cancellationToken).ConfigureAwait(false); + } + + /// Get disk. + /// The name of the disk. + /// Specify the $expand query. Example: 'properties($select=diskType)'. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public virtual Response GetDevTestLabDisk(string name, string expand = default, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(name, nameof(name)); + + return GetDevTestLabDisks().Get(name, expand, cancellationToken); + } + + /// Gets a collection of DevTestLabEnvironments in the . + /// An object representing collection of DevTestLabEnvironments and their operations over a DevTestLabEnvironmentResource. + public virtual DevTestLabEnvironmentCollection GetDevTestLabEnvironments() + { + return GetCachedClient(client => new DevTestLabEnvironmentCollection(client, Id)); + } + + /// Get environment. + /// The name of the environment. + /// Specify the $expand query. Example: 'properties($select=deploymentProperties)'. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public virtual async Task> GetDevTestLabEnvironmentAsync(string name, string expand = default, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(name, nameof(name)); + + return await GetDevTestLabEnvironments().GetAsync(name, expand, cancellationToken).ConfigureAwait(false); + } + + /// Get environment. + /// The name of the environment. + /// Specify the $expand query. Example: 'properties($select=deploymentProperties)'. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public virtual Response GetDevTestLabEnvironment(string name, string expand = default, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(name, nameof(name)); + + return GetDevTestLabEnvironments().Get(name, expand, cancellationToken); + } + + /// Gets a collection of DevTestLabSecrets in the . + /// An object representing collection of DevTestLabSecrets and their operations over a DevTestLabSecretResource. + public virtual DevTestLabSecretCollection GetDevTestLabSecrets() + { + return GetCachedClient(client => new DevTestLabSecretCollection(client, Id)); + } + + /// Get secret. + /// The name of the secret. + /// Specify the $expand query. Example: 'properties($select=value)'. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public virtual async Task> GetDevTestLabSecretAsync(string name, string expand = default, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(name, nameof(name)); + + return await GetDevTestLabSecrets().GetAsync(name, expand, cancellationToken).ConfigureAwait(false); + } + + /// Get secret. + /// The name of the secret. + /// Specify the $expand query. Example: 'properties($select=value)'. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public virtual Response GetDevTestLabSecret(string name, string expand = default, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(name, nameof(name)); + + return GetDevTestLabSecrets().Get(name, expand, cancellationToken); + } + + /// Gets a collection of DevTestLabServiceFabrics in the . + /// An object representing collection of DevTestLabServiceFabrics and their operations over a DevTestLabServiceFabricResource. + public virtual DevTestLabServiceFabricCollection GetDevTestLabServiceFabrics() + { + return GetCachedClient(client => new DevTestLabServiceFabricCollection(client, Id)); + } + + /// Get service fabric. + /// The name of the service fabric. + /// Specify the $expand query. Example: 'properties($expand=applicableSchedule)'. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public virtual async Task> GetDevTestLabServiceFabricAsync(string name, string expand = default, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(name, nameof(name)); + + return await GetDevTestLabServiceFabrics().GetAsync(name, expand, cancellationToken).ConfigureAwait(false); + } + + /// Get service fabric. + /// The name of the service fabric. + /// Specify the $expand query. Example: 'properties($expand=applicableSchedule)'. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public virtual Response GetDevTestLabServiceFabric(string name, string expand = default, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(name, nameof(name)); + + return GetDevTestLabServiceFabrics().Get(name, expand, cancellationToken); + } } } diff --git a/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/DevTestLabVirtualNetworkCollection.cs b/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/DevTestLabVirtualNetworkCollection.cs index 1684222c4218..04ef63cc217d 100644 --- a/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/DevTestLabVirtualNetworkCollection.cs +++ b/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/DevTestLabVirtualNetworkCollection.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.DevTestLabs { @@ -24,51 +25,49 @@ namespace Azure.ResourceManager.DevTestLabs /// public partial class DevTestLabVirtualNetworkCollection : ArmCollection, IEnumerable, IAsyncEnumerable { - private readonly ClientDiagnostics _devTestLabVirtualNetworkVirtualNetworksClientDiagnostics; - private readonly VirtualNetworksRestOperations _devTestLabVirtualNetworkVirtualNetworksRestClient; + private readonly ClientDiagnostics _virtualNetworksClientDiagnostics; + private readonly VirtualNetworks _virtualNetworksRestClient; - /// Initializes a new instance of the class for mocking. + /// Initializes a new instance of DevTestLabVirtualNetworkCollection for mocking. protected DevTestLabVirtualNetworkCollection() { } - /// 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 DevTestLabVirtualNetworkCollection(ArmClient client, ResourceIdentifier id) : base(client, id) { - _devTestLabVirtualNetworkVirtualNetworksClientDiagnostics = new ClientDiagnostics("Azure.ResourceManager.DevTestLabs", DevTestLabVirtualNetworkResource.ResourceType.Namespace, Diagnostics); - TryGetApiVersion(DevTestLabVirtualNetworkResource.ResourceType, out string devTestLabVirtualNetworkVirtualNetworksApiVersion); - _devTestLabVirtualNetworkVirtualNetworksRestClient = new VirtualNetworksRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, devTestLabVirtualNetworkVirtualNetworksApiVersion); -#if DEBUG - ValidateResourceId(Id); -#endif + TryGetApiVersion(DevTestLabVirtualNetworkResource.ResourceType, out string devTestLabVirtualNetworkApiVersion); + _virtualNetworksClientDiagnostics = new ClientDiagnostics("Azure.ResourceManager.DevTestLabs", DevTestLabVirtualNetworkResource.ResourceType.Namespace, Diagnostics); + _virtualNetworksRestClient = new VirtualNetworks(_virtualNetworksClientDiagnostics, Pipeline, Endpoint, devTestLabVirtualNetworkApiVersion ?? "2018-09-15"); + ValidateResourceId(id); } + /// + [Conditional("DEBUG")] internal static void ValidateResourceId(ResourceIdentifier id) { if (id.ResourceType != DevTestLabResource.ResourceType) - throw new ArgumentException(string.Format(CultureInfo.CurrentCulture, "Invalid resource type {0} expected {1}", id.ResourceType, DevTestLabResource.ResourceType), nameof(id)); + { + throw new ArgumentException(string.Format("Invalid resource type {0} expected {1}", id.ResourceType, DevTestLabResource.ResourceType), id); + } } /// /// Create or replace an existing virtual network. This operation can take a while to complete. /// /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/virtualnetworks/{name} - /// - /// - /// Operation Id - /// VirtualNetworks_CreateOrUpdate + /// Request Path. + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/virtualnetworks/{name}. /// /// - /// Default Api Version - /// 2018-09-15 + /// Operation Id. + /// VirtualNetworks_CreateOrUpdate. /// /// - /// Resource - /// + /// Default Api Version. + /// 2018-09-15. /// /// /// @@ -76,21 +75,34 @@ internal static void ValidateResourceId(ResourceIdentifier id) /// The name of the virtual network. /// A virtual network. /// 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 name, DevTestLabVirtualNetworkData data, CancellationToken cancellationToken = default) { Argument.AssertNotNullOrEmpty(name, nameof(name)); Argument.AssertNotNull(data, nameof(data)); - using var scope = _devTestLabVirtualNetworkVirtualNetworksClientDiagnostics.CreateScope("DevTestLabVirtualNetworkCollection.CreateOrUpdate"); + using DiagnosticScope scope = _virtualNetworksClientDiagnostics.CreateScope("DevTestLabVirtualNetworkCollection.CreateOrUpdate"); scope.Start(); try { - var response = await _devTestLabVirtualNetworkVirtualNetworksRestClient.CreateOrUpdateAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, name, data, cancellationToken).ConfigureAwait(false); - var operation = new DevTestLabsArmOperation(new DevTestLabVirtualNetworkOperationSource(Client), _devTestLabVirtualNetworkVirtualNetworksClientDiagnostics, Pipeline, _devTestLabVirtualNetworkVirtualNetworksRestClient.CreateCreateOrUpdateRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, name, data).Request, response, OperationFinalStateVia.Location); + RequestContext context = new RequestContext + { + CancellationToken = cancellationToken + }; + HttpMessage message = _virtualNetworksRestClient.CreateCreateOrUpdateRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, name, DevTestLabVirtualNetworkData.ToRequestContent(data), context); + Response response = await Pipeline.ProcessMessageAsync(message, context).ConfigureAwait(false); + DevTestLabsArmOperation operation = new DevTestLabsArmOperation( + new DevTestLabVirtualNetworkOperationSource(Client), + _virtualNetworksClientDiagnostics, + Pipeline, + message.Request, + response, + OperationFinalStateVia.Location); if (waitUntil == WaitUntil.Completed) + { await operation.WaitForCompletionAsync(cancellationToken).ConfigureAwait(false); + } return operation; } catch (Exception e) @@ -104,20 +116,16 @@ public virtual async Task> Create /// Create or replace an existing virtual network. This operation can take a while to complete. /// /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/virtualnetworks/{name} + /// Request Path. + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/virtualnetworks/{name}. /// /// - /// Operation Id - /// VirtualNetworks_CreateOrUpdate + /// Operation Id. + /// VirtualNetworks_CreateOrUpdate. /// /// - /// Default Api Version - /// 2018-09-15 - /// - /// - /// Resource - /// + /// Default Api Version. + /// 2018-09-15. /// /// /// @@ -125,21 +133,34 @@ public virtual async Task> Create /// The name of the virtual network. /// A virtual network. /// 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 name, DevTestLabVirtualNetworkData data, CancellationToken cancellationToken = default) { Argument.AssertNotNullOrEmpty(name, nameof(name)); Argument.AssertNotNull(data, nameof(data)); - using var scope = _devTestLabVirtualNetworkVirtualNetworksClientDiagnostics.CreateScope("DevTestLabVirtualNetworkCollection.CreateOrUpdate"); + using DiagnosticScope scope = _virtualNetworksClientDiagnostics.CreateScope("DevTestLabVirtualNetworkCollection.CreateOrUpdate"); scope.Start(); try { - var response = _devTestLabVirtualNetworkVirtualNetworksRestClient.CreateOrUpdate(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, name, data, cancellationToken); - var operation = new DevTestLabsArmOperation(new DevTestLabVirtualNetworkOperationSource(Client), _devTestLabVirtualNetworkVirtualNetworksClientDiagnostics, Pipeline, _devTestLabVirtualNetworkVirtualNetworksRestClient.CreateCreateOrUpdateRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, name, data).Request, response, OperationFinalStateVia.Location); + RequestContext context = new RequestContext + { + CancellationToken = cancellationToken + }; + HttpMessage message = _virtualNetworksRestClient.CreateCreateOrUpdateRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, name, DevTestLabVirtualNetworkData.ToRequestContent(data), context); + Response response = Pipeline.ProcessMessage(message, context); + DevTestLabsArmOperation operation = new DevTestLabsArmOperation( + new DevTestLabVirtualNetworkOperationSource(Client), + _virtualNetworksClientDiagnostics, + Pipeline, + message.Request, + response, + OperationFinalStateVia.Location); if (waitUntil == WaitUntil.Completed) + { operation.WaitForCompletion(cancellationToken); + } return operation; } catch (Exception e) @@ -153,39 +174,43 @@ public virtual ArmOperation CreateOrUpdate(Wai /// Get virtual network. /// /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/virtualnetworks/{name} + /// Request Path. + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/virtualnetworks/{name}. /// /// - /// Operation Id - /// VirtualNetworks_Get + /// Operation Id. + /// VirtualNetworks_Get. /// /// - /// Default Api Version - /// 2018-09-15 - /// - /// - /// Resource - /// + /// Default Api Version. + /// 2018-09-15. /// /// /// /// The name of the virtual network. /// Specify the $expand query. Example: 'properties($expand=externalSubnets)'. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. - public virtual async Task> GetAsync(string name, string expand = null, CancellationToken cancellationToken = default) + /// is an empty string, and was expected to be non-empty. + public virtual async Task> GetAsync(string name, string expand = default, CancellationToken cancellationToken = default) { Argument.AssertNotNullOrEmpty(name, nameof(name)); - using var scope = _devTestLabVirtualNetworkVirtualNetworksClientDiagnostics.CreateScope("DevTestLabVirtualNetworkCollection.Get"); + using DiagnosticScope scope = _virtualNetworksClientDiagnostics.CreateScope("DevTestLabVirtualNetworkCollection.Get"); scope.Start(); try { - var response = await _devTestLabVirtualNetworkVirtualNetworksRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, name, expand, cancellationToken).ConfigureAwait(false); + RequestContext context = new RequestContext + { + CancellationToken = cancellationToken + }; + HttpMessage message = _virtualNetworksRestClient.CreateGetRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, name, expand, context); + Response result = await Pipeline.ProcessMessageAsync(message, context).ConfigureAwait(false); + Response response = Response.FromValue(DevTestLabVirtualNetworkData.FromResponse(result), result); if (response.Value == null) + { throw new RequestFailedException(response.GetRawResponse()); + } return Response.FromValue(new DevTestLabVirtualNetworkResource(Client, response.Value), response.GetRawResponse()); } catch (Exception e) @@ -199,39 +224,43 @@ public virtual async Task> GetAsync(s /// Get virtual network. /// /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/virtualnetworks/{name} - /// - /// - /// Operation Id - /// VirtualNetworks_Get + /// Request Path. + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/virtualnetworks/{name}. /// /// - /// Default Api Version - /// 2018-09-15 + /// Operation Id. + /// VirtualNetworks_Get. /// /// - /// Resource - /// + /// Default Api Version. + /// 2018-09-15. /// /// /// /// The name of the virtual network. /// Specify the $expand query. Example: 'properties($expand=externalSubnets)'. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. - public virtual Response Get(string name, string expand = null, CancellationToken cancellationToken = default) + /// is an empty string, and was expected to be non-empty. + public virtual Response Get(string name, string expand = default, CancellationToken cancellationToken = default) { Argument.AssertNotNullOrEmpty(name, nameof(name)); - using var scope = _devTestLabVirtualNetworkVirtualNetworksClientDiagnostics.CreateScope("DevTestLabVirtualNetworkCollection.Get"); + using DiagnosticScope scope = _virtualNetworksClientDiagnostics.CreateScope("DevTestLabVirtualNetworkCollection.Get"); scope.Start(); try { - var response = _devTestLabVirtualNetworkVirtualNetworksRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, name, expand, cancellationToken); + RequestContext context = new RequestContext + { + CancellationToken = cancellationToken + }; + HttpMessage message = _virtualNetworksRestClient.CreateGetRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, name, expand, context); + Response result = Pipeline.ProcessMessage(message, context); + Response response = Response.FromValue(DevTestLabVirtualNetworkData.FromResponse(result), result); if (response.Value == null) + { throw new RequestFailedException(response.GetRawResponse()); + } return Response.FromValue(new DevTestLabVirtualNetworkResource(Client, response.Value), response.GetRawResponse()); } catch (Exception e) @@ -245,20 +274,16 @@ public virtual Response Get(string name, strin /// List virtual networks in a given lab. /// /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/virtualnetworks + /// Request Path. + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/virtualnetworks. /// /// - /// Operation Id - /// VirtualNetworks_List + /// Operation Id. + /// VirtualNetworks_List. /// /// - /// Default Api Version - /// 2018-09-15 - /// - /// - /// Resource - /// + /// Default Api Version. + /// 2018-09-15. /// /// /// @@ -267,32 +292,39 @@ public virtual Response Get(string name, strin /// The maximum number of resources to return from the operation. Example: '$top=10'. /// The ordering expression for the results, using OData notation. Example: '$orderby=name desc'. /// The cancellation token to use. - /// An async collection of that may take multiple service requests to iterate over. - public virtual AsyncPageable GetAllAsync(string expand = null, string filter = null, int? top = null, string orderby = null, CancellationToken cancellationToken = default) + /// A collection of that may take multiple service requests to iterate over. + public virtual AsyncPageable GetAllAsync(string expand = default, string filter = default, int? top = default, string @orderby = default, CancellationToken cancellationToken = default) { - HttpMessage FirstPageRequest(int? pageSizeHint) => _devTestLabVirtualNetworkVirtualNetworksRestClient.CreateListRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, expand, filter, top, orderby); - HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _devTestLabVirtualNetworkVirtualNetworksRestClient.CreateListNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName, Id.Name, expand, filter, top, orderby); - return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new DevTestLabVirtualNetworkResource(Client, DevTestLabVirtualNetworkData.DeserializeDevTestLabVirtualNetworkData(e)), _devTestLabVirtualNetworkVirtualNetworksClientDiagnostics, Pipeline, "DevTestLabVirtualNetworkCollection.GetAll", "value", "nextLink", cancellationToken); + RequestContext context = new RequestContext + { + CancellationToken = cancellationToken + }; + return new AsyncPageableWrapper(new VirtualNetworksGetAllAsyncCollectionResultOfT( + _virtualNetworksRestClient, + Id.SubscriptionId, + Id.ResourceGroupName, + Id.Name, + expand, + filter, + top, + @orderby, + context), data => new DevTestLabVirtualNetworkResource(Client, data)); } /// /// List virtual networks in a given lab. /// /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/virtualnetworks - /// - /// - /// Operation Id - /// VirtualNetworks_List + /// Request Path. + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/virtualnetworks. /// /// - /// Default Api Version - /// 2018-09-15 + /// Operation Id. + /// VirtualNetworks_List. /// /// - /// Resource - /// + /// Default Api Version. + /// 2018-09-15. /// /// /// @@ -302,48 +334,73 @@ public virtual AsyncPageable GetAllAsync(strin /// The ordering expression for the results, using OData notation. Example: '$orderby=name desc'. /// The cancellation token to use. /// A collection of that may take multiple service requests to iterate over. - public virtual Pageable GetAll(string expand = null, string filter = null, int? top = null, string orderby = null, CancellationToken cancellationToken = default) + public virtual Pageable GetAll(string expand = default, string filter = default, int? top = default, string @orderby = default, CancellationToken cancellationToken = default) { - HttpMessage FirstPageRequest(int? pageSizeHint) => _devTestLabVirtualNetworkVirtualNetworksRestClient.CreateListRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, expand, filter, top, orderby); - HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _devTestLabVirtualNetworkVirtualNetworksRestClient.CreateListNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName, Id.Name, expand, filter, top, orderby); - return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new DevTestLabVirtualNetworkResource(Client, DevTestLabVirtualNetworkData.DeserializeDevTestLabVirtualNetworkData(e)), _devTestLabVirtualNetworkVirtualNetworksClientDiagnostics, Pipeline, "DevTestLabVirtualNetworkCollection.GetAll", "value", "nextLink", cancellationToken); + RequestContext context = new RequestContext + { + CancellationToken = cancellationToken + }; + return new PageableWrapper(new VirtualNetworksGetAllCollectionResultOfT( + _virtualNetworksRestClient, + Id.SubscriptionId, + Id.ResourceGroupName, + Id.Name, + expand, + filter, + top, + @orderby, + context), data => new DevTestLabVirtualNetworkResource(Client, data)); } /// /// Checks to see if the resource exists in azure. /// /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/virtualnetworks/{name} - /// - /// - /// Operation Id - /// VirtualNetworks_Get + /// Request Path. + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/virtualnetworks/{name}. /// /// - /// Default Api Version - /// 2018-09-15 + /// Operation Id. + /// VirtualNetworks_Get. /// /// - /// Resource - /// + /// Default Api Version. + /// 2018-09-15. /// /// /// /// The name of the virtual network. /// Specify the $expand query. Example: 'properties($expand=externalSubnets)'. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. - public virtual async Task> ExistsAsync(string name, string expand = null, CancellationToken cancellationToken = default) + /// is an empty string, and was expected to be non-empty. + public virtual async Task> ExistsAsync(string name, string expand = default, CancellationToken cancellationToken = default) { Argument.AssertNotNullOrEmpty(name, nameof(name)); - using var scope = _devTestLabVirtualNetworkVirtualNetworksClientDiagnostics.CreateScope("DevTestLabVirtualNetworkCollection.Exists"); + using DiagnosticScope scope = _virtualNetworksClientDiagnostics.CreateScope("DevTestLabVirtualNetworkCollection.Exists"); scope.Start(); try { - var response = await _devTestLabVirtualNetworkVirtualNetworksRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, name, expand, cancellationToken: cancellationToken).ConfigureAwait(false); + RequestContext context = new RequestContext + { + CancellationToken = cancellationToken + }; + HttpMessage message = _virtualNetworksRestClient.CreateGetRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, name, expand, context); + await Pipeline.SendAsync(message, context.CancellationToken).ConfigureAwait(false); + Response result = message.Response; + Response response = default; + switch (result.Status) + { + case 200: + response = Response.FromValue(DevTestLabVirtualNetworkData.FromResponse(result), result); + break; + case 404: + response = Response.FromValue((DevTestLabVirtualNetworkData)null, result); + break; + default: + throw new RequestFailedException(result); + } return Response.FromValue(response.Value != null, response.GetRawResponse()); } catch (Exception e) @@ -357,37 +414,51 @@ public virtual async Task> ExistsAsync(string name, string expand /// Checks to see if the resource exists in azure. /// /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/virtualnetworks/{name} + /// Request Path. + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/virtualnetworks/{name}. /// /// - /// Operation Id - /// VirtualNetworks_Get + /// Operation Id. + /// VirtualNetworks_Get. /// /// - /// Default Api Version - /// 2018-09-15 - /// - /// - /// Resource - /// + /// Default Api Version. + /// 2018-09-15. /// /// /// /// The name of the virtual network. /// Specify the $expand query. Example: 'properties($expand=externalSubnets)'. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. - public virtual Response Exists(string name, string expand = null, CancellationToken cancellationToken = default) + /// is an empty string, and was expected to be non-empty. + public virtual Response Exists(string name, string expand = default, CancellationToken cancellationToken = default) { Argument.AssertNotNullOrEmpty(name, nameof(name)); - using var scope = _devTestLabVirtualNetworkVirtualNetworksClientDiagnostics.CreateScope("DevTestLabVirtualNetworkCollection.Exists"); + using DiagnosticScope scope = _virtualNetworksClientDiagnostics.CreateScope("DevTestLabVirtualNetworkCollection.Exists"); scope.Start(); try { - var response = _devTestLabVirtualNetworkVirtualNetworksRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, name, expand, cancellationToken: cancellationToken); + RequestContext context = new RequestContext + { + CancellationToken = cancellationToken + }; + HttpMessage message = _virtualNetworksRestClient.CreateGetRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, name, expand, context); + Pipeline.Send(message, context.CancellationToken); + Response result = message.Response; + Response response = default; + switch (result.Status) + { + case 200: + response = Response.FromValue(DevTestLabVirtualNetworkData.FromResponse(result), result); + break; + case 404: + response = Response.FromValue((DevTestLabVirtualNetworkData)null, result); + break; + default: + throw new RequestFailedException(result); + } return Response.FromValue(response.Value != null, response.GetRawResponse()); } catch (Exception e) @@ -401,39 +472,55 @@ public virtual Response Exists(string name, string expand = null, Cancella /// Tries to get details for this resource from the service. /// /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/virtualnetworks/{name} - /// - /// - /// Operation Id - /// VirtualNetworks_Get + /// Request Path. + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/virtualnetworks/{name}. /// /// - /// Default Api Version - /// 2018-09-15 + /// Operation Id. + /// VirtualNetworks_Get. /// /// - /// Resource - /// + /// Default Api Version. + /// 2018-09-15. /// /// /// /// The name of the virtual network. /// Specify the $expand query. Example: 'properties($expand=externalSubnets)'. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. - public virtual async Task> GetIfExistsAsync(string name, string expand = null, CancellationToken cancellationToken = default) + /// is an empty string, and was expected to be non-empty. + public virtual async Task> GetIfExistsAsync(string name, string expand = default, CancellationToken cancellationToken = default) { Argument.AssertNotNullOrEmpty(name, nameof(name)); - using var scope = _devTestLabVirtualNetworkVirtualNetworksClientDiagnostics.CreateScope("DevTestLabVirtualNetworkCollection.GetIfExists"); + using DiagnosticScope scope = _virtualNetworksClientDiagnostics.CreateScope("DevTestLabVirtualNetworkCollection.GetIfExists"); scope.Start(); try { - var response = await _devTestLabVirtualNetworkVirtualNetworksRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, name, expand, cancellationToken: cancellationToken).ConfigureAwait(false); + RequestContext context = new RequestContext + { + CancellationToken = cancellationToken + }; + HttpMessage message = _virtualNetworksRestClient.CreateGetRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, name, expand, context); + await Pipeline.SendAsync(message, context.CancellationToken).ConfigureAwait(false); + Response result = message.Response; + Response response = default; + switch (result.Status) + { + case 200: + response = Response.FromValue(DevTestLabVirtualNetworkData.FromResponse(result), result); + break; + case 404: + response = Response.FromValue((DevTestLabVirtualNetworkData)null, result); + break; + default: + throw new RequestFailedException(result); + } if (response.Value == null) + { return new NoValueResponse(response.GetRawResponse()); + } return Response.FromValue(new DevTestLabVirtualNetworkResource(Client, response.Value), response.GetRawResponse()); } catch (Exception e) @@ -447,39 +534,55 @@ public virtual async Task> Ge /// Tries to get details for this resource from the service. /// /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/virtualnetworks/{name} + /// Request Path. + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/virtualnetworks/{name}. /// /// - /// Operation Id - /// VirtualNetworks_Get + /// Operation Id. + /// VirtualNetworks_Get. /// /// - /// Default Api Version - /// 2018-09-15 - /// - /// - /// Resource - /// + /// Default Api Version. + /// 2018-09-15. /// /// /// /// The name of the virtual network. /// Specify the $expand query. Example: 'properties($expand=externalSubnets)'. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. - public virtual NullableResponse GetIfExists(string name, string expand = null, CancellationToken cancellationToken = default) + /// is an empty string, and was expected to be non-empty. + public virtual NullableResponse GetIfExists(string name, string expand = default, CancellationToken cancellationToken = default) { Argument.AssertNotNullOrEmpty(name, nameof(name)); - using var scope = _devTestLabVirtualNetworkVirtualNetworksClientDiagnostics.CreateScope("DevTestLabVirtualNetworkCollection.GetIfExists"); + using DiagnosticScope scope = _virtualNetworksClientDiagnostics.CreateScope("DevTestLabVirtualNetworkCollection.GetIfExists"); scope.Start(); try { - var response = _devTestLabVirtualNetworkVirtualNetworksRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, name, expand, cancellationToken: cancellationToken); + RequestContext context = new RequestContext + { + CancellationToken = cancellationToken + }; + HttpMessage message = _virtualNetworksRestClient.CreateGetRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, name, expand, context); + Pipeline.Send(message, context.CancellationToken); + Response result = message.Response; + Response response = default; + switch (result.Status) + { + case 200: + response = Response.FromValue(DevTestLabVirtualNetworkData.FromResponse(result), result); + break; + case 404: + response = Response.FromValue((DevTestLabVirtualNetworkData)null, result); + break; + default: + throw new RequestFailedException(result); + } if (response.Value == null) + { return new NoValueResponse(response.GetRawResponse()); + } return Response.FromValue(new DevTestLabVirtualNetworkResource(Client, response.Value), response.GetRawResponse()); } catch (Exception e) @@ -499,6 +602,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/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/DevTestLabVirtualNetworkData.Serialization.cs b/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/DevTestLabVirtualNetworkData.Serialization.cs index bc1fffaa9422..22d173799aa5 100644 --- a/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/DevTestLabVirtualNetworkData.Serialization.cs +++ b/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/DevTestLabVirtualNetworkData.Serialization.cs @@ -10,16 +10,47 @@ using System.Collections.Generic; using System.Text; using System.Text.Json; +using Azure; using Azure.Core; using Azure.ResourceManager.DevTestLabs.Models; using Azure.ResourceManager.Models; namespace Azure.ResourceManager.DevTestLabs { - public partial class DevTestLabVirtualNetworkData : IUtf8JsonSerializable, IJsonModel + /// A virtual network. + public partial class DevTestLabVirtualNetworkData : TrackedResourceData, IJsonModel { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + /// Initializes a new instance of for deserialization. + internal DevTestLabVirtualNetworkData() + { + } + + /// 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)) + { + return DeserializeDevTestLabVirtualNetworkData(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(DevTestLabVirtualNetworkData)} does not support reading '{options.Format}' format."); + } + } + /// The to deserialize the from. + internal static DevTestLabVirtualNetworkData FromResponse(Response response) + { + using JsonDocument document = JsonDocument.Parse(response.Content, ModelSerializationExtensions.JsonDocumentOptions); + return DeserializeDevTestLabVirtualNetworkData(document.RootElement, ModelSerializationExtensions.WireOptions); + } + + /// The JSON writer. + /// The client options for reading and writing models. void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) { writer.WriteStartObject(); @@ -31,269 +62,153 @@ void IJsonModel.Write(Utf8JsonWriter writer, Model /// 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(DevTestLabVirtualNetworkData)} does not support writing '{format}' format."); } - base.JsonModelWriteCore(writer, options); writer.WritePropertyName("properties"u8); - writer.WriteStartObject(); - if (Optional.IsCollectionDefined(AllowedSubnets)) + writer.WriteObjectValue(Properties, options); + if (Optional.IsCollectionDefined(Tags)) { - writer.WritePropertyName("allowedSubnets"u8); - writer.WriteStartArray(); - foreach (var item in AllowedSubnets) + writer.WritePropertyName("tags"u8); + writer.WriteStartObject(); + foreach (var item in Tags) { - writer.WriteObjectValue(item, options); - } - writer.WriteEndArray(); - } - if (Optional.IsDefined(Description)) - { - writer.WritePropertyName("description"u8); - writer.WriteStringValue(Description); - } - if (Optional.IsDefined(ExternalProviderResourceId)) - { - writer.WritePropertyName("externalProviderResourceId"u8); - writer.WriteStringValue(ExternalProviderResourceId); - } - if (options.Format != "W" && Optional.IsCollectionDefined(ExternalSubnets)) - { - writer.WritePropertyName("externalSubnets"u8); - writer.WriteStartArray(); - foreach (var item in ExternalSubnets) - { - writer.WriteObjectValue(item, options); - } - writer.WriteEndArray(); - } - if (Optional.IsCollectionDefined(SubnetOverrides)) - { - writer.WritePropertyName("subnetOverrides"u8); - writer.WriteStartArray(); - foreach (var item in SubnetOverrides) - { - writer.WriteObjectValue(item, options); + writer.WritePropertyName(item.Key); + if (item.Value == null) + { + writer.WriteNullValue(); + continue; + } + writer.WriteStringValue(item.Value); } - writer.WriteEndArray(); - } - if (options.Format != "W" && Optional.IsDefined(CreatedOn)) - { - writer.WritePropertyName("createdDate"u8); - writer.WriteStringValue(CreatedOn.Value, "O"); + writer.WriteEndObject(); } - if (options.Format != "W" && Optional.IsDefined(ProvisioningState)) - { - writer.WritePropertyName("provisioningState"u8); - writer.WriteStringValue(ProvisioningState); - } - if (options.Format != "W" && Optional.IsDefined(UniqueIdentifier)) - { - writer.WritePropertyName("uniqueIdentifier"u8); - writer.WriteStringValue(UniqueIdentifier.Value); - } - writer.WriteEndObject(); } - DevTestLabVirtualNetworkData IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + /// The JSON reader. + /// The client options for reading and writing models. + DevTestLabVirtualNetworkData IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) => (DevTestLabVirtualNetworkData)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(DevTestLabVirtualNetworkData)} does not support reading '{format}' format."); } - using JsonDocument document = JsonDocument.ParseValue(ref reader); return DeserializeDevTestLabVirtualNetworkData(document.RootElement, options); } - internal static DevTestLabVirtualNetworkData DeserializeDevTestLabVirtualNetworkData(JsonElement element, ModelReaderWriterOptions options = null) + /// The JSON element to deserialize. + /// The client options for reading and writing models. + internal static DevTestLabVirtualNetworkData DeserializeDevTestLabVirtualNetworkData(JsonElement element, ModelReaderWriterOptions options) { - options ??= ModelSerializationExtensions.WireOptions; - if (element.ValueKind == JsonValueKind.Null) { return null; } - IDictionary tags = default; - AzureLocation location = default; ResourceIdentifier id = default; string name = default; - ResourceType type = default; + ResourceType resourceType = default; SystemData systemData = default; - IList allowedSubnets = default; - string description = default; - string externalProviderResourceId = default; - IReadOnlyList externalSubnets = default; - IList subnetOverrides = default; - DateTimeOffset? createdDate = default; - string provisioningState = default; - Guid? uniqueIdentifier = default; - IDictionary serializedAdditionalRawData = default; - Dictionary rawDataDictionary = new Dictionary(); - foreach (var property in element.EnumerateObject()) + IDictionary additionalBinaryDataProperties = new ChangeTrackingDictionary(); + AzureLocation location = default; + VirtualNetworkProperties properties = default; + IDictionary tags = default; + foreach (var prop in element.EnumerateObject()) { - if (property.NameEquals("tags"u8)) + if (prop.NameEquals("id"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()) - { - dictionary.Add(property0.Name, property0.Value.GetString()); - } - tags = dictionary; + id = new ResourceIdentifier(prop.Value.GetString()); continue; } - if (property.NameEquals("location"u8)) + if (prop.NameEquals("name"u8)) { - location = new AzureLocation(property.Value.GetString()); + name = prop.Value.GetString(); continue; } - if (property.NameEquals("id"u8)) + if (prop.NameEquals("type"u8)) { - id = new ResourceIdentifier(property.Value.GetString()); + if (prop.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + resourceType = new ResourceType(prop.Value.GetString()); continue; } - if (property.NameEquals("name"u8)) + if (prop.NameEquals("systemData"u8)) { - name = property.Value.GetString(); + if (prop.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + systemData = ModelReaderWriter.Read(new BinaryData(Encoding.UTF8.GetBytes(prop.Value.GetRawText())), ModelSerializationExtensions.WireOptions, AzureResourceManagerDevTestLabsContext.Default); 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) - { - continue; - } - systemData = ModelReaderWriter.Read(new BinaryData(Encoding.UTF8.GetBytes(property.Value.GetRawText())), ModelSerializationExtensions.WireOptions, AzureResourceManagerDevTestLabsContext.Default); + properties = VirtualNetworkProperties.DeserializeVirtualNetworkProperties(prop.Value, options); continue; } - if (property.NameEquals("properties"u8)) + if (prop.NameEquals("tags"u8)) { - if (property.Value.ValueKind == JsonValueKind.Null) + if (prop.Value.ValueKind == JsonValueKind.Null) { - property.ThrowNonNullablePropertyIsNull(); continue; } - foreach (var property0 in property.Value.EnumerateObject()) + Dictionary dictionary = new Dictionary(); + foreach (var prop0 in prop.Value.EnumerateObject()) { - if (property0.NameEquals("allowedSubnets"u8)) - { - if (property0.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - List array = new List(); - foreach (var item in property0.Value.EnumerateArray()) - { - array.Add(DevTestLabSubnet.DeserializeDevTestLabSubnet(item, options)); - } - allowedSubnets = array; - continue; - } - if (property0.NameEquals("description"u8)) - { - description = property0.Value.GetString(); - continue; - } - if (property0.NameEquals("externalProviderResourceId"u8)) - { - externalProviderResourceId = property0.Value.GetString(); - continue; - } - if (property0.NameEquals("externalSubnets"u8)) - { - if (property0.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - List array = new List(); - foreach (var item in property0.Value.EnumerateArray()) - { - array.Add(DevTestLabExternalSubnet.DeserializeDevTestLabExternalSubnet(item, options)); - } - externalSubnets = array; - continue; - } - if (property0.NameEquals("subnetOverrides"u8)) + if (prop0.Value.ValueKind == JsonValueKind.Null) { - if (property0.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - List array = new List(); - foreach (var item in property0.Value.EnumerateArray()) - { - array.Add(DevTestLabSubnetOverride.DeserializeDevTestLabSubnetOverride(item, options)); - } - subnetOverrides = array; - continue; + dictionary.Add(prop0.Name, null); } - if (property0.NameEquals("createdDate"u8)) + else { - if (property0.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - createdDate = property0.Value.GetDateTimeOffset("O"); - continue; - } - if (property0.NameEquals("provisioningState"u8)) - { - provisioningState = property0.Value.GetString(); - continue; - } - if (property0.NameEquals("uniqueIdentifier"u8)) - { - if (property0.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - uniqueIdentifier = property0.Value.GetGuid(); - continue; + dictionary.Add(prop0.Name, prop0.Value.GetString()); } } + tags = dictionary; 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 DevTestLabVirtualNetworkData( id, name, - type, + resourceType, systemData, - tags ?? new ChangeTrackingDictionary(), + additionalBinaryDataProperties, location, - allowedSubnets ?? new ChangeTrackingList(), - description, - externalProviderResourceId, - externalSubnets ?? new ChangeTrackingList(), - subnetOverrides ?? new ChangeTrackingList(), - createdDate, - provisioningState, - uniqueIdentifier, - serializedAdditionalRawData); + properties, + tags ?? new ChangeTrackingDictionary()); } - 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": @@ -303,22 +218,23 @@ BinaryData IPersistableModel.Write(ModelReaderWrit } } - DevTestLabVirtualNetworkData 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. + DevTestLabVirtualNetworkData IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) => (DevTestLabVirtualNetworkData)PersistableModelCreateCore(data, options); - switch (format) + /// The client options for reading and writing models. + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + + /// The to serialize into . + internal static RequestContent ToRequestContent(DevTestLabVirtualNetworkData devTestLabVirtualNetworkData) + { + if (devTestLabVirtualNetworkData == null) { - case "J": - { - using JsonDocument document = JsonDocument.Parse(data, ModelSerializationExtensions.JsonDocumentOptions); - return DeserializeDevTestLabVirtualNetworkData(document.RootElement, options); - } - default: - throw new FormatException($"The model {nameof(DevTestLabVirtualNetworkData)} does not support reading '{options.Format}' format."); + return null; } + Utf8JsonRequestContent content = new Utf8JsonRequestContent(); + content.JsonWriter.WriteObjectValue(devTestLabVirtualNetworkData, ModelSerializationExtensions.WireOptions); + return content; } - - string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; } } diff --git a/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/DevTestLabVirtualNetworkData.cs b/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/DevTestLabVirtualNetworkData.cs index 8b58484033bd..74274c67d828 100644 --- a/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/DevTestLabVirtualNetworkData.cs +++ b/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/DevTestLabVirtualNetworkData.cs @@ -13,102 +13,135 @@ namespace Azure.ResourceManager.DevTestLabs { - /// - /// A class representing the DevTestLabVirtualNetwork data model. - /// A virtual network. - /// + /// A virtual network. public partial class DevTestLabVirtualNetworkData : 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 DevTestLabVirtualNetworkData(AzureLocation location) : base(location) { - AllowedSubnets = new ChangeTrackingList(); - ExternalSubnets = new ChangeTrackingList(); - SubnetOverrides = new ChangeTrackingList(); + } /// Initializes a new instance of . - /// The id. - /// The name. - /// The resourceType. - /// The systemData. - /// The tags. - /// The location. - /// The allowed subnets of the virtual network. - /// The description of the virtual network. - /// The Microsoft.Network resource identifier of the virtual network. - /// The external subnet properties. - /// The subnet overrides of the virtual network. - /// The creation date of the virtual network. - /// The provisioning status of the resource. - /// The unique immutable identifier of a resource (Guid). - /// Keeps track of any properties unknown to the library. - internal DevTestLabVirtualNetworkData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, IDictionary tags, AzureLocation location, IList allowedSubnets, string description, string externalProviderResourceId, IReadOnlyList externalSubnets, IList subnetOverrides, DateTimeOffset? createdOn, string provisioningState, Guid? uniqueIdentifier, IDictionary serializedAdditionalRawData) : base(id, name, resourceType, systemData, tags, 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. + /// The geo-location where the resource lives. + /// The properties of the resource. + /// Resource tags. + internal DevTestLabVirtualNetworkData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, IDictionary additionalBinaryDataProperties, AzureLocation location, VirtualNetworkProperties properties, IDictionary tags) : base(id, name, resourceType, systemData, tags, location) { - AllowedSubnets = allowedSubnets; - Description = description; - ExternalProviderResourceId = externalProviderResourceId; - ExternalSubnets = externalSubnets; - SubnetOverrides = subnetOverrides; - CreatedOn = createdOn; - ProvisioningState = provisioningState; - UniqueIdentifier = uniqueIdentifier; - _serializedAdditionalRawData = serializedAdditionalRawData; + _additionalBinaryDataProperties = additionalBinaryDataProperties; + Properties = properties; } - /// Initializes a new instance of for deserialization. - internal DevTestLabVirtualNetworkData() + /// The properties of the resource. + internal VirtualNetworkProperties Properties { get; set; } + + /// The allowed subnets of the virtual network. + public IList AllowedSubnets { + get + { + if (Properties is null) + { + Properties = new VirtualNetworkProperties(); + } + return Properties.AllowedSubnets; + } } - /// The allowed subnets of the virtual network. - public IList AllowedSubnets { get; } /// The description of the virtual network. - public string Description { get; set; } + public string Description + { + get + { + return Properties is null ? default : Properties.Description; + } + set + { + if (Properties is null) + { + Properties = new VirtualNetworkProperties(); + } + Properties.Description = value; + } + } + /// The Microsoft.Network resource identifier of the virtual network. - public string ExternalProviderResourceId { get; set; } + public string ExternalProviderResourceId + { + get + { + return Properties is null ? default : Properties.ExternalProviderResourceId; + } + set + { + if (Properties is null) + { + Properties = new VirtualNetworkProperties(); + } + Properties.ExternalProviderResourceId = value; + } + } + /// The external subnet properties. - public IReadOnlyList ExternalSubnets { get; } + public IReadOnlyList ExternalSubnets + { + get + { + if (Properties is null) + { + Properties = new VirtualNetworkProperties(); + } + return Properties.ExternalSubnets; + } + } + /// The subnet overrides of the virtual network. - public IList SubnetOverrides { get; } + public IList SubnetOverrides + { + get + { + if (Properties is null) + { + Properties = new VirtualNetworkProperties(); + } + return Properties.SubnetOverrides; + } + } + /// The creation date of the virtual network. - public DateTimeOffset? CreatedOn { get; } + public DateTimeOffset? CreatedOn + { + get + { + return Properties is null ? default : Properties.CreatedOn; + } + } + /// The provisioning status of the resource. - public string ProvisioningState { get; } + public string ProvisioningState + { + get + { + return Properties is null ? default : Properties.ProvisioningState; + } + } + /// The unique immutable identifier of a resource (Guid). - public Guid? UniqueIdentifier { get; } + public Guid? UniqueIdentifier + { + get + { + return Properties is null ? default : Properties.UniqueIdentifier; + } + } } } diff --git a/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/DevTestLabVirtualNetworkResource.Serialization.cs b/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/DevTestLabVirtualNetworkResource.Serialization.cs index 06e3a8476a84..633d85817631 100644 --- a/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/DevTestLabVirtualNetworkResource.Serialization.cs +++ b/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/DevTestLabVirtualNetworkResource.Serialization.cs @@ -11,19 +11,29 @@ namespace Azure.ResourceManager.DevTestLabs { + /// public partial class DevTestLabVirtualNetworkResource : IJsonModel { - private static DevTestLabVirtualNetworkData s_dataDeserializationInstance; - private static DevTestLabVirtualNetworkData DataDeserializationInstance => s_dataDeserializationInstance ??= new(); + private static IJsonModel s_dataDeserializationInstance; + private static IJsonModel DataDeserializationInstance => s_dataDeserializationInstance ??= new DevTestLabVirtualNetworkData(); + + /// 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); - DevTestLabVirtualNetworkData 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. + DevTestLabVirtualNetworkData 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, AzureResourceManagerDevTestLabsContext.Default); + /// The binary data to be processed. + /// The client options for reading and writing models. DevTestLabVirtualNetworkData IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) => ModelReaderWriter.Read(data, options, AzureResourceManagerDevTestLabsContext.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/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/DevTestLabVirtualNetworkResource.cs b/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/DevTestLabVirtualNetworkResource.cs index 5ea88bb5ea15..a2eae42ec07f 100644 --- a/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/DevTestLabVirtualNetworkResource.cs +++ b/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/DevTestLabVirtualNetworkResource.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.DevTestLabs.Models; +using Azure.ResourceManager.Resources; namespace Azure.ResourceManager.DevTestLabs { /// - /// A Class representing a DevTestLabVirtualNetwork 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 GetDevTestLabVirtualNetworkResource method. - /// Otherwise you can get one from its parent resource using the GetDevTestLabVirtualNetwork method. + /// A class representing a DevTestLabVirtualNetwork 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 GetDevTestLabVirtualNetworks method. /// public partial class DevTestLabVirtualNetworkResource : ArmResource { - /// Generate the resource identifier of a instance. - /// The subscriptionId. - /// The resourceGroupName. - /// The labName. - /// The name. - public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string labName, string name) - { - var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/virtualnetworks/{name}"; - return new ResourceIdentifier(resourceId); - } - - private readonly ClientDiagnostics _devTestLabVirtualNetworkVirtualNetworksClientDiagnostics; - private readonly VirtualNetworksRestOperations _devTestLabVirtualNetworkVirtualNetworksRestClient; + private readonly ClientDiagnostics _virtualNetworksClientDiagnostics; + private readonly VirtualNetworks _virtualNetworksRestClient; private readonly DevTestLabVirtualNetworkData _data; - /// Gets the resource type for the operations. public static readonly ResourceType ResourceType = "Microsoft.DevTestLab/labs/virtualnetworks"; - /// Initializes a new instance of the class for mocking. + /// Initializes a new instance of DevTestLabVirtualNetworkResource for mocking. protected DevTestLabVirtualNetworkResource() { } - /// 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 DevTestLabVirtualNetworkResource(ArmClient client, DevTestLabVirtualNetworkData data) : this(client, data.Id) @@ -56,72 +46,94 @@ internal DevTestLabVirtualNetworkResource(ArmClient client, DevTestLabVirtualNet _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 DevTestLabVirtualNetworkResource(ArmClient client, ResourceIdentifier id) : base(client, id) { - _devTestLabVirtualNetworkVirtualNetworksClientDiagnostics = new ClientDiagnostics("Azure.ResourceManager.DevTestLabs", ResourceType.Namespace, Diagnostics); - TryGetApiVersion(ResourceType, out string devTestLabVirtualNetworkVirtualNetworksApiVersion); - _devTestLabVirtualNetworkVirtualNetworksRestClient = new VirtualNetworksRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, devTestLabVirtualNetworkVirtualNetworksApiVersion); -#if DEBUG - ValidateResourceId(Id); -#endif + TryGetApiVersion(ResourceType, out string devTestLabVirtualNetworkApiVersion); + _virtualNetworksClientDiagnostics = new ClientDiagnostics("Azure.ResourceManager.DevTestLabs", ResourceType.Namespace, Diagnostics); + _virtualNetworksRestClient = new VirtualNetworks(_virtualNetworksClientDiagnostics, Pipeline, Endpoint, devTestLabVirtualNetworkApiVersion ?? "2018-09-15"); + 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 DevTestLabVirtualNetworkData 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 labName. + /// The name. + public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string labName, string name) + { + string resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/virtualnetworks/{name}"; + 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 virtual network. /// /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/virtualnetworks/{name} + /// Request Path. + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/virtualnetworks/{name}. /// /// - /// Operation Id - /// VirtualNetworks_Get + /// Operation Id. + /// VirtualNetworks_Get. /// /// - /// Default Api Version - /// 2018-09-15 + /// Default Api Version. + /// 2018-09-15. /// /// - /// Resource - /// + /// Resource. + /// . /// /// /// /// Specify the $expand query. Example: 'properties($expand=externalSubnets)'. /// The cancellation token to use. - public virtual async Task> GetAsync(string expand = null, CancellationToken cancellationToken = default) + public virtual async Task> GetAsync(string expand = default, CancellationToken cancellationToken = default) { - using var scope = _devTestLabVirtualNetworkVirtualNetworksClientDiagnostics.CreateScope("DevTestLabVirtualNetworkResource.Get"); + using DiagnosticScope scope = _virtualNetworksClientDiagnostics.CreateScope("DevTestLabVirtualNetworkResource.Get"); scope.Start(); try { - var response = await _devTestLabVirtualNetworkVirtualNetworksRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, expand, cancellationToken).ConfigureAwait(false); + RequestContext context = new RequestContext + { + CancellationToken = cancellationToken + }; + HttpMessage message = _virtualNetworksRestClient.CreateGetRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, expand, context); + Response result = await Pipeline.ProcessMessageAsync(message, context).ConfigureAwait(false); + Response response = Response.FromValue(DevTestLabVirtualNetworkData.FromResponse(result), result); if (response.Value == null) + { throw new RequestFailedException(response.GetRawResponse()); + } return Response.FromValue(new DevTestLabVirtualNetworkResource(Client, response.Value), response.GetRawResponse()); } catch (Exception e) @@ -135,34 +147,42 @@ public virtual async Task> GetAsync(s /// Get virtual network. /// /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/virtualnetworks/{name} + /// Request Path. + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/virtualnetworks/{name}. /// /// - /// Operation Id - /// VirtualNetworks_Get + /// Operation Id. + /// VirtualNetworks_Get. /// /// - /// Default Api Version - /// 2018-09-15 + /// Default Api Version. + /// 2018-09-15. /// /// - /// Resource - /// + /// Resource. + /// . /// /// /// /// Specify the $expand query. Example: 'properties($expand=externalSubnets)'. /// The cancellation token to use. - public virtual Response Get(string expand = null, CancellationToken cancellationToken = default) + public virtual Response Get(string expand = default, CancellationToken cancellationToken = default) { - using var scope = _devTestLabVirtualNetworkVirtualNetworksClientDiagnostics.CreateScope("DevTestLabVirtualNetworkResource.Get"); + using DiagnosticScope scope = _virtualNetworksClientDiagnostics.CreateScope("DevTestLabVirtualNetworkResource.Get"); scope.Start(); try { - var response = _devTestLabVirtualNetworkVirtualNetworksRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, expand, cancellationToken); + RequestContext context = new RequestContext + { + CancellationToken = cancellationToken + }; + HttpMessage message = _virtualNetworksRestClient.CreateGetRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, expand, context); + Response result = Pipeline.ProcessMessage(message, context); + Response response = Response.FromValue(DevTestLabVirtualNetworkData.FromResponse(result), result); if (response.Value == null) + { throw new RequestFailedException(response.GetRawResponse()); + } return Response.FromValue(new DevTestLabVirtualNetworkResource(Client, response.Value), response.GetRawResponse()); } catch (Exception e) @@ -173,39 +193,49 @@ public virtual Response Get(string expand = nu } /// - /// Delete virtual network. This operation can take a while to complete. + /// Allows modifying tags of virtual networks. All other properties will be ignored. /// /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/virtualnetworks/{name} + /// Request Path. + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/virtualnetworks/{name}. /// /// - /// Operation Id - /// VirtualNetworks_Delete + /// Operation Id. + /// VirtualNetworks_Update. /// /// - /// Default Api Version - /// 2018-09-15 + /// Default Api Version. + /// 2018-09-15. /// /// - /// Resource - /// + /// Resource. + /// . /// /// /// - /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. + /// A virtual network. /// The cancellation token to use. - public virtual async Task DeleteAsync(WaitUntil waitUntil, CancellationToken cancellationToken = default) + /// is null. + public virtual async Task> UpdateAsync(DevTestLabVirtualNetworkPatch patch, CancellationToken cancellationToken = default) { - using var scope = _devTestLabVirtualNetworkVirtualNetworksClientDiagnostics.CreateScope("DevTestLabVirtualNetworkResource.Delete"); + Argument.AssertNotNull(patch, nameof(patch)); + + using DiagnosticScope scope = _virtualNetworksClientDiagnostics.CreateScope("DevTestLabVirtualNetworkResource.Update"); scope.Start(); try { - var response = await _devTestLabVirtualNetworkVirtualNetworksRestClient.DeleteAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, cancellationToken).ConfigureAwait(false); - var operation = new DevTestLabsArmOperation(_devTestLabVirtualNetworkVirtualNetworksClientDiagnostics, Pipeline, _devTestLabVirtualNetworkVirtualNetworksRestClient.CreateDeleteRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name).Request, response, OperationFinalStateVia.Location); - if (waitUntil == WaitUntil.Completed) - await operation.WaitForCompletionResponseAsync(cancellationToken).ConfigureAwait(false); - return operation; + RequestContext context = new RequestContext + { + CancellationToken = cancellationToken + }; + HttpMessage message = _virtualNetworksRestClient.CreateUpdateRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, DevTestLabVirtualNetworkPatch.ToRequestContent(patch), context); + Response result = await Pipeline.ProcessMessageAsync(message, context).ConfigureAwait(false); + Response response = Response.FromValue(DevTestLabVirtualNetworkData.FromResponse(result), result); + if (response.Value == null) + { + throw new RequestFailedException(response.GetRawResponse()); + } + return Response.FromValue(new DevTestLabVirtualNetworkResource(Client, response.Value), response.GetRawResponse()); } catch (Exception e) { @@ -215,39 +245,49 @@ public virtual async Task DeleteAsync(WaitUntil waitUntil, Cancell } /// - /// Delete virtual network. This operation can take a while to complete. + /// Allows modifying tags of virtual networks. All other properties will be ignored. /// /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/virtualnetworks/{name} + /// Request Path. + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/virtualnetworks/{name}. /// /// - /// Operation Id - /// VirtualNetworks_Delete + /// Operation Id. + /// VirtualNetworks_Update. /// /// - /// Default Api Version - /// 2018-09-15 + /// Default Api Version. + /// 2018-09-15. /// /// - /// Resource - /// + /// Resource. + /// . /// /// /// - /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. + /// A virtual network. /// The cancellation token to use. - public virtual ArmOperation Delete(WaitUntil waitUntil, CancellationToken cancellationToken = default) + /// is null. + public virtual Response Update(DevTestLabVirtualNetworkPatch patch, CancellationToken cancellationToken = default) { - using var scope = _devTestLabVirtualNetworkVirtualNetworksClientDiagnostics.CreateScope("DevTestLabVirtualNetworkResource.Delete"); + Argument.AssertNotNull(patch, nameof(patch)); + + using DiagnosticScope scope = _virtualNetworksClientDiagnostics.CreateScope("DevTestLabVirtualNetworkResource.Update"); scope.Start(); try { - var response = _devTestLabVirtualNetworkVirtualNetworksRestClient.Delete(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, cancellationToken); - var operation = new DevTestLabsArmOperation(_devTestLabVirtualNetworkVirtualNetworksClientDiagnostics, Pipeline, _devTestLabVirtualNetworkVirtualNetworksRestClient.CreateDeleteRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name).Request, response, OperationFinalStateVia.Location); - if (waitUntil == WaitUntil.Completed) - operation.WaitForCompletionResponse(cancellationToken); - return operation; + RequestContext context = new RequestContext + { + CancellationToken = cancellationToken + }; + HttpMessage message = _virtualNetworksRestClient.CreateUpdateRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, DevTestLabVirtualNetworkPatch.ToRequestContent(patch), context); + Response result = Pipeline.ProcessMessage(message, context); + Response response = Response.FromValue(DevTestLabVirtualNetworkData.FromResponse(result), result); + if (response.Value == null) + { + throw new RequestFailedException(response.GetRawResponse()); + } + return Response.FromValue(new DevTestLabVirtualNetworkResource(Client, response.Value), response.GetRawResponse()); } catch (Exception e) { @@ -257,39 +297,46 @@ public virtual ArmOperation Delete(WaitUntil waitUntil, CancellationToken cancel } /// - /// Allows modifying tags of virtual networks. All other properties will be ignored. + /// Delete virtual network. This operation can take a while to complete. /// /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/virtualnetworks/{name} + /// Request Path. + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/virtualnetworks/{name}. /// /// - /// Operation Id - /// VirtualNetworks_Update + /// Operation Id. + /// VirtualNetworks_Delete. /// /// - /// Default Api Version - /// 2018-09-15 + /// Default Api Version. + /// 2018-09-15. /// /// - /// Resource - /// + /// Resource. + /// . /// /// /// - /// A virtual network. + /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. /// The cancellation token to use. - /// is null. - public virtual async Task> UpdateAsync(DevTestLabVirtualNetworkPatch patch, CancellationToken cancellationToken = default) + public virtual async Task DeleteAsync(WaitUntil waitUntil, CancellationToken cancellationToken = default) { - Argument.AssertNotNull(patch, nameof(patch)); - - using var scope = _devTestLabVirtualNetworkVirtualNetworksClientDiagnostics.CreateScope("DevTestLabVirtualNetworkResource.Update"); + using DiagnosticScope scope = _virtualNetworksClientDiagnostics.CreateScope("DevTestLabVirtualNetworkResource.Delete"); scope.Start(); try { - var response = await _devTestLabVirtualNetworkVirtualNetworksRestClient.UpdateAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, patch, cancellationToken).ConfigureAwait(false); - return Response.FromValue(new DevTestLabVirtualNetworkResource(Client, response.Value), response.GetRawResponse()); + RequestContext context = new RequestContext + { + CancellationToken = cancellationToken + }; + HttpMessage message = _virtualNetworksRestClient.CreateDeleteRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, context); + Response response = await Pipeline.ProcessMessageAsync(message, context).ConfigureAwait(false); + DevTestLabsArmOperation operation = new DevTestLabsArmOperation(_virtualNetworksClientDiagnostics, Pipeline, message.Request, response, OperationFinalStateVia.Location); + if (waitUntil == WaitUntil.Completed) + { + await operation.WaitForCompletionResponseAsync(cancellationToken).ConfigureAwait(false); + } + return operation; } catch (Exception e) { @@ -299,39 +346,46 @@ public virtual async Task> UpdateAsyn } /// - /// Allows modifying tags of virtual networks. All other properties will be ignored. + /// Delete virtual network. This operation can take a while to complete. /// /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/virtualnetworks/{name} + /// Request Path. + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/virtualnetworks/{name}. /// /// - /// Operation Id - /// VirtualNetworks_Update + /// Operation Id. + /// VirtualNetworks_Delete. /// /// - /// Default Api Version - /// 2018-09-15 + /// Default Api Version. + /// 2018-09-15. /// /// - /// Resource - /// + /// Resource. + /// . /// /// /// - /// A virtual network. + /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. /// The cancellation token to use. - /// is null. - public virtual Response Update(DevTestLabVirtualNetworkPatch patch, CancellationToken cancellationToken = default) + public virtual ArmOperation Delete(WaitUntil waitUntil, CancellationToken cancellationToken = default) { - Argument.AssertNotNull(patch, nameof(patch)); - - using var scope = _devTestLabVirtualNetworkVirtualNetworksClientDiagnostics.CreateScope("DevTestLabVirtualNetworkResource.Update"); + using DiagnosticScope scope = _virtualNetworksClientDiagnostics.CreateScope("DevTestLabVirtualNetworkResource.Delete"); scope.Start(); try { - var response = _devTestLabVirtualNetworkVirtualNetworksRestClient.Update(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, patch, cancellationToken); - return Response.FromValue(new DevTestLabVirtualNetworkResource(Client, response.Value), response.GetRawResponse()); + RequestContext context = new RequestContext + { + CancellationToken = cancellationToken + }; + HttpMessage message = _virtualNetworksRestClient.CreateDeleteRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, context); + Response response = Pipeline.ProcessMessage(message, context); + DevTestLabsArmOperation operation = new DevTestLabsArmOperation(_virtualNetworksClientDiagnostics, Pipeline, message.Request, response, OperationFinalStateVia.Location); + if (waitUntil == WaitUntil.Completed) + { + operation.WaitForCompletionResponse(cancellationToken); + } + return operation; } catch (Exception e) { @@ -340,27 +394,7 @@ public virtual Response Update(DevTestLabVirtu } } - /// - /// Add a tag to the current resource. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/virtualnetworks/{name} - /// - /// - /// Operation Id - /// VirtualNetworks_Get - /// - /// - /// Default Api Version - /// 2018-09-15 - /// - /// - /// Resource - /// - /// - /// - /// + /// Add a tag to the current resource. /// The key for the tag. /// The value for the tag. /// The cancellation token to use. @@ -370,29 +404,35 @@ public virtual async Task> AddTagAsyn Argument.AssertNotNull(key, nameof(key)); Argument.AssertNotNull(value, nameof(value)); - using var scope = _devTestLabVirtualNetworkVirtualNetworksClientDiagnostics.CreateScope("DevTestLabVirtualNetworkResource.AddTag"); + using DiagnosticScope scope = _virtualNetworksClientDiagnostics.CreateScope("DevTestLabVirtualNetworkResource.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 _devTestLabVirtualNetworkVirtualNetworksRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, null, cancellationToken).ConfigureAwait(false); - return Response.FromValue(new DevTestLabVirtualNetworkResource(Client, originalResponse.Value), originalResponse.GetRawResponse()); + await GetTagResource().CreateOrUpdateAsync(WaitUntil.Completed, originalTags.Value.Data, cancellationToken).ConfigureAwait(false); + RequestContext context = new RequestContext + { + CancellationToken = cancellationToken + }; + HttpMessage message = _virtualNetworksRestClient.CreateGetRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, default, context); + Response result = await Pipeline.ProcessMessageAsync(message, context).ConfigureAwait(false); + Response response = Response.FromValue(DevTestLabVirtualNetworkData.FromResponse(result), result); + return Response.FromValue(new DevTestLabVirtualNetworkResource(Client, response.Value), response.GetRawResponse()); } else { - var current = (await GetAsync(cancellationToken: cancellationToken).ConfigureAwait(false)).Value.Data; - var patch = new DevTestLabVirtualNetworkPatch(); - foreach (var tag in current.Tags) + DevTestLabVirtualNetworkData current = (await GetAsync(cancellationToken: cancellationToken).ConfigureAwait(false)).Value.Data; + DevTestLabVirtualNetworkPatch patch = new DevTestLabVirtualNetworkPatch(); + 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) @@ -402,27 +442,7 @@ public virtual async Task> AddTagAsyn } } - /// - /// Add a tag to the current resource. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/virtualnetworks/{name} - /// - /// - /// Operation Id - /// VirtualNetworks_Get - /// - /// - /// Default Api Version - /// 2018-09-15 - /// - /// - /// Resource - /// - /// - /// - /// + /// Add a tag to the current resource. /// The key for the tag. /// The value for the tag. /// The cancellation token to use. @@ -432,29 +452,35 @@ public virtual Response AddTag(string key, str Argument.AssertNotNull(key, nameof(key)); Argument.AssertNotNull(value, nameof(value)); - using var scope = _devTestLabVirtualNetworkVirtualNetworksClientDiagnostics.CreateScope("DevTestLabVirtualNetworkResource.AddTag"); + using DiagnosticScope scope = _virtualNetworksClientDiagnostics.CreateScope("DevTestLabVirtualNetworkResource.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 = _devTestLabVirtualNetworkVirtualNetworksRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, null, cancellationToken); - return Response.FromValue(new DevTestLabVirtualNetworkResource(Client, originalResponse.Value), originalResponse.GetRawResponse()); + GetTagResource().CreateOrUpdate(WaitUntil.Completed, originalTags.Value.Data, cancellationToken); + RequestContext context = new RequestContext + { + CancellationToken = cancellationToken + }; + HttpMessage message = _virtualNetworksRestClient.CreateGetRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, default, context); + Response result = Pipeline.ProcessMessage(message, context); + Response response = Response.FromValue(DevTestLabVirtualNetworkData.FromResponse(result), result); + return Response.FromValue(new DevTestLabVirtualNetworkResource(Client, response.Value), response.GetRawResponse()); } else { - var current = Get(cancellationToken: cancellationToken).Value.Data; - var patch = new DevTestLabVirtualNetworkPatch(); - foreach (var tag in current.Tags) + DevTestLabVirtualNetworkData current = Get(cancellationToken: cancellationToken).Value.Data; + DevTestLabVirtualNetworkPatch patch = new DevTestLabVirtualNetworkPatch(); + 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) @@ -464,54 +490,40 @@ public virtual Response AddTag(string key, str } } - /// - /// Replace the tags on the resource with the given set. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/virtualnetworks/{name} - /// - /// - /// Operation Id - /// VirtualNetworks_Get - /// - /// - /// Default Api Version - /// 2018-09-15 - /// - /// - /// 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 = _devTestLabVirtualNetworkVirtualNetworksClientDiagnostics.CreateScope("DevTestLabVirtualNetworkResource.SetTags"); + using DiagnosticScope scope = _virtualNetworksClientDiagnostics.CreateScope("DevTestLabVirtualNetworkResource.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 _devTestLabVirtualNetworkVirtualNetworksRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, null, cancellationToken).ConfigureAwait(false); - return Response.FromValue(new DevTestLabVirtualNetworkResource(Client, originalResponse.Value), originalResponse.GetRawResponse()); + await GetTagResource().CreateOrUpdateAsync(WaitUntil.Completed, originalTags.Value.Data, cancellationToken).ConfigureAwait(false); + RequestContext context = new RequestContext + { + CancellationToken = cancellationToken + }; + HttpMessage message = _virtualNetworksRestClient.CreateGetRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, default, context); + Response result = await Pipeline.ProcessMessageAsync(message, context).ConfigureAwait(false); + Response response = Response.FromValue(DevTestLabVirtualNetworkData.FromResponse(result), result); + return Response.FromValue(new DevTestLabVirtualNetworkResource(Client, response.Value), response.GetRawResponse()); } else { - var current = (await GetAsync(cancellationToken: cancellationToken).ConfigureAwait(false)).Value.Data; - var patch = new DevTestLabVirtualNetworkPatch(); + DevTestLabVirtualNetworkData current = (await GetAsync(cancellationToken: cancellationToken).ConfigureAwait(false)).Value.Data; + DevTestLabVirtualNetworkPatch patch = new DevTestLabVirtualNetworkPatch(); 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) @@ -521,54 +533,40 @@ public virtual async Task> SetTagsAsy } } - /// - /// Replace the tags on the resource with the given set. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/virtualnetworks/{name} - /// - /// - /// Operation Id - /// VirtualNetworks_Get - /// - /// - /// Default Api Version - /// 2018-09-15 - /// - /// - /// 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 = _devTestLabVirtualNetworkVirtualNetworksClientDiagnostics.CreateScope("DevTestLabVirtualNetworkResource.SetTags"); + using DiagnosticScope scope = _virtualNetworksClientDiagnostics.CreateScope("DevTestLabVirtualNetworkResource.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 = _devTestLabVirtualNetworkVirtualNetworksRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, null, cancellationToken); - return Response.FromValue(new DevTestLabVirtualNetworkResource(Client, originalResponse.Value), originalResponse.GetRawResponse()); + GetTagResource().CreateOrUpdate(WaitUntil.Completed, originalTags.Value.Data, cancellationToken); + RequestContext context = new RequestContext + { + CancellationToken = cancellationToken + }; + HttpMessage message = _virtualNetworksRestClient.CreateGetRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, default, context); + Response result = Pipeline.ProcessMessage(message, context); + Response response = Response.FromValue(DevTestLabVirtualNetworkData.FromResponse(result), result); + return Response.FromValue(new DevTestLabVirtualNetworkResource(Client, response.Value), response.GetRawResponse()); } else { - var current = Get(cancellationToken: cancellationToken).Value.Data; - var patch = new DevTestLabVirtualNetworkPatch(); + DevTestLabVirtualNetworkData current = Get(cancellationToken: cancellationToken).Value.Data; + DevTestLabVirtualNetworkPatch patch = new DevTestLabVirtualNetworkPatch(); 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) @@ -578,27 +576,7 @@ public virtual Response SetTags(IDictionary - /// Removes a tag by key from the resource. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/virtualnetworks/{name} - /// - /// - /// Operation Id - /// VirtualNetworks_Get - /// - /// - /// Default Api Version - /// 2018-09-15 - /// - /// - /// Resource - /// - /// - /// - /// + /// Removes a tag by key from the resource. /// The key for the tag. /// The cancellation token to use. /// is null. @@ -606,29 +584,35 @@ public virtual async Task> RemoveTagA { Argument.AssertNotNull(key, nameof(key)); - using var scope = _devTestLabVirtualNetworkVirtualNetworksClientDiagnostics.CreateScope("DevTestLabVirtualNetworkResource.RemoveTag"); + using DiagnosticScope scope = _virtualNetworksClientDiagnostics.CreateScope("DevTestLabVirtualNetworkResource.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 _devTestLabVirtualNetworkVirtualNetworksRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, null, cancellationToken).ConfigureAwait(false); - return Response.FromValue(new DevTestLabVirtualNetworkResource(Client, originalResponse.Value), originalResponse.GetRawResponse()); + await GetTagResource().CreateOrUpdateAsync(WaitUntil.Completed, originalTags.Value.Data, cancellationToken).ConfigureAwait(false); + RequestContext context = new RequestContext + { + CancellationToken = cancellationToken + }; + HttpMessage message = _virtualNetworksRestClient.CreateGetRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, default, context); + Response result = await Pipeline.ProcessMessageAsync(message, context).ConfigureAwait(false); + Response response = Response.FromValue(DevTestLabVirtualNetworkData.FromResponse(result), result); + return Response.FromValue(new DevTestLabVirtualNetworkResource(Client, response.Value), response.GetRawResponse()); } else { - var current = (await GetAsync(cancellationToken: cancellationToken).ConfigureAwait(false)).Value.Data; - var patch = new DevTestLabVirtualNetworkPatch(); - foreach (var tag in current.Tags) + DevTestLabVirtualNetworkData current = (await GetAsync(cancellationToken: cancellationToken).ConfigureAwait(false)).Value.Data; + DevTestLabVirtualNetworkPatch patch = new DevTestLabVirtualNetworkPatch(); + 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) @@ -638,27 +622,7 @@ public virtual async Task> RemoveTagA } } - /// - /// Removes a tag by key from the resource. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/virtualnetworks/{name} - /// - /// - /// Operation Id - /// VirtualNetworks_Get - /// - /// - /// Default Api Version - /// 2018-09-15 - /// - /// - /// Resource - /// - /// - /// - /// + /// Removes a tag by key from the resource. /// The key for the tag. /// The cancellation token to use. /// is null. @@ -666,29 +630,35 @@ public virtual Response RemoveTag(string key, { Argument.AssertNotNull(key, nameof(key)); - using var scope = _devTestLabVirtualNetworkVirtualNetworksClientDiagnostics.CreateScope("DevTestLabVirtualNetworkResource.RemoveTag"); + using DiagnosticScope scope = _virtualNetworksClientDiagnostics.CreateScope("DevTestLabVirtualNetworkResource.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 = _devTestLabVirtualNetworkVirtualNetworksRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, null, cancellationToken); - return Response.FromValue(new DevTestLabVirtualNetworkResource(Client, originalResponse.Value), originalResponse.GetRawResponse()); + GetTagResource().CreateOrUpdate(WaitUntil.Completed, originalTags.Value.Data, cancellationToken); + RequestContext context = new RequestContext + { + CancellationToken = cancellationToken + }; + HttpMessage message = _virtualNetworksRestClient.CreateGetRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, default, context); + Response result = Pipeline.ProcessMessage(message, context); + Response response = Response.FromValue(DevTestLabVirtualNetworkData.FromResponse(result), result); + return Response.FromValue(new DevTestLabVirtualNetworkResource(Client, response.Value), response.GetRawResponse()); } else { - var current = Get(cancellationToken: cancellationToken).Value.Data; - var patch = new DevTestLabVirtualNetworkPatch(); - foreach (var tag in current.Tags) + DevTestLabVirtualNetworkData current = Get(cancellationToken: cancellationToken).Value.Data; + DevTestLabVirtualNetworkPatch patch = new DevTestLabVirtualNetworkPatch(); + 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) diff --git a/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/DevTestLabVmCollection.cs b/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/DevTestLabVmCollection.cs index 72c66e8d21ac..5371a083d612 100644 --- a/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/DevTestLabVmCollection.cs +++ b/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/DevTestLabVmCollection.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.DevTestLabs { @@ -24,51 +25,49 @@ namespace Azure.ResourceManager.DevTestLabs /// public partial class DevTestLabVmCollection : ArmCollection, IEnumerable, IAsyncEnumerable { - private readonly ClientDiagnostics _devTestLabVmVirtualMachinesClientDiagnostics; - private readonly VirtualMachinesRestOperations _devTestLabVmVirtualMachinesRestClient; + private readonly ClientDiagnostics _virtualMachinesClientDiagnostics; + private readonly VirtualMachines _virtualMachinesRestClient; - /// Initializes a new instance of the class for mocking. + /// Initializes a new instance of DevTestLabVmCollection for mocking. protected DevTestLabVmCollection() { } - /// 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 DevTestLabVmCollection(ArmClient client, ResourceIdentifier id) : base(client, id) { - _devTestLabVmVirtualMachinesClientDiagnostics = new ClientDiagnostics("Azure.ResourceManager.DevTestLabs", DevTestLabVmResource.ResourceType.Namespace, Diagnostics); - TryGetApiVersion(DevTestLabVmResource.ResourceType, out string devTestLabVmVirtualMachinesApiVersion); - _devTestLabVmVirtualMachinesRestClient = new VirtualMachinesRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, devTestLabVmVirtualMachinesApiVersion); -#if DEBUG - ValidateResourceId(Id); -#endif + TryGetApiVersion(DevTestLabVmResource.ResourceType, out string devTestLabVmApiVersion); + _virtualMachinesClientDiagnostics = new ClientDiagnostics("Azure.ResourceManager.DevTestLabs", DevTestLabVmResource.ResourceType.Namespace, Diagnostics); + _virtualMachinesRestClient = new VirtualMachines(_virtualMachinesClientDiagnostics, Pipeline, Endpoint, devTestLabVmApiVersion ?? "2018-09-15"); + ValidateResourceId(id); } + /// + [Conditional("DEBUG")] internal static void ValidateResourceId(ResourceIdentifier id) { if (id.ResourceType != DevTestLabResource.ResourceType) - throw new ArgumentException(string.Format(CultureInfo.CurrentCulture, "Invalid resource type {0} expected {1}", id.ResourceType, DevTestLabResource.ResourceType), nameof(id)); + { + throw new ArgumentException(string.Format("Invalid resource type {0} expected {1}", id.ResourceType, DevTestLabResource.ResourceType), id); + } } /// /// Create or replace an existing virtual machine. This operation can take a while to complete. /// /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/virtualmachines/{name} - /// - /// - /// Operation Id - /// VirtualMachines_CreateOrUpdate + /// Request Path. + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/virtualmachines/{name}. /// /// - /// Default Api Version - /// 2018-09-15 + /// Operation Id. + /// VirtualMachines_CreateOrUpdate. /// /// - /// Resource - /// + /// Default Api Version. + /// 2018-09-15. /// /// /// @@ -76,21 +75,34 @@ internal static void ValidateResourceId(ResourceIdentifier id) /// The name of the virtual machine. /// A virtual machine. /// 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 name, DevTestLabVmData data, CancellationToken cancellationToken = default) { Argument.AssertNotNullOrEmpty(name, nameof(name)); Argument.AssertNotNull(data, nameof(data)); - using var scope = _devTestLabVmVirtualMachinesClientDiagnostics.CreateScope("DevTestLabVmCollection.CreateOrUpdate"); + using DiagnosticScope scope = _virtualMachinesClientDiagnostics.CreateScope("DevTestLabVmCollection.CreateOrUpdate"); scope.Start(); try { - var response = await _devTestLabVmVirtualMachinesRestClient.CreateOrUpdateAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, name, data, cancellationToken).ConfigureAwait(false); - var operation = new DevTestLabsArmOperation(new DevTestLabVmOperationSource(Client), _devTestLabVmVirtualMachinesClientDiagnostics, Pipeline, _devTestLabVmVirtualMachinesRestClient.CreateCreateOrUpdateRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, name, data).Request, response, OperationFinalStateVia.Location); + RequestContext context = new RequestContext + { + CancellationToken = cancellationToken + }; + HttpMessage message = _virtualMachinesRestClient.CreateCreateOrUpdateRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, name, DevTestLabVmData.ToRequestContent(data), context); + Response response = await Pipeline.ProcessMessageAsync(message, context).ConfigureAwait(false); + DevTestLabsArmOperation operation = new DevTestLabsArmOperation( + new DevTestLabVmOperationSource(Client), + _virtualMachinesClientDiagnostics, + Pipeline, + message.Request, + response, + OperationFinalStateVia.Location); if (waitUntil == WaitUntil.Completed) + { await operation.WaitForCompletionAsync(cancellationToken).ConfigureAwait(false); + } return operation; } catch (Exception e) @@ -104,20 +116,16 @@ public virtual async Task> CreateOrUpdateAsyn /// Create or replace an existing virtual machine. This operation can take a while to complete. /// /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/virtualmachines/{name} + /// Request Path. + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/virtualmachines/{name}. /// /// - /// Operation Id - /// VirtualMachines_CreateOrUpdate + /// Operation Id. + /// VirtualMachines_CreateOrUpdate. /// /// - /// Default Api Version - /// 2018-09-15 - /// - /// - /// Resource - /// + /// Default Api Version. + /// 2018-09-15. /// /// /// @@ -125,21 +133,34 @@ public virtual async Task> CreateOrUpdateAsyn /// The name of the virtual machine. /// A virtual machine. /// 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 name, DevTestLabVmData data, CancellationToken cancellationToken = default) { Argument.AssertNotNullOrEmpty(name, nameof(name)); Argument.AssertNotNull(data, nameof(data)); - using var scope = _devTestLabVmVirtualMachinesClientDiagnostics.CreateScope("DevTestLabVmCollection.CreateOrUpdate"); + using DiagnosticScope scope = _virtualMachinesClientDiagnostics.CreateScope("DevTestLabVmCollection.CreateOrUpdate"); scope.Start(); try { - var response = _devTestLabVmVirtualMachinesRestClient.CreateOrUpdate(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, name, data, cancellationToken); - var operation = new DevTestLabsArmOperation(new DevTestLabVmOperationSource(Client), _devTestLabVmVirtualMachinesClientDiagnostics, Pipeline, _devTestLabVmVirtualMachinesRestClient.CreateCreateOrUpdateRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, name, data).Request, response, OperationFinalStateVia.Location); + RequestContext context = new RequestContext + { + CancellationToken = cancellationToken + }; + HttpMessage message = _virtualMachinesRestClient.CreateCreateOrUpdateRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, name, DevTestLabVmData.ToRequestContent(data), context); + Response response = Pipeline.ProcessMessage(message, context); + DevTestLabsArmOperation operation = new DevTestLabsArmOperation( + new DevTestLabVmOperationSource(Client), + _virtualMachinesClientDiagnostics, + Pipeline, + message.Request, + response, + OperationFinalStateVia.Location); if (waitUntil == WaitUntil.Completed) + { operation.WaitForCompletion(cancellationToken); + } return operation; } catch (Exception e) @@ -153,39 +174,43 @@ public virtual ArmOperation CreateOrUpdate(WaitUntil waitU /// Get virtual machine. /// /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/virtualmachines/{name} + /// Request Path. + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/virtualmachines/{name}. /// /// - /// Operation Id - /// VirtualMachines_Get + /// Operation Id. + /// VirtualMachines_Get. /// /// - /// Default Api Version - /// 2018-09-15 - /// - /// - /// Resource - /// + /// Default Api Version. + /// 2018-09-15. /// /// /// /// The name of the virtual machine. /// Specify the $expand query. Example: 'properties($expand=artifacts,computeVm,networkInterface,applicableSchedule)'. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. - public virtual async Task> GetAsync(string name, string expand = null, CancellationToken cancellationToken = default) + /// is an empty string, and was expected to be non-empty. + public virtual async Task> GetAsync(string name, string expand = default, CancellationToken cancellationToken = default) { Argument.AssertNotNullOrEmpty(name, nameof(name)); - using var scope = _devTestLabVmVirtualMachinesClientDiagnostics.CreateScope("DevTestLabVmCollection.Get"); + using DiagnosticScope scope = _virtualMachinesClientDiagnostics.CreateScope("DevTestLabVmCollection.Get"); scope.Start(); try { - var response = await _devTestLabVmVirtualMachinesRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, name, expand, cancellationToken).ConfigureAwait(false); + RequestContext context = new RequestContext + { + CancellationToken = cancellationToken + }; + HttpMessage message = _virtualMachinesRestClient.CreateGetRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, name, expand, context); + Response result = await Pipeline.ProcessMessageAsync(message, context).ConfigureAwait(false); + Response response = Response.FromValue(DevTestLabVmData.FromResponse(result), result); if (response.Value == null) + { throw new RequestFailedException(response.GetRawResponse()); + } return Response.FromValue(new DevTestLabVmResource(Client, response.Value), response.GetRawResponse()); } catch (Exception e) @@ -199,39 +224,43 @@ public virtual async Task> GetAsync(string name, /// Get virtual machine. /// /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/virtualmachines/{name} - /// - /// - /// Operation Id - /// VirtualMachines_Get + /// Request Path. + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/virtualmachines/{name}. /// /// - /// Default Api Version - /// 2018-09-15 + /// Operation Id. + /// VirtualMachines_Get. /// /// - /// Resource - /// + /// Default Api Version. + /// 2018-09-15. /// /// /// /// The name of the virtual machine. /// Specify the $expand query. Example: 'properties($expand=artifacts,computeVm,networkInterface,applicableSchedule)'. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. - public virtual Response Get(string name, string expand = null, CancellationToken cancellationToken = default) + /// is an empty string, and was expected to be non-empty. + public virtual Response Get(string name, string expand = default, CancellationToken cancellationToken = default) { Argument.AssertNotNullOrEmpty(name, nameof(name)); - using var scope = _devTestLabVmVirtualMachinesClientDiagnostics.CreateScope("DevTestLabVmCollection.Get"); + using DiagnosticScope scope = _virtualMachinesClientDiagnostics.CreateScope("DevTestLabVmCollection.Get"); scope.Start(); try { - var response = _devTestLabVmVirtualMachinesRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, name, expand, cancellationToken); + RequestContext context = new RequestContext + { + CancellationToken = cancellationToken + }; + HttpMessage message = _virtualMachinesRestClient.CreateGetRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, name, expand, context); + Response result = Pipeline.ProcessMessage(message, context); + Response response = Response.FromValue(DevTestLabVmData.FromResponse(result), result); if (response.Value == null) + { throw new RequestFailedException(response.GetRawResponse()); + } return Response.FromValue(new DevTestLabVmResource(Client, response.Value), response.GetRawResponse()); } catch (Exception e) @@ -245,20 +274,16 @@ public virtual Response Get(string name, string expand = n /// List virtual machines in a given lab. /// /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/virtualmachines + /// Request Path. + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/virtualmachines. /// /// - /// Operation Id - /// VirtualMachines_List + /// Operation Id. + /// VirtualMachines_List. /// /// - /// Default Api Version - /// 2018-09-15 - /// - /// - /// Resource - /// + /// Default Api Version. + /// 2018-09-15. /// /// /// @@ -267,32 +292,39 @@ public virtual Response Get(string name, string expand = n /// The maximum number of resources to return from the operation. Example: '$top=10'. /// The ordering expression for the results, using OData notation. Example: '$orderby=name desc'. /// The cancellation token to use. - /// An async collection of that may take multiple service requests to iterate over. - public virtual AsyncPageable GetAllAsync(string expand = null, string filter = null, int? top = null, string orderby = null, CancellationToken cancellationToken = default) + /// A collection of that may take multiple service requests to iterate over. + public virtual AsyncPageable GetAllAsync(string expand = default, string filter = default, int? top = default, string @orderby = default, CancellationToken cancellationToken = default) { - HttpMessage FirstPageRequest(int? pageSizeHint) => _devTestLabVmVirtualMachinesRestClient.CreateListRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, expand, filter, top, orderby); - HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _devTestLabVmVirtualMachinesRestClient.CreateListNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName, Id.Name, expand, filter, top, orderby); - return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new DevTestLabVmResource(Client, DevTestLabVmData.DeserializeDevTestLabVmData(e)), _devTestLabVmVirtualMachinesClientDiagnostics, Pipeline, "DevTestLabVmCollection.GetAll", "value", "nextLink", cancellationToken); + RequestContext context = new RequestContext + { + CancellationToken = cancellationToken + }; + return new AsyncPageableWrapper(new VirtualMachinesGetAllAsyncCollectionResultOfT( + _virtualMachinesRestClient, + Id.SubscriptionId, + Id.ResourceGroupName, + Id.Name, + expand, + filter, + top, + @orderby, + context), data => new DevTestLabVmResource(Client, data)); } /// /// List virtual machines in a given lab. /// /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/virtualmachines - /// - /// - /// Operation Id - /// VirtualMachines_List + /// Request Path. + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/virtualmachines. /// /// - /// Default Api Version - /// 2018-09-15 + /// Operation Id. + /// VirtualMachines_List. /// /// - /// Resource - /// + /// Default Api Version. + /// 2018-09-15. /// /// /// @@ -302,48 +334,73 @@ public virtual AsyncPageable GetAllAsync(string expand = n /// The ordering expression for the results, using OData notation. Example: '$orderby=name desc'. /// The cancellation token to use. /// A collection of that may take multiple service requests to iterate over. - public virtual Pageable GetAll(string expand = null, string filter = null, int? top = null, string orderby = null, CancellationToken cancellationToken = default) + public virtual Pageable GetAll(string expand = default, string filter = default, int? top = default, string @orderby = default, CancellationToken cancellationToken = default) { - HttpMessage FirstPageRequest(int? pageSizeHint) => _devTestLabVmVirtualMachinesRestClient.CreateListRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, expand, filter, top, orderby); - HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _devTestLabVmVirtualMachinesRestClient.CreateListNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName, Id.Name, expand, filter, top, orderby); - return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new DevTestLabVmResource(Client, DevTestLabVmData.DeserializeDevTestLabVmData(e)), _devTestLabVmVirtualMachinesClientDiagnostics, Pipeline, "DevTestLabVmCollection.GetAll", "value", "nextLink", cancellationToken); + RequestContext context = new RequestContext + { + CancellationToken = cancellationToken + }; + return new PageableWrapper(new VirtualMachinesGetAllCollectionResultOfT( + _virtualMachinesRestClient, + Id.SubscriptionId, + Id.ResourceGroupName, + Id.Name, + expand, + filter, + top, + @orderby, + context), data => new DevTestLabVmResource(Client, data)); } /// /// Checks to see if the resource exists in azure. /// /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/virtualmachines/{name} - /// - /// - /// Operation Id - /// VirtualMachines_Get + /// Request Path. + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/virtualmachines/{name}. /// /// - /// Default Api Version - /// 2018-09-15 + /// Operation Id. + /// VirtualMachines_Get. /// /// - /// Resource - /// + /// Default Api Version. + /// 2018-09-15. /// /// /// /// The name of the virtual machine. /// Specify the $expand query. Example: 'properties($expand=artifacts,computeVm,networkInterface,applicableSchedule)'. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. - public virtual async Task> ExistsAsync(string name, string expand = null, CancellationToken cancellationToken = default) + /// is an empty string, and was expected to be non-empty. + public virtual async Task> ExistsAsync(string name, string expand = default, CancellationToken cancellationToken = default) { Argument.AssertNotNullOrEmpty(name, nameof(name)); - using var scope = _devTestLabVmVirtualMachinesClientDiagnostics.CreateScope("DevTestLabVmCollection.Exists"); + using DiagnosticScope scope = _virtualMachinesClientDiagnostics.CreateScope("DevTestLabVmCollection.Exists"); scope.Start(); try { - var response = await _devTestLabVmVirtualMachinesRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, name, expand, cancellationToken: cancellationToken).ConfigureAwait(false); + RequestContext context = new RequestContext + { + CancellationToken = cancellationToken + }; + HttpMessage message = _virtualMachinesRestClient.CreateGetRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, name, expand, context); + await Pipeline.SendAsync(message, context.CancellationToken).ConfigureAwait(false); + Response result = message.Response; + Response response = default; + switch (result.Status) + { + case 200: + response = Response.FromValue(DevTestLabVmData.FromResponse(result), result); + break; + case 404: + response = Response.FromValue((DevTestLabVmData)null, result); + break; + default: + throw new RequestFailedException(result); + } return Response.FromValue(response.Value != null, response.GetRawResponse()); } catch (Exception e) @@ -357,37 +414,51 @@ public virtual async Task> ExistsAsync(string name, string expand /// Checks to see if the resource exists in azure. /// /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/virtualmachines/{name} + /// Request Path. + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/virtualmachines/{name}. /// /// - /// Operation Id - /// VirtualMachines_Get + /// Operation Id. + /// VirtualMachines_Get. /// /// - /// Default Api Version - /// 2018-09-15 - /// - /// - /// Resource - /// + /// Default Api Version. + /// 2018-09-15. /// /// /// /// The name of the virtual machine. /// Specify the $expand query. Example: 'properties($expand=artifacts,computeVm,networkInterface,applicableSchedule)'. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. - public virtual Response Exists(string name, string expand = null, CancellationToken cancellationToken = default) + /// is an empty string, and was expected to be non-empty. + public virtual Response Exists(string name, string expand = default, CancellationToken cancellationToken = default) { Argument.AssertNotNullOrEmpty(name, nameof(name)); - using var scope = _devTestLabVmVirtualMachinesClientDiagnostics.CreateScope("DevTestLabVmCollection.Exists"); + using DiagnosticScope scope = _virtualMachinesClientDiagnostics.CreateScope("DevTestLabVmCollection.Exists"); scope.Start(); try { - var response = _devTestLabVmVirtualMachinesRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, name, expand, cancellationToken: cancellationToken); + RequestContext context = new RequestContext + { + CancellationToken = cancellationToken + }; + HttpMessage message = _virtualMachinesRestClient.CreateGetRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, name, expand, context); + Pipeline.Send(message, context.CancellationToken); + Response result = message.Response; + Response response = default; + switch (result.Status) + { + case 200: + response = Response.FromValue(DevTestLabVmData.FromResponse(result), result); + break; + case 404: + response = Response.FromValue((DevTestLabVmData)null, result); + break; + default: + throw new RequestFailedException(result); + } return Response.FromValue(response.Value != null, response.GetRawResponse()); } catch (Exception e) @@ -401,39 +472,55 @@ public virtual Response Exists(string name, string expand = null, Cancella /// Tries to get details for this resource from the service. /// /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/virtualmachines/{name} - /// - /// - /// Operation Id - /// VirtualMachines_Get + /// Request Path. + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/virtualmachines/{name}. /// /// - /// Default Api Version - /// 2018-09-15 + /// Operation Id. + /// VirtualMachines_Get. /// /// - /// Resource - /// + /// Default Api Version. + /// 2018-09-15. /// /// /// /// The name of the virtual machine. /// Specify the $expand query. Example: 'properties($expand=artifacts,computeVm,networkInterface,applicableSchedule)'. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. - public virtual async Task> GetIfExistsAsync(string name, string expand = null, CancellationToken cancellationToken = default) + /// is an empty string, and was expected to be non-empty. + public virtual async Task> GetIfExistsAsync(string name, string expand = default, CancellationToken cancellationToken = default) { Argument.AssertNotNullOrEmpty(name, nameof(name)); - using var scope = _devTestLabVmVirtualMachinesClientDiagnostics.CreateScope("DevTestLabVmCollection.GetIfExists"); + using DiagnosticScope scope = _virtualMachinesClientDiagnostics.CreateScope("DevTestLabVmCollection.GetIfExists"); scope.Start(); try { - var response = await _devTestLabVmVirtualMachinesRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, name, expand, cancellationToken: cancellationToken).ConfigureAwait(false); + RequestContext context = new RequestContext + { + CancellationToken = cancellationToken + }; + HttpMessage message = _virtualMachinesRestClient.CreateGetRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, name, expand, context); + await Pipeline.SendAsync(message, context.CancellationToken).ConfigureAwait(false); + Response result = message.Response; + Response response = default; + switch (result.Status) + { + case 200: + response = Response.FromValue(DevTestLabVmData.FromResponse(result), result); + break; + case 404: + response = Response.FromValue((DevTestLabVmData)null, result); + break; + default: + throw new RequestFailedException(result); + } if (response.Value == null) + { return new NoValueResponse(response.GetRawResponse()); + } return Response.FromValue(new DevTestLabVmResource(Client, response.Value), response.GetRawResponse()); } catch (Exception e) @@ -447,39 +534,55 @@ public virtual async Task> GetIfExistsAsy /// Tries to get details for this resource from the service. /// /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/virtualmachines/{name} + /// Request Path. + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/virtualmachines/{name}. /// /// - /// Operation Id - /// VirtualMachines_Get + /// Operation Id. + /// VirtualMachines_Get. /// /// - /// Default Api Version - /// 2018-09-15 - /// - /// - /// Resource - /// + /// Default Api Version. + /// 2018-09-15. /// /// /// /// The name of the virtual machine. /// Specify the $expand query. Example: 'properties($expand=artifacts,computeVm,networkInterface,applicableSchedule)'. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. - public virtual NullableResponse GetIfExists(string name, string expand = null, CancellationToken cancellationToken = default) + /// is an empty string, and was expected to be non-empty. + public virtual NullableResponse GetIfExists(string name, string expand = default, CancellationToken cancellationToken = default) { Argument.AssertNotNullOrEmpty(name, nameof(name)); - using var scope = _devTestLabVmVirtualMachinesClientDiagnostics.CreateScope("DevTestLabVmCollection.GetIfExists"); + using DiagnosticScope scope = _virtualMachinesClientDiagnostics.CreateScope("DevTestLabVmCollection.GetIfExists"); scope.Start(); try { - var response = _devTestLabVmVirtualMachinesRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, name, expand, cancellationToken: cancellationToken); + RequestContext context = new RequestContext + { + CancellationToken = cancellationToken + }; + HttpMessage message = _virtualMachinesRestClient.CreateGetRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, name, expand, context); + Pipeline.Send(message, context.CancellationToken); + Response result = message.Response; + Response response = default; + switch (result.Status) + { + case 200: + response = Response.FromValue(DevTestLabVmData.FromResponse(result), result); + break; + case 404: + response = Response.FromValue((DevTestLabVmData)null, result); + break; + default: + throw new RequestFailedException(result); + } if (response.Value == null) + { return new NoValueResponse(response.GetRawResponse()); + } return Response.FromValue(new DevTestLabVmResource(Client, response.Value), response.GetRawResponse()); } catch (Exception e) @@ -499,6 +602,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/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/DevTestLabVmData.Serialization.cs b/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/DevTestLabVmData.Serialization.cs index 17745cb22d79..ba1691f4ac55 100644 --- a/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/DevTestLabVmData.Serialization.cs +++ b/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/DevTestLabVmData.Serialization.cs @@ -10,16 +10,47 @@ using System.Collections.Generic; using System.Text; using System.Text.Json; +using Azure; using Azure.Core; using Azure.ResourceManager.DevTestLabs.Models; using Azure.ResourceManager.Models; namespace Azure.ResourceManager.DevTestLabs { - public partial class DevTestLabVmData : IUtf8JsonSerializable, IJsonModel + /// A virtual machine. + public partial class DevTestLabVmData : TrackedResourceData, IJsonModel { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + /// Initializes a new instance of for deserialization. + internal DevTestLabVmData() + { + } + /// 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)) + { + return DeserializeDevTestLabVmData(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(DevTestLabVmData)} does not support reading '{options.Format}' format."); + } + } + + /// The to deserialize the from. + internal static DevTestLabVmData FromResponse(Response response) + { + using JsonDocument document = JsonDocument.Parse(response.Content, ModelSerializationExtensions.JsonDocumentOptions); + return DeserializeDevTestLabVmData(document.RootElement, ModelSerializationExtensions.WireOptions); + } + + /// The JSON writer. + /// The client options for reading and writing models. void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) { writer.WriteStartObject(); @@ -31,645 +62,153 @@ void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriter /// 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(DevTestLabVmData)} does not support writing '{format}' format."); } - base.JsonModelWriteCore(writer, options); writer.WritePropertyName("properties"u8); - writer.WriteStartObject(); - if (Optional.IsDefined(Notes)) - { - writer.WritePropertyName("notes"u8); - writer.WriteStringValue(Notes); - } - if (Optional.IsDefined(OwnerObjectId)) + writer.WriteObjectValue(Properties, options); + if (Optional.IsCollectionDefined(Tags)) { - writer.WritePropertyName("ownerObjectId"u8); - writer.WriteStringValue(OwnerObjectId); - } - if (Optional.IsDefined(OwnerUserPrincipalName)) - { - writer.WritePropertyName("ownerUserPrincipalName"u8); - writer.WriteStringValue(OwnerUserPrincipalName); - } - if (options.Format != "W" && Optional.IsDefined(CreatedByUserId)) - { - writer.WritePropertyName("createdByUserId"u8); - writer.WriteStringValue(CreatedByUserId); - } - if (options.Format != "W" && Optional.IsDefined(CreatedByUser)) - { - writer.WritePropertyName("createdByUser"u8); - writer.WriteStringValue(CreatedByUser); - } - if (Optional.IsDefined(CreatedOn)) - { - writer.WritePropertyName("createdDate"u8); - writer.WriteStringValue(CreatedOn.Value, "O"); - } - if (options.Format != "W" && Optional.IsDefined(ComputeId)) - { - writer.WritePropertyName("computeId"u8); - writer.WriteStringValue(ComputeId); - } - if (Optional.IsDefined(CustomImageId)) - { - writer.WritePropertyName("customImageId"u8); - writer.WriteStringValue(CustomImageId); - } - if (options.Format != "W" && Optional.IsDefined(OSType)) - { - writer.WritePropertyName("osType"u8); - writer.WriteStringValue(OSType); - } - if (Optional.IsDefined(Size)) - { - writer.WritePropertyName("size"u8); - writer.WriteStringValue(Size); - } - if (Optional.IsDefined(UserName)) - { - writer.WritePropertyName("userName"u8); - writer.WriteStringValue(UserName); - } - if (Optional.IsDefined(Password)) - { - writer.WritePropertyName("password"u8); - writer.WriteStringValue(Password); - } - if (Optional.IsDefined(SshKey)) - { - writer.WritePropertyName("sshKey"u8); - writer.WriteStringValue(SshKey); - } - if (Optional.IsDefined(IsAuthenticationWithSshKey)) - { - writer.WritePropertyName("isAuthenticationWithSshKey"u8); - writer.WriteBooleanValue(IsAuthenticationWithSshKey.Value); - } - if (options.Format != "W" && Optional.IsDefined(Fqdn)) - { - writer.WritePropertyName("fqdn"u8); - writer.WriteStringValue(Fqdn); - } - if (Optional.IsDefined(LabSubnetName)) - { - writer.WritePropertyName("labSubnetName"u8); - writer.WriteStringValue(LabSubnetName); - } - if (Optional.IsDefined(LabVirtualNetworkId)) - { - writer.WritePropertyName("labVirtualNetworkId"u8); - writer.WriteStringValue(LabVirtualNetworkId); - } - if (Optional.IsDefined(DisallowPublicIPAddress)) - { - writer.WritePropertyName("disallowPublicIpAddress"u8); - writer.WriteBooleanValue(DisallowPublicIPAddress.Value); - } - if (Optional.IsCollectionDefined(Artifacts)) - { - writer.WritePropertyName("artifacts"u8); - writer.WriteStartArray(); - foreach (var item in Artifacts) - { - writer.WriteObjectValue(item, options); - } - writer.WriteEndArray(); - } - if (options.Format != "W" && Optional.IsDefined(ArtifactDeploymentStatus)) - { - writer.WritePropertyName("artifactDeploymentStatus"u8); - writer.WriteObjectValue(ArtifactDeploymentStatus, options); - } - if (Optional.IsDefined(GalleryImageReference)) - { - writer.WritePropertyName("galleryImageReference"u8); - writer.WriteObjectValue(GalleryImageReference, options); - } - if (Optional.IsDefined(PlanId)) - { - writer.WritePropertyName("planId"u8); - writer.WriteStringValue(PlanId); - } - if (options.Format != "W" && Optional.IsDefined(ComputeVm)) - { - writer.WritePropertyName("computeVm"u8); - writer.WriteObjectValue(ComputeVm, options); - } - if (Optional.IsDefined(NetworkInterface)) - { - writer.WritePropertyName("networkInterface"u8); - writer.WriteObjectValue(NetworkInterface, options); - } - if (options.Format != "W" && Optional.IsDefined(ApplicableSchedule)) - { - writer.WritePropertyName("applicableSchedule"u8); - writer.WriteObjectValue(ApplicableSchedule, options); - } - if (Optional.IsDefined(ExpireOn)) - { - writer.WritePropertyName("expirationDate"u8); - writer.WriteStringValue(ExpireOn.Value, "O"); - } - if (Optional.IsDefined(AllowClaim)) - { - writer.WritePropertyName("allowClaim"u8); - writer.WriteBooleanValue(AllowClaim.Value); - } - if (Optional.IsDefined(StorageType)) - { - writer.WritePropertyName("storageType"u8); - writer.WriteStringValue(StorageType); - } - if (options.Format != "W" && Optional.IsDefined(VmCreationSource)) - { - writer.WritePropertyName("virtualMachineCreationSource"u8); - writer.WriteStringValue(VmCreationSource.Value.ToString()); - } - if (Optional.IsDefined(EnvironmentId)) - { - writer.WritePropertyName("environmentId"u8); - writer.WriteStringValue(EnvironmentId); - } - if (Optional.IsCollectionDefined(DataDiskParameters)) - { - writer.WritePropertyName("dataDiskParameters"u8); - writer.WriteStartArray(); - foreach (var item in DataDiskParameters) + writer.WritePropertyName("tags"u8); + writer.WriteStartObject(); + foreach (var item in Tags) { - writer.WriteObjectValue(item, options); - } - writer.WriteEndArray(); - } - if (Optional.IsCollectionDefined(ScheduleParameters)) - { - writer.WritePropertyName("scheduleParameters"u8); - writer.WriteStartArray(); - foreach (var item in ScheduleParameters) - { - writer.WriteObjectValue(item, options); + writer.WritePropertyName(item.Key); + if (item.Value == null) + { + writer.WriteNullValue(); + continue; + } + writer.WriteStringValue(item.Value); } - writer.WriteEndArray(); - } - if (options.Format != "W" && Optional.IsDefined(LastKnownPowerState)) - { - writer.WritePropertyName("lastKnownPowerState"u8); - writer.WriteStringValue(LastKnownPowerState); - } - if (options.Format != "W" && Optional.IsDefined(ProvisioningState)) - { - writer.WritePropertyName("provisioningState"u8); - writer.WriteStringValue(ProvisioningState); + writer.WriteEndObject(); } - if (options.Format != "W" && Optional.IsDefined(UniqueIdentifier)) - { - writer.WritePropertyName("uniqueIdentifier"u8); - writer.WriteStringValue(UniqueIdentifier.Value); - } - writer.WriteEndObject(); } - DevTestLabVmData IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + /// The JSON reader. + /// The client options for reading and writing models. + DevTestLabVmData IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) => (DevTestLabVmData)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(DevTestLabVmData)} does not support reading '{format}' format."); } - using JsonDocument document = JsonDocument.ParseValue(ref reader); return DeserializeDevTestLabVmData(document.RootElement, options); } - internal static DevTestLabVmData DeserializeDevTestLabVmData(JsonElement element, ModelReaderWriterOptions options = null) + /// The JSON element to deserialize. + /// The client options for reading and writing models. + internal static DevTestLabVmData DeserializeDevTestLabVmData(JsonElement element, ModelReaderWriterOptions options) { - options ??= ModelSerializationExtensions.WireOptions; - if (element.ValueKind == JsonValueKind.Null) { return null; } - IDictionary tags = default; - AzureLocation location = default; ResourceIdentifier id = default; string name = default; - ResourceType type = default; + ResourceType resourceType = default; SystemData systemData = default; - string notes = default; - string ownerObjectId = default; - string ownerUserPrincipalName = default; - string createdByUserId = default; - string createdByUser = default; - DateTimeOffset? createdDate = default; - ResourceIdentifier computeId = default; - string customImageId = default; - string osType = default; - string size = default; - string userName = default; - string password = default; - string sshKey = default; - bool? isAuthenticationWithSshKey = default; - string fqdn = default; - string labSubnetName = default; - ResourceIdentifier labVirtualNetworkId = default; - bool? disallowPublicIPAddress = default; - IList artifacts = default; - DevTestLabArtifactDeploymentStatus artifactDeploymentStatus = default; - DevTestLabGalleryImageReference galleryImageReference = default; - string planId = default; - ComputeVmProperties computeVm = default; - DevTestLabNetworkInterface networkInterface = default; - DevTestLabApplicableSchedule applicableSchedule = default; - DateTimeOffset? expirationDate = default; - bool? allowClaim = default; - string storageType = default; - DevTestLabVmCreationSource? vmCreationSource = default; - ResourceIdentifier environmentId = default; - IList dataDiskParameters = default; - IList scheduleParameters = default; - string lastKnownPowerState = default; - string provisioningState = default; - Guid? uniqueIdentifier = default; - IDictionary serializedAdditionalRawData = default; - Dictionary rawDataDictionary = new Dictionary(); - foreach (var property in element.EnumerateObject()) + IDictionary additionalBinaryDataProperties = new ChangeTrackingDictionary(); + AzureLocation location = default; + LabVirtualMachineProperties properties = default; + IDictionary tags = default; + foreach (var prop in element.EnumerateObject()) { - if (property.NameEquals("tags"u8)) + if (prop.NameEquals("id"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()) - { - dictionary.Add(property0.Name, property0.Value.GetString()); - } - tags = dictionary; + id = new ResourceIdentifier(prop.Value.GetString()); continue; } - if (property.NameEquals("location"u8)) + if (prop.NameEquals("name"u8)) { - location = new AzureLocation(property.Value.GetString()); + name = prop.Value.GetString(); continue; } - if (property.NameEquals("id"u8)) + if (prop.NameEquals("type"u8)) { - id = new ResourceIdentifier(property.Value.GetString()); + if (prop.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + resourceType = new ResourceType(prop.Value.GetString()); continue; } - if (property.NameEquals("name"u8)) + if (prop.NameEquals("systemData"u8)) { - name = property.Value.GetString(); + if (prop.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + systemData = ModelReaderWriter.Read(new BinaryData(Encoding.UTF8.GetBytes(prop.Value.GetRawText())), ModelSerializationExtensions.WireOptions, AzureResourceManagerDevTestLabsContext.Default); 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) - { - continue; - } - systemData = ModelReaderWriter.Read(new BinaryData(Encoding.UTF8.GetBytes(property.Value.GetRawText())), ModelSerializationExtensions.WireOptions, AzureResourceManagerDevTestLabsContext.Default); + properties = LabVirtualMachineProperties.DeserializeLabVirtualMachineProperties(prop.Value, options); continue; } - if (property.NameEquals("properties"u8)) + if (prop.NameEquals("tags"u8)) { - if (property.Value.ValueKind == JsonValueKind.Null) + if (prop.Value.ValueKind == JsonValueKind.Null) { - property.ThrowNonNullablePropertyIsNull(); continue; } - foreach (var property0 in property.Value.EnumerateObject()) + Dictionary dictionary = new Dictionary(); + foreach (var prop0 in prop.Value.EnumerateObject()) { - if (property0.NameEquals("notes"u8)) - { - notes = property0.Value.GetString(); - continue; - } - if (property0.NameEquals("ownerObjectId"u8)) - { - ownerObjectId = property0.Value.GetString(); - continue; - } - if (property0.NameEquals("ownerUserPrincipalName"u8)) - { - ownerUserPrincipalName = property0.Value.GetString(); - continue; - } - if (property0.NameEquals("createdByUserId"u8)) - { - createdByUserId = property0.Value.GetString(); - continue; - } - if (property0.NameEquals("createdByUser"u8)) - { - createdByUser = property0.Value.GetString(); - continue; - } - if (property0.NameEquals("createdDate"u8)) - { - if (property0.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - createdDate = property0.Value.GetDateTimeOffset("O"); - continue; - } - if (property0.NameEquals("computeId"u8)) - { - if (property0.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - computeId = new ResourceIdentifier(property0.Value.GetString()); - continue; - } - if (property0.NameEquals("customImageId"u8)) - { - customImageId = property0.Value.GetString(); - continue; - } - if (property0.NameEquals("osType"u8)) - { - osType = property0.Value.GetString(); - continue; - } - if (property0.NameEquals("size"u8)) - { - size = property0.Value.GetString(); - continue; - } - if (property0.NameEquals("userName"u8)) - { - userName = property0.Value.GetString(); - continue; - } - if (property0.NameEquals("password"u8)) - { - password = property0.Value.GetString(); - continue; - } - if (property0.NameEquals("sshKey"u8)) - { - sshKey = property0.Value.GetString(); - continue; - } - if (property0.NameEquals("isAuthenticationWithSshKey"u8)) - { - if (property0.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - isAuthenticationWithSshKey = property0.Value.GetBoolean(); - continue; - } - if (property0.NameEquals("fqdn"u8)) - { - fqdn = property0.Value.GetString(); - continue; - } - if (property0.NameEquals("labSubnetName"u8)) - { - labSubnetName = property0.Value.GetString(); - continue; - } - if (property0.NameEquals("labVirtualNetworkId"u8)) - { - if (property0.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - labVirtualNetworkId = new ResourceIdentifier(property0.Value.GetString()); - continue; - } - if (property0.NameEquals("disallowPublicIpAddress"u8)) - { - if (property0.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - disallowPublicIPAddress = property0.Value.GetBoolean(); - continue; - } - if (property0.NameEquals("artifacts"u8)) - { - if (property0.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - List array = new List(); - foreach (var item in property0.Value.EnumerateArray()) - { - array.Add(DevTestLabArtifactInstallInfo.DeserializeDevTestLabArtifactInstallInfo(item, options)); - } - artifacts = array; - continue; - } - if (property0.NameEquals("artifactDeploymentStatus"u8)) - { - if (property0.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - artifactDeploymentStatus = DevTestLabArtifactDeploymentStatus.DeserializeDevTestLabArtifactDeploymentStatus(property0.Value, options); - continue; - } - if (property0.NameEquals("galleryImageReference"u8)) - { - if (property0.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - galleryImageReference = DevTestLabGalleryImageReference.DeserializeDevTestLabGalleryImageReference(property0.Value, options); - continue; - } - if (property0.NameEquals("planId"u8)) - { - planId = property0.Value.GetString(); - continue; - } - if (property0.NameEquals("computeVm"u8)) - { - if (property0.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - computeVm = ComputeVmProperties.DeserializeComputeVmProperties(property0.Value, options); - continue; - } - if (property0.NameEquals("networkInterface"u8)) - { - if (property0.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - networkInterface = DevTestLabNetworkInterface.DeserializeDevTestLabNetworkInterface(property0.Value, options); - continue; - } - if (property0.NameEquals("applicableSchedule"u8)) - { - if (property0.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - applicableSchedule = DevTestLabApplicableSchedule.DeserializeDevTestLabApplicableSchedule(property0.Value, options); - continue; - } - if (property0.NameEquals("expirationDate"u8)) - { - if (property0.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - expirationDate = property0.Value.GetDateTimeOffset("O"); - continue; - } - if (property0.NameEquals("allowClaim"u8)) - { - if (property0.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - allowClaim = property0.Value.GetBoolean(); - continue; - } - if (property0.NameEquals("storageType"u8)) - { - storageType = property0.Value.GetString(); - continue; - } - if (property0.NameEquals("virtualMachineCreationSource"u8)) - { - if (property0.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - vmCreationSource = new DevTestLabVmCreationSource(property0.Value.GetString()); - continue; - } - if (property0.NameEquals("environmentId"u8)) - { - if (property0.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - environmentId = new ResourceIdentifier(property0.Value.GetString()); - continue; - } - if (property0.NameEquals("dataDiskParameters"u8)) - { - if (property0.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - List array = new List(); - foreach (var item in property0.Value.EnumerateArray()) - { - array.Add(DevTestLabDataDiskProperties.DeserializeDevTestLabDataDiskProperties(item, options)); - } - dataDiskParameters = array; - continue; - } - if (property0.NameEquals("scheduleParameters"u8)) - { - if (property0.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - List array = new List(); - foreach (var item in property0.Value.EnumerateArray()) - { - array.Add(DevTestLabScheduleCreationParameter.DeserializeDevTestLabScheduleCreationParameter(item, options)); - } - scheduleParameters = array; - continue; - } - if (property0.NameEquals("lastKnownPowerState"u8)) + if (prop0.Value.ValueKind == JsonValueKind.Null) { - lastKnownPowerState = property0.Value.GetString(); - continue; + dictionary.Add(prop0.Name, null); } - if (property0.NameEquals("provisioningState"u8)) + else { - provisioningState = property0.Value.GetString(); - continue; - } - if (property0.NameEquals("uniqueIdentifier"u8)) - { - if (property0.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - uniqueIdentifier = property0.Value.GetGuid(); - continue; + dictionary.Add(prop0.Name, prop0.Value.GetString()); } } + tags = dictionary; 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 DevTestLabVmData( id, name, - type, + resourceType, systemData, - tags ?? new ChangeTrackingDictionary(), + additionalBinaryDataProperties, location, - notes, - ownerObjectId, - ownerUserPrincipalName, - createdByUserId, - createdByUser, - createdDate, - computeId, - customImageId, - osType, - size, - userName, - password, - sshKey, - isAuthenticationWithSshKey, - fqdn, - labSubnetName, - labVirtualNetworkId, - disallowPublicIPAddress, - artifacts ?? new ChangeTrackingList(), - artifactDeploymentStatus, - galleryImageReference, - planId, - computeVm, - networkInterface, - applicableSchedule, - expirationDate, - allowClaim, - storageType, - vmCreationSource, - environmentId, - dataDiskParameters ?? new ChangeTrackingList(), - scheduleParameters ?? new ChangeTrackingList(), - lastKnownPowerState, - provisioningState, - uniqueIdentifier, - serializedAdditionalRawData); + properties, + tags ?? new ChangeTrackingDictionary()); } - 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": @@ -679,22 +218,23 @@ BinaryData IPersistableModel.Write(ModelReaderWriterOptions op } } - DevTestLabVmData 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. + DevTestLabVmData IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) => (DevTestLabVmData)PersistableModelCreateCore(data, options); - switch (format) + /// The client options for reading and writing models. + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + + /// The to serialize into . + internal static RequestContent ToRequestContent(DevTestLabVmData devTestLabVmData) + { + if (devTestLabVmData == null) { - case "J": - { - using JsonDocument document = JsonDocument.Parse(data, ModelSerializationExtensions.JsonDocumentOptions); - return DeserializeDevTestLabVmData(document.RootElement, options); - } - default: - throw new FormatException($"The model {nameof(DevTestLabVmData)} does not support reading '{options.Format}' format."); + return null; } + Utf8JsonRequestContent content = new Utf8JsonRequestContent(); + content.JsonWriter.WriteObjectValue(devTestLabVmData, ModelSerializationExtensions.WireOptions); + return content; } - - string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; } } diff --git a/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/DevTestLabVmData.cs b/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/DevTestLabVmData.cs index 8e17158f41da..4d8383e686ea 100644 --- a/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/DevTestLabVmData.cs +++ b/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/DevTestLabVmData.cs @@ -13,210 +13,522 @@ namespace Azure.ResourceManager.DevTestLabs { - /// - /// A class representing the DevTestLabVm data model. - /// A virtual machine. - /// + /// A virtual machine. public partial class DevTestLabVmData : 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 DevTestLabVmData(AzureLocation location) : base(location) { - Artifacts = new ChangeTrackingList(); - DataDiskParameters = new ChangeTrackingList(); - ScheduleParameters = new ChangeTrackingList(); + } /// Initializes a new instance of . - /// The id. - /// The name. - /// The resourceType. - /// The systemData. - /// The tags. - /// The location. - /// The notes of the virtual machine. - /// The object identifier of the owner of the virtual machine. - /// The user principal name of the virtual machine owner. - /// The object identifier of the creator of the virtual machine. - /// The email address of creator of the virtual machine. - /// The creation date of the virtual machine. - /// The resource identifier (Microsoft.Compute) of the virtual machine. - /// The custom image identifier of the virtual machine. - /// The OS type of the virtual machine. - /// The size of the virtual machine. - /// The user name of the virtual machine. - /// The password of the virtual machine administrator. - /// The SSH key of the virtual machine administrator. - /// Indicates whether this virtual machine uses an SSH key for authentication. - /// The fully-qualified domain name of the virtual machine. - /// The lab subnet name of the virtual machine. - /// The lab virtual network identifier of the virtual machine. - /// Indicates whether the virtual machine is to be created without a public IP address. - /// The artifacts to be installed on the virtual machine. - /// The artifact deployment status for the virtual machine. - /// The Microsoft Azure Marketplace image reference of the virtual machine. - /// The id of the plan associated with the virtual machine image. - /// The compute virtual machine properties. - /// The network interface properties. - /// The applicable schedule for the virtual machine. - /// The expiration date for VM. - /// Indicates whether another user can take ownership of the virtual machine. - /// Storage type to use for virtual machine (i.e. Standard, Premium). - /// Tells source of creation of lab virtual machine. Output property only. - /// The resource ID of the environment that contains this virtual machine, if any. - /// New or existing data disks to attach to the virtual machine after creation. - /// Virtual Machine schedules to be created. - /// Last known compute power state captured in DTL. - /// The provisioning status of the resource. - /// The unique immutable identifier of a resource (Guid). - /// Keeps track of any properties unknown to the library. - internal DevTestLabVmData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, IDictionary tags, AzureLocation location, string notes, string ownerObjectId, string ownerUserPrincipalName, string createdByUserId, string createdByUser, DateTimeOffset? createdOn, ResourceIdentifier computeId, string customImageId, string osType, string size, string userName, string password, string sshKey, bool? isAuthenticationWithSshKey, string fqdn, string labSubnetName, ResourceIdentifier labVirtualNetworkId, bool? disallowPublicIPAddress, IList artifacts, DevTestLabArtifactDeploymentStatus artifactDeploymentStatus, DevTestLabGalleryImageReference galleryImageReference, string planId, ComputeVmProperties computeVm, DevTestLabNetworkInterface networkInterface, DevTestLabApplicableSchedule applicableSchedule, DateTimeOffset? expireOn, bool? allowClaim, string storageType, DevTestLabVmCreationSource? vmCreationSource, ResourceIdentifier environmentId, IList dataDiskParameters, IList scheduleParameters, string lastKnownPowerState, string provisioningState, Guid? uniqueIdentifier, IDictionary serializedAdditionalRawData) : base(id, name, resourceType, systemData, tags, location) - { - Notes = notes; - OwnerObjectId = ownerObjectId; - OwnerUserPrincipalName = ownerUserPrincipalName; - CreatedByUserId = createdByUserId; - CreatedByUser = createdByUser; - CreatedOn = createdOn; - ComputeId = computeId; - CustomImageId = customImageId; - OSType = osType; - Size = size; - UserName = userName; - Password = password; - SshKey = sshKey; - IsAuthenticationWithSshKey = isAuthenticationWithSshKey; - Fqdn = fqdn; - LabSubnetName = labSubnetName; - LabVirtualNetworkId = labVirtualNetworkId; - DisallowPublicIPAddress = disallowPublicIPAddress; - Artifacts = artifacts; - ArtifactDeploymentStatus = artifactDeploymentStatus; - GalleryImageReference = galleryImageReference; - PlanId = planId; - ComputeVm = computeVm; - NetworkInterface = networkInterface; - ApplicableSchedule = applicableSchedule; - ExpireOn = expireOn; - AllowClaim = allowClaim; - StorageType = storageType; - VmCreationSource = vmCreationSource; - EnvironmentId = environmentId; - DataDiskParameters = dataDiskParameters; - ScheduleParameters = scheduleParameters; - LastKnownPowerState = lastKnownPowerState; - ProvisioningState = provisioningState; - UniqueIdentifier = uniqueIdentifier; - _serializedAdditionalRawData = serializedAdditionalRawData; - } - - /// Initializes a new instance of for deserialization. - internal DevTestLabVmData() + /// 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 geo-location where the resource lives. + /// The properties of the resource. + /// Resource tags. + internal DevTestLabVmData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, IDictionary additionalBinaryDataProperties, AzureLocation location, LabVirtualMachineProperties properties, IDictionary tags) : base(id, name, resourceType, systemData, tags, location) { + _additionalBinaryDataProperties = additionalBinaryDataProperties; + Properties = properties; } + /// The properties of the resource. + internal LabVirtualMachineProperties Properties { get; set; } + /// The notes of the virtual machine. - public string Notes { get; set; } + public string Notes + { + get + { + return Properties is null ? default : Properties.Notes; + } + set + { + if (Properties is null) + { + Properties = new LabVirtualMachineProperties(); + } + Properties.Notes = value; + } + } + /// The object identifier of the owner of the virtual machine. - public string OwnerObjectId { get; set; } + public string OwnerObjectId + { + get + { + return Properties is null ? default : Properties.OwnerObjectId; + } + set + { + if (Properties is null) + { + Properties = new LabVirtualMachineProperties(); + } + Properties.OwnerObjectId = value; + } + } + /// The user principal name of the virtual machine owner. - public string OwnerUserPrincipalName { get; set; } + public string OwnerUserPrincipalName + { + get + { + return Properties is null ? default : Properties.OwnerUserPrincipalName; + } + set + { + if (Properties is null) + { + Properties = new LabVirtualMachineProperties(); + } + Properties.OwnerUserPrincipalName = value; + } + } + /// The object identifier of the creator of the virtual machine. - public string CreatedByUserId { get; } + public string CreatedByUserId + { + get + { + return Properties is null ? default : Properties.CreatedByUserId; + } + } + /// The email address of creator of the virtual machine. - public string CreatedByUser { get; } + public string CreatedByUser + { + get + { + return Properties is null ? default : Properties.CreatedByUser; + } + } + /// The creation date of the virtual machine. - public DateTimeOffset? CreatedOn { get; set; } + public DateTimeOffset? CreatedOn + { + get + { + return Properties is null ? default : Properties.CreatedOn; + } + set + { + if (Properties is null) + { + Properties = new LabVirtualMachineProperties(); + } + Properties.CreatedOn = value.Value; + } + } + /// The resource identifier (Microsoft.Compute) of the virtual machine. - public ResourceIdentifier ComputeId { get; } + public ResourceIdentifier ComputeId + { + get + { + return Properties is null ? default : Properties.ComputeId; + } + } + /// The custom image identifier of the virtual machine. - public string CustomImageId { get; set; } + public string CustomImageId + { + get + { + return Properties is null ? default : Properties.CustomImageId; + } + set + { + if (Properties is null) + { + Properties = new LabVirtualMachineProperties(); + } + Properties.CustomImageId = value; + } + } + /// The OS type of the virtual machine. - public string OSType { get; } + public string OSType + { + get + { + return Properties is null ? default : Properties.OSType; + } + } + /// The size of the virtual machine. - public string Size { get; set; } + public string Size + { + get + { + return Properties is null ? default : Properties.Size; + } + set + { + if (Properties is null) + { + Properties = new LabVirtualMachineProperties(); + } + Properties.Size = value; + } + } + /// The user name of the virtual machine. - public string UserName { get; set; } + public string UserName + { + get + { + return Properties is null ? default : Properties.UserName; + } + set + { + if (Properties is null) + { + Properties = new LabVirtualMachineProperties(); + } + Properties.UserName = value; + } + } + /// The password of the virtual machine administrator. - public string Password { get; set; } + public string Password + { + get + { + return Properties is null ? default : Properties.Password; + } + set + { + if (Properties is null) + { + Properties = new LabVirtualMachineProperties(); + } + Properties.Password = value; + } + } + /// The SSH key of the virtual machine administrator. - public string SshKey { get; set; } + public string SshKey + { + get + { + return Properties is null ? default : Properties.SshKey; + } + set + { + if (Properties is null) + { + Properties = new LabVirtualMachineProperties(); + } + Properties.SshKey = value; + } + } + /// Indicates whether this virtual machine uses an SSH key for authentication. - public bool? IsAuthenticationWithSshKey { get; set; } + public bool? IsAuthenticationWithSshKey + { + get + { + return Properties is null ? default : Properties.IsAuthenticationWithSshKey; + } + set + { + if (Properties is null) + { + Properties = new LabVirtualMachineProperties(); + } + Properties.IsAuthenticationWithSshKey = value.Value; + } + } + /// The fully-qualified domain name of the virtual machine. - public string Fqdn { get; } + public string Fqdn + { + get + { + return Properties is null ? default : Properties.Fqdn; + } + } + /// The lab subnet name of the virtual machine. - public string LabSubnetName { get; set; } + public string LabSubnetName + { + get + { + return Properties is null ? default : Properties.LabSubnetName; + } + set + { + if (Properties is null) + { + Properties = new LabVirtualMachineProperties(); + } + Properties.LabSubnetName = value; + } + } + /// The lab virtual network identifier of the virtual machine. - public ResourceIdentifier LabVirtualNetworkId { get; set; } + public ResourceIdentifier LabVirtualNetworkId + { + get + { + return Properties is null ? default : Properties.LabVirtualNetworkId; + } + set + { + if (Properties is null) + { + Properties = new LabVirtualMachineProperties(); + } + Properties.LabVirtualNetworkId = value; + } + } + /// Indicates whether the virtual machine is to be created without a public IP address. - public bool? DisallowPublicIPAddress { get; set; } + public bool? DisallowPublicIPAddress + { + get + { + return Properties is null ? default : Properties.DisallowPublicIPAddress; + } + set + { + if (Properties is null) + { + Properties = new LabVirtualMachineProperties(); + } + Properties.DisallowPublicIPAddress = value.Value; + } + } + /// The artifacts to be installed on the virtual machine. - public IList Artifacts { get; } + public IList Artifacts + { + get + { + if (Properties is null) + { + Properties = new LabVirtualMachineProperties(); + } + return Properties.Artifacts; + } + } + /// The artifact deployment status for the virtual machine. - public DevTestLabArtifactDeploymentStatus ArtifactDeploymentStatus { get; } + public DevTestLabArtifactDeploymentStatus ArtifactDeploymentStatus + { + get + { + return Properties is null ? default : Properties.ArtifactDeploymentStatus; + } + } + /// The Microsoft Azure Marketplace image reference of the virtual machine. - public DevTestLabGalleryImageReference GalleryImageReference { get; set; } + public DevTestLabGalleryImageReference GalleryImageReference + { + get + { + return Properties is null ? default : Properties.GalleryImageReference; + } + set + { + if (Properties is null) + { + Properties = new LabVirtualMachineProperties(); + } + Properties.GalleryImageReference = value; + } + } + /// The id of the plan associated with the virtual machine image. - public string PlanId { get; set; } + public string PlanId + { + get + { + return Properties is null ? default : Properties.PlanId; + } + set + { + if (Properties is null) + { + Properties = new LabVirtualMachineProperties(); + } + Properties.PlanId = value; + } + } + /// The compute virtual machine properties. - public ComputeVmProperties ComputeVm { get; } + public ComputeVmProperties ComputeVm + { + get + { + return Properties is null ? default : Properties.ComputeVm; + } + } + /// The network interface properties. - public DevTestLabNetworkInterface NetworkInterface { get; set; } + public DevTestLabNetworkInterface NetworkInterface + { + get + { + return Properties is null ? default : Properties.NetworkInterface; + } + set + { + if (Properties is null) + { + Properties = new LabVirtualMachineProperties(); + } + Properties.NetworkInterface = value; + } + } + /// The applicable schedule for the virtual machine. - public DevTestLabApplicableSchedule ApplicableSchedule { get; } + public DevTestLabApplicableSchedule ApplicableSchedule + { + get + { + return Properties is null ? default : Properties.ApplicableSchedule; + } + } + /// The expiration date for VM. - public DateTimeOffset? ExpireOn { get; set; } + public DateTimeOffset? ExpireOn + { + get + { + return Properties is null ? default : Properties.ExpireOn; + } + set + { + if (Properties is null) + { + Properties = new LabVirtualMachineProperties(); + } + Properties.ExpireOn = value.Value; + } + } + /// Indicates whether another user can take ownership of the virtual machine. - public bool? AllowClaim { get; set; } + public bool? AllowClaim + { + get + { + return Properties is null ? default : Properties.AllowClaim; + } + set + { + if (Properties is null) + { + Properties = new LabVirtualMachineProperties(); + } + Properties.AllowClaim = value.Value; + } + } + /// Storage type to use for virtual machine (i.e. Standard, Premium). - public string StorageType { get; set; } + public string StorageType + { + get + { + return Properties is null ? default : Properties.StorageType; + } + set + { + if (Properties is null) + { + Properties = new LabVirtualMachineProperties(); + } + Properties.StorageType = value; + } + } + /// Tells source of creation of lab virtual machine. Output property only. - public DevTestLabVmCreationSource? VmCreationSource { get; } + public DevTestLabVmCreationSource? VmCreationSource + { + get + { + return Properties is null ? default : Properties.VmCreationSource; + } + } + /// The resource ID of the environment that contains this virtual machine, if any. - public ResourceIdentifier EnvironmentId { get; set; } + public ResourceIdentifier EnvironmentId + { + get + { + return Properties is null ? default : Properties.EnvironmentId; + } + set + { + if (Properties is null) + { + Properties = new LabVirtualMachineProperties(); + } + Properties.EnvironmentId = value; + } + } + /// New or existing data disks to attach to the virtual machine after creation. - public IList DataDiskParameters { get; } + public IList DataDiskParameters + { + get + { + if (Properties is null) + { + Properties = new LabVirtualMachineProperties(); + } + return Properties.DataDiskParameters; + } + } + /// Virtual Machine schedules to be created. - public IList ScheduleParameters { get; } + public IList ScheduleParameters + { + get + { + if (Properties is null) + { + Properties = new LabVirtualMachineProperties(); + } + return Properties.ScheduleParameters; + } + } + /// Last known compute power state captured in DTL. - public string LastKnownPowerState { get; } + public string LastKnownPowerState + { + get + { + return Properties is null ? default : Properties.LastKnownPowerState; + } + } + /// The provisioning status of the resource. - public string ProvisioningState { get; } + public string ProvisioningState + { + get + { + return Properties is null ? default : Properties.ProvisioningState; + } + } + /// The unique immutable identifier of a resource (Guid). - public Guid? UniqueIdentifier { get; } + public Guid? UniqueIdentifier + { + get + { + return Properties is null ? default : Properties.UniqueIdentifier; + } + } } } diff --git a/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/DevTestLabVmResource.Serialization.cs b/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/DevTestLabVmResource.Serialization.cs index 194c34a85999..f7c719924c6b 100644 --- a/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/DevTestLabVmResource.Serialization.cs +++ b/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/DevTestLabVmResource.Serialization.cs @@ -11,19 +11,29 @@ namespace Azure.ResourceManager.DevTestLabs { + /// public partial class DevTestLabVmResource : IJsonModel { - private static DevTestLabVmData s_dataDeserializationInstance; - private static DevTestLabVmData DataDeserializationInstance => s_dataDeserializationInstance ??= new(); + private static IJsonModel s_dataDeserializationInstance; + private static IJsonModel DataDeserializationInstance => s_dataDeserializationInstance ??= new DevTestLabVmData(); + + /// 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); - DevTestLabVmData 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. + DevTestLabVmData 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, AzureResourceManagerDevTestLabsContext.Default); + /// The binary data to be processed. + /// The client options for reading and writing models. DevTestLabVmData IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) => ModelReaderWriter.Read(data, options, AzureResourceManagerDevTestLabsContext.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/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/DevTestLabVmResource.cs b/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/DevTestLabVmResource.cs index 46c50d1745f4..af95e7fc64cb 100644 --- a/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/DevTestLabVmResource.cs +++ b/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/DevTestLabVmResource.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.DevTestLabs.Models; +using Azure.ResourceManager.Resources; namespace Azure.ResourceManager.DevTestLabs { /// - /// A Class representing a DevTestLabVm 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 GetDevTestLabVmResource method. - /// Otherwise you can get one from its parent resource using the GetDevTestLabVm method. + /// A class representing a DevTestLabVm 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 GetDevTestLabVms method. /// public partial class DevTestLabVmResource : ArmResource { - /// Generate the resource identifier of a instance. - /// The subscriptionId. - /// The resourceGroupName. - /// The labName. - /// The name. - public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string labName, string name) - { - var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/virtualmachines/{name}"; - return new ResourceIdentifier(resourceId); - } - - private readonly ClientDiagnostics _devTestLabVmVirtualMachinesClientDiagnostics; - private readonly VirtualMachinesRestOperations _devTestLabVmVirtualMachinesRestClient; + private readonly ClientDiagnostics _virtualMachinesClientDiagnostics; + private readonly VirtualMachines _virtualMachinesRestClient; private readonly DevTestLabVmData _data; - /// Gets the resource type for the operations. public static readonly ResourceType ResourceType = "Microsoft.DevTestLab/labs/virtualmachines"; - /// Initializes a new instance of the class for mocking. + /// Initializes a new instance of DevTestLabVmResource for mocking. protected DevTestLabVmResource() { } - /// 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 DevTestLabVmResource(ArmClient client, DevTestLabVmData data) : this(client, data.Id) @@ -56,143 +46,94 @@ internal DevTestLabVmResource(ArmClient client, DevTestLabVmData data) : this(cl _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 DevTestLabVmResource(ArmClient client, ResourceIdentifier id) : base(client, id) { - _devTestLabVmVirtualMachinesClientDiagnostics = new ClientDiagnostics("Azure.ResourceManager.DevTestLabs", ResourceType.Namespace, Diagnostics); - TryGetApiVersion(ResourceType, out string devTestLabVmVirtualMachinesApiVersion); - _devTestLabVmVirtualMachinesRestClient = new VirtualMachinesRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, devTestLabVmVirtualMachinesApiVersion); -#if DEBUG - ValidateResourceId(Id); -#endif + TryGetApiVersion(ResourceType, out string devTestLabVmApiVersion); + _virtualMachinesClientDiagnostics = new ClientDiagnostics("Azure.ResourceManager.DevTestLabs", ResourceType.Namespace, Diagnostics); + _virtualMachinesRestClient = new VirtualMachines(_virtualMachinesClientDiagnostics, Pipeline, Endpoint, devTestLabVmApiVersion ?? "2018-09-15"); + 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 DevTestLabVmData 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 DevTestLabVmScheduleResources in the DevTestLabVm. - /// An object representing collection of DevTestLabVmScheduleResources and their operations over a DevTestLabVmScheduleResource. - public virtual DevTestLabVmScheduleCollection GetDevTestLabVmSchedules() - { - return GetCachedClient(client => new DevTestLabVmScheduleCollection(client, Id)); - } - - /// - /// Get schedule. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/virtualmachines/{virtualMachineName}/schedules/{name} - /// - /// - /// Operation Id - /// VirtualMachineSchedules_Get - /// - /// - /// Default Api Version - /// 2018-09-15 - /// - /// - /// Resource - /// - /// - /// - /// - /// The name of the schedule. - /// Specify the $expand query. Example: 'properties($select=status)'. - /// The cancellation token to use. - /// is null. - /// is an empty string, and was expected to be non-empty. - [ForwardsClientCalls] - public virtual async Task> GetDevTestLabVmScheduleAsync(string name, string expand = null, CancellationToken cancellationToken = default) + /// Generate the resource identifier for this resource. + /// The subscriptionId. + /// The resourceGroupName. + /// The labName. + /// The name. + public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string labName, string name) { - return await GetDevTestLabVmSchedules().GetAsync(name, expand, cancellationToken).ConfigureAwait(false); + string resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/virtualmachines/{name}"; + return new ResourceIdentifier(resourceId); } - /// - /// Get schedule. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/virtualmachines/{virtualMachineName}/schedules/{name} - /// - /// - /// Operation Id - /// VirtualMachineSchedules_Get - /// - /// - /// Default Api Version - /// 2018-09-15 - /// - /// - /// Resource - /// - /// - /// - /// - /// The name of the schedule. - /// Specify the $expand query. Example: 'properties($select=status)'. - /// The cancellation token to use. - /// is null. - /// is an empty string, and was expected to be non-empty. - [ForwardsClientCalls] - public virtual Response GetDevTestLabVmSchedule(string name, string expand = null, CancellationToken cancellationToken = default) + /// + [Conditional("DEBUG")] + internal static void ValidateResourceId(ResourceIdentifier id) { - return GetDevTestLabVmSchedules().Get(name, expand, cancellationToken); + if (id.ResourceType != ResourceType) + { + throw new ArgumentException(string.Format("Invalid resource type {0} expected {1}", id.ResourceType, ResourceType), id); + } } /// /// Get virtual machine. /// /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/virtualmachines/{name} + /// Request Path. + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/virtualmachines/{name}. /// /// - /// Operation Id - /// VirtualMachines_Get + /// Operation Id. + /// VirtualMachines_Get. /// /// - /// Default Api Version - /// 2018-09-15 + /// Default Api Version. + /// 2018-09-15. /// /// - /// Resource - /// + /// Resource. + /// . /// /// /// /// Specify the $expand query. Example: 'properties($expand=artifacts,computeVm,networkInterface,applicableSchedule)'. /// The cancellation token to use. - public virtual async Task> GetAsync(string expand = null, CancellationToken cancellationToken = default) + public virtual async Task> GetAsync(string expand = default, CancellationToken cancellationToken = default) { - using var scope = _devTestLabVmVirtualMachinesClientDiagnostics.CreateScope("DevTestLabVmResource.Get"); + using DiagnosticScope scope = _virtualMachinesClientDiagnostics.CreateScope("DevTestLabVmResource.Get"); scope.Start(); try { - var response = await _devTestLabVmVirtualMachinesRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, expand, cancellationToken).ConfigureAwait(false); + RequestContext context = new RequestContext + { + CancellationToken = cancellationToken + }; + HttpMessage message = _virtualMachinesRestClient.CreateGetRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, expand, context); + Response result = await Pipeline.ProcessMessageAsync(message, context).ConfigureAwait(false); + Response response = Response.FromValue(DevTestLabVmData.FromResponse(result), result); if (response.Value == null) + { throw new RequestFailedException(response.GetRawResponse()); + } return Response.FromValue(new DevTestLabVmResource(Client, response.Value), response.GetRawResponse()); } catch (Exception e) @@ -206,34 +147,42 @@ public virtual async Task> GetAsync(string expand /// Get virtual machine. /// /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/virtualmachines/{name} + /// Request Path. + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/virtualmachines/{name}. /// /// - /// Operation Id - /// VirtualMachines_Get + /// Operation Id. + /// VirtualMachines_Get. /// /// - /// Default Api Version - /// 2018-09-15 + /// Default Api Version. + /// 2018-09-15. /// /// - /// Resource - /// + /// Resource. + /// . /// /// /// /// Specify the $expand query. Example: 'properties($expand=artifacts,computeVm,networkInterface,applicableSchedule)'. /// The cancellation token to use. - public virtual Response Get(string expand = null, CancellationToken cancellationToken = default) + public virtual Response Get(string expand = default, CancellationToken cancellationToken = default) { - using var scope = _devTestLabVmVirtualMachinesClientDiagnostics.CreateScope("DevTestLabVmResource.Get"); + using DiagnosticScope scope = _virtualMachinesClientDiagnostics.CreateScope("DevTestLabVmResource.Get"); scope.Start(); try { - var response = _devTestLabVmVirtualMachinesRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, expand, cancellationToken); + RequestContext context = new RequestContext + { + CancellationToken = cancellationToken + }; + HttpMessage message = _virtualMachinesRestClient.CreateGetRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, expand, context); + Response result = Pipeline.ProcessMessage(message, context); + Response response = Response.FromValue(DevTestLabVmData.FromResponse(result), result); if (response.Value == null) + { throw new RequestFailedException(response.GetRawResponse()); + } return Response.FromValue(new DevTestLabVmResource(Client, response.Value), response.GetRawResponse()); } catch (Exception e) @@ -244,39 +193,49 @@ public virtual Response Get(string expand = null, Cancella } /// - /// Delete virtual machine. This operation can take a while to complete. + /// Allows modifying tags of virtual machines. All other properties will be ignored. /// /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/virtualmachines/{name} + /// Request Path. + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/virtualmachines/{name}. /// /// - /// Operation Id - /// VirtualMachines_Delete + /// Operation Id. + /// VirtualMachines_Update. /// /// - /// Default Api Version - /// 2018-09-15 + /// Default Api Version. + /// 2018-09-15. /// /// - /// Resource - /// + /// Resource. + /// . /// /// /// - /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. + /// A virtual machine. /// The cancellation token to use. - public virtual async Task DeleteAsync(WaitUntil waitUntil, CancellationToken cancellationToken = default) + /// is null. + public virtual async Task> UpdateAsync(DevTestLabVmPatch patch, CancellationToken cancellationToken = default) { - using var scope = _devTestLabVmVirtualMachinesClientDiagnostics.CreateScope("DevTestLabVmResource.Delete"); + Argument.AssertNotNull(patch, nameof(patch)); + + using DiagnosticScope scope = _virtualMachinesClientDiagnostics.CreateScope("DevTestLabVmResource.Update"); scope.Start(); try { - var response = await _devTestLabVmVirtualMachinesRestClient.DeleteAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, cancellationToken).ConfigureAwait(false); - var operation = new DevTestLabsArmOperation(_devTestLabVmVirtualMachinesClientDiagnostics, Pipeline, _devTestLabVmVirtualMachinesRestClient.CreateDeleteRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name).Request, response, OperationFinalStateVia.Location); - if (waitUntil == WaitUntil.Completed) - await operation.WaitForCompletionResponseAsync(cancellationToken).ConfigureAwait(false); - return operation; + RequestContext context = new RequestContext + { + CancellationToken = cancellationToken + }; + HttpMessage message = _virtualMachinesRestClient.CreateUpdateRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, DevTestLabVmPatch.ToRequestContent(patch), context); + Response result = await Pipeline.ProcessMessageAsync(message, context).ConfigureAwait(false); + Response response = Response.FromValue(DevTestLabVmData.FromResponse(result), result); + if (response.Value == null) + { + throw new RequestFailedException(response.GetRawResponse()); + } + return Response.FromValue(new DevTestLabVmResource(Client, response.Value), response.GetRawResponse()); } catch (Exception e) { @@ -286,39 +245,49 @@ public virtual async Task DeleteAsync(WaitUntil waitUntil, Cancell } /// - /// Delete virtual machine. This operation can take a while to complete. + /// Allows modifying tags of virtual machines. All other properties will be ignored. /// /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/virtualmachines/{name} + /// Request Path. + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/virtualmachines/{name}. /// /// - /// Operation Id - /// VirtualMachines_Delete + /// Operation Id. + /// VirtualMachines_Update. /// /// - /// Default Api Version - /// 2018-09-15 + /// Default Api Version. + /// 2018-09-15. /// /// - /// Resource - /// + /// Resource. + /// . /// /// /// - /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. + /// A virtual machine. /// The cancellation token to use. - public virtual ArmOperation Delete(WaitUntil waitUntil, CancellationToken cancellationToken = default) + /// is null. + public virtual Response Update(DevTestLabVmPatch patch, CancellationToken cancellationToken = default) { - using var scope = _devTestLabVmVirtualMachinesClientDiagnostics.CreateScope("DevTestLabVmResource.Delete"); + Argument.AssertNotNull(patch, nameof(patch)); + + using DiagnosticScope scope = _virtualMachinesClientDiagnostics.CreateScope("DevTestLabVmResource.Update"); scope.Start(); try { - var response = _devTestLabVmVirtualMachinesRestClient.Delete(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, cancellationToken); - var operation = new DevTestLabsArmOperation(_devTestLabVmVirtualMachinesClientDiagnostics, Pipeline, _devTestLabVmVirtualMachinesRestClient.CreateDeleteRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name).Request, response, OperationFinalStateVia.Location); - if (waitUntil == WaitUntil.Completed) - operation.WaitForCompletionResponse(cancellationToken); - return operation; + RequestContext context = new RequestContext + { + CancellationToken = cancellationToken + }; + HttpMessage message = _virtualMachinesRestClient.CreateUpdateRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, DevTestLabVmPatch.ToRequestContent(patch), context); + Response result = Pipeline.ProcessMessage(message, context); + Response response = Response.FromValue(DevTestLabVmData.FromResponse(result), result); + if (response.Value == null) + { + throw new RequestFailedException(response.GetRawResponse()); + } + return Response.FromValue(new DevTestLabVmResource(Client, response.Value), response.GetRawResponse()); } catch (Exception e) { @@ -328,39 +297,46 @@ public virtual ArmOperation Delete(WaitUntil waitUntil, CancellationToken cancel } /// - /// Allows modifying tags of virtual machines. All other properties will be ignored. + /// Delete virtual machine. This operation can take a while to complete. /// /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/virtualmachines/{name} + /// Request Path. + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/virtualmachines/{name}. /// /// - /// Operation Id - /// VirtualMachines_Update + /// Operation Id. + /// VirtualMachines_Delete. /// /// - /// Default Api Version - /// 2018-09-15 + /// Default Api Version. + /// 2018-09-15. /// /// - /// Resource - /// + /// Resource. + /// . /// /// /// - /// A virtual machine. + /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. /// The cancellation token to use. - /// is null. - public virtual async Task> UpdateAsync(DevTestLabVmPatch patch, CancellationToken cancellationToken = default) + public virtual async Task DeleteAsync(WaitUntil waitUntil, CancellationToken cancellationToken = default) { - Argument.AssertNotNull(patch, nameof(patch)); - - using var scope = _devTestLabVmVirtualMachinesClientDiagnostics.CreateScope("DevTestLabVmResource.Update"); + using DiagnosticScope scope = _virtualMachinesClientDiagnostics.CreateScope("DevTestLabVmResource.Delete"); scope.Start(); try { - var response = await _devTestLabVmVirtualMachinesRestClient.UpdateAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, patch, cancellationToken).ConfigureAwait(false); - return Response.FromValue(new DevTestLabVmResource(Client, response.Value), response.GetRawResponse()); + RequestContext context = new RequestContext + { + CancellationToken = cancellationToken + }; + HttpMessage message = _virtualMachinesRestClient.CreateDeleteRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, context); + Response response = await Pipeline.ProcessMessageAsync(message, context).ConfigureAwait(false); + DevTestLabsArmOperation operation = new DevTestLabsArmOperation(_virtualMachinesClientDiagnostics, Pipeline, message.Request, response, OperationFinalStateVia.Location); + if (waitUntil == WaitUntil.Completed) + { + await operation.WaitForCompletionResponseAsync(cancellationToken).ConfigureAwait(false); + } + return operation; } catch (Exception e) { @@ -370,39 +346,46 @@ public virtual async Task> UpdateAsync(DevTestLab } /// - /// Allows modifying tags of virtual machines. All other properties will be ignored. + /// Delete virtual machine. This operation can take a while to complete. /// /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/virtualmachines/{name} + /// Request Path. + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/virtualmachines/{name}. /// /// - /// Operation Id - /// VirtualMachines_Update + /// Operation Id. + /// VirtualMachines_Delete. /// /// - /// Default Api Version - /// 2018-09-15 + /// Default Api Version. + /// 2018-09-15. /// /// - /// Resource - /// + /// Resource. + /// . /// /// /// - /// A virtual machine. + /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. /// The cancellation token to use. - /// is null. - public virtual Response Update(DevTestLabVmPatch patch, CancellationToken cancellationToken = default) + public virtual ArmOperation Delete(WaitUntil waitUntil, CancellationToken cancellationToken = default) { - Argument.AssertNotNull(patch, nameof(patch)); - - using var scope = _devTestLabVmVirtualMachinesClientDiagnostics.CreateScope("DevTestLabVmResource.Update"); + using DiagnosticScope scope = _virtualMachinesClientDiagnostics.CreateScope("DevTestLabVmResource.Delete"); scope.Start(); try { - var response = _devTestLabVmVirtualMachinesRestClient.Update(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, patch, cancellationToken); - return Response.FromValue(new DevTestLabVmResource(Client, response.Value), response.GetRawResponse()); + RequestContext context = new RequestContext + { + CancellationToken = cancellationToken + }; + HttpMessage message = _virtualMachinesRestClient.CreateDeleteRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, context); + Response response = Pipeline.ProcessMessage(message, context); + DevTestLabsArmOperation operation = new DevTestLabsArmOperation(_virtualMachinesClientDiagnostics, Pipeline, message.Request, response, OperationFinalStateVia.Location); + if (waitUntil == WaitUntil.Completed) + { + operation.WaitForCompletionResponse(cancellationToken); + } + return operation; } catch (Exception e) { @@ -415,20 +398,20 @@ public virtual Response Update(DevTestLabVmPatch patch, Ca /// Attach a new or existing data disk to virtual machine. This operation can take a while to complete. /// /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/virtualmachines/{name}/addDataDisk + /// Request Path. + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/virtualmachines/{name}/addDataDisk. /// /// - /// Operation Id - /// VirtualMachines_AddDataDisk + /// Operation Id. + /// VirtualMachines_AddDataDisk. /// /// - /// Default Api Version - /// 2018-09-15 + /// Default Api Version. + /// 2018-09-15. /// /// - /// Resource - /// + /// Resource. + /// . /// /// /// @@ -440,14 +423,21 @@ public virtual async Task AddDataDiskAsync(WaitUntil waitUntil, De { Argument.AssertNotNull(dataDiskProperties, nameof(dataDiskProperties)); - using var scope = _devTestLabVmVirtualMachinesClientDiagnostics.CreateScope("DevTestLabVmResource.AddDataDisk"); + using DiagnosticScope scope = _virtualMachinesClientDiagnostics.CreateScope("DevTestLabVmResource.AddDataDisk"); scope.Start(); try { - var response = await _devTestLabVmVirtualMachinesRestClient.AddDataDiskAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, dataDiskProperties, cancellationToken).ConfigureAwait(false); - var operation = new DevTestLabsArmOperation(_devTestLabVmVirtualMachinesClientDiagnostics, Pipeline, _devTestLabVmVirtualMachinesRestClient.CreateAddDataDiskRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, dataDiskProperties).Request, response, OperationFinalStateVia.Location); + RequestContext context = new RequestContext + { + CancellationToken = cancellationToken + }; + HttpMessage message = _virtualMachinesRestClient.CreateAddDataDiskRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, DevTestLabDataDiskProperties.ToRequestContent(dataDiskProperties), context); + Response response = await Pipeline.ProcessMessageAsync(message, context).ConfigureAwait(false); + DevTestLabsArmOperation operation = new DevTestLabsArmOperation(_virtualMachinesClientDiagnostics, Pipeline, message.Request, response, OperationFinalStateVia.Location); if (waitUntil == WaitUntil.Completed) + { await operation.WaitForCompletionResponseAsync(cancellationToken).ConfigureAwait(false); + } return operation; } catch (Exception e) @@ -461,20 +451,20 @@ public virtual async Task AddDataDiskAsync(WaitUntil waitUntil, De /// Attach a new or existing data disk to virtual machine. This operation can take a while to complete. /// /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/virtualmachines/{name}/addDataDisk + /// Request Path. + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/virtualmachines/{name}/addDataDisk. /// /// - /// Operation Id - /// VirtualMachines_AddDataDisk + /// Operation Id. + /// VirtualMachines_AddDataDisk. /// /// - /// Default Api Version - /// 2018-09-15 + /// Default Api Version. + /// 2018-09-15. /// /// - /// Resource - /// + /// Resource. + /// . /// /// /// @@ -486,14 +476,21 @@ public virtual ArmOperation AddDataDisk(WaitUntil waitUntil, DevTestLabDataDiskP { Argument.AssertNotNull(dataDiskProperties, nameof(dataDiskProperties)); - using var scope = _devTestLabVmVirtualMachinesClientDiagnostics.CreateScope("DevTestLabVmResource.AddDataDisk"); + using DiagnosticScope scope = _virtualMachinesClientDiagnostics.CreateScope("DevTestLabVmResource.AddDataDisk"); scope.Start(); try { - var response = _devTestLabVmVirtualMachinesRestClient.AddDataDisk(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, dataDiskProperties, cancellationToken); - var operation = new DevTestLabsArmOperation(_devTestLabVmVirtualMachinesClientDiagnostics, Pipeline, _devTestLabVmVirtualMachinesRestClient.CreateAddDataDiskRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, dataDiskProperties).Request, response, OperationFinalStateVia.Location); + RequestContext context = new RequestContext + { + CancellationToken = cancellationToken + }; + HttpMessage message = _virtualMachinesRestClient.CreateAddDataDiskRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, DevTestLabDataDiskProperties.ToRequestContent(dataDiskProperties), context); + Response response = Pipeline.ProcessMessage(message, context); + DevTestLabsArmOperation operation = new DevTestLabsArmOperation(_virtualMachinesClientDiagnostics, Pipeline, message.Request, response, OperationFinalStateVia.Location); if (waitUntil == WaitUntil.Completed) + { operation.WaitForCompletionResponse(cancellationToken); + } return operation; } catch (Exception e) @@ -507,20 +504,20 @@ public virtual ArmOperation AddDataDisk(WaitUntil waitUntil, DevTestLabDataDiskP /// Apply artifacts to virtual machine. This operation can take a while to complete. /// /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/virtualmachines/{name}/applyArtifacts + /// Request Path. + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/virtualmachines/{name}/applyArtifacts. /// /// - /// Operation Id - /// VirtualMachines_ApplyArtifacts + /// Operation Id. + /// VirtualMachines_ApplyArtifacts. /// /// - /// Default Api Version - /// 2018-09-15 + /// Default Api Version. + /// 2018-09-15. /// /// - /// Resource - /// + /// Resource. + /// . /// /// /// @@ -532,14 +529,21 @@ public virtual async Task ApplyArtifactsAsync(WaitUntil waitUntil, { Argument.AssertNotNull(content, nameof(content)); - using var scope = _devTestLabVmVirtualMachinesClientDiagnostics.CreateScope("DevTestLabVmResource.ApplyArtifacts"); + using DiagnosticScope scope = _virtualMachinesClientDiagnostics.CreateScope("DevTestLabVmResource.ApplyArtifacts"); scope.Start(); try { - var response = await _devTestLabVmVirtualMachinesRestClient.ApplyArtifactsAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, content, cancellationToken).ConfigureAwait(false); - var operation = new DevTestLabsArmOperation(_devTestLabVmVirtualMachinesClientDiagnostics, Pipeline, _devTestLabVmVirtualMachinesRestClient.CreateApplyArtifactsRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, content).Request, response, OperationFinalStateVia.Location); + RequestContext context = new RequestContext + { + CancellationToken = cancellationToken + }; + HttpMessage message = _virtualMachinesRestClient.CreateApplyArtifactsRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, DevTestLabVmApplyArtifactsContent.ToRequestContent(content), context); + Response response = await Pipeline.ProcessMessageAsync(message, context).ConfigureAwait(false); + DevTestLabsArmOperation operation = new DevTestLabsArmOperation(_virtualMachinesClientDiagnostics, Pipeline, message.Request, response, OperationFinalStateVia.Location); if (waitUntil == WaitUntil.Completed) + { await operation.WaitForCompletionResponseAsync(cancellationToken).ConfigureAwait(false); + } return operation; } catch (Exception e) @@ -553,20 +557,20 @@ public virtual async Task ApplyArtifactsAsync(WaitUntil waitUntil, /// Apply artifacts to virtual machine. This operation can take a while to complete. /// /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/virtualmachines/{name}/applyArtifacts + /// Request Path. + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/virtualmachines/{name}/applyArtifacts. /// /// - /// Operation Id - /// VirtualMachines_ApplyArtifacts + /// Operation Id. + /// VirtualMachines_ApplyArtifacts. /// /// - /// Default Api Version - /// 2018-09-15 + /// Default Api Version. + /// 2018-09-15. /// /// - /// Resource - /// + /// Resource. + /// . /// /// /// @@ -578,14 +582,21 @@ public virtual ArmOperation ApplyArtifacts(WaitUntil waitUntil, DevTestLabVmAppl { Argument.AssertNotNull(content, nameof(content)); - using var scope = _devTestLabVmVirtualMachinesClientDiagnostics.CreateScope("DevTestLabVmResource.ApplyArtifacts"); + using DiagnosticScope scope = _virtualMachinesClientDiagnostics.CreateScope("DevTestLabVmResource.ApplyArtifacts"); scope.Start(); try { - var response = _devTestLabVmVirtualMachinesRestClient.ApplyArtifacts(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, content, cancellationToken); - var operation = new DevTestLabsArmOperation(_devTestLabVmVirtualMachinesClientDiagnostics, Pipeline, _devTestLabVmVirtualMachinesRestClient.CreateApplyArtifactsRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, content).Request, response, OperationFinalStateVia.Location); + RequestContext context = new RequestContext + { + CancellationToken = cancellationToken + }; + HttpMessage message = _virtualMachinesRestClient.CreateApplyArtifactsRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, DevTestLabVmApplyArtifactsContent.ToRequestContent(content), context); + Response response = Pipeline.ProcessMessage(message, context); + DevTestLabsArmOperation operation = new DevTestLabsArmOperation(_virtualMachinesClientDiagnostics, Pipeline, message.Request, response, OperationFinalStateVia.Location); if (waitUntil == WaitUntil.Completed) + { operation.WaitForCompletionResponse(cancellationToken); + } return operation; } catch (Exception e) @@ -599,20 +610,20 @@ public virtual ArmOperation ApplyArtifacts(WaitUntil waitUntil, DevTestLabVmAppl /// Take ownership of an existing virtual machine This operation can take a while to complete. /// /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/virtualmachines/{name}/claim + /// Request Path. + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/virtualmachines/{name}/claim. /// /// - /// Operation Id - /// VirtualMachines_Claim + /// Operation Id. + /// VirtualMachines_Claim. /// /// - /// Default Api Version - /// 2018-09-15 + /// Default Api Version. + /// 2018-09-15. /// /// - /// Resource - /// + /// Resource. + /// . /// /// /// @@ -620,14 +631,21 @@ public virtual ArmOperation ApplyArtifacts(WaitUntil waitUntil, DevTestLabVmAppl /// The cancellation token to use. public virtual async Task ClaimAsync(WaitUntil waitUntil, CancellationToken cancellationToken = default) { - using var scope = _devTestLabVmVirtualMachinesClientDiagnostics.CreateScope("DevTestLabVmResource.Claim"); + using DiagnosticScope scope = _virtualMachinesClientDiagnostics.CreateScope("DevTestLabVmResource.Claim"); scope.Start(); try { - var response = await _devTestLabVmVirtualMachinesRestClient.ClaimAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, cancellationToken).ConfigureAwait(false); - var operation = new DevTestLabsArmOperation(_devTestLabVmVirtualMachinesClientDiagnostics, Pipeline, _devTestLabVmVirtualMachinesRestClient.CreateClaimRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name).Request, response, OperationFinalStateVia.Location); + RequestContext context = new RequestContext + { + CancellationToken = cancellationToken + }; + HttpMessage message = _virtualMachinesRestClient.CreateClaimRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, context); + Response response = await Pipeline.ProcessMessageAsync(message, context).ConfigureAwait(false); + DevTestLabsArmOperation operation = new DevTestLabsArmOperation(_virtualMachinesClientDiagnostics, Pipeline, message.Request, response, OperationFinalStateVia.Location); if (waitUntil == WaitUntil.Completed) + { await operation.WaitForCompletionResponseAsync(cancellationToken).ConfigureAwait(false); + } return operation; } catch (Exception e) @@ -641,20 +659,20 @@ public virtual async Task ClaimAsync(WaitUntil waitUntil, Cancella /// Take ownership of an existing virtual machine This operation can take a while to complete. /// /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/virtualmachines/{name}/claim + /// Request Path. + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/virtualmachines/{name}/claim. /// /// - /// Operation Id - /// VirtualMachines_Claim + /// Operation Id. + /// VirtualMachines_Claim. /// /// - /// Default Api Version - /// 2018-09-15 + /// Default Api Version. + /// 2018-09-15. /// /// - /// Resource - /// + /// Resource. + /// . /// /// /// @@ -662,14 +680,21 @@ public virtual async Task ClaimAsync(WaitUntil waitUntil, Cancella /// The cancellation token to use. public virtual ArmOperation Claim(WaitUntil waitUntil, CancellationToken cancellationToken = default) { - using var scope = _devTestLabVmVirtualMachinesClientDiagnostics.CreateScope("DevTestLabVmResource.Claim"); + using DiagnosticScope scope = _virtualMachinesClientDiagnostics.CreateScope("DevTestLabVmResource.Claim"); scope.Start(); try { - var response = _devTestLabVmVirtualMachinesRestClient.Claim(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, cancellationToken); - var operation = new DevTestLabsArmOperation(_devTestLabVmVirtualMachinesClientDiagnostics, Pipeline, _devTestLabVmVirtualMachinesRestClient.CreateClaimRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name).Request, response, OperationFinalStateVia.Location); + RequestContext context = new RequestContext + { + CancellationToken = cancellationToken + }; + HttpMessage message = _virtualMachinesRestClient.CreateClaimRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, context); + Response response = Pipeline.ProcessMessage(message, context); + DevTestLabsArmOperation operation = new DevTestLabsArmOperation(_virtualMachinesClientDiagnostics, Pipeline, message.Request, response, OperationFinalStateVia.Location); if (waitUntil == WaitUntil.Completed) + { operation.WaitForCompletionResponse(cancellationToken); + } return operation; } catch (Exception e) @@ -683,20 +708,20 @@ public virtual ArmOperation Claim(WaitUntil waitUntil, CancellationToken cancell /// Detach the specified disk from the virtual machine. This operation can take a while to complete. /// /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/virtualmachines/{name}/detachDataDisk + /// Request Path. + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/virtualmachines/{name}/detachDataDisk. /// /// - /// Operation Id - /// VirtualMachines_DetachDataDisk + /// Operation Id. + /// VirtualMachines_DetachDataDisk. /// /// - /// Default Api Version - /// 2018-09-15 + /// Default Api Version. + /// 2018-09-15. /// /// - /// Resource - /// + /// Resource. + /// . /// /// /// @@ -708,14 +733,21 @@ public virtual async Task DetachDataDiskAsync(WaitUntil waitUntil, { Argument.AssertNotNull(content, nameof(content)); - using var scope = _devTestLabVmVirtualMachinesClientDiagnostics.CreateScope("DevTestLabVmResource.DetachDataDisk"); + using DiagnosticScope scope = _virtualMachinesClientDiagnostics.CreateScope("DevTestLabVmResource.DetachDataDisk"); scope.Start(); try { - var response = await _devTestLabVmVirtualMachinesRestClient.DetachDataDiskAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, content, cancellationToken).ConfigureAwait(false); - var operation = new DevTestLabsArmOperation(_devTestLabVmVirtualMachinesClientDiagnostics, Pipeline, _devTestLabVmVirtualMachinesRestClient.CreateDetachDataDiskRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, content).Request, response, OperationFinalStateVia.Location); + RequestContext context = new RequestContext + { + CancellationToken = cancellationToken + }; + HttpMessage message = _virtualMachinesRestClient.CreateDetachDataDiskRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, DevTestLabVmDetachDataDiskContent.ToRequestContent(content), context); + Response response = await Pipeline.ProcessMessageAsync(message, context).ConfigureAwait(false); + DevTestLabsArmOperation operation = new DevTestLabsArmOperation(_virtualMachinesClientDiagnostics, Pipeline, message.Request, response, OperationFinalStateVia.Location); if (waitUntil == WaitUntil.Completed) + { await operation.WaitForCompletionResponseAsync(cancellationToken).ConfigureAwait(false); + } return operation; } catch (Exception e) @@ -729,20 +761,20 @@ public virtual async Task DetachDataDiskAsync(WaitUntil waitUntil, /// Detach the specified disk from the virtual machine. This operation can take a while to complete. /// /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/virtualmachines/{name}/detachDataDisk + /// Request Path. + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/virtualmachines/{name}/detachDataDisk. /// /// - /// Operation Id - /// VirtualMachines_DetachDataDisk + /// Operation Id. + /// VirtualMachines_DetachDataDisk. /// /// - /// Default Api Version - /// 2018-09-15 + /// Default Api Version. + /// 2018-09-15. /// /// - /// Resource - /// + /// Resource. + /// . /// /// /// @@ -754,14 +786,21 @@ public virtual ArmOperation DetachDataDisk(WaitUntil waitUntil, DevTestLabVmDeta { Argument.AssertNotNull(content, nameof(content)); - using var scope = _devTestLabVmVirtualMachinesClientDiagnostics.CreateScope("DevTestLabVmResource.DetachDataDisk"); + using DiagnosticScope scope = _virtualMachinesClientDiagnostics.CreateScope("DevTestLabVmResource.DetachDataDisk"); scope.Start(); try { - var response = _devTestLabVmVirtualMachinesRestClient.DetachDataDisk(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, content, cancellationToken); - var operation = new DevTestLabsArmOperation(_devTestLabVmVirtualMachinesClientDiagnostics, Pipeline, _devTestLabVmVirtualMachinesRestClient.CreateDetachDataDiskRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, content).Request, response, OperationFinalStateVia.Location); + RequestContext context = new RequestContext + { + CancellationToken = cancellationToken + }; + HttpMessage message = _virtualMachinesRestClient.CreateDetachDataDiskRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, DevTestLabVmDetachDataDiskContent.ToRequestContent(content), context); + Response response = Pipeline.ProcessMessage(message, context); + DevTestLabsArmOperation operation = new DevTestLabsArmOperation(_virtualMachinesClientDiagnostics, Pipeline, message.Request, response, OperationFinalStateVia.Location); if (waitUntil == WaitUntil.Completed) + { operation.WaitForCompletionResponse(cancellationToken); + } return operation; } catch (Exception e) @@ -775,31 +814,41 @@ public virtual ArmOperation DetachDataDisk(WaitUntil waitUntil, DevTestLabVmDeta /// Gets a string that represents the contents of the RDP file for the virtual machine /// /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/virtualmachines/{name}/getRdpFileContents + /// Request Path. + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/virtualmachines/{name}/getRdpFileContents. /// /// - /// Operation Id - /// VirtualMachines_GetRdpFileContents + /// Operation Id. + /// VirtualMachines_GetRdpFileContents. /// /// - /// Default Api Version - /// 2018-09-15 + /// Default Api Version. + /// 2018-09-15. /// /// - /// Resource - /// + /// Resource. + /// . /// /// /// /// The cancellation token to use. public virtual async Task> GetRdpFileContentsAsync(CancellationToken cancellationToken = default) { - using var scope = _devTestLabVmVirtualMachinesClientDiagnostics.CreateScope("DevTestLabVmResource.GetRdpFileContents"); + using DiagnosticScope scope = _virtualMachinesClientDiagnostics.CreateScope("DevTestLabVmResource.GetRdpFileContents"); scope.Start(); try { - var response = await _devTestLabVmVirtualMachinesRestClient.GetRdpFileContentsAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, cancellationToken).ConfigureAwait(false); + RequestContext context = new RequestContext + { + CancellationToken = cancellationToken + }; + HttpMessage message = _virtualMachinesRestClient.CreateGetRdpFileContentsRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, context); + Response result = await Pipeline.ProcessMessageAsync(message, context).ConfigureAwait(false); + Response response = Response.FromValue(DevTestLabRdpConnection.FromResponse(result), result); + if (response.Value == null) + { + throw new RequestFailedException(response.GetRawResponse()); + } return response; } catch (Exception e) @@ -813,31 +862,41 @@ public virtual async Task> GetRdpFileContentsA /// Gets a string that represents the contents of the RDP file for the virtual machine /// /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/virtualmachines/{name}/getRdpFileContents + /// Request Path. + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/virtualmachines/{name}/getRdpFileContents. /// /// - /// Operation Id - /// VirtualMachines_GetRdpFileContents + /// Operation Id. + /// VirtualMachines_GetRdpFileContents. /// /// - /// Default Api Version - /// 2018-09-15 + /// Default Api Version. + /// 2018-09-15. /// /// - /// Resource - /// + /// Resource. + /// . /// /// /// /// The cancellation token to use. public virtual Response GetRdpFileContents(CancellationToken cancellationToken = default) { - using var scope = _devTestLabVmVirtualMachinesClientDiagnostics.CreateScope("DevTestLabVmResource.GetRdpFileContents"); + using DiagnosticScope scope = _virtualMachinesClientDiagnostics.CreateScope("DevTestLabVmResource.GetRdpFileContents"); scope.Start(); try { - var response = _devTestLabVmVirtualMachinesRestClient.GetRdpFileContents(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, cancellationToken); + RequestContext context = new RequestContext + { + CancellationToken = cancellationToken + }; + HttpMessage message = _virtualMachinesRestClient.CreateGetRdpFileContentsRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, context); + Response result = Pipeline.ProcessMessage(message, context); + Response response = Response.FromValue(DevTestLabRdpConnection.FromResponse(result), result); + if (response.Value == null) + { + throw new RequestFailedException(response.GetRawResponse()); + } return response; } catch (Exception e) @@ -851,31 +910,41 @@ public virtual Response GetRdpFileContents(Cancellation /// Lists the applicable start/stop schedules, if any. /// /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/virtualmachines/{name}/listApplicableSchedules + /// Request Path. + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/virtualmachines/{name}/listApplicableSchedules. /// /// - /// Operation Id - /// VirtualMachines_ListApplicableSchedules + /// Operation Id. + /// VirtualMachines_ListApplicableSchedules. /// /// - /// Default Api Version - /// 2018-09-15 + /// Default Api Version. + /// 2018-09-15. /// /// - /// Resource - /// + /// Resource. + /// . /// /// /// /// The cancellation token to use. public virtual async Task> GetApplicableSchedulesAsync(CancellationToken cancellationToken = default) { - using var scope = _devTestLabVmVirtualMachinesClientDiagnostics.CreateScope("DevTestLabVmResource.GetApplicableSchedules"); + using DiagnosticScope scope = _virtualMachinesClientDiagnostics.CreateScope("DevTestLabVmResource.GetApplicableSchedules"); scope.Start(); try { - var response = await _devTestLabVmVirtualMachinesRestClient.ListApplicableSchedulesAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, cancellationToken).ConfigureAwait(false); + RequestContext context = new RequestContext + { + CancellationToken = cancellationToken + }; + HttpMessage message = _virtualMachinesRestClient.CreateGetApplicableSchedulesRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, context); + Response result = await Pipeline.ProcessMessageAsync(message, context).ConfigureAwait(false); + Response response = Response.FromValue(DevTestLabApplicableSchedule.FromResponse(result), result); + if (response.Value == null) + { + throw new RequestFailedException(response.GetRawResponse()); + } return response; } catch (Exception e) @@ -889,31 +958,41 @@ public virtual async Task> GetApplicableS /// Lists the applicable start/stop schedules, if any. /// /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/virtualmachines/{name}/listApplicableSchedules + /// Request Path. + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/virtualmachines/{name}/listApplicableSchedules. /// /// - /// Operation Id - /// VirtualMachines_ListApplicableSchedules + /// Operation Id. + /// VirtualMachines_ListApplicableSchedules. /// /// - /// Default Api Version - /// 2018-09-15 + /// Default Api Version. + /// 2018-09-15. /// /// - /// Resource - /// + /// Resource. + /// . /// /// /// /// The cancellation token to use. public virtual Response GetApplicableSchedules(CancellationToken cancellationToken = default) { - using var scope = _devTestLabVmVirtualMachinesClientDiagnostics.CreateScope("DevTestLabVmResource.GetApplicableSchedules"); + using DiagnosticScope scope = _virtualMachinesClientDiagnostics.CreateScope("DevTestLabVmResource.GetApplicableSchedules"); scope.Start(); try { - var response = _devTestLabVmVirtualMachinesRestClient.ListApplicableSchedules(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, cancellationToken); + RequestContext context = new RequestContext + { + CancellationToken = cancellationToken + }; + HttpMessage message = _virtualMachinesRestClient.CreateGetApplicableSchedulesRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, context); + Response result = Pipeline.ProcessMessage(message, context); + Response response = Response.FromValue(DevTestLabApplicableSchedule.FromResponse(result), result); + if (response.Value == null) + { + throw new RequestFailedException(response.GetRawResponse()); + } return response; } catch (Exception e) @@ -927,20 +1006,20 @@ public virtual Response GetApplicableSchedules(Can /// Redeploy a virtual machine This operation can take a while to complete. /// /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/virtualmachines/{name}/redeploy + /// Request Path. + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/virtualmachines/{name}/redeploy. /// /// - /// Operation Id - /// VirtualMachines_Redeploy + /// Operation Id. + /// VirtualMachines_Redeploy. /// /// - /// Default Api Version - /// 2018-09-15 + /// Default Api Version. + /// 2018-09-15. /// /// - /// Resource - /// + /// Resource. + /// . /// /// /// @@ -948,14 +1027,21 @@ public virtual Response GetApplicableSchedules(Can /// The cancellation token to use. public virtual async Task RedeployAsync(WaitUntil waitUntil, CancellationToken cancellationToken = default) { - using var scope = _devTestLabVmVirtualMachinesClientDiagnostics.CreateScope("DevTestLabVmResource.Redeploy"); + using DiagnosticScope scope = _virtualMachinesClientDiagnostics.CreateScope("DevTestLabVmResource.Redeploy"); scope.Start(); try { - var response = await _devTestLabVmVirtualMachinesRestClient.RedeployAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, cancellationToken).ConfigureAwait(false); - var operation = new DevTestLabsArmOperation(_devTestLabVmVirtualMachinesClientDiagnostics, Pipeline, _devTestLabVmVirtualMachinesRestClient.CreateRedeployRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name).Request, response, OperationFinalStateVia.Location); + RequestContext context = new RequestContext + { + CancellationToken = cancellationToken + }; + HttpMessage message = _virtualMachinesRestClient.CreateRedeployRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, context); + Response response = await Pipeline.ProcessMessageAsync(message, context).ConfigureAwait(false); + DevTestLabsArmOperation operation = new DevTestLabsArmOperation(_virtualMachinesClientDiagnostics, Pipeline, message.Request, response, OperationFinalStateVia.Location); if (waitUntil == WaitUntil.Completed) + { await operation.WaitForCompletionResponseAsync(cancellationToken).ConfigureAwait(false); + } return operation; } catch (Exception e) @@ -969,20 +1055,20 @@ public virtual async Task RedeployAsync(WaitUntil waitUntil, Cance /// Redeploy a virtual machine This operation can take a while to complete. /// /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/virtualmachines/{name}/redeploy + /// Request Path. + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/virtualmachines/{name}/redeploy. /// /// - /// Operation Id - /// VirtualMachines_Redeploy + /// Operation Id. + /// VirtualMachines_Redeploy. /// /// - /// Default Api Version - /// 2018-09-15 + /// Default Api Version. + /// 2018-09-15. /// /// - /// Resource - /// + /// Resource. + /// . /// /// /// @@ -990,14 +1076,21 @@ public virtual async Task RedeployAsync(WaitUntil waitUntil, Cance /// The cancellation token to use. public virtual ArmOperation Redeploy(WaitUntil waitUntil, CancellationToken cancellationToken = default) { - using var scope = _devTestLabVmVirtualMachinesClientDiagnostics.CreateScope("DevTestLabVmResource.Redeploy"); + using DiagnosticScope scope = _virtualMachinesClientDiagnostics.CreateScope("DevTestLabVmResource.Redeploy"); scope.Start(); try { - var response = _devTestLabVmVirtualMachinesRestClient.Redeploy(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, cancellationToken); - var operation = new DevTestLabsArmOperation(_devTestLabVmVirtualMachinesClientDiagnostics, Pipeline, _devTestLabVmVirtualMachinesRestClient.CreateRedeployRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name).Request, response, OperationFinalStateVia.Location); + RequestContext context = new RequestContext + { + CancellationToken = cancellationToken + }; + HttpMessage message = _virtualMachinesRestClient.CreateRedeployRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, context); + Response response = Pipeline.ProcessMessage(message, context); + DevTestLabsArmOperation operation = new DevTestLabsArmOperation(_virtualMachinesClientDiagnostics, Pipeline, message.Request, response, OperationFinalStateVia.Location); if (waitUntil == WaitUntil.Completed) + { operation.WaitForCompletionResponse(cancellationToken); + } return operation; } catch (Exception e) @@ -1011,20 +1104,20 @@ public virtual ArmOperation Redeploy(WaitUntil waitUntil, CancellationToken canc /// Resize Virtual Machine. This operation can take a while to complete. /// /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/virtualmachines/{name}/resize + /// Request Path. + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/virtualmachines/{name}/resize. /// /// - /// Operation Id - /// VirtualMachines_Resize + /// Operation Id. + /// VirtualMachines_Resize. /// /// - /// Default Api Version - /// 2018-09-15 + /// Default Api Version. + /// 2018-09-15. /// /// - /// Resource - /// + /// Resource. + /// . /// /// /// @@ -1036,14 +1129,21 @@ public virtual async Task ResizeAsync(WaitUntil waitUntil, DevTest { Argument.AssertNotNull(content, nameof(content)); - using var scope = _devTestLabVmVirtualMachinesClientDiagnostics.CreateScope("DevTestLabVmResource.Resize"); + using DiagnosticScope scope = _virtualMachinesClientDiagnostics.CreateScope("DevTestLabVmResource.Resize"); scope.Start(); try { - var response = await _devTestLabVmVirtualMachinesRestClient.ResizeAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, content, cancellationToken).ConfigureAwait(false); - var operation = new DevTestLabsArmOperation(_devTestLabVmVirtualMachinesClientDiagnostics, Pipeline, _devTestLabVmVirtualMachinesRestClient.CreateResizeRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, content).Request, response, OperationFinalStateVia.Location); + RequestContext context = new RequestContext + { + CancellationToken = cancellationToken + }; + HttpMessage message = _virtualMachinesRestClient.CreateResizeRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, DevTestLabVmResizeContent.ToRequestContent(content), context); + Response response = await Pipeline.ProcessMessageAsync(message, context).ConfigureAwait(false); + DevTestLabsArmOperation operation = new DevTestLabsArmOperation(_virtualMachinesClientDiagnostics, Pipeline, message.Request, response, OperationFinalStateVia.Location); if (waitUntil == WaitUntil.Completed) + { await operation.WaitForCompletionResponseAsync(cancellationToken).ConfigureAwait(false); + } return operation; } catch (Exception e) @@ -1057,20 +1157,20 @@ public virtual async Task ResizeAsync(WaitUntil waitUntil, DevTest /// Resize Virtual Machine. This operation can take a while to complete. /// /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/virtualmachines/{name}/resize + /// Request Path. + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/virtualmachines/{name}/resize. /// /// - /// Operation Id - /// VirtualMachines_Resize + /// Operation Id. + /// VirtualMachines_Resize. /// /// - /// Default Api Version - /// 2018-09-15 + /// Default Api Version. + /// 2018-09-15. /// /// - /// Resource - /// + /// Resource. + /// . /// /// /// @@ -1082,14 +1182,21 @@ public virtual ArmOperation Resize(WaitUntil waitUntil, DevTestLabVmResizeConten { Argument.AssertNotNull(content, nameof(content)); - using var scope = _devTestLabVmVirtualMachinesClientDiagnostics.CreateScope("DevTestLabVmResource.Resize"); + using DiagnosticScope scope = _virtualMachinesClientDiagnostics.CreateScope("DevTestLabVmResource.Resize"); scope.Start(); try { - var response = _devTestLabVmVirtualMachinesRestClient.Resize(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, content, cancellationToken); - var operation = new DevTestLabsArmOperation(_devTestLabVmVirtualMachinesClientDiagnostics, Pipeline, _devTestLabVmVirtualMachinesRestClient.CreateResizeRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, content).Request, response, OperationFinalStateVia.Location); + RequestContext context = new RequestContext + { + CancellationToken = cancellationToken + }; + HttpMessage message = _virtualMachinesRestClient.CreateResizeRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, DevTestLabVmResizeContent.ToRequestContent(content), context); + Response response = Pipeline.ProcessMessage(message, context); + DevTestLabsArmOperation operation = new DevTestLabsArmOperation(_virtualMachinesClientDiagnostics, Pipeline, message.Request, response, OperationFinalStateVia.Location); if (waitUntil == WaitUntil.Completed) + { operation.WaitForCompletionResponse(cancellationToken); + } return operation; } catch (Exception e) @@ -1103,20 +1210,20 @@ public virtual ArmOperation Resize(WaitUntil waitUntil, DevTestLabVmResizeConten /// Restart a virtual machine. This operation can take a while to complete. /// /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/virtualmachines/{name}/restart + /// Request Path. + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/virtualmachines/{name}/restart. /// /// - /// Operation Id - /// VirtualMachines_Restart + /// Operation Id. + /// VirtualMachines_Restart. /// /// - /// Default Api Version - /// 2018-09-15 + /// Default Api Version. + /// 2018-09-15. /// /// - /// Resource - /// + /// Resource. + /// . /// /// /// @@ -1124,14 +1231,21 @@ public virtual ArmOperation Resize(WaitUntil waitUntil, DevTestLabVmResizeConten /// The cancellation token to use. public virtual async Task RestartAsync(WaitUntil waitUntil, CancellationToken cancellationToken = default) { - using var scope = _devTestLabVmVirtualMachinesClientDiagnostics.CreateScope("DevTestLabVmResource.Restart"); + using DiagnosticScope scope = _virtualMachinesClientDiagnostics.CreateScope("DevTestLabVmResource.Restart"); scope.Start(); try { - var response = await _devTestLabVmVirtualMachinesRestClient.RestartAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, cancellationToken).ConfigureAwait(false); - var operation = new DevTestLabsArmOperation(_devTestLabVmVirtualMachinesClientDiagnostics, Pipeline, _devTestLabVmVirtualMachinesRestClient.CreateRestartRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name).Request, response, OperationFinalStateVia.Location); + RequestContext context = new RequestContext + { + CancellationToken = cancellationToken + }; + HttpMessage message = _virtualMachinesRestClient.CreateRestartRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, context); + Response response = await Pipeline.ProcessMessageAsync(message, context).ConfigureAwait(false); + DevTestLabsArmOperation operation = new DevTestLabsArmOperation(_virtualMachinesClientDiagnostics, Pipeline, message.Request, response, OperationFinalStateVia.Location); if (waitUntil == WaitUntil.Completed) + { await operation.WaitForCompletionResponseAsync(cancellationToken).ConfigureAwait(false); + } return operation; } catch (Exception e) @@ -1145,20 +1259,20 @@ public virtual async Task RestartAsync(WaitUntil waitUntil, Cancel /// Restart a virtual machine. This operation can take a while to complete. /// /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/virtualmachines/{name}/restart + /// Request Path. + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/virtualmachines/{name}/restart. /// /// - /// Operation Id - /// VirtualMachines_Restart + /// Operation Id. + /// VirtualMachines_Restart. /// /// - /// Default Api Version - /// 2018-09-15 + /// Default Api Version. + /// 2018-09-15. /// /// - /// Resource - /// + /// Resource. + /// . /// /// /// @@ -1166,14 +1280,21 @@ public virtual async Task RestartAsync(WaitUntil waitUntil, Cancel /// The cancellation token to use. public virtual ArmOperation Restart(WaitUntil waitUntil, CancellationToken cancellationToken = default) { - using var scope = _devTestLabVmVirtualMachinesClientDiagnostics.CreateScope("DevTestLabVmResource.Restart"); + using DiagnosticScope scope = _virtualMachinesClientDiagnostics.CreateScope("DevTestLabVmResource.Restart"); scope.Start(); try { - var response = _devTestLabVmVirtualMachinesRestClient.Restart(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, cancellationToken); - var operation = new DevTestLabsArmOperation(_devTestLabVmVirtualMachinesClientDiagnostics, Pipeline, _devTestLabVmVirtualMachinesRestClient.CreateRestartRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name).Request, response, OperationFinalStateVia.Location); + RequestContext context = new RequestContext + { + CancellationToken = cancellationToken + }; + HttpMessage message = _virtualMachinesRestClient.CreateRestartRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, context); + Response response = Pipeline.ProcessMessage(message, context); + DevTestLabsArmOperation operation = new DevTestLabsArmOperation(_virtualMachinesClientDiagnostics, Pipeline, message.Request, response, OperationFinalStateVia.Location); if (waitUntil == WaitUntil.Completed) + { operation.WaitForCompletionResponse(cancellationToken); + } return operation; } catch (Exception e) @@ -1187,20 +1308,20 @@ public virtual ArmOperation Restart(WaitUntil waitUntil, CancellationToken cance /// Start a virtual machine. This operation can take a while to complete. /// /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/virtualmachines/{name}/start + /// Request Path. + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/virtualmachines/{name}/start. /// /// - /// Operation Id - /// VirtualMachines_Start + /// Operation Id. + /// VirtualMachines_Start. /// /// - /// Default Api Version - /// 2018-09-15 + /// Default Api Version. + /// 2018-09-15. /// /// - /// Resource - /// + /// Resource. + /// . /// /// /// @@ -1208,14 +1329,21 @@ public virtual ArmOperation Restart(WaitUntil waitUntil, CancellationToken cance /// The cancellation token to use. public virtual async Task StartAsync(WaitUntil waitUntil, CancellationToken cancellationToken = default) { - using var scope = _devTestLabVmVirtualMachinesClientDiagnostics.CreateScope("DevTestLabVmResource.Start"); + using DiagnosticScope scope = _virtualMachinesClientDiagnostics.CreateScope("DevTestLabVmResource.Start"); scope.Start(); try { - var response = await _devTestLabVmVirtualMachinesRestClient.StartAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, cancellationToken).ConfigureAwait(false); - var operation = new DevTestLabsArmOperation(_devTestLabVmVirtualMachinesClientDiagnostics, Pipeline, _devTestLabVmVirtualMachinesRestClient.CreateStartRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name).Request, response, OperationFinalStateVia.Location); + RequestContext context = new RequestContext + { + CancellationToken = cancellationToken + }; + HttpMessage message = _virtualMachinesRestClient.CreateStartRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, context); + Response response = await Pipeline.ProcessMessageAsync(message, context).ConfigureAwait(false); + DevTestLabsArmOperation operation = new DevTestLabsArmOperation(_virtualMachinesClientDiagnostics, Pipeline, message.Request, response, OperationFinalStateVia.Location); if (waitUntil == WaitUntil.Completed) + { await operation.WaitForCompletionResponseAsync(cancellationToken).ConfigureAwait(false); + } return operation; } catch (Exception e) @@ -1229,20 +1357,20 @@ public virtual async Task StartAsync(WaitUntil waitUntil, Cancella /// Start a virtual machine. This operation can take a while to complete. /// /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/virtualmachines/{name}/start + /// Request Path. + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/virtualmachines/{name}/start. /// /// - /// Operation Id - /// VirtualMachines_Start + /// Operation Id. + /// VirtualMachines_Start. /// /// - /// Default Api Version - /// 2018-09-15 + /// Default Api Version. + /// 2018-09-15. /// /// - /// Resource - /// + /// Resource. + /// . /// /// /// @@ -1250,14 +1378,21 @@ public virtual async Task StartAsync(WaitUntil waitUntil, Cancella /// The cancellation token to use. public virtual ArmOperation Start(WaitUntil waitUntil, CancellationToken cancellationToken = default) { - using var scope = _devTestLabVmVirtualMachinesClientDiagnostics.CreateScope("DevTestLabVmResource.Start"); + using DiagnosticScope scope = _virtualMachinesClientDiagnostics.CreateScope("DevTestLabVmResource.Start"); scope.Start(); try { - var response = _devTestLabVmVirtualMachinesRestClient.Start(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, cancellationToken); - var operation = new DevTestLabsArmOperation(_devTestLabVmVirtualMachinesClientDiagnostics, Pipeline, _devTestLabVmVirtualMachinesRestClient.CreateStartRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name).Request, response, OperationFinalStateVia.Location); + RequestContext context = new RequestContext + { + CancellationToken = cancellationToken + }; + HttpMessage message = _virtualMachinesRestClient.CreateStartRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, context); + Response response = Pipeline.ProcessMessage(message, context); + DevTestLabsArmOperation operation = new DevTestLabsArmOperation(_virtualMachinesClientDiagnostics, Pipeline, message.Request, response, OperationFinalStateVia.Location); if (waitUntil == WaitUntil.Completed) + { operation.WaitForCompletionResponse(cancellationToken); + } return operation; } catch (Exception e) @@ -1271,20 +1406,20 @@ public virtual ArmOperation Start(WaitUntil waitUntil, CancellationToken cancell /// Stop a virtual machine This operation can take a while to complete. /// /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/virtualmachines/{name}/stop + /// Request Path. + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/virtualmachines/{name}/stop. /// /// - /// Operation Id - /// VirtualMachines_Stop + /// Operation Id. + /// VirtualMachines_Stop. /// /// - /// Default Api Version - /// 2018-09-15 + /// Default Api Version. + /// 2018-09-15. /// /// - /// Resource - /// + /// Resource. + /// . /// /// /// @@ -1292,14 +1427,21 @@ public virtual ArmOperation Start(WaitUntil waitUntil, CancellationToken cancell /// The cancellation token to use. public virtual async Task StopAsync(WaitUntil waitUntil, CancellationToken cancellationToken = default) { - using var scope = _devTestLabVmVirtualMachinesClientDiagnostics.CreateScope("DevTestLabVmResource.Stop"); + using DiagnosticScope scope = _virtualMachinesClientDiagnostics.CreateScope("DevTestLabVmResource.Stop"); scope.Start(); try { - var response = await _devTestLabVmVirtualMachinesRestClient.StopAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, cancellationToken).ConfigureAwait(false); - var operation = new DevTestLabsArmOperation(_devTestLabVmVirtualMachinesClientDiagnostics, Pipeline, _devTestLabVmVirtualMachinesRestClient.CreateStopRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name).Request, response, OperationFinalStateVia.Location); + RequestContext context = new RequestContext + { + CancellationToken = cancellationToken + }; + HttpMessage message = _virtualMachinesRestClient.CreateStopRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, context); + Response response = await Pipeline.ProcessMessageAsync(message, context).ConfigureAwait(false); + DevTestLabsArmOperation operation = new DevTestLabsArmOperation(_virtualMachinesClientDiagnostics, Pipeline, message.Request, response, OperationFinalStateVia.Location); if (waitUntil == WaitUntil.Completed) + { await operation.WaitForCompletionResponseAsync(cancellationToken).ConfigureAwait(false); + } return operation; } catch (Exception e) @@ -1313,20 +1455,20 @@ public virtual async Task StopAsync(WaitUntil waitUntil, Cancellat /// Stop a virtual machine This operation can take a while to complete. /// /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/virtualmachines/{name}/stop + /// Request Path. + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/virtualmachines/{name}/stop. /// /// - /// Operation Id - /// VirtualMachines_Stop + /// Operation Id. + /// VirtualMachines_Stop. /// /// - /// Default Api Version - /// 2018-09-15 + /// Default Api Version. + /// 2018-09-15. /// /// - /// Resource - /// + /// Resource. + /// . /// /// /// @@ -1334,14 +1476,21 @@ public virtual async Task StopAsync(WaitUntil waitUntil, Cancellat /// The cancellation token to use. public virtual ArmOperation Stop(WaitUntil waitUntil, CancellationToken cancellationToken = default) { - using var scope = _devTestLabVmVirtualMachinesClientDiagnostics.CreateScope("DevTestLabVmResource.Stop"); + using DiagnosticScope scope = _virtualMachinesClientDiagnostics.CreateScope("DevTestLabVmResource.Stop"); scope.Start(); try { - var response = _devTestLabVmVirtualMachinesRestClient.Stop(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, cancellationToken); - var operation = new DevTestLabsArmOperation(_devTestLabVmVirtualMachinesClientDiagnostics, Pipeline, _devTestLabVmVirtualMachinesRestClient.CreateStopRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name).Request, response, OperationFinalStateVia.Location); + RequestContext context = new RequestContext + { + CancellationToken = cancellationToken + }; + HttpMessage message = _virtualMachinesRestClient.CreateStopRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, context); + Response response = Pipeline.ProcessMessage(message, context); + DevTestLabsArmOperation operation = new DevTestLabsArmOperation(_virtualMachinesClientDiagnostics, Pipeline, message.Request, response, OperationFinalStateVia.Location); if (waitUntil == WaitUntil.Completed) + { operation.WaitForCompletionResponse(cancellationToken); + } return operation; } catch (Exception e) @@ -1355,20 +1504,20 @@ public virtual ArmOperation Stop(WaitUntil waitUntil, CancellationToken cancella /// Transfers all data disks attached to the virtual machine to be owned by the current user. This operation can take a while to complete. /// /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/virtualmachines/{name}/transferDisks + /// Request Path. + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/virtualmachines/{name}/transferDisks. /// /// - /// Operation Id - /// VirtualMachines_TransferDisks + /// Operation Id. + /// VirtualMachines_TransferDisks. /// /// - /// Default Api Version - /// 2018-09-15 + /// Default Api Version. + /// 2018-09-15. /// /// - /// Resource - /// + /// Resource. + /// . /// /// /// @@ -1376,14 +1525,21 @@ public virtual ArmOperation Stop(WaitUntil waitUntil, CancellationToken cancella /// The cancellation token to use. public virtual async Task TransferDisksAsync(WaitUntil waitUntil, CancellationToken cancellationToken = default) { - using var scope = _devTestLabVmVirtualMachinesClientDiagnostics.CreateScope("DevTestLabVmResource.TransferDisks"); + using DiagnosticScope scope = _virtualMachinesClientDiagnostics.CreateScope("DevTestLabVmResource.TransferDisks"); scope.Start(); try { - var response = await _devTestLabVmVirtualMachinesRestClient.TransferDisksAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, cancellationToken).ConfigureAwait(false); - var operation = new DevTestLabsArmOperation(_devTestLabVmVirtualMachinesClientDiagnostics, Pipeline, _devTestLabVmVirtualMachinesRestClient.CreateTransferDisksRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name).Request, response, OperationFinalStateVia.Location); + RequestContext context = new RequestContext + { + CancellationToken = cancellationToken + }; + HttpMessage message = _virtualMachinesRestClient.CreateTransferDisksRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, context); + Response response = await Pipeline.ProcessMessageAsync(message, context).ConfigureAwait(false); + DevTestLabsArmOperation operation = new DevTestLabsArmOperation(_virtualMachinesClientDiagnostics, Pipeline, message.Request, response, OperationFinalStateVia.Location); if (waitUntil == WaitUntil.Completed) + { await operation.WaitForCompletionResponseAsync(cancellationToken).ConfigureAwait(false); + } return operation; } catch (Exception e) @@ -1397,20 +1553,20 @@ public virtual async Task TransferDisksAsync(WaitUntil waitUntil, /// Transfers all data disks attached to the virtual machine to be owned by the current user. This operation can take a while to complete. /// /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/virtualmachines/{name}/transferDisks + /// Request Path. + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/virtualmachines/{name}/transferDisks. /// /// - /// Operation Id - /// VirtualMachines_TransferDisks + /// Operation Id. + /// VirtualMachines_TransferDisks. /// /// - /// Default Api Version - /// 2018-09-15 + /// Default Api Version. + /// 2018-09-15. /// /// - /// Resource - /// + /// Resource. + /// . /// /// /// @@ -1418,14 +1574,21 @@ public virtual async Task TransferDisksAsync(WaitUntil waitUntil, /// The cancellation token to use. public virtual ArmOperation TransferDisks(WaitUntil waitUntil, CancellationToken cancellationToken = default) { - using var scope = _devTestLabVmVirtualMachinesClientDiagnostics.CreateScope("DevTestLabVmResource.TransferDisks"); + using DiagnosticScope scope = _virtualMachinesClientDiagnostics.CreateScope("DevTestLabVmResource.TransferDisks"); scope.Start(); try { - var response = _devTestLabVmVirtualMachinesRestClient.TransferDisks(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, cancellationToken); - var operation = new DevTestLabsArmOperation(_devTestLabVmVirtualMachinesClientDiagnostics, Pipeline, _devTestLabVmVirtualMachinesRestClient.CreateTransferDisksRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name).Request, response, OperationFinalStateVia.Location); + RequestContext context = new RequestContext + { + CancellationToken = cancellationToken + }; + HttpMessage message = _virtualMachinesRestClient.CreateTransferDisksRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, context); + Response response = Pipeline.ProcessMessage(message, context); + DevTestLabsArmOperation operation = new DevTestLabsArmOperation(_virtualMachinesClientDiagnostics, Pipeline, message.Request, response, OperationFinalStateVia.Location); if (waitUntil == WaitUntil.Completed) + { operation.WaitForCompletionResponse(cancellationToken); + } return operation; } catch (Exception e) @@ -1439,20 +1602,20 @@ public virtual ArmOperation TransferDisks(WaitUntil waitUntil, CancellationToken /// Release ownership of an existing virtual machine This operation can take a while to complete. /// /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/virtualmachines/{name}/unClaim + /// Request Path. + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/virtualmachines/{name}/unClaim. /// /// - /// Operation Id - /// VirtualMachines_UnClaim + /// Operation Id. + /// VirtualMachines_UnClaim. /// /// - /// Default Api Version - /// 2018-09-15 + /// Default Api Version. + /// 2018-09-15. /// /// - /// Resource - /// + /// Resource. + /// . /// /// /// @@ -1460,14 +1623,21 @@ public virtual ArmOperation TransferDisks(WaitUntil waitUntil, CancellationToken /// The cancellation token to use. public virtual async Task UnClaimAsync(WaitUntil waitUntil, CancellationToken cancellationToken = default) { - using var scope = _devTestLabVmVirtualMachinesClientDiagnostics.CreateScope("DevTestLabVmResource.UnClaim"); + using DiagnosticScope scope = _virtualMachinesClientDiagnostics.CreateScope("DevTestLabVmResource.UnClaim"); scope.Start(); try { - var response = await _devTestLabVmVirtualMachinesRestClient.UnClaimAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, cancellationToken).ConfigureAwait(false); - var operation = new DevTestLabsArmOperation(_devTestLabVmVirtualMachinesClientDiagnostics, Pipeline, _devTestLabVmVirtualMachinesRestClient.CreateUnClaimRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name).Request, response, OperationFinalStateVia.Location); + RequestContext context = new RequestContext + { + CancellationToken = cancellationToken + }; + HttpMessage message = _virtualMachinesRestClient.CreateUnClaimRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, context); + Response response = await Pipeline.ProcessMessageAsync(message, context).ConfigureAwait(false); + DevTestLabsArmOperation operation = new DevTestLabsArmOperation(_virtualMachinesClientDiagnostics, Pipeline, message.Request, response, OperationFinalStateVia.Location); if (waitUntil == WaitUntil.Completed) + { await operation.WaitForCompletionResponseAsync(cancellationToken).ConfigureAwait(false); + } return operation; } catch (Exception e) @@ -1481,20 +1651,20 @@ public virtual async Task UnClaimAsync(WaitUntil waitUntil, Cancel /// Release ownership of an existing virtual machine This operation can take a while to complete. /// /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/virtualmachines/{name}/unClaim + /// Request Path. + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/virtualmachines/{name}/unClaim. /// /// - /// Operation Id - /// VirtualMachines_UnClaim + /// Operation Id. + /// VirtualMachines_UnClaim. /// /// - /// Default Api Version - /// 2018-09-15 + /// Default Api Version. + /// 2018-09-15. /// /// - /// Resource - /// + /// Resource. + /// . /// /// /// @@ -1502,14 +1672,21 @@ public virtual async Task UnClaimAsync(WaitUntil waitUntil, Cancel /// The cancellation token to use. public virtual ArmOperation UnClaim(WaitUntil waitUntil, CancellationToken cancellationToken = default) { - using var scope = _devTestLabVmVirtualMachinesClientDiagnostics.CreateScope("DevTestLabVmResource.UnClaim"); + using DiagnosticScope scope = _virtualMachinesClientDiagnostics.CreateScope("DevTestLabVmResource.UnClaim"); scope.Start(); try { - var response = _devTestLabVmVirtualMachinesRestClient.UnClaim(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, cancellationToken); - var operation = new DevTestLabsArmOperation(_devTestLabVmVirtualMachinesClientDiagnostics, Pipeline, _devTestLabVmVirtualMachinesRestClient.CreateUnClaimRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name).Request, response, OperationFinalStateVia.Location); + RequestContext context = new RequestContext + { + CancellationToken = cancellationToken + }; + HttpMessage message = _virtualMachinesRestClient.CreateUnClaimRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, context); + Response response = Pipeline.ProcessMessage(message, context); + DevTestLabsArmOperation operation = new DevTestLabsArmOperation(_virtualMachinesClientDiagnostics, Pipeline, message.Request, response, OperationFinalStateVia.Location); if (waitUntil == WaitUntil.Completed) + { operation.WaitForCompletionResponse(cancellationToken); + } return operation; } catch (Exception e) @@ -1519,27 +1696,7 @@ public virtual ArmOperation UnClaim(WaitUntil waitUntil, CancellationToken cance } } - /// - /// Add a tag to the current resource. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/virtualmachines/{name} - /// - /// - /// Operation Id - /// VirtualMachines_Get - /// - /// - /// Default Api Version - /// 2018-09-15 - /// - /// - /// Resource - /// - /// - /// - /// + /// Add a tag to the current resource. /// The key for the tag. /// The value for the tag. /// The cancellation token to use. @@ -1549,29 +1706,35 @@ public virtual async Task> AddTagAsync(string key Argument.AssertNotNull(key, nameof(key)); Argument.AssertNotNull(value, nameof(value)); - using var scope = _devTestLabVmVirtualMachinesClientDiagnostics.CreateScope("DevTestLabVmResource.AddTag"); + using DiagnosticScope scope = _virtualMachinesClientDiagnostics.CreateScope("DevTestLabVmResource.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 _devTestLabVmVirtualMachinesRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, null, cancellationToken).ConfigureAwait(false); - return Response.FromValue(new DevTestLabVmResource(Client, originalResponse.Value), originalResponse.GetRawResponse()); + await GetTagResource().CreateOrUpdateAsync(WaitUntil.Completed, originalTags.Value.Data, cancellationToken).ConfigureAwait(false); + RequestContext context = new RequestContext + { + CancellationToken = cancellationToken + }; + HttpMessage message = _virtualMachinesRestClient.CreateGetRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, default, context); + Response result = await Pipeline.ProcessMessageAsync(message, context).ConfigureAwait(false); + Response response = Response.FromValue(DevTestLabVmData.FromResponse(result), result); + return Response.FromValue(new DevTestLabVmResource(Client, response.Value), response.GetRawResponse()); } else { - var current = (await GetAsync(cancellationToken: cancellationToken).ConfigureAwait(false)).Value.Data; - var patch = new DevTestLabVmPatch(); - foreach (var tag in current.Tags) + DevTestLabVmData current = (await GetAsync(cancellationToken: cancellationToken).ConfigureAwait(false)).Value.Data; + DevTestLabVmPatch patch = new DevTestLabVmPatch(); + 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) @@ -1581,27 +1744,7 @@ public virtual async Task> AddTagAsync(string key } } - /// - /// Add a tag to the current resource. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/virtualmachines/{name} - /// - /// - /// Operation Id - /// VirtualMachines_Get - /// - /// - /// Default Api Version - /// 2018-09-15 - /// - /// - /// Resource - /// - /// - /// - /// + /// Add a tag to the current resource. /// The key for the tag. /// The value for the tag. /// The cancellation token to use. @@ -1611,29 +1754,35 @@ public virtual Response AddTag(string key, string value, C Argument.AssertNotNull(key, nameof(key)); Argument.AssertNotNull(value, nameof(value)); - using var scope = _devTestLabVmVirtualMachinesClientDiagnostics.CreateScope("DevTestLabVmResource.AddTag"); + using DiagnosticScope scope = _virtualMachinesClientDiagnostics.CreateScope("DevTestLabVmResource.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 = _devTestLabVmVirtualMachinesRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, null, cancellationToken); - return Response.FromValue(new DevTestLabVmResource(Client, originalResponse.Value), originalResponse.GetRawResponse()); + GetTagResource().CreateOrUpdate(WaitUntil.Completed, originalTags.Value.Data, cancellationToken); + RequestContext context = new RequestContext + { + CancellationToken = cancellationToken + }; + HttpMessage message = _virtualMachinesRestClient.CreateGetRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, default, context); + Response result = Pipeline.ProcessMessage(message, context); + Response response = Response.FromValue(DevTestLabVmData.FromResponse(result), result); + return Response.FromValue(new DevTestLabVmResource(Client, response.Value), response.GetRawResponse()); } else { - var current = Get(cancellationToken: cancellationToken).Value.Data; - var patch = new DevTestLabVmPatch(); - foreach (var tag in current.Tags) + DevTestLabVmData current = Get(cancellationToken: cancellationToken).Value.Data; + DevTestLabVmPatch patch = new DevTestLabVmPatch(); + 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) @@ -1643,54 +1792,40 @@ public virtual Response AddTag(string key, string value, C } } - /// - /// Replace the tags on the resource with the given set. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/virtualmachines/{name} - /// - /// - /// Operation Id - /// VirtualMachines_Get - /// - /// - /// Default Api Version - /// 2018-09-15 - /// - /// - /// 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 = _devTestLabVmVirtualMachinesClientDiagnostics.CreateScope("DevTestLabVmResource.SetTags"); + using DiagnosticScope scope = _virtualMachinesClientDiagnostics.CreateScope("DevTestLabVmResource.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 _devTestLabVmVirtualMachinesRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, null, cancellationToken).ConfigureAwait(false); - return Response.FromValue(new DevTestLabVmResource(Client, originalResponse.Value), originalResponse.GetRawResponse()); + await GetTagResource().CreateOrUpdateAsync(WaitUntil.Completed, originalTags.Value.Data, cancellationToken).ConfigureAwait(false); + RequestContext context = new RequestContext + { + CancellationToken = cancellationToken + }; + HttpMessage message = _virtualMachinesRestClient.CreateGetRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, default, context); + Response result = await Pipeline.ProcessMessageAsync(message, context).ConfigureAwait(false); + Response response = Response.FromValue(DevTestLabVmData.FromResponse(result), result); + return Response.FromValue(new DevTestLabVmResource(Client, response.Value), response.GetRawResponse()); } else { - var current = (await GetAsync(cancellationToken: cancellationToken).ConfigureAwait(false)).Value.Data; - var patch = new DevTestLabVmPatch(); + DevTestLabVmData current = (await GetAsync(cancellationToken: cancellationToken).ConfigureAwait(false)).Value.Data; + DevTestLabVmPatch patch = new DevTestLabVmPatch(); 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) @@ -1700,54 +1835,40 @@ public virtual async Task> SetTagsAsync(IDictiona } } - /// - /// Replace the tags on the resource with the given set. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/virtualmachines/{name} - /// - /// - /// Operation Id - /// VirtualMachines_Get - /// - /// - /// Default Api Version - /// 2018-09-15 - /// - /// - /// 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 = _devTestLabVmVirtualMachinesClientDiagnostics.CreateScope("DevTestLabVmResource.SetTags"); + using DiagnosticScope scope = _virtualMachinesClientDiagnostics.CreateScope("DevTestLabVmResource.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 = _devTestLabVmVirtualMachinesRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, null, cancellationToken); - return Response.FromValue(new DevTestLabVmResource(Client, originalResponse.Value), originalResponse.GetRawResponse()); + GetTagResource().CreateOrUpdate(WaitUntil.Completed, originalTags.Value.Data, cancellationToken); + RequestContext context = new RequestContext + { + CancellationToken = cancellationToken + }; + HttpMessage message = _virtualMachinesRestClient.CreateGetRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, default, context); + Response result = Pipeline.ProcessMessage(message, context); + Response response = Response.FromValue(DevTestLabVmData.FromResponse(result), result); + return Response.FromValue(new DevTestLabVmResource(Client, response.Value), response.GetRawResponse()); } else { - var current = Get(cancellationToken: cancellationToken).Value.Data; - var patch = new DevTestLabVmPatch(); + DevTestLabVmData current = Get(cancellationToken: cancellationToken).Value.Data; + DevTestLabVmPatch patch = new DevTestLabVmPatch(); 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) @@ -1757,27 +1878,7 @@ public virtual Response SetTags(IDictionary - /// Removes a tag by key from the resource. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/virtualmachines/{name} - /// - /// - /// Operation Id - /// VirtualMachines_Get - /// - /// - /// Default Api Version - /// 2018-09-15 - /// - /// - /// Resource - /// - /// - /// - /// + /// Removes a tag by key from the resource. /// The key for the tag. /// The cancellation token to use. /// is null. @@ -1785,29 +1886,35 @@ public virtual async Task> RemoveTagAsync(string { Argument.AssertNotNull(key, nameof(key)); - using var scope = _devTestLabVmVirtualMachinesClientDiagnostics.CreateScope("DevTestLabVmResource.RemoveTag"); + using DiagnosticScope scope = _virtualMachinesClientDiagnostics.CreateScope("DevTestLabVmResource.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 _devTestLabVmVirtualMachinesRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, null, cancellationToken).ConfigureAwait(false); - return Response.FromValue(new DevTestLabVmResource(Client, originalResponse.Value), originalResponse.GetRawResponse()); + await GetTagResource().CreateOrUpdateAsync(WaitUntil.Completed, originalTags.Value.Data, cancellationToken).ConfigureAwait(false); + RequestContext context = new RequestContext + { + CancellationToken = cancellationToken + }; + HttpMessage message = _virtualMachinesRestClient.CreateGetRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, default, context); + Response result = await Pipeline.ProcessMessageAsync(message, context).ConfigureAwait(false); + Response response = Response.FromValue(DevTestLabVmData.FromResponse(result), result); + return Response.FromValue(new DevTestLabVmResource(Client, response.Value), response.GetRawResponse()); } else { - var current = (await GetAsync(cancellationToken: cancellationToken).ConfigureAwait(false)).Value.Data; - var patch = new DevTestLabVmPatch(); - foreach (var tag in current.Tags) + DevTestLabVmData current = (await GetAsync(cancellationToken: cancellationToken).ConfigureAwait(false)).Value.Data; + DevTestLabVmPatch patch = new DevTestLabVmPatch(); + 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) @@ -1817,27 +1924,7 @@ public virtual async Task> RemoveTagAsync(string } } - /// - /// Removes a tag by key from the resource. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/virtualmachines/{name} - /// - /// - /// Operation Id - /// VirtualMachines_Get - /// - /// - /// Default Api Version - /// 2018-09-15 - /// - /// - /// Resource - /// - /// - /// - /// + /// Removes a tag by key from the resource. /// The key for the tag. /// The cancellation token to use. /// is null. @@ -1845,29 +1932,35 @@ public virtual Response RemoveTag(string key, Cancellation { Argument.AssertNotNull(key, nameof(key)); - using var scope = _devTestLabVmVirtualMachinesClientDiagnostics.CreateScope("DevTestLabVmResource.RemoveTag"); + using DiagnosticScope scope = _virtualMachinesClientDiagnostics.CreateScope("DevTestLabVmResource.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 = _devTestLabVmVirtualMachinesRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, null, cancellationToken); - return Response.FromValue(new DevTestLabVmResource(Client, originalResponse.Value), originalResponse.GetRawResponse()); + GetTagResource().CreateOrUpdate(WaitUntil.Completed, originalTags.Value.Data, cancellationToken); + RequestContext context = new RequestContext + { + CancellationToken = cancellationToken + }; + HttpMessage message = _virtualMachinesRestClient.CreateGetRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, default, context); + Response result = Pipeline.ProcessMessage(message, context); + Response response = Response.FromValue(DevTestLabVmData.FromResponse(result), result); + return Response.FromValue(new DevTestLabVmResource(Client, response.Value), response.GetRawResponse()); } else { - var current = Get(cancellationToken: cancellationToken).Value.Data; - var patch = new DevTestLabVmPatch(); - foreach (var tag in current.Tags) + DevTestLabVmData current = Get(cancellationToken: cancellationToken).Value.Data; + DevTestLabVmPatch patch = new DevTestLabVmPatch(); + 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) @@ -1876,5 +1969,40 @@ public virtual Response RemoveTag(string key, Cancellation throw; } } + + /// Gets a collection of DevTestLabVmSchedules in the . + /// An object representing collection of DevTestLabVmSchedules and their operations over a DevTestLabVmScheduleResource. + public virtual DevTestLabVmScheduleCollection GetDevTestLabVmSchedules() + { + return GetCachedClient(client => new DevTestLabVmScheduleCollection(client, Id)); + } + + /// Get schedule. + /// The name of the Schedule. + /// Specify the $expand query. Example: 'properties($select=status)'. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public virtual async Task> GetDevTestLabVmScheduleAsync(string name, string expand = default, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(name, nameof(name)); + + return await GetDevTestLabVmSchedules().GetAsync(name, expand, cancellationToken).ConfigureAwait(false); + } + + /// Get schedule. + /// The name of the Schedule. + /// Specify the $expand query. Example: 'properties($select=status)'. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public virtual Response GetDevTestLabVmSchedule(string name, string expand = default, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(name, nameof(name)); + + return GetDevTestLabVmSchedules().Get(name, expand, cancellationToken); + } } } diff --git a/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/DevTestLabVmScheduleCollection.cs b/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/DevTestLabVmScheduleCollection.cs index ba41076735f1..fa2be30dbe04 100644 --- a/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/DevTestLabVmScheduleCollection.cs +++ b/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/DevTestLabVmScheduleCollection.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.DevTestLabs { @@ -24,75 +25,81 @@ namespace Azure.ResourceManager.DevTestLabs /// public partial class DevTestLabVmScheduleCollection : ArmCollection, IEnumerable, IAsyncEnumerable { - private readonly ClientDiagnostics _devTestLabVmScheduleVmSchedulesClientDiagnostics; - private readonly VirtualMachineSchedulesRestOperations _devTestLabVmScheduleVmSchedulesRestClient; + private readonly ClientDiagnostics _devTestLabVmSchedulesClientDiagnostics; + private readonly DevTestLabVmSchedules _devTestLabVmSchedulesRestClient; - /// Initializes a new instance of the class for mocking. + /// Initializes a new instance of DevTestLabVmScheduleCollection for mocking. protected DevTestLabVmScheduleCollection() { } - /// 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 DevTestLabVmScheduleCollection(ArmClient client, ResourceIdentifier id) : base(client, id) { - _devTestLabVmScheduleVmSchedulesClientDiagnostics = new ClientDiagnostics("Azure.ResourceManager.DevTestLabs", DevTestLabVmScheduleResource.ResourceType.Namespace, Diagnostics); - TryGetApiVersion(DevTestLabVmScheduleResource.ResourceType, out string devTestLabVmScheduleVmSchedulesApiVersion); - _devTestLabVmScheduleVmSchedulesRestClient = new VirtualMachineSchedulesRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, devTestLabVmScheduleVmSchedulesApiVersion); -#if DEBUG - ValidateResourceId(Id); -#endif + TryGetApiVersion(DevTestLabVmScheduleResource.ResourceType, out string devTestLabVmScheduleApiVersion); + _devTestLabVmSchedulesClientDiagnostics = new ClientDiagnostics("Azure.ResourceManager.DevTestLabs", DevTestLabVmScheduleResource.ResourceType.Namespace, Diagnostics); + _devTestLabVmSchedulesRestClient = new DevTestLabVmSchedules(_devTestLabVmSchedulesClientDiagnostics, Pipeline, Endpoint, devTestLabVmScheduleApiVersion ?? "2018-09-15"); + ValidateResourceId(id); } + /// + [Conditional("DEBUG")] internal static void ValidateResourceId(ResourceIdentifier id) { if (id.ResourceType != DevTestLabVmResource.ResourceType) - throw new ArgumentException(string.Format(CultureInfo.CurrentCulture, "Invalid resource type {0} expected {1}", id.ResourceType, DevTestLabVmResource.ResourceType), nameof(id)); + { + throw new ArgumentException(string.Format("Invalid resource type {0} expected {1}", id.ResourceType, DevTestLabVmResource.ResourceType), id); + } } /// /// Create or replace an existing schedule. /// /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/virtualmachines/{virtualMachineName}/schedules/{name} - /// - /// - /// Operation Id - /// VirtualMachineSchedules_CreateOrUpdate + /// Request Path. + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/virtualmachines/{virtualMachineName}/schedules/{name}. /// /// - /// Default Api Version - /// 2018-09-15 + /// Operation Id. + /// VirtualMachineSchedules_CreateOrUpdate. /// /// - /// Resource - /// + /// Default Api Version. + /// 2018-09-15. /// /// /// /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. - /// The name of the schedule. + /// The name of the Schedule. /// A schedule. /// 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 name, DevTestLabScheduleData data, CancellationToken cancellationToken = default) { Argument.AssertNotNullOrEmpty(name, nameof(name)); Argument.AssertNotNull(data, nameof(data)); - using var scope = _devTestLabVmScheduleVmSchedulesClientDiagnostics.CreateScope("DevTestLabVmScheduleCollection.CreateOrUpdate"); + using DiagnosticScope scope = _devTestLabVmSchedulesClientDiagnostics.CreateScope("DevTestLabVmScheduleCollection.CreateOrUpdate"); scope.Start(); try { - var response = await _devTestLabVmScheduleVmSchedulesRestClient.CreateOrUpdateAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, name, data, cancellationToken).ConfigureAwait(false); - var uri = _devTestLabVmScheduleVmSchedulesRestClient.CreateCreateOrUpdateRequestUri(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, name, data); - var rehydrationToken = NextLinkOperationImplementation.GetRehydrationToken(RequestMethod.Put, uri.ToUri(), uri.ToString(), "None", null, OperationFinalStateVia.OriginalUri.ToString()); - var operation = new DevTestLabsArmOperation(Response.FromValue(new DevTestLabVmScheduleResource(Client, response), response.GetRawResponse()), rehydrationToken); + RequestContext context = new RequestContext + { + CancellationToken = cancellationToken + }; + HttpMessage message = _devTestLabVmSchedulesRestClient.CreateCreateOrUpdateRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, name, DevTestLabScheduleData.ToRequestContent(data), context); + Response result = await Pipeline.ProcessMessageAsync(message, context).ConfigureAwait(false); + Response response = Response.FromValue(DevTestLabScheduleData.FromResponse(result), result); + RequestUriBuilder uri = message.Request.Uri; + RehydrationToken rehydrationToken = NextLinkOperationImplementation.GetRehydrationToken(RequestMethod.Put, uri.ToUri(), uri.ToString(), "None", null, OperationFinalStateVia.OriginalUri.ToString()); + DevTestLabsArmOperation operation = new DevTestLabsArmOperation(Response.FromValue(new DevTestLabVmScheduleResource(Client, response.Value), response.GetRawResponse()), rehydrationToken); if (waitUntil == WaitUntil.Completed) + { await operation.WaitForCompletionAsync(cancellationToken).ConfigureAwait(false); + } return operation; } catch (Exception e) @@ -106,44 +113,48 @@ public virtual async Task> CreateOrUp /// Create or replace an existing schedule. /// /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/virtualmachines/{virtualMachineName}/schedules/{name} + /// Request Path. + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/virtualmachines/{virtualMachineName}/schedules/{name}. /// /// - /// Operation Id - /// VirtualMachineSchedules_CreateOrUpdate + /// Operation Id. + /// VirtualMachineSchedules_CreateOrUpdate. /// /// - /// Default Api Version - /// 2018-09-15 - /// - /// - /// Resource - /// + /// Default Api Version. + /// 2018-09-15. /// /// /// /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. - /// The name of the schedule. + /// The name of the Schedule. /// A schedule. /// 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 name, DevTestLabScheduleData data, CancellationToken cancellationToken = default) { Argument.AssertNotNullOrEmpty(name, nameof(name)); Argument.AssertNotNull(data, nameof(data)); - using var scope = _devTestLabVmScheduleVmSchedulesClientDiagnostics.CreateScope("DevTestLabVmScheduleCollection.CreateOrUpdate"); + using DiagnosticScope scope = _devTestLabVmSchedulesClientDiagnostics.CreateScope("DevTestLabVmScheduleCollection.CreateOrUpdate"); scope.Start(); try { - var response = _devTestLabVmScheduleVmSchedulesRestClient.CreateOrUpdate(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, name, data, cancellationToken); - var uri = _devTestLabVmScheduleVmSchedulesRestClient.CreateCreateOrUpdateRequestUri(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, name, data); - var rehydrationToken = NextLinkOperationImplementation.GetRehydrationToken(RequestMethod.Put, uri.ToUri(), uri.ToString(), "None", null, OperationFinalStateVia.OriginalUri.ToString()); - var operation = new DevTestLabsArmOperation(Response.FromValue(new DevTestLabVmScheduleResource(Client, response), response.GetRawResponse()), rehydrationToken); + RequestContext context = new RequestContext + { + CancellationToken = cancellationToken + }; + HttpMessage message = _devTestLabVmSchedulesRestClient.CreateCreateOrUpdateRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, name, DevTestLabScheduleData.ToRequestContent(data), context); + Response result = Pipeline.ProcessMessage(message, context); + Response response = Response.FromValue(DevTestLabScheduleData.FromResponse(result), result); + RequestUriBuilder uri = message.Request.Uri; + RehydrationToken rehydrationToken = NextLinkOperationImplementation.GetRehydrationToken(RequestMethod.Put, uri.ToUri(), uri.ToString(), "None", null, OperationFinalStateVia.OriginalUri.ToString()); + DevTestLabsArmOperation operation = new DevTestLabsArmOperation(Response.FromValue(new DevTestLabVmScheduleResource(Client, response.Value), response.GetRawResponse()), rehydrationToken); if (waitUntil == WaitUntil.Completed) + { operation.WaitForCompletion(cancellationToken); + } return operation; } catch (Exception e) @@ -157,39 +168,43 @@ public virtual ArmOperation CreateOrUpdate(WaitUnt /// Get schedule. /// /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/virtualmachines/{virtualMachineName}/schedules/{name} + /// Request Path. + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/virtualmachines/{virtualMachineName}/schedules/{name}. /// /// - /// Operation Id - /// VirtualMachineSchedules_Get + /// Operation Id. + /// VirtualMachineSchedules_Get. /// /// - /// Default Api Version - /// 2018-09-15 - /// - /// - /// Resource - /// + /// Default Api Version. + /// 2018-09-15. /// /// /// - /// The name of the schedule. + /// The name of the Schedule. /// Specify the $expand query. Example: 'properties($select=status)'. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. - public virtual async Task> GetAsync(string name, string expand = null, CancellationToken cancellationToken = default) + /// is an empty string, and was expected to be non-empty. + public virtual async Task> GetAsync(string name, string expand = default, CancellationToken cancellationToken = default) { Argument.AssertNotNullOrEmpty(name, nameof(name)); - using var scope = _devTestLabVmScheduleVmSchedulesClientDiagnostics.CreateScope("DevTestLabVmScheduleCollection.Get"); + using DiagnosticScope scope = _devTestLabVmSchedulesClientDiagnostics.CreateScope("DevTestLabVmScheduleCollection.Get"); scope.Start(); try { - var response = await _devTestLabVmScheduleVmSchedulesRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, name, expand, cancellationToken).ConfigureAwait(false); + RequestContext context = new RequestContext + { + CancellationToken = cancellationToken + }; + HttpMessage message = _devTestLabVmSchedulesRestClient.CreateGetRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, name, expand, context); + Response result = await Pipeline.ProcessMessageAsync(message, context).ConfigureAwait(false); + Response response = Response.FromValue(DevTestLabScheduleData.FromResponse(result), result); if (response.Value == null) + { throw new RequestFailedException(response.GetRawResponse()); + } return Response.FromValue(new DevTestLabVmScheduleResource(Client, response.Value), response.GetRawResponse()); } catch (Exception e) @@ -203,39 +218,43 @@ public virtual async Task> GetAsync(strin /// Get schedule. /// /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/virtualmachines/{virtualMachineName}/schedules/{name} - /// - /// - /// Operation Id - /// VirtualMachineSchedules_Get + /// Request Path. + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/virtualmachines/{virtualMachineName}/schedules/{name}. /// /// - /// Default Api Version - /// 2018-09-15 + /// Operation Id. + /// VirtualMachineSchedules_Get. /// /// - /// Resource - /// + /// Default Api Version. + /// 2018-09-15. /// /// /// - /// The name of the schedule. + /// The name of the Schedule. /// Specify the $expand query. Example: 'properties($select=status)'. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. - public virtual Response Get(string name, string expand = null, CancellationToken cancellationToken = default) + /// is an empty string, and was expected to be non-empty. + public virtual Response Get(string name, string expand = default, CancellationToken cancellationToken = default) { Argument.AssertNotNullOrEmpty(name, nameof(name)); - using var scope = _devTestLabVmScheduleVmSchedulesClientDiagnostics.CreateScope("DevTestLabVmScheduleCollection.Get"); + using DiagnosticScope scope = _devTestLabVmSchedulesClientDiagnostics.CreateScope("DevTestLabVmScheduleCollection.Get"); scope.Start(); try { - var response = _devTestLabVmScheduleVmSchedulesRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, name, expand, cancellationToken); + RequestContext context = new RequestContext + { + CancellationToken = cancellationToken + }; + HttpMessage message = _devTestLabVmSchedulesRestClient.CreateGetRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, name, expand, context); + Response result = Pipeline.ProcessMessage(message, context); + Response response = Response.FromValue(DevTestLabScheduleData.FromResponse(result), result); if (response.Value == null) + { throw new RequestFailedException(response.GetRawResponse()); + } return Response.FromValue(new DevTestLabVmScheduleResource(Client, response.Value), response.GetRawResponse()); } catch (Exception e) @@ -249,20 +268,16 @@ public virtual Response Get(string name, string ex /// List schedules in a given virtual machine. /// /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/virtualmachines/{virtualMachineName}/schedules + /// Request Path. + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/virtualmachines/{virtualMachineName}/schedules. /// /// - /// Operation Id - /// VirtualMachineSchedules_List + /// Operation Id. + /// VirtualMachineSchedules_List. /// /// - /// Default Api Version - /// 2018-09-15 - /// - /// - /// Resource - /// + /// Default Api Version. + /// 2018-09-15. /// /// /// @@ -271,32 +286,40 @@ public virtual Response Get(string name, string ex /// The maximum number of resources to return from the operation. Example: '$top=10'. /// The ordering expression for the results, using OData notation. Example: '$orderby=name desc'. /// The cancellation token to use. - /// An async collection of that may take multiple service requests to iterate over. - public virtual AsyncPageable GetAllAsync(string expand = null, string filter = null, int? top = null, string orderby = null, CancellationToken cancellationToken = default) + /// A collection of that may take multiple service requests to iterate over. + public virtual AsyncPageable GetAllAsync(string expand = default, string filter = default, int? top = default, string @orderby = default, CancellationToken cancellationToken = default) { - HttpMessage FirstPageRequest(int? pageSizeHint) => _devTestLabVmScheduleVmSchedulesRestClient.CreateListRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, expand, filter, top, orderby); - HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _devTestLabVmScheduleVmSchedulesRestClient.CreateListNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, expand, filter, top, orderby); - return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new DevTestLabVmScheduleResource(Client, DevTestLabScheduleData.DeserializeDevTestLabScheduleData(e)), _devTestLabVmScheduleVmSchedulesClientDiagnostics, Pipeline, "DevTestLabVmScheduleCollection.GetAll", "value", "nextLink", cancellationToken); + RequestContext context = new RequestContext + { + CancellationToken = cancellationToken + }; + return new AsyncPageableWrapper(new DevTestLabVmSchedulesGetAllAsyncCollectionResultOfT( + _devTestLabVmSchedulesRestClient, + Id.SubscriptionId, + Id.ResourceGroupName, + Id.Parent.Name, + Id.Name, + expand, + filter, + top, + @orderby, + context), data => new DevTestLabVmScheduleResource(Client, data)); } /// /// List schedules in a given virtual machine. /// /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/virtualmachines/{virtualMachineName}/schedules - /// - /// - /// Operation Id - /// VirtualMachineSchedules_List + /// Request Path. + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/virtualmachines/{virtualMachineName}/schedules. /// /// - /// Default Api Version - /// 2018-09-15 + /// Operation Id. + /// VirtualMachineSchedules_List. /// /// - /// Resource - /// + /// Default Api Version. + /// 2018-09-15. /// /// /// @@ -306,48 +329,74 @@ public virtual AsyncPageable GetAllAsync(string ex /// The ordering expression for the results, using OData notation. Example: '$orderby=name desc'. /// The cancellation token to use. /// A collection of that may take multiple service requests to iterate over. - public virtual Pageable GetAll(string expand = null, string filter = null, int? top = null, string orderby = null, CancellationToken cancellationToken = default) + public virtual Pageable GetAll(string expand = default, string filter = default, int? top = default, string @orderby = default, CancellationToken cancellationToken = default) { - HttpMessage FirstPageRequest(int? pageSizeHint) => _devTestLabVmScheduleVmSchedulesRestClient.CreateListRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, expand, filter, top, orderby); - HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _devTestLabVmScheduleVmSchedulesRestClient.CreateListNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, expand, filter, top, orderby); - return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new DevTestLabVmScheduleResource(Client, DevTestLabScheduleData.DeserializeDevTestLabScheduleData(e)), _devTestLabVmScheduleVmSchedulesClientDiagnostics, Pipeline, "DevTestLabVmScheduleCollection.GetAll", "value", "nextLink", cancellationToken); + RequestContext context = new RequestContext + { + CancellationToken = cancellationToken + }; + return new PageableWrapper(new DevTestLabVmSchedulesGetAllCollectionResultOfT( + _devTestLabVmSchedulesRestClient, + Id.SubscriptionId, + Id.ResourceGroupName, + Id.Parent.Name, + Id.Name, + expand, + filter, + top, + @orderby, + context), data => new DevTestLabVmScheduleResource(Client, data)); } /// /// Checks to see if the resource exists in azure. /// /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/virtualmachines/{virtualMachineName}/schedules/{name} - /// - /// - /// Operation Id - /// VirtualMachineSchedules_Get + /// Request Path. + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/virtualmachines/{virtualMachineName}/schedules/{name}. /// /// - /// Default Api Version - /// 2018-09-15 + /// Operation Id. + /// VirtualMachineSchedules_Get. /// /// - /// Resource - /// + /// Default Api Version. + /// 2018-09-15. /// /// /// - /// The name of the schedule. + /// The name of the Schedule. /// Specify the $expand query. Example: 'properties($select=status)'. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. - public virtual async Task> ExistsAsync(string name, string expand = null, CancellationToken cancellationToken = default) + /// is an empty string, and was expected to be non-empty. + public virtual async Task> ExistsAsync(string name, string expand = default, CancellationToken cancellationToken = default) { Argument.AssertNotNullOrEmpty(name, nameof(name)); - using var scope = _devTestLabVmScheduleVmSchedulesClientDiagnostics.CreateScope("DevTestLabVmScheduleCollection.Exists"); + using DiagnosticScope scope = _devTestLabVmSchedulesClientDiagnostics.CreateScope("DevTestLabVmScheduleCollection.Exists"); scope.Start(); try { - var response = await _devTestLabVmScheduleVmSchedulesRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, name, expand, cancellationToken: cancellationToken).ConfigureAwait(false); + RequestContext context = new RequestContext + { + CancellationToken = cancellationToken + }; + HttpMessage message = _devTestLabVmSchedulesRestClient.CreateGetRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, name, expand, context); + await Pipeline.SendAsync(message, context.CancellationToken).ConfigureAwait(false); + Response result = message.Response; + Response response = default; + switch (result.Status) + { + case 200: + response = Response.FromValue(DevTestLabScheduleData.FromResponse(result), result); + break; + case 404: + response = Response.FromValue((DevTestLabScheduleData)null, result); + break; + default: + throw new RequestFailedException(result); + } return Response.FromValue(response.Value != null, response.GetRawResponse()); } catch (Exception e) @@ -361,37 +410,51 @@ public virtual async Task> ExistsAsync(string name, string expand /// Checks to see if the resource exists in azure. /// /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/virtualmachines/{virtualMachineName}/schedules/{name} + /// Request Path. + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/virtualmachines/{virtualMachineName}/schedules/{name}. /// /// - /// Operation Id - /// VirtualMachineSchedules_Get + /// Operation Id. + /// VirtualMachineSchedules_Get. /// /// - /// Default Api Version - /// 2018-09-15 - /// - /// - /// Resource - /// + /// Default Api Version. + /// 2018-09-15. /// /// /// - /// The name of the schedule. + /// The name of the Schedule. /// Specify the $expand query. Example: 'properties($select=status)'. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. - public virtual Response Exists(string name, string expand = null, CancellationToken cancellationToken = default) + /// is an empty string, and was expected to be non-empty. + public virtual Response Exists(string name, string expand = default, CancellationToken cancellationToken = default) { Argument.AssertNotNullOrEmpty(name, nameof(name)); - using var scope = _devTestLabVmScheduleVmSchedulesClientDiagnostics.CreateScope("DevTestLabVmScheduleCollection.Exists"); + using DiagnosticScope scope = _devTestLabVmSchedulesClientDiagnostics.CreateScope("DevTestLabVmScheduleCollection.Exists"); scope.Start(); try { - var response = _devTestLabVmScheduleVmSchedulesRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, name, expand, cancellationToken: cancellationToken); + RequestContext context = new RequestContext + { + CancellationToken = cancellationToken + }; + HttpMessage message = _devTestLabVmSchedulesRestClient.CreateGetRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, name, expand, context); + Pipeline.Send(message, context.CancellationToken); + Response result = message.Response; + Response response = default; + switch (result.Status) + { + case 200: + response = Response.FromValue(DevTestLabScheduleData.FromResponse(result), result); + break; + case 404: + response = Response.FromValue((DevTestLabScheduleData)null, result); + break; + default: + throw new RequestFailedException(result); + } return Response.FromValue(response.Value != null, response.GetRawResponse()); } catch (Exception e) @@ -405,39 +468,55 @@ public virtual Response Exists(string name, string expand = null, Cancella /// Tries to get details for this resource from the service. /// /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/virtualmachines/{virtualMachineName}/schedules/{name} - /// - /// - /// Operation Id - /// VirtualMachineSchedules_Get + /// Request Path. + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/virtualmachines/{virtualMachineName}/schedules/{name}. /// /// - /// Default Api Version - /// 2018-09-15 + /// Operation Id. + /// VirtualMachineSchedules_Get. /// /// - /// Resource - /// + /// Default Api Version. + /// 2018-09-15. /// /// /// - /// The name of the schedule. + /// The name of the Schedule. /// Specify the $expand query. Example: 'properties($select=status)'. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. - public virtual async Task> GetIfExistsAsync(string name, string expand = null, CancellationToken cancellationToken = default) + /// is an empty string, and was expected to be non-empty. + public virtual async Task> GetIfExistsAsync(string name, string expand = default, CancellationToken cancellationToken = default) { Argument.AssertNotNullOrEmpty(name, nameof(name)); - using var scope = _devTestLabVmScheduleVmSchedulesClientDiagnostics.CreateScope("DevTestLabVmScheduleCollection.GetIfExists"); + using DiagnosticScope scope = _devTestLabVmSchedulesClientDiagnostics.CreateScope("DevTestLabVmScheduleCollection.GetIfExists"); scope.Start(); try { - var response = await _devTestLabVmScheduleVmSchedulesRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, name, expand, cancellationToken: cancellationToken).ConfigureAwait(false); + RequestContext context = new RequestContext + { + CancellationToken = cancellationToken + }; + HttpMessage message = _devTestLabVmSchedulesRestClient.CreateGetRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, name, expand, context); + await Pipeline.SendAsync(message, context.CancellationToken).ConfigureAwait(false); + Response result = message.Response; + Response response = default; + switch (result.Status) + { + case 200: + response = Response.FromValue(DevTestLabScheduleData.FromResponse(result), result); + break; + case 404: + response = Response.FromValue((DevTestLabScheduleData)null, result); + break; + default: + throw new RequestFailedException(result); + } if (response.Value == null) + { return new NoValueResponse(response.GetRawResponse()); + } return Response.FromValue(new DevTestLabVmScheduleResource(Client, response.Value), response.GetRawResponse()); } catch (Exception e) @@ -451,39 +530,55 @@ public virtual async Task> GetIfE /// Tries to get details for this resource from the service. /// /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/virtualmachines/{virtualMachineName}/schedules/{name} + /// Request Path. + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/virtualmachines/{virtualMachineName}/schedules/{name}. /// /// - /// Operation Id - /// VirtualMachineSchedules_Get + /// Operation Id. + /// VirtualMachineSchedules_Get. /// /// - /// Default Api Version - /// 2018-09-15 - /// - /// - /// Resource - /// + /// Default Api Version. + /// 2018-09-15. /// /// /// - /// The name of the schedule. + /// The name of the Schedule. /// Specify the $expand query. Example: 'properties($select=status)'. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// is null. - public virtual NullableResponse GetIfExists(string name, string expand = null, CancellationToken cancellationToken = default) + /// is an empty string, and was expected to be non-empty. + public virtual NullableResponse GetIfExists(string name, string expand = default, CancellationToken cancellationToken = default) { Argument.AssertNotNullOrEmpty(name, nameof(name)); - using var scope = _devTestLabVmScheduleVmSchedulesClientDiagnostics.CreateScope("DevTestLabVmScheduleCollection.GetIfExists"); + using DiagnosticScope scope = _devTestLabVmSchedulesClientDiagnostics.CreateScope("DevTestLabVmScheduleCollection.GetIfExists"); scope.Start(); try { - var response = _devTestLabVmScheduleVmSchedulesRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, name, expand, cancellationToken: cancellationToken); + RequestContext context = new RequestContext + { + CancellationToken = cancellationToken + }; + HttpMessage message = _devTestLabVmSchedulesRestClient.CreateGetRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, name, expand, context); + Pipeline.Send(message, context.CancellationToken); + Response result = message.Response; + Response response = default; + switch (result.Status) + { + case 200: + response = Response.FromValue(DevTestLabScheduleData.FromResponse(result), result); + break; + case 404: + response = Response.FromValue((DevTestLabScheduleData)null, result); + break; + default: + throw new RequestFailedException(result); + } if (response.Value == null) + { return new NoValueResponse(response.GetRawResponse()); + } return Response.FromValue(new DevTestLabVmScheduleResource(Client, response.Value), response.GetRawResponse()); } catch (Exception e) @@ -503,6 +598,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/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/DevTestLabVmScheduleResource.Serialization.cs b/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/DevTestLabVmScheduleResource.Serialization.cs index d2d4c0831fb1..eb4d5cf6ebf2 100644 --- a/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/DevTestLabVmScheduleResource.Serialization.cs +++ b/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/DevTestLabVmScheduleResource.Serialization.cs @@ -8,22 +8,33 @@ using System; using System.ClientModel.Primitives; using System.Text.Json; +using Azure.ResourceManager; namespace Azure.ResourceManager.DevTestLabs { - public partial class DevTestLabVmScheduleResource : IJsonModel + /// + public partial class DevTestLabVmScheduleResource : ArmResource, IJsonModel { - private static DevTestLabScheduleData s_dataDeserializationInstance; - private static DevTestLabScheduleData DataDeserializationInstance => s_dataDeserializationInstance ??= new(); + private static IJsonModel s_dataDeserializationInstance; + private static IJsonModel DataDeserializationInstance => s_dataDeserializationInstance ??= new DevTestLabScheduleData(); + + /// 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); - DevTestLabScheduleData 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. + DevTestLabScheduleData 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, AzureResourceManagerDevTestLabsContext.Default); + /// The binary data to be processed. + /// The client options for reading and writing models. DevTestLabScheduleData IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) => ModelReaderWriter.Read(data, options, AzureResourceManagerDevTestLabsContext.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/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/DevTestLabVmScheduleResource.cs b/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/DevTestLabVmScheduleResource.cs index 22326c43c7a2..398038a868fa 100644 --- a/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/DevTestLabVmScheduleResource.cs +++ b/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/DevTestLabVmScheduleResource.cs @@ -7,48 +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.DevTestLabs.Models; +using Azure.ResourceManager.Resources; namespace Azure.ResourceManager.DevTestLabs { /// - /// A Class representing a DevTestLabVmSchedule 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 GetDevTestLabVmScheduleResource method. - /// Otherwise you can get one from its parent resource using the GetDevTestLabVmSchedule method. + /// A class representing a DevTestLabVmSchedule 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 GetDevTestLabVmSchedules method. /// public partial class DevTestLabVmScheduleResource : ArmResource { - /// Generate the resource identifier of a instance. - /// The subscriptionId. - /// The resourceGroupName. - /// The labName. - /// The vmName. - /// The name. - public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string labName, string vmName, string name) - { - var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/virtualmachines/{vmName}/schedules/{name}"; - return new ResourceIdentifier(resourceId); - } - - private readonly ClientDiagnostics _devTestLabVmScheduleVmSchedulesClientDiagnostics; - private readonly VirtualMachineSchedulesRestOperations _devTestLabVmScheduleVmSchedulesRestClient; + private readonly ClientDiagnostics _devTestLabVmSchedulesClientDiagnostics; + private readonly DevTestLabVmSchedules _devTestLabVmSchedulesRestClient; private readonly DevTestLabScheduleData _data; - /// Gets the resource type for the operations. public static readonly ResourceType ResourceType = "Microsoft.DevTestLab/labs/virtualmachines/schedules"; - /// Initializes a new instance of the class for mocking. + /// Initializes a new instance of DevTestLabVmScheduleResource for mocking. protected DevTestLabVmScheduleResource() { } - /// 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 DevTestLabVmScheduleResource(ArmClient client, DevTestLabScheduleData data) : this(client, data.Id) @@ -57,72 +46,83 @@ internal DevTestLabVmScheduleResource(ArmClient client, DevTestLabScheduleData d _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 DevTestLabVmScheduleResource(ArmClient client, ResourceIdentifier id) : base(client, id) { - _devTestLabVmScheduleVmSchedulesClientDiagnostics = new ClientDiagnostics("Azure.ResourceManager.DevTestLabs", ResourceType.Namespace, Diagnostics); - TryGetApiVersion(ResourceType, out string devTestLabVmScheduleVmSchedulesApiVersion); - _devTestLabVmScheduleVmSchedulesRestClient = new VirtualMachineSchedulesRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, devTestLabVmScheduleVmSchedulesApiVersion); -#if DEBUG - ValidateResourceId(Id); -#endif + TryGetApiVersion(ResourceType, out string devTestLabVmScheduleApiVersion); + _devTestLabVmSchedulesClientDiagnostics = new ClientDiagnostics("Azure.ResourceManager.DevTestLabs", ResourceType.Namespace, Diagnostics); + _devTestLabVmSchedulesRestClient = new DevTestLabVmSchedules(_devTestLabVmSchedulesClientDiagnostics, Pipeline, Endpoint, devTestLabVmScheduleApiVersion ?? "2018-09-15"); + 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 DevTestLabScheduleData Data { get { if (!HasData) + { throw new InvalidOperationException("The current instance does not have data, you must call Get first."); + } return _data; } } + /// + [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 schedule. /// /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/virtualmachines/{virtualMachineName}/schedules/{name} + /// Request Path. + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/virtualmachines/{virtualMachineName}/schedules/{name}. /// /// - /// Operation Id - /// VirtualMachineSchedules_Get + /// Operation Id. + /// VirtualMachineSchedules_Get. /// /// - /// Default Api Version - /// 2018-09-15 + /// Default Api Version. + /// 2018-09-15. /// /// - /// Resource - /// + /// Resource. + /// . /// /// /// /// Specify the $expand query. Example: 'properties($select=status)'. /// The cancellation token to use. - public virtual async Task> GetAsync(string expand = null, CancellationToken cancellationToken = default) + public virtual async Task> GetAsync(string expand = default, CancellationToken cancellationToken = default) { - using var scope = _devTestLabVmScheduleVmSchedulesClientDiagnostics.CreateScope("DevTestLabVmScheduleResource.Get"); + using DiagnosticScope scope = _devTestLabVmSchedulesClientDiagnostics.CreateScope("DevTestLabVmScheduleResource.Get"); scope.Start(); try { - var response = await _devTestLabVmScheduleVmSchedulesRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, expand, cancellationToken).ConfigureAwait(false); + RequestContext context = new RequestContext + { + CancellationToken = cancellationToken + }; + HttpMessage message = _devTestLabVmSchedulesRestClient.CreateGetRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, expand, context); + Response result = await Pipeline.ProcessMessageAsync(message, context).ConfigureAwait(false); + Response response = Response.FromValue(DevTestLabScheduleData.FromResponse(result), result); if (response.Value == null) + { throw new RequestFailedException(response.GetRawResponse()); + } return Response.FromValue(new DevTestLabVmScheduleResource(Client, response.Value), response.GetRawResponse()); } catch (Exception e) @@ -136,34 +136,42 @@ public virtual async Task> GetAsync(strin /// Get schedule. /// /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/virtualmachines/{virtualMachineName}/schedules/{name} + /// Request Path. + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/virtualmachines/{virtualMachineName}/schedules/{name}. /// /// - /// Operation Id - /// VirtualMachineSchedules_Get + /// Operation Id. + /// VirtualMachineSchedules_Get. /// /// - /// Default Api Version - /// 2018-09-15 + /// Default Api Version. + /// 2018-09-15. /// /// - /// Resource - /// + /// Resource. + /// . /// /// /// /// Specify the $expand query. Example: 'properties($select=status)'. /// The cancellation token to use. - public virtual Response Get(string expand = null, CancellationToken cancellationToken = default) + public virtual Response Get(string expand = default, CancellationToken cancellationToken = default) { - using var scope = _devTestLabVmScheduleVmSchedulesClientDiagnostics.CreateScope("DevTestLabVmScheduleResource.Get"); + using DiagnosticScope scope = _devTestLabVmSchedulesClientDiagnostics.CreateScope("DevTestLabVmScheduleResource.Get"); scope.Start(); try { - var response = _devTestLabVmScheduleVmSchedulesRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, expand, cancellationToken); + RequestContext context = new RequestContext + { + CancellationToken = cancellationToken + }; + HttpMessage message = _devTestLabVmSchedulesRestClient.CreateGetRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, expand, context); + Response result = Pipeline.ProcessMessage(message, context); + Response response = Response.FromValue(DevTestLabScheduleData.FromResponse(result), result); if (response.Value == null) + { throw new RequestFailedException(response.GetRawResponse()); + } return Response.FromValue(new DevTestLabVmScheduleResource(Client, response.Value), response.GetRawResponse()); } catch (Exception e) @@ -174,41 +182,49 @@ public virtual Response Get(string expand = null, } /// - /// Delete schedule. + /// Allows modifying tags of schedules. All other properties will be ignored. /// /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/virtualmachines/{virtualMachineName}/schedules/{name} + /// Request Path. + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/virtualmachines/{virtualMachineName}/schedules/{name}. /// /// - /// Operation Id - /// VirtualMachineSchedules_Delete + /// Operation Id. + /// VirtualMachineSchedules_Update. /// /// - /// Default Api Version - /// 2018-09-15 + /// Default Api Version. + /// 2018-09-15. /// /// - /// Resource - /// + /// Resource. + /// . /// /// /// - /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. + /// A schedule. /// The cancellation token to use. - public virtual async Task DeleteAsync(WaitUntil waitUntil, CancellationToken cancellationToken = default) + /// is null. + public virtual async Task> UpdateAsync(DevTestLabSchedulePatch patch, CancellationToken cancellationToken = default) { - using var scope = _devTestLabVmScheduleVmSchedulesClientDiagnostics.CreateScope("DevTestLabVmScheduleResource.Delete"); + Argument.AssertNotNull(patch, nameof(patch)); + + using DiagnosticScope scope = _devTestLabVmSchedulesClientDiagnostics.CreateScope("DevTestLabVmScheduleResource.Update"); scope.Start(); try { - var response = await _devTestLabVmScheduleVmSchedulesRestClient.DeleteAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, cancellationToken).ConfigureAwait(false); - var uri = _devTestLabVmScheduleVmSchedulesRestClient.CreateDeleteRequestUri(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name); - var rehydrationToken = NextLinkOperationImplementation.GetRehydrationToken(RequestMethod.Delete, uri.ToUri(), uri.ToString(), "None", null, OperationFinalStateVia.OriginalUri.ToString()); - var operation = new DevTestLabsArmOperation(response, rehydrationToken); - if (waitUntil == WaitUntil.Completed) - await operation.WaitForCompletionResponseAsync(cancellationToken).ConfigureAwait(false); - return operation; + RequestContext context = new RequestContext + { + CancellationToken = cancellationToken + }; + HttpMessage message = _devTestLabVmSchedulesRestClient.CreateUpdateRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, DevTestLabSchedulePatch.ToRequestContent(patch), context); + Response result = await Pipeline.ProcessMessageAsync(message, context).ConfigureAwait(false); + Response response = Response.FromValue(DevTestLabScheduleData.FromResponse(result), result); + if (response.Value == null) + { + throw new RequestFailedException(response.GetRawResponse()); + } + return Response.FromValue(new DevTestLabVmScheduleResource(Client, response.Value), response.GetRawResponse()); } catch (Exception e) { @@ -218,41 +234,49 @@ public virtual async Task DeleteAsync(WaitUntil waitUntil, Cancell } /// - /// Delete schedule. + /// Allows modifying tags of schedules. All other properties will be ignored. /// /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/virtualmachines/{virtualMachineName}/schedules/{name} + /// Request Path. + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/virtualmachines/{virtualMachineName}/schedules/{name}. /// /// - /// Operation Id - /// VirtualMachineSchedules_Delete + /// Operation Id. + /// VirtualMachineSchedules_Update. /// /// - /// Default Api Version - /// 2018-09-15 + /// Default Api Version. + /// 2018-09-15. /// /// - /// Resource - /// + /// Resource. + /// . /// /// /// - /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. + /// A schedule. /// The cancellation token to use. - public virtual ArmOperation Delete(WaitUntil waitUntil, CancellationToken cancellationToken = default) + /// is null. + public virtual Response Update(DevTestLabSchedulePatch patch, CancellationToken cancellationToken = default) { - using var scope = _devTestLabVmScheduleVmSchedulesClientDiagnostics.CreateScope("DevTestLabVmScheduleResource.Delete"); + Argument.AssertNotNull(patch, nameof(patch)); + + using DiagnosticScope scope = _devTestLabVmSchedulesClientDiagnostics.CreateScope("DevTestLabVmScheduleResource.Update"); scope.Start(); try { - var response = _devTestLabVmScheduleVmSchedulesRestClient.Delete(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, cancellationToken); - var uri = _devTestLabVmScheduleVmSchedulesRestClient.CreateDeleteRequestUri(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name); - var rehydrationToken = NextLinkOperationImplementation.GetRehydrationToken(RequestMethod.Delete, uri.ToUri(), uri.ToString(), "None", null, OperationFinalStateVia.OriginalUri.ToString()); - var operation = new DevTestLabsArmOperation(response, rehydrationToken); - if (waitUntil == WaitUntil.Completed) - operation.WaitForCompletionResponse(cancellationToken); - return operation; + RequestContext context = new RequestContext + { + CancellationToken = cancellationToken + }; + HttpMessage message = _devTestLabVmSchedulesRestClient.CreateUpdateRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, DevTestLabSchedulePatch.ToRequestContent(patch), context); + Response result = Pipeline.ProcessMessage(message, context); + Response response = Response.FromValue(DevTestLabScheduleData.FromResponse(result), result); + if (response.Value == null) + { + throw new RequestFailedException(response.GetRawResponse()); + } + return Response.FromValue(new DevTestLabVmScheduleResource(Client, response.Value), response.GetRawResponse()); } catch (Exception e) { @@ -262,39 +286,48 @@ public virtual ArmOperation Delete(WaitUntil waitUntil, CancellationToken cancel } /// - /// Allows modifying tags of schedules. All other properties will be ignored. + /// Delete schedule. /// /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/virtualmachines/{virtualMachineName}/schedules/{name} + /// Request Path. + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/virtualmachines/{virtualMachineName}/schedules/{name}. /// /// - /// Operation Id - /// VirtualMachineSchedules_Update + /// Operation Id. + /// VirtualMachineSchedules_Delete. /// /// - /// Default Api Version - /// 2018-09-15 + /// Default Api Version. + /// 2018-09-15. /// /// - /// Resource - /// + /// Resource. + /// . /// /// /// - /// A schedule. + /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. /// The cancellation token to use. - /// is null. - public virtual async Task> UpdateAsync(DevTestLabSchedulePatch patch, CancellationToken cancellationToken = default) + public virtual async Task DeleteAsync(WaitUntil waitUntil, CancellationToken cancellationToken = default) { - Argument.AssertNotNull(patch, nameof(patch)); - - using var scope = _devTestLabVmScheduleVmSchedulesClientDiagnostics.CreateScope("DevTestLabVmScheduleResource.Update"); + using DiagnosticScope scope = _devTestLabVmSchedulesClientDiagnostics.CreateScope("DevTestLabVmScheduleResource.Delete"); scope.Start(); try { - var response = await _devTestLabVmScheduleVmSchedulesRestClient.UpdateAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, patch, cancellationToken).ConfigureAwait(false); - return Response.FromValue(new DevTestLabVmScheduleResource(Client, response.Value), response.GetRawResponse()); + RequestContext context = new RequestContext + { + CancellationToken = cancellationToken + }; + HttpMessage message = _devTestLabVmSchedulesRestClient.CreateDeleteRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, context); + Response response = await Pipeline.ProcessMessageAsync(message, context).ConfigureAwait(false); + RequestUriBuilder uri = message.Request.Uri; + RehydrationToken rehydrationToken = NextLinkOperationImplementation.GetRehydrationToken(RequestMethod.Delete, uri.ToUri(), uri.ToString(), "None", null, OperationFinalStateVia.OriginalUri.ToString()); + DevTestLabsArmOperation operation = new DevTestLabsArmOperation(response, rehydrationToken); + if (waitUntil == WaitUntil.Completed) + { + await operation.WaitForCompletionResponseAsync(cancellationToken).ConfigureAwait(false); + } + return operation; } catch (Exception e) { @@ -304,39 +337,48 @@ public virtual async Task> UpdateAsync(De } /// - /// Allows modifying tags of schedules. All other properties will be ignored. + /// Delete schedule. /// /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/virtualmachines/{virtualMachineName}/schedules/{name} + /// Request Path. + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/virtualmachines/{virtualMachineName}/schedules/{name}. /// /// - /// Operation Id - /// VirtualMachineSchedules_Update + /// Operation Id. + /// VirtualMachineSchedules_Delete. /// /// - /// Default Api Version - /// 2018-09-15 + /// Default Api Version. + /// 2018-09-15. /// /// - /// Resource - /// + /// Resource. + /// . /// /// /// - /// A schedule. + /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. /// The cancellation token to use. - /// is null. - public virtual Response Update(DevTestLabSchedulePatch patch, CancellationToken cancellationToken = default) + public virtual ArmOperation Delete(WaitUntil waitUntil, CancellationToken cancellationToken = default) { - Argument.AssertNotNull(patch, nameof(patch)); - - using var scope = _devTestLabVmScheduleVmSchedulesClientDiagnostics.CreateScope("DevTestLabVmScheduleResource.Update"); + using DiagnosticScope scope = _devTestLabVmSchedulesClientDiagnostics.CreateScope("DevTestLabVmScheduleResource.Delete"); scope.Start(); try { - var response = _devTestLabVmScheduleVmSchedulesRestClient.Update(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, patch, cancellationToken); - return Response.FromValue(new DevTestLabVmScheduleResource(Client, response.Value), response.GetRawResponse()); + RequestContext context = new RequestContext + { + CancellationToken = cancellationToken + }; + HttpMessage message = _devTestLabVmSchedulesRestClient.CreateDeleteRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, context); + Response response = Pipeline.ProcessMessage(message, context); + RequestUriBuilder uri = message.Request.Uri; + RehydrationToken rehydrationToken = NextLinkOperationImplementation.GetRehydrationToken(RequestMethod.Delete, uri.ToUri(), uri.ToString(), "None", null, OperationFinalStateVia.OriginalUri.ToString()); + DevTestLabsArmOperation operation = new DevTestLabsArmOperation(response, rehydrationToken); + if (waitUntil == WaitUntil.Completed) + { + operation.WaitForCompletionResponse(cancellationToken); + } + return operation; } catch (Exception e) { @@ -349,20 +391,20 @@ public virtual Response Update(DevTestLabScheduleP /// Execute a schedule. This operation can take a while to complete. /// /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/virtualmachines/{virtualMachineName}/schedules/{name}/execute + /// Request Path. + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/virtualmachines/{virtualMachineName}/schedules/{name}/execute. /// /// - /// Operation Id - /// VirtualMachineSchedules_Execute + /// Operation Id. + /// VirtualMachineSchedules_Execute. /// /// - /// Default Api Version - /// 2018-09-15 + /// Default Api Version. + /// 2018-09-15. /// /// - /// Resource - /// + /// Resource. + /// . /// /// /// @@ -370,14 +412,21 @@ public virtual Response Update(DevTestLabScheduleP /// The cancellation token to use. public virtual async Task ExecuteAsync(WaitUntil waitUntil, CancellationToken cancellationToken = default) { - using var scope = _devTestLabVmScheduleVmSchedulesClientDiagnostics.CreateScope("DevTestLabVmScheduleResource.Execute"); + using DiagnosticScope scope = _devTestLabVmSchedulesClientDiagnostics.CreateScope("DevTestLabVmScheduleResource.Execute"); scope.Start(); try { - var response = await _devTestLabVmScheduleVmSchedulesRestClient.ExecuteAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, cancellationToken).ConfigureAwait(false); - var operation = new DevTestLabsArmOperation(_devTestLabVmScheduleVmSchedulesClientDiagnostics, Pipeline, _devTestLabVmScheduleVmSchedulesRestClient.CreateExecuteRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name).Request, response, OperationFinalStateVia.Location); + RequestContext context = new RequestContext + { + CancellationToken = cancellationToken + }; + HttpMessage message = _devTestLabVmSchedulesRestClient.CreateExecuteRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, context); + Response response = await Pipeline.ProcessMessageAsync(message, context).ConfigureAwait(false); + DevTestLabsArmOperation operation = new DevTestLabsArmOperation(_devTestLabVmSchedulesClientDiagnostics, Pipeline, message.Request, response, OperationFinalStateVia.Location); if (waitUntil == WaitUntil.Completed) + { await operation.WaitForCompletionResponseAsync(cancellationToken).ConfigureAwait(false); + } return operation; } catch (Exception e) @@ -391,20 +440,20 @@ public virtual async Task ExecuteAsync(WaitUntil waitUntil, Cancel /// Execute a schedule. This operation can take a while to complete. /// /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/virtualmachines/{virtualMachineName}/schedules/{name}/execute + /// Request Path. + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/virtualmachines/{virtualMachineName}/schedules/{name}/execute. /// /// - /// Operation Id - /// VirtualMachineSchedules_Execute + /// Operation Id. + /// VirtualMachineSchedules_Execute. /// /// - /// Default Api Version - /// 2018-09-15 + /// Default Api Version. + /// 2018-09-15. /// /// - /// Resource - /// + /// Resource. + /// . /// /// /// @@ -412,14 +461,21 @@ public virtual async Task ExecuteAsync(WaitUntil waitUntil, Cancel /// The cancellation token to use. public virtual ArmOperation Execute(WaitUntil waitUntil, CancellationToken cancellationToken = default) { - using var scope = _devTestLabVmScheduleVmSchedulesClientDiagnostics.CreateScope("DevTestLabVmScheduleResource.Execute"); + using DiagnosticScope scope = _devTestLabVmSchedulesClientDiagnostics.CreateScope("DevTestLabVmScheduleResource.Execute"); scope.Start(); try { - var response = _devTestLabVmScheduleVmSchedulesRestClient.Execute(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, cancellationToken); - var operation = new DevTestLabsArmOperation(_devTestLabVmScheduleVmSchedulesClientDiagnostics, Pipeline, _devTestLabVmScheduleVmSchedulesRestClient.CreateExecuteRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name).Request, response, OperationFinalStateVia.Location); + RequestContext context = new RequestContext + { + CancellationToken = cancellationToken + }; + HttpMessage message = _devTestLabVmSchedulesRestClient.CreateExecuteRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, context); + Response response = Pipeline.ProcessMessage(message, context); + DevTestLabsArmOperation operation = new DevTestLabsArmOperation(_devTestLabVmSchedulesClientDiagnostics, Pipeline, message.Request, response, OperationFinalStateVia.Location); if (waitUntil == WaitUntil.Completed) + { operation.WaitForCompletionResponse(cancellationToken); + } return operation; } catch (Exception e) @@ -429,27 +485,7 @@ public virtual ArmOperation Execute(WaitUntil waitUntil, CancellationToken cance } } - /// - /// Add a tag to the current resource. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/virtualmachines/{virtualMachineName}/schedules/{name} - /// - /// - /// Operation Id - /// VirtualMachineSchedules_Get - /// - /// - /// Default Api Version - /// 2018-09-15 - /// - /// - /// Resource - /// - /// - /// - /// + /// Add a tag to the current resource. /// The key for the tag. /// The value for the tag. /// The cancellation token to use. @@ -459,29 +495,35 @@ public virtual async Task> AddTagAsync(st Argument.AssertNotNull(key, nameof(key)); Argument.AssertNotNull(value, nameof(value)); - using var scope = _devTestLabVmScheduleVmSchedulesClientDiagnostics.CreateScope("DevTestLabVmScheduleResource.AddTag"); + using DiagnosticScope scope = _devTestLabVmSchedulesClientDiagnostics.CreateScope("DevTestLabVmScheduleResource.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 _devTestLabVmScheduleVmSchedulesRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, null, cancellationToken).ConfigureAwait(false); - return Response.FromValue(new DevTestLabVmScheduleResource(Client, originalResponse.Value), originalResponse.GetRawResponse()); + await GetTagResource().CreateOrUpdateAsync(WaitUntil.Completed, originalTags.Value.Data, cancellationToken).ConfigureAwait(false); + RequestContext context = new RequestContext + { + CancellationToken = cancellationToken + }; + HttpMessage message = _devTestLabVmSchedulesRestClient.CreateGetRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, default, context); + Response result = await Pipeline.ProcessMessageAsync(message, context).ConfigureAwait(false); + Response response = Response.FromValue(DevTestLabScheduleData.FromResponse(result), result); + return Response.FromValue(new DevTestLabVmScheduleResource(Client, response.Value), response.GetRawResponse()); } else { - var current = (await GetAsync(cancellationToken: cancellationToken).ConfigureAwait(false)).Value.Data; - var patch = new DevTestLabSchedulePatch(); - foreach (var tag in current.Tags) + DevTestLabScheduleData current = (await GetAsync(cancellationToken: cancellationToken).ConfigureAwait(false)).Value.Data; + DevTestLabSchedulePatch patch = new DevTestLabSchedulePatch(); + 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) @@ -491,27 +533,7 @@ public virtual async Task> AddTagAsync(st } } - /// - /// Add a tag to the current resource. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/virtualmachines/{virtualMachineName}/schedules/{name} - /// - /// - /// Operation Id - /// VirtualMachineSchedules_Get - /// - /// - /// Default Api Version - /// 2018-09-15 - /// - /// - /// Resource - /// - /// - /// - /// + /// Add a tag to the current resource. /// The key for the tag. /// The value for the tag. /// The cancellation token to use. @@ -521,29 +543,35 @@ public virtual Response AddTag(string key, string Argument.AssertNotNull(key, nameof(key)); Argument.AssertNotNull(value, nameof(value)); - using var scope = _devTestLabVmScheduleVmSchedulesClientDiagnostics.CreateScope("DevTestLabVmScheduleResource.AddTag"); + using DiagnosticScope scope = _devTestLabVmSchedulesClientDiagnostics.CreateScope("DevTestLabVmScheduleResource.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 = _devTestLabVmScheduleVmSchedulesRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, null, cancellationToken); - return Response.FromValue(new DevTestLabVmScheduleResource(Client, originalResponse.Value), originalResponse.GetRawResponse()); + GetTagResource().CreateOrUpdate(WaitUntil.Completed, originalTags.Value.Data, cancellationToken); + RequestContext context = new RequestContext + { + CancellationToken = cancellationToken + }; + HttpMessage message = _devTestLabVmSchedulesRestClient.CreateGetRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, default, context); + Response result = Pipeline.ProcessMessage(message, context); + Response response = Response.FromValue(DevTestLabScheduleData.FromResponse(result), result); + return Response.FromValue(new DevTestLabVmScheduleResource(Client, response.Value), response.GetRawResponse()); } else { - var current = Get(cancellationToken: cancellationToken).Value.Data; - var patch = new DevTestLabSchedulePatch(); - foreach (var tag in current.Tags) + DevTestLabScheduleData current = Get(cancellationToken: cancellationToken).Value.Data; + DevTestLabSchedulePatch patch = new DevTestLabSchedulePatch(); + 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) @@ -553,54 +581,40 @@ public virtual Response AddTag(string key, string } } - /// - /// Replace the tags on the resource with the given set. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/virtualmachines/{virtualMachineName}/schedules/{name} - /// - /// - /// Operation Id - /// VirtualMachineSchedules_Get - /// - /// - /// Default Api Version - /// 2018-09-15 - /// - /// - /// 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 = _devTestLabVmScheduleVmSchedulesClientDiagnostics.CreateScope("DevTestLabVmScheduleResource.SetTags"); + using DiagnosticScope scope = _devTestLabVmSchedulesClientDiagnostics.CreateScope("DevTestLabVmScheduleResource.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 _devTestLabVmScheduleVmSchedulesRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, null, cancellationToken).ConfigureAwait(false); - return Response.FromValue(new DevTestLabVmScheduleResource(Client, originalResponse.Value), originalResponse.GetRawResponse()); + await GetTagResource().CreateOrUpdateAsync(WaitUntil.Completed, originalTags.Value.Data, cancellationToken).ConfigureAwait(false); + RequestContext context = new RequestContext + { + CancellationToken = cancellationToken + }; + HttpMessage message = _devTestLabVmSchedulesRestClient.CreateGetRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, default, context); + Response result = await Pipeline.ProcessMessageAsync(message, context).ConfigureAwait(false); + Response response = Response.FromValue(DevTestLabScheduleData.FromResponse(result), result); + return Response.FromValue(new DevTestLabVmScheduleResource(Client, response.Value), response.GetRawResponse()); } else { - var current = (await GetAsync(cancellationToken: cancellationToken).ConfigureAwait(false)).Value.Data; - var patch = new DevTestLabSchedulePatch(); + DevTestLabScheduleData current = (await GetAsync(cancellationToken: cancellationToken).ConfigureAwait(false)).Value.Data; + DevTestLabSchedulePatch patch = new DevTestLabSchedulePatch(); 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) @@ -610,54 +624,40 @@ public virtual async Task> SetTagsAsync(I } } - /// - /// Replace the tags on the resource with the given set. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/virtualmachines/{virtualMachineName}/schedules/{name} - /// - /// - /// Operation Id - /// VirtualMachineSchedules_Get - /// - /// - /// Default Api Version - /// 2018-09-15 - /// - /// - /// 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 = _devTestLabVmScheduleVmSchedulesClientDiagnostics.CreateScope("DevTestLabVmScheduleResource.SetTags"); + using DiagnosticScope scope = _devTestLabVmSchedulesClientDiagnostics.CreateScope("DevTestLabVmScheduleResource.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 = _devTestLabVmScheduleVmSchedulesRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, null, cancellationToken); - return Response.FromValue(new DevTestLabVmScheduleResource(Client, originalResponse.Value), originalResponse.GetRawResponse()); + GetTagResource().CreateOrUpdate(WaitUntil.Completed, originalTags.Value.Data, cancellationToken); + RequestContext context = new RequestContext + { + CancellationToken = cancellationToken + }; + HttpMessage message = _devTestLabVmSchedulesRestClient.CreateGetRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, default, context); + Response result = Pipeline.ProcessMessage(message, context); + Response response = Response.FromValue(DevTestLabScheduleData.FromResponse(result), result); + return Response.FromValue(new DevTestLabVmScheduleResource(Client, response.Value), response.GetRawResponse()); } else { - var current = Get(cancellationToken: cancellationToken).Value.Data; - var patch = new DevTestLabSchedulePatch(); + DevTestLabScheduleData current = Get(cancellationToken: cancellationToken).Value.Data; + DevTestLabSchedulePatch patch = new DevTestLabSchedulePatch(); 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) @@ -667,27 +667,7 @@ public virtual Response SetTags(IDictionary - /// Removes a tag by key from the resource. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/virtualmachines/{virtualMachineName}/schedules/{name} - /// - /// - /// Operation Id - /// VirtualMachineSchedules_Get - /// - /// - /// Default Api Version - /// 2018-09-15 - /// - /// - /// Resource - /// - /// - /// - /// + /// Removes a tag by key from the resource. /// The key for the tag. /// The cancellation token to use. /// is null. @@ -695,29 +675,35 @@ public virtual async Task> RemoveTagAsync { Argument.AssertNotNull(key, nameof(key)); - using var scope = _devTestLabVmScheduleVmSchedulesClientDiagnostics.CreateScope("DevTestLabVmScheduleResource.RemoveTag"); + using DiagnosticScope scope = _devTestLabVmSchedulesClientDiagnostics.CreateScope("DevTestLabVmScheduleResource.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 _devTestLabVmScheduleVmSchedulesRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, null, cancellationToken).ConfigureAwait(false); - return Response.FromValue(new DevTestLabVmScheduleResource(Client, originalResponse.Value), originalResponse.GetRawResponse()); + await GetTagResource().CreateOrUpdateAsync(WaitUntil.Completed, originalTags.Value.Data, cancellationToken).ConfigureAwait(false); + RequestContext context = new RequestContext + { + CancellationToken = cancellationToken + }; + HttpMessage message = _devTestLabVmSchedulesRestClient.CreateGetRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, default, context); + Response result = await Pipeline.ProcessMessageAsync(message, context).ConfigureAwait(false); + Response response = Response.FromValue(DevTestLabScheduleData.FromResponse(result), result); + return Response.FromValue(new DevTestLabVmScheduleResource(Client, response.Value), response.GetRawResponse()); } else { - var current = (await GetAsync(cancellationToken: cancellationToken).ConfigureAwait(false)).Value.Data; - var patch = new DevTestLabSchedulePatch(); - foreach (var tag in current.Tags) + DevTestLabScheduleData current = (await GetAsync(cancellationToken: cancellationToken).ConfigureAwait(false)).Value.Data; + DevTestLabSchedulePatch patch = new DevTestLabSchedulePatch(); + 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) @@ -727,27 +713,7 @@ public virtual async Task> RemoveTagAsync } } - /// - /// Removes a tag by key from the resource. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/virtualmachines/{virtualMachineName}/schedules/{name} - /// - /// - /// Operation Id - /// VirtualMachineSchedules_Get - /// - /// - /// Default Api Version - /// 2018-09-15 - /// - /// - /// Resource - /// - /// - /// - /// + /// Removes a tag by key from the resource. /// The key for the tag. /// The cancellation token to use. /// is null. @@ -755,29 +721,35 @@ public virtual Response RemoveTag(string key, Canc { Argument.AssertNotNull(key, nameof(key)); - using var scope = _devTestLabVmScheduleVmSchedulesClientDiagnostics.CreateScope("DevTestLabVmScheduleResource.RemoveTag"); + using DiagnosticScope scope = _devTestLabVmSchedulesClientDiagnostics.CreateScope("DevTestLabVmScheduleResource.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 = _devTestLabVmScheduleVmSchedulesRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, null, cancellationToken); - return Response.FromValue(new DevTestLabVmScheduleResource(Client, originalResponse.Value), originalResponse.GetRawResponse()); + GetTagResource().CreateOrUpdate(WaitUntil.Completed, originalTags.Value.Data, cancellationToken); + RequestContext context = new RequestContext + { + CancellationToken = cancellationToken + }; + HttpMessage message = _devTestLabVmSchedulesRestClient.CreateGetRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, default, context); + Response result = Pipeline.ProcessMessage(message, context); + Response response = Response.FromValue(DevTestLabScheduleData.FromResponse(result), result); + return Response.FromValue(new DevTestLabVmScheduleResource(Client, response.Value), response.GetRawResponse()); } else { - var current = Get(cancellationToken: cancellationToken).Value.Data; - var patch = new DevTestLabSchedulePatch(); - foreach (var tag in current.Tags) + DevTestLabScheduleData current = Get(cancellationToken: cancellationToken).Value.Data; + DevTestLabSchedulePatch patch = new DevTestLabSchedulePatch(); + 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) diff --git a/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/Extensions/DevTestLabsExtensions.cs b/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/Extensions/DevTestLabsExtensions.cs index 06015ffd1325..a64e3c5bc453 100644 --- a/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/Extensions/DevTestLabsExtensions.cs +++ b/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/Extensions/DevTestLabsExtensions.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.DevTestLabs.Mocking; using Azure.ResourceManager.Resources; @@ -17,30 +19,32 @@ namespace Azure.ResourceManager.DevTestLabs /// A class to add extension methods to Azure.ResourceManager.DevTestLabs. public static partial class DevTestLabsExtensions { + /// private static MockableDevTestLabsArmClient GetMockableDevTestLabsArmClient(ArmClient client) { - return client.GetCachedClient(client0 => new MockableDevTestLabsArmClient(client0)); + return client.GetCachedClient(client0 => new MockableDevTestLabsArmClient(client0, ResourceIdentifier.Root)); } - private static MockableDevTestLabsResourceGroupResource GetMockableDevTestLabsResourceGroupResource(ArmResource resource) + /// + private static MockableDevTestLabsResourceGroupResource GetMockableDevTestLabsResourceGroupResource(ResourceGroupResource resourceGroupResource) { - return resource.GetCachedClient(client => new MockableDevTestLabsResourceGroupResource(client, resource.Id)); + return resourceGroupResource.GetCachedClient(client => new MockableDevTestLabsResourceGroupResource(client, resourceGroupResource.Id)); } - private static MockableDevTestLabsSubscriptionResource GetMockableDevTestLabsSubscriptionResource(ArmResource resource) + /// + private static MockableDevTestLabsSubscriptionResource GetMockableDevTestLabsSubscriptionResource(SubscriptionResource subscriptionResource) { - return resource.GetCachedClient(client => new MockableDevTestLabsSubscriptionResource(client, resource.Id)); + return subscriptionResource.GetCachedClient(client => new MockableDevTestLabsSubscriptionResource(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 DevTestLabResource GetDevTestLabResource(this ArmClient client, Re } /// - /// 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 DevTestLabGlobalScheduleResource GetDevTestLabGlobalScheduleResour } /// - /// 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 DevTestLabScheduleResource GetDevTestLabScheduleResource(this ArmC } /// - /// 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 DevTestLabServiceFabricScheduleResource GetDevTestLabServiceFabric } /// - /// 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,14 +128,13 @@ public static DevTestLabVmScheduleResource GetDevTestLabVmScheduleResource(this } /// - /// 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. @@ -147,14 +146,13 @@ public static DevTestLabArtifactSourceResource GetDevTestLabArtifactSourceResour } /// - /// 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. @@ -166,14 +164,13 @@ public static DevTestLabArmTemplateResource GetDevTestLabArmTemplateResource(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. @@ -185,14 +182,13 @@ public static DevTestLabArtifactResource GetDevTestLabArtifactResource(this ArmC } /// - /// 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. @@ -204,14 +200,13 @@ public static DevTestLabCostResource GetDevTestLabCostResource(this ArmClient cl } /// - /// 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. @@ -223,14 +218,13 @@ public static DevTestLabCustomImageResource GetDevTestLabCustomImageResource(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. @@ -242,14 +236,13 @@ public static DevTestLabFormulaResource GetDevTestLabFormulaResource(this ArmCli } /// - /// 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. @@ -261,14 +254,13 @@ public static DevTestLabNotificationChannelResource GetDevTestLabNotificationCha } /// - /// 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. @@ -280,14 +272,13 @@ public static DevTestLabPolicyResource GetDevTestLabPolicyResource(this ArmClien } /// - /// 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. @@ -299,14 +290,13 @@ public static DevTestLabServiceRunnerResource GetDevTestLabServiceRunnerResource } /// - /// 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. @@ -318,14 +308,13 @@ public static DevTestLabUserResource GetDevTestLabUserResource(this ArmClient cl } /// - /// 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. @@ -337,14 +326,13 @@ public static DevTestLabDiskResource GetDevTestLabDiskResource(this ArmClient cl } /// - /// 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. @@ -356,14 +344,13 @@ public static DevTestLabEnvironmentResource GetDevTestLabEnvironmentResource(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. @@ -375,14 +362,13 @@ public static DevTestLabSecretResource GetDevTestLabSecretResource(this ArmClien } /// - /// 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. @@ -394,14 +380,13 @@ public static DevTestLabServiceFabricResource GetDevTestLabServiceFabricResource } /// - /// 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. @@ -413,14 +398,13 @@ public static DevTestLabVmResource GetDevTestLabVmResource(this ArmClient client } /// - /// Gets an object representing a along with the instance operations that can be performed on it but with no data. - /// You can use to create a from its components. + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. /// - /// 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. @@ -432,15 +416,15 @@ public static DevTestLabVirtualNetworkResource GetDevTestLabVirtualNetworkResour } /// - /// Gets a collection of DevTestLabResources in the ResourceGroupResource. + /// Gets a collection of DevTestLabs 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 DevTestLabResources and their operations over a DevTestLabResource. + /// An object representing collection of DevTestLabs and their operations over a DevTestLabResource. public static DevTestLabCollection GetDevTestLabs(this ResourceGroupResource resourceGroupResource) { Argument.AssertNotNull(resourceGroupResource, nameof(resourceGroupResource)); @@ -450,37 +434,18 @@ public static DevTestLabCollection GetDevTestLabs(this ResourceGroupResource res /// /// Get lab. - /// /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{name} - /// - /// - /// Operation Id - /// Labs_Get - /// - /// - /// Default Api Version - /// 2018-09-15 - /// - /// - /// 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 name of the lab. /// Specify the $expand query. Example: 'properties($select=defaultStorageAccount)'. /// 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> GetDevTestLabAsync(this ResourceGroupResource resourceGroupResource, string name, string expand = null, CancellationToken cancellationToken = default) + public static async Task> GetDevTestLabAsync(this ResourceGroupResource resourceGroupResource, string name, string expand = default, CancellationToken cancellationToken = default) { Argument.AssertNotNull(resourceGroupResource, nameof(resourceGroupResource)); @@ -489,37 +454,18 @@ public static async Task> GetDevTestLabAsync(this R /// /// Get lab. - /// /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{name} - /// - /// - /// Operation Id - /// Labs_Get - /// - /// - /// Default Api Version - /// 2018-09-15 - /// - /// - /// 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 name of the lab. /// Specify the $expand query. Example: 'properties($select=defaultStorageAccount)'. /// 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 GetDevTestLab(this ResourceGroupResource resourceGroupResource, string name, string expand = null, CancellationToken cancellationToken = default) + public static Response GetDevTestLab(this ResourceGroupResource resourceGroupResource, string name, string expand = default, CancellationToken cancellationToken = default) { Argument.AssertNotNull(resourceGroupResource, nameof(resourceGroupResource)); @@ -527,15 +473,15 @@ public static Response GetDevTestLab(this ResourceGroupResou } /// - /// Gets a collection of DevTestLabGlobalScheduleResources in the ResourceGroupResource. + /// Gets a collection of DevTestLabGlobalSchedules 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 DevTestLabGlobalScheduleResources and their operations over a DevTestLabGlobalScheduleResource. + /// An object representing collection of DevTestLabGlobalSchedules and their operations over a DevTestLabGlobalScheduleResource. public static DevTestLabGlobalScheduleCollection GetDevTestLabGlobalSchedules(this ResourceGroupResource resourceGroupResource) { Argument.AssertNotNull(resourceGroupResource, nameof(resourceGroupResource)); @@ -545,37 +491,18 @@ public static DevTestLabGlobalScheduleCollection GetDevTestLabGlobalSchedules(th /// /// Get schedule. - /// /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/schedules/{name} - /// - /// - /// Operation Id - /// GlobalSchedules_Get - /// - /// - /// Default Api Version - /// 2018-09-15 - /// - /// - /// 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 name of the schedule. + /// The the method will execute against. + /// The name of the Schedule. /// Specify the $expand query. Example: 'properties($select=status)'. /// 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> GetDevTestLabGlobalScheduleAsync(this ResourceGroupResource resourceGroupResource, string name, string expand = null, CancellationToken cancellationToken = default) + public static async Task> GetDevTestLabGlobalScheduleAsync(this ResourceGroupResource resourceGroupResource, string name, string expand = default, CancellationToken cancellationToken = default) { Argument.AssertNotNull(resourceGroupResource, nameof(resourceGroupResource)); @@ -584,37 +511,18 @@ public static async Task> GetDevTestL /// /// Get schedule. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/schedules/{name} - /// - /// - /// Operation Id - /// GlobalSchedules_Get - /// - /// - /// Default Api Version - /// 2018-09-15 - /// - /// - /// 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 name of the schedule. + /// The the method will execute against. + /// The name of the Schedule. /// Specify the $expand query. Example: 'properties($select=status)'. /// 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 GetDevTestLabGlobalSchedule(this ResourceGroupResource resourceGroupResource, string name, string expand = null, CancellationToken cancellationToken = default) + public static Response GetDevTestLabGlobalSchedule(this ResourceGroupResource resourceGroupResource, string name, string expand = default, CancellationToken cancellationToken = default) { Argument.AssertNotNull(resourceGroupResource, nameof(resourceGroupResource)); @@ -623,70 +531,34 @@ public static Response GetDevTestLabGlobalSche /// /// List labs in a subscription. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/providers/Microsoft.DevTestLab/labs - /// - /// - /// Operation Id - /// Labs_ListBySubscription - /// - /// - /// Default Api Version - /// 2018-09-15 - /// - /// - /// 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. /// Specify the $expand query. Example: 'properties($select=defaultStorageAccount)'. /// The filter to apply to the operation. Example: '$filter=contains(name,'myName'). /// The maximum number of resources to return from the operation. Example: '$top=10'. /// The ordering expression for the results, using OData notation. Example: '$orderby=name desc'. /// The cancellation token to use. /// is null. - /// An async collection of that may take multiple service requests to iterate over. - public static AsyncPageable GetDevTestLabsAsync(this SubscriptionResource subscriptionResource, string expand = null, string filter = null, int? top = null, string orderby = null, CancellationToken cancellationToken = default) + /// A collection of that may take multiple service requests to iterate over. + public static AsyncPageable GetDevTestLabsAsync(this SubscriptionResource subscriptionResource, string expand = default, string filter = default, int? top = default, string @orderby = default, CancellationToken cancellationToken = default) { Argument.AssertNotNull(subscriptionResource, nameof(subscriptionResource)); - return GetMockableDevTestLabsSubscriptionResource(subscriptionResource).GetDevTestLabsAsync(expand, filter, top, orderby, cancellationToken); + return GetMockableDevTestLabsSubscriptionResource(subscriptionResource).GetDevTestLabsAsync(expand, filter, top, @orderby, cancellationToken); } /// /// List labs in a subscription. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/providers/Microsoft.DevTestLab/labs - /// - /// - /// Operation Id - /// Labs_ListBySubscription - /// - /// - /// Default Api Version - /// 2018-09-15 - /// - /// - /// 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. /// Specify the $expand query. Example: 'properties($select=defaultStorageAccount)'. /// The filter to apply to the operation. Example: '$filter=contains(name,'myName'). /// The maximum number of resources to return from the operation. Example: '$top=10'. @@ -694,79 +566,43 @@ public static AsyncPageable GetDevTestLabsAsync(this Subscri /// The cancellation token to use. /// is null. /// A collection of that may take multiple service requests to iterate over. - public static Pageable GetDevTestLabs(this SubscriptionResource subscriptionResource, string expand = null, string filter = null, int? top = null, string orderby = null, CancellationToken cancellationToken = default) + public static Pageable GetDevTestLabs(this SubscriptionResource subscriptionResource, string expand = default, string filter = default, int? top = default, string @orderby = default, CancellationToken cancellationToken = default) { Argument.AssertNotNull(subscriptionResource, nameof(subscriptionResource)); - return GetMockableDevTestLabsSubscriptionResource(subscriptionResource).GetDevTestLabs(expand, filter, top, orderby, cancellationToken); + return GetMockableDevTestLabsSubscriptionResource(subscriptionResource).GetDevTestLabs(expand, filter, top, @orderby, cancellationToken); } /// /// List schedules in a subscription. - /// /// - /// Request Path - /// /subscriptions/{subscriptionId}/providers/Microsoft.DevTestLab/schedules - /// - /// - /// Operation Id - /// GlobalSchedules_ListBySubscription - /// - /// - /// Default Api Version - /// 2018-09-15 - /// - /// - /// 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. /// Specify the $expand query. Example: 'properties($select=status)'. /// The filter to apply to the operation. Example: '$filter=contains(name,'myName'). /// The maximum number of resources to return from the operation. Example: '$top=10'. /// The ordering expression for the results, using OData notation. Example: '$orderby=name desc'. /// The cancellation token to use. /// is null. - /// An async collection of that may take multiple service requests to iterate over. - public static AsyncPageable GetDevTestLabGlobalSchedulesAsync(this SubscriptionResource subscriptionResource, string expand = null, string filter = null, int? top = null, string orderby = null, CancellationToken cancellationToken = default) + /// A collection of that may take multiple service requests to iterate over. + public static AsyncPageable GetDevTestLabGlobalSchedulesAsync(this SubscriptionResource subscriptionResource, string expand = default, string filter = default, int? top = default, string @orderby = default, CancellationToken cancellationToken = default) { Argument.AssertNotNull(subscriptionResource, nameof(subscriptionResource)); - return GetMockableDevTestLabsSubscriptionResource(subscriptionResource).GetDevTestLabGlobalSchedulesAsync(expand, filter, top, orderby, cancellationToken); + return GetMockableDevTestLabsSubscriptionResource(subscriptionResource).GetDevTestLabGlobalSchedulesAsync(expand, filter, top, @orderby, cancellationToken); } /// /// List schedules in a subscription. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/providers/Microsoft.DevTestLab/schedules - /// - /// - /// Operation Id - /// GlobalSchedules_ListBySubscription - /// - /// - /// Default Api Version - /// 2018-09-15 - /// - /// - /// 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. /// Specify the $expand query. Example: 'properties($select=status)'. /// The filter to apply to the operation. Example: '$filter=contains(name,'myName'). /// The maximum number of resources to return from the operation. Example: '$top=10'. @@ -774,11 +610,11 @@ public static AsyncPageable GetDevTestLabGloba /// The cancellation token to use. /// is null. /// A collection of that may take multiple service requests to iterate over. - public static Pageable GetDevTestLabGlobalSchedules(this SubscriptionResource subscriptionResource, string expand = null, string filter = null, int? top = null, string orderby = null, CancellationToken cancellationToken = default) + public static Pageable GetDevTestLabGlobalSchedules(this SubscriptionResource subscriptionResource, string expand = default, string filter = default, int? top = default, string @orderby = default, CancellationToken cancellationToken = default) { Argument.AssertNotNull(subscriptionResource, nameof(subscriptionResource)); - return GetMockableDevTestLabsSubscriptionResource(subscriptionResource).GetDevTestLabGlobalSchedules(expand, filter, top, orderby, cancellationToken); + return GetMockableDevTestLabsSubscriptionResource(subscriptionResource).GetDevTestLabGlobalSchedules(expand, filter, top, @orderby, cancellationToken); } } } diff --git a/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/Extensions/MockableDevTestLabsArmClient.cs b/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/Extensions/MockableDevTestLabsArmClient.cs index a3f9bef407e5..865f609c02ed 100644 --- a/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/Extensions/MockableDevTestLabsArmClient.cs +++ b/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/Extensions/MockableDevTestLabsArmClient.cs @@ -6,38 +6,27 @@ #nullable disable using Azure.Core; +using Azure.ResourceManager; +using Azure.ResourceManager.DevTestLabs; namespace Azure.ResourceManager.DevTestLabs.Mocking { - /// A class to add extension methods to ArmClient. + /// A class to add extension methods to . public partial class MockableDevTestLabsArmClient : ArmResource { - /// Initializes a new instance of the class for mocking. + /// Initializes a new instance of MockableDevTestLabsArmClient for mocking. protected MockableDevTestLabsArmClient() { } - /// 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 MockableDevTestLabsArmClient(ArmClient client, ResourceIdentifier id) : base(client, id) { } - internal MockableDevTestLabsArmClient(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 DevTestLabResource GetDevTestLabResource(ResourceIdentifier id) @@ -46,10 +35,7 @@ public virtual DevTestLabResource GetDevTestLabResource(ResourceIdentifier id) return new DevTestLabResource(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 DevTestLabGlobalScheduleResource GetDevTestLabGlobalScheduleResource(ResourceIdentifier id) @@ -58,10 +44,7 @@ public virtual DevTestLabGlobalScheduleResource GetDevTestLabGlobalScheduleResou return new DevTestLabGlobalScheduleResource(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 DevTestLabScheduleResource GetDevTestLabScheduleResource(ResourceIdentifier id) @@ -70,10 +53,7 @@ public virtual DevTestLabScheduleResource GetDevTestLabScheduleResource(Resource return new DevTestLabScheduleResource(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 DevTestLabServiceFabricScheduleResource GetDevTestLabServiceFabricScheduleResource(ResourceIdentifier id) @@ -82,10 +62,7 @@ public virtual DevTestLabServiceFabricScheduleResource GetDevTestLabServiceFabri return new DevTestLabServiceFabricScheduleResource(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 DevTestLabVmScheduleResource GetDevTestLabVmScheduleResource(ResourceIdentifier id) @@ -94,10 +71,7 @@ public virtual DevTestLabVmScheduleResource GetDevTestLabVmScheduleResource(Reso return new DevTestLabVmScheduleResource(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 DevTestLabArtifactSourceResource GetDevTestLabArtifactSourceResource(ResourceIdentifier id) @@ -106,10 +80,7 @@ public virtual DevTestLabArtifactSourceResource GetDevTestLabArtifactSourceResou return new DevTestLabArtifactSourceResource(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 DevTestLabArmTemplateResource GetDevTestLabArmTemplateResource(ResourceIdentifier id) @@ -118,10 +89,7 @@ public virtual DevTestLabArmTemplateResource GetDevTestLabArmTemplateResource(Re return new DevTestLabArmTemplateResource(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 DevTestLabArtifactResource GetDevTestLabArtifactResource(ResourceIdentifier id) @@ -130,10 +98,7 @@ public virtual DevTestLabArtifactResource GetDevTestLabArtifactResource(Resource return new DevTestLabArtifactResource(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 DevTestLabCostResource GetDevTestLabCostResource(ResourceIdentifier id) @@ -142,10 +107,7 @@ public virtual DevTestLabCostResource GetDevTestLabCostResource(ResourceIdentifi return new DevTestLabCostResource(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 DevTestLabCustomImageResource GetDevTestLabCustomImageResource(ResourceIdentifier id) @@ -154,10 +116,7 @@ public virtual DevTestLabCustomImageResource GetDevTestLabCustomImageResource(Re return new DevTestLabCustomImageResource(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 DevTestLabFormulaResource GetDevTestLabFormulaResource(ResourceIdentifier id) @@ -166,10 +125,7 @@ public virtual DevTestLabFormulaResource GetDevTestLabFormulaResource(ResourceId return new DevTestLabFormulaResource(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 DevTestLabNotificationChannelResource GetDevTestLabNotificationChannelResource(ResourceIdentifier id) @@ -178,10 +134,7 @@ public virtual DevTestLabNotificationChannelResource GetDevTestLabNotificationCh return new DevTestLabNotificationChannelResource(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 DevTestLabPolicyResource GetDevTestLabPolicyResource(ResourceIdentifier id) @@ -190,10 +143,7 @@ public virtual DevTestLabPolicyResource GetDevTestLabPolicyResource(ResourceIden return new DevTestLabPolicyResource(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 DevTestLabServiceRunnerResource GetDevTestLabServiceRunnerResource(ResourceIdentifier id) @@ -202,10 +152,7 @@ public virtual DevTestLabServiceRunnerResource GetDevTestLabServiceRunnerResourc return new DevTestLabServiceRunnerResource(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 DevTestLabUserResource GetDevTestLabUserResource(ResourceIdentifier id) @@ -214,10 +161,7 @@ public virtual DevTestLabUserResource GetDevTestLabUserResource(ResourceIdentifi return new DevTestLabUserResource(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 DevTestLabDiskResource GetDevTestLabDiskResource(ResourceIdentifier id) @@ -226,10 +170,7 @@ public virtual DevTestLabDiskResource GetDevTestLabDiskResource(ResourceIdentifi return new DevTestLabDiskResource(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 DevTestLabEnvironmentResource GetDevTestLabEnvironmentResource(ResourceIdentifier id) @@ -238,10 +179,7 @@ public virtual DevTestLabEnvironmentResource GetDevTestLabEnvironmentResource(Re return new DevTestLabEnvironmentResource(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 DevTestLabSecretResource GetDevTestLabSecretResource(ResourceIdentifier id) @@ -250,10 +188,7 @@ public virtual DevTestLabSecretResource GetDevTestLabSecretResource(ResourceIden return new DevTestLabSecretResource(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 DevTestLabServiceFabricResource GetDevTestLabServiceFabricResource(ResourceIdentifier id) @@ -262,10 +197,7 @@ public virtual DevTestLabServiceFabricResource GetDevTestLabServiceFabricResourc return new DevTestLabServiceFabricResource(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 DevTestLabVmResource GetDevTestLabVmResource(ResourceIdentifier id) @@ -274,10 +206,7 @@ public virtual DevTestLabVmResource GetDevTestLabVmResource(ResourceIdentifier i return new DevTestLabVmResource(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 DevTestLabVirtualNetworkResource GetDevTestLabVirtualNetworkResource(ResourceIdentifier id) diff --git a/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/Extensions/MockableDevTestLabsResourceGroupResource.cs b/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/Extensions/MockableDevTestLabsResourceGroupResource.cs index ee28bb9e2757..602dc330d8bf 100644 --- a/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/Extensions/MockableDevTestLabsResourceGroupResource.cs +++ b/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/Extensions/MockableDevTestLabsResourceGroupResource.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.DevTestLabs; +using Azure.ResourceManager.Resources; namespace Azure.ResourceManager.DevTestLabs.Mocking { - /// A class to add extension methods to ResourceGroupResource. + /// A class to add extension methods to . public partial class MockableDevTestLabsResourceGroupResource : ArmResource { - /// Initializes a new instance of the class for mocking. + /// Initializes a new instance of MockableDevTestLabsResourceGroupResource for mocking. protected MockableDevTestLabsResourceGroupResource() { } - /// 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 MockableDevTestLabsResourceGroupResource(ArmClient client, ResourceIdentifier id) : base(client, id) { } - private string GetApiVersionOrNull(ResourceType resourceType) - { - TryGetApiVersion(resourceType, out string apiVersion); - return apiVersion; - } - - /// Gets a collection of DevTestLabResources in the ResourceGroupResource. - /// An object representing collection of DevTestLabResources and their operations over a DevTestLabResource. + /// Gets a collection of DevTestLabs in the . + /// An object representing collection of DevTestLabs and their operations over a DevTestLabResource. public virtual DevTestLabCollection GetDevTestLabs() { return GetCachedClient(client => new DevTestLabCollection(client, Id)); @@ -44,20 +42,16 @@ public virtual DevTestLabCollection GetDevTestLabs() /// Get lab. /// /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{name} - /// - /// - /// Operation Id - /// Labs_Get + /// Request Path. + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{name}. /// /// - /// Default Api Version - /// 2018-09-15 + /// Operation Id. + /// Labs_Get. /// /// - /// Resource - /// + /// Default Api Version. + /// 2018-09-15. /// /// /// @@ -67,8 +61,10 @@ public virtual DevTestLabCollection GetDevTestLabs() /// is null. /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] - public virtual async Task> GetDevTestLabAsync(string name, string expand = null, CancellationToken cancellationToken = default) + public virtual async Task> GetDevTestLabAsync(string name, string expand = default, CancellationToken cancellationToken = default) { + Argument.AssertNotNullOrEmpty(name, nameof(name)); + return await GetDevTestLabs().GetAsync(name, expand, cancellationToken).ConfigureAwait(false); } @@ -76,20 +72,16 @@ public virtual async Task> GetDevTestLabAsync(strin /// Get lab. /// /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{name} - /// - /// - /// Operation Id - /// Labs_Get + /// Request Path. + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{name}. /// /// - /// Default Api Version - /// 2018-09-15 + /// Operation Id. + /// Labs_Get. /// /// - /// Resource - /// + /// Default Api Version. + /// 2018-09-15. /// /// /// @@ -99,13 +91,15 @@ public virtual async Task> GetDevTestLabAsync(strin /// is null. /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] - public virtual Response GetDevTestLab(string name, string expand = null, CancellationToken cancellationToken = default) + public virtual Response GetDevTestLab(string name, string expand = default, CancellationToken cancellationToken = default) { + Argument.AssertNotNullOrEmpty(name, nameof(name)); + return GetDevTestLabs().Get(name, expand, cancellationToken); } - /// Gets a collection of DevTestLabGlobalScheduleResources in the ResourceGroupResource. - /// An object representing collection of DevTestLabGlobalScheduleResources and their operations over a DevTestLabGlobalScheduleResource. + /// Gets a collection of DevTestLabGlobalSchedules in the . + /// An object representing collection of DevTestLabGlobalSchedules and their operations over a DevTestLabGlobalScheduleResource. public virtual DevTestLabGlobalScheduleCollection GetDevTestLabGlobalSchedules() { return GetCachedClient(client => new DevTestLabGlobalScheduleCollection(client, Id)); @@ -115,31 +109,29 @@ public virtual DevTestLabGlobalScheduleCollection GetDevTestLabGlobalSchedules() /// Get schedule. /// /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/schedules/{name} - /// - /// - /// Operation Id - /// GlobalSchedules_Get + /// Request Path. + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/schedules/{name}. /// /// - /// Default Api Version - /// 2018-09-15 + /// Operation Id. + /// GlobalSchedules_Get. /// /// - /// Resource - /// + /// Default Api Version. + /// 2018-09-15. /// /// /// - /// The name of the schedule. + /// The name of the Schedule. /// Specify the $expand query. Example: 'properties($select=status)'. /// The cancellation token to use. /// is null. /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] - public virtual async Task> GetDevTestLabGlobalScheduleAsync(string name, string expand = null, CancellationToken cancellationToken = default) + public virtual async Task> GetDevTestLabGlobalScheduleAsync(string name, string expand = default, CancellationToken cancellationToken = default) { + Argument.AssertNotNullOrEmpty(name, nameof(name)); + return await GetDevTestLabGlobalSchedules().GetAsync(name, expand, cancellationToken).ConfigureAwait(false); } @@ -147,31 +139,29 @@ public virtual async Task> GetDevTest /// Get schedule. /// /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/schedules/{name} + /// Request Path. + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/schedules/{name}. /// /// - /// Operation Id - /// GlobalSchedules_Get + /// Operation Id. + /// GlobalSchedules_Get. /// /// - /// Default Api Version - /// 2018-09-15 - /// - /// - /// Resource - /// + /// Default Api Version. + /// 2018-09-15. /// /// /// - /// The name of the schedule. + /// The name of the Schedule. /// Specify the $expand query. Example: 'properties($select=status)'. /// The cancellation token to use. /// is null. /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] - public virtual Response GetDevTestLabGlobalSchedule(string name, string expand = null, CancellationToken cancellationToken = default) + public virtual Response GetDevTestLabGlobalSchedule(string name, string expand = default, CancellationToken cancellationToken = default) { + Argument.AssertNotNullOrEmpty(name, nameof(name)); + return GetDevTestLabGlobalSchedules().Get(name, expand, cancellationToken); } } diff --git a/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/Extensions/MockableDevTestLabsSubscriptionResource.cs b/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/Extensions/MockableDevTestLabsSubscriptionResource.cs index 7a0d242b56c7..f38cdab5df5d 100644 --- a/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/Extensions/MockableDevTestLabsSubscriptionResource.cs +++ b/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/Extensions/MockableDevTestLabsSubscriptionResource.cs @@ -6,61 +6,57 @@ #nullable disable using System.Threading; -using Autorest.CSharp.Core; +using Azure; using Azure.Core; using Azure.Core.Pipeline; +using Azure.ResourceManager; +using Azure.ResourceManager.DevTestLabs; +using Azure.ResourceManager.Resources; namespace Azure.ResourceManager.DevTestLabs.Mocking { - /// A class to add extension methods to SubscriptionResource. + /// A class to add extension methods to . public partial class MockableDevTestLabsSubscriptionResource : ArmResource { - private ClientDiagnostics _devTestLabLabsClientDiagnostics; - private LabsRestOperations _devTestLabLabsRestClient; - private ClientDiagnostics _devTestLabGlobalScheduleGlobalSchedulesClientDiagnostics; - private GlobalSchedulesRestOperations _devTestLabGlobalScheduleGlobalSchedulesRestClient; + private ClientDiagnostics _labsClientDiagnostics; + private Labs _labsRestClient; + private ClientDiagnostics _devTestLabGlobalSchedulesClientDiagnostics; + private DevTestLabGlobalSchedules _devTestLabGlobalSchedulesRestClient; - /// Initializes a new instance of the class for mocking. + /// Initializes a new instance of MockableDevTestLabsSubscriptionResource for mocking. protected MockableDevTestLabsSubscriptionResource() { } - /// 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 MockableDevTestLabsSubscriptionResource(ArmClient client, ResourceIdentifier id) : base(client, id) { } - private ClientDiagnostics DevTestLabLabsClientDiagnostics => _devTestLabLabsClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.DevTestLabs", DevTestLabResource.ResourceType.Namespace, Diagnostics); - private LabsRestOperations DevTestLabLabsRestClient => _devTestLabLabsRestClient ??= new LabsRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, GetApiVersionOrNull(DevTestLabResource.ResourceType)); - private ClientDiagnostics DevTestLabGlobalScheduleGlobalSchedulesClientDiagnostics => _devTestLabGlobalScheduleGlobalSchedulesClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.DevTestLabs", DevTestLabGlobalScheduleResource.ResourceType.Namespace, Diagnostics); - private GlobalSchedulesRestOperations DevTestLabGlobalScheduleGlobalSchedulesRestClient => _devTestLabGlobalScheduleGlobalSchedulesRestClient ??= new GlobalSchedulesRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, GetApiVersionOrNull(DevTestLabGlobalScheduleResource.ResourceType)); + private ClientDiagnostics LabsClientDiagnostics => _labsClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.DevTestLabs.Mocking", ProviderConstants.DefaultProviderNamespace, Diagnostics); - private string GetApiVersionOrNull(ResourceType resourceType) - { - TryGetApiVersion(resourceType, out string apiVersion); - return apiVersion; - } + private Labs LabsRestClient => _labsRestClient ??= new Labs(LabsClientDiagnostics, Pipeline, Endpoint, "2018-09-15"); + + private ClientDiagnostics DevTestLabGlobalSchedulesClientDiagnostics => _devTestLabGlobalSchedulesClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.DevTestLabs.Mocking", ProviderConstants.DefaultProviderNamespace, Diagnostics); + + private DevTestLabGlobalSchedules DevTestLabGlobalSchedulesRestClient => _devTestLabGlobalSchedulesRestClient ??= new DevTestLabGlobalSchedules(DevTestLabGlobalSchedulesClientDiagnostics, Pipeline, Endpoint, "2018-09-15"); /// /// List labs in a subscription. /// /// - /// Request Path - /// /subscriptions/{subscriptionId}/providers/Microsoft.DevTestLab/labs + /// Request Path. + /// /subscriptions/{subscriptionId}/providers/Microsoft.DevTestLab/labs. /// /// - /// Operation Id - /// Labs_ListBySubscription + /// Operation Id. + /// Labs_ListBySubscription. /// /// - /// Default Api Version - /// 2018-09-15 - /// - /// - /// Resource - /// + /// Default Api Version. + /// 2018-09-15. /// /// /// @@ -69,32 +65,37 @@ private string GetApiVersionOrNull(ResourceType resourceType) /// The maximum number of resources to return from the operation. Example: '$top=10'. /// The ordering expression for the results, using OData notation. Example: '$orderby=name desc'. /// The cancellation token to use. - /// An async collection of that may take multiple service requests to iterate over. - public virtual AsyncPageable GetDevTestLabsAsync(string expand = null, string filter = null, int? top = null, string orderby = null, CancellationToken cancellationToken = default) + /// A collection of that may take multiple service requests to iterate over. + public virtual AsyncPageable GetDevTestLabsAsync(string expand = default, string filter = default, int? top = default, string @orderby = default, CancellationToken cancellationToken = default) { - HttpMessage FirstPageRequest(int? pageSizeHint) => DevTestLabLabsRestClient.CreateListBySubscriptionRequest(Id.SubscriptionId, expand, filter, top, orderby); - HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => DevTestLabLabsRestClient.CreateListBySubscriptionNextPageRequest(nextLink, Id.SubscriptionId, expand, filter, top, orderby); - return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new DevTestLabResource(Client, DevTestLabData.DeserializeDevTestLabData(e)), DevTestLabLabsClientDiagnostics, Pipeline, "MockableDevTestLabsSubscriptionResource.GetDevTestLabs", "value", "nextLink", cancellationToken); + RequestContext context = new RequestContext + { + CancellationToken = cancellationToken + }; + return new AsyncPageableWrapper(new LabsGetBySubscriptionAsyncCollectionResultOfT( + LabsRestClient, + Id.SubscriptionId, + expand, + filter, + top, + @orderby, + context), data => new DevTestLabResource(Client, data)); } /// /// List labs in a subscription. /// /// - /// Request Path - /// /subscriptions/{subscriptionId}/providers/Microsoft.DevTestLab/labs + /// Request Path. + /// /subscriptions/{subscriptionId}/providers/Microsoft.DevTestLab/labs. /// /// - /// Operation Id - /// Labs_ListBySubscription + /// Operation Id. + /// Labs_ListBySubscription. /// /// - /// Default Api Version - /// 2018-09-15 - /// - /// - /// Resource - /// + /// Default Api Version. + /// 2018-09-15. /// /// /// @@ -104,31 +105,36 @@ public virtual AsyncPageable GetDevTestLabsAsync(string expa /// The ordering expression for the results, using OData notation. Example: '$orderby=name desc'. /// The cancellation token to use. /// A collection of that may take multiple service requests to iterate over. - public virtual Pageable GetDevTestLabs(string expand = null, string filter = null, int? top = null, string orderby = null, CancellationToken cancellationToken = default) + public virtual Pageable GetDevTestLabs(string expand = default, string filter = default, int? top = default, string @orderby = default, CancellationToken cancellationToken = default) { - HttpMessage FirstPageRequest(int? pageSizeHint) => DevTestLabLabsRestClient.CreateListBySubscriptionRequest(Id.SubscriptionId, expand, filter, top, orderby); - HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => DevTestLabLabsRestClient.CreateListBySubscriptionNextPageRequest(nextLink, Id.SubscriptionId, expand, filter, top, orderby); - return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new DevTestLabResource(Client, DevTestLabData.DeserializeDevTestLabData(e)), DevTestLabLabsClientDiagnostics, Pipeline, "MockableDevTestLabsSubscriptionResource.GetDevTestLabs", "value", "nextLink", cancellationToken); + RequestContext context = new RequestContext + { + CancellationToken = cancellationToken + }; + return new PageableWrapper(new LabsGetBySubscriptionCollectionResultOfT( + LabsRestClient, + Id.SubscriptionId, + expand, + filter, + top, + @orderby, + context), data => new DevTestLabResource(Client, data)); } /// /// List schedules in a subscription. /// /// - /// Request Path - /// /subscriptions/{subscriptionId}/providers/Microsoft.DevTestLab/schedules - /// - /// - /// Operation Id - /// GlobalSchedules_ListBySubscription + /// Request Path. + /// /subscriptions/{subscriptionId}/providers/Microsoft.DevTestLab/schedules. /// /// - /// Default Api Version - /// 2018-09-15 + /// Operation Id. + /// GlobalSchedules_ListBySubscription. /// /// - /// Resource - /// + /// Default Api Version. + /// 2018-09-15. /// /// /// @@ -137,32 +143,37 @@ public virtual Pageable GetDevTestLabs(string expand = null, /// The maximum number of resources to return from the operation. Example: '$top=10'. /// The ordering expression for the results, using OData notation. Example: '$orderby=name desc'. /// The cancellation token to use. - /// An async collection of that may take multiple service requests to iterate over. - public virtual AsyncPageable GetDevTestLabGlobalSchedulesAsync(string expand = null, string filter = null, int? top = null, string orderby = null, CancellationToken cancellationToken = default) + /// A collection of that may take multiple service requests to iterate over. + public virtual AsyncPageable GetDevTestLabGlobalSchedulesAsync(string expand = default, string filter = default, int? top = default, string @orderby = default, CancellationToken cancellationToken = default) { - HttpMessage FirstPageRequest(int? pageSizeHint) => DevTestLabGlobalScheduleGlobalSchedulesRestClient.CreateListBySubscriptionRequest(Id.SubscriptionId, expand, filter, top, orderby); - HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => DevTestLabGlobalScheduleGlobalSchedulesRestClient.CreateListBySubscriptionNextPageRequest(nextLink, Id.SubscriptionId, expand, filter, top, orderby); - return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new DevTestLabGlobalScheduleResource(Client, DevTestLabScheduleData.DeserializeDevTestLabScheduleData(e)), DevTestLabGlobalScheduleGlobalSchedulesClientDiagnostics, Pipeline, "MockableDevTestLabsSubscriptionResource.GetDevTestLabGlobalSchedules", "value", "nextLink", cancellationToken); + RequestContext context = new RequestContext + { + CancellationToken = cancellationToken + }; + return new AsyncPageableWrapper(new DevTestLabGlobalSchedulesGetBySubscriptionAsyncCollectionResultOfT( + DevTestLabGlobalSchedulesRestClient, + Id.SubscriptionId, + expand, + filter, + top, + @orderby, + context), data => new DevTestLabGlobalScheduleResource(Client, data)); } /// /// List schedules in a subscription. /// /// - /// Request Path - /// /subscriptions/{subscriptionId}/providers/Microsoft.DevTestLab/schedules - /// - /// - /// Operation Id - /// GlobalSchedules_ListBySubscription + /// Request Path. + /// /subscriptions/{subscriptionId}/providers/Microsoft.DevTestLab/schedules. /// /// - /// Default Api Version - /// 2018-09-15 + /// Operation Id. + /// GlobalSchedules_ListBySubscription. /// /// - /// Resource - /// + /// Default Api Version. + /// 2018-09-15. /// /// /// @@ -172,11 +183,20 @@ public virtual AsyncPageable GetDevTestLabGlob /// The ordering expression for the results, using OData notation. Example: '$orderby=name desc'. /// The cancellation token to use. /// A collection of that may take multiple service requests to iterate over. - public virtual Pageable GetDevTestLabGlobalSchedules(string expand = null, string filter = null, int? top = null, string orderby = null, CancellationToken cancellationToken = default) + public virtual Pageable GetDevTestLabGlobalSchedules(string expand = default, string filter = default, int? top = default, string @orderby = default, CancellationToken cancellationToken = default) { - HttpMessage FirstPageRequest(int? pageSizeHint) => DevTestLabGlobalScheduleGlobalSchedulesRestClient.CreateListBySubscriptionRequest(Id.SubscriptionId, expand, filter, top, orderby); - HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => DevTestLabGlobalScheduleGlobalSchedulesRestClient.CreateListBySubscriptionNextPageRequest(nextLink, Id.SubscriptionId, expand, filter, top, orderby); - return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new DevTestLabGlobalScheduleResource(Client, DevTestLabScheduleData.DeserializeDevTestLabScheduleData(e)), DevTestLabGlobalScheduleGlobalSchedulesClientDiagnostics, Pipeline, "MockableDevTestLabsSubscriptionResource.GetDevTestLabGlobalSchedules", "value", "nextLink", cancellationToken); + RequestContext context = new RequestContext + { + CancellationToken = cancellationToken + }; + return new PageableWrapper(new DevTestLabGlobalSchedulesGetBySubscriptionCollectionResultOfT( + DevTestLabGlobalSchedulesRestClient, + Id.SubscriptionId, + expand, + filter, + top, + @orderby, + context), data => new DevTestLabGlobalScheduleResource(Client, data)); } } } diff --git a/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/Internal/Argument.cs b/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/Internal/Argument.cs index 4a75d5a02d0a..5f5bae76c17f 100644 --- a/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/Internal/Argument.cs +++ b/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/Internal/Argument.cs @@ -11,8 +11,10 @@ namespace Azure.ResourceManager.DevTestLabs { - 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/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/Internal/AsyncPageableWrapper.cs b/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/Internal/AsyncPageableWrapper.cs new file mode 100644 index 000000000000..e0d86f344b13 --- /dev/null +++ b/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/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.DevTestLabs +{ + 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/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/Internal/ChangeTrackingDictionary.cs b/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/Internal/ChangeTrackingDictionary.cs index 5b596b668fa4..27979f5a2aad 100644 --- a/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/Internal/ChangeTrackingDictionary.cs +++ b/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/Internal/ChangeTrackingDictionary.cs @@ -11,7 +11,8 @@ namespace Azure.ResourceManager.DevTestLabs { - 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/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/Internal/ChangeTrackingList.cs b/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/Internal/ChangeTrackingList.cs index e4847c04608a..ed2740d72268 100644 --- a/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/Internal/ChangeTrackingList.cs +++ b/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/Internal/ChangeTrackingList.cs @@ -12,7 +12,7 @@ namespace Azure.ResourceManager.DevTestLabs { - 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/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/Internal/ClientPipelineExtensions.cs b/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/Internal/ClientPipelineExtensions.cs new file mode 100644 index 000000000000..bfff5d981920 --- /dev/null +++ b/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/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.DevTestLabs +{ + 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/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/Internal/CodeGenMemberAttribute.cs b/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/Internal/CodeGenMemberAttribute.cs new file mode 100644 index 000000000000..72778edeb7e4 --- /dev/null +++ b/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/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 Microsoft.TypeSpec.Generator.Customizations +{ + [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/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/Internal/CodeGenSerializationAttribute.cs b/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/Internal/CodeGenSerializationAttribute.cs new file mode 100644 index 000000000000..dfcabf517497 --- /dev/null +++ b/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/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 Microsoft.TypeSpec.Generator.Customizations +{ + [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/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/Internal/CodeGenSuppressAttribute.cs b/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/Internal/CodeGenSuppressAttribute.cs new file mode 100644 index 000000000000..38d536e69173 --- /dev/null +++ b/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/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 Microsoft.TypeSpec.Generator.Customizations +{ + [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/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/Internal/CodeGenTypeAttribute.cs b/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/Internal/CodeGenTypeAttribute.cs new file mode 100644 index 000000000000..f36b5f513173 --- /dev/null +++ b/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/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 Microsoft.TypeSpec.Generator.Customizations +{ + [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/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/Internal/ErrorResult.cs b/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/Internal/ErrorResult.cs new file mode 100644 index 000000000000..81cabe5a226e --- /dev/null +++ b/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/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.DevTestLabs +{ + 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/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/Internal/ModelSerializationExtensions.cs b/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/Internal/ModelSerializationExtensions.cs index b5353357c6bb..a32864dbc7c2 100644 --- a/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/Internal/ModelSerializationExtensions.cs +++ b/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/Internal/ModelSerializationExtensions.cs @@ -10,19 +10,18 @@ using System.Collections.Generic; using System.Diagnostics; using System.Globalization; +using System.Runtime.InteropServices; using System.Text.Json; -using System.Xml; -using Azure.Core; namespace Azure.ResourceManager.DevTestLabs { - 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 +47,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 +92,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 +106,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 +180,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; @@ -260,150 +256,13 @@ 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 + public static BinaryData GetUtf8Bytes(this JsonElement element) { - 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() - }; +#if NET9_0_OR_GREATER + return new global::System.BinaryData(global::System.Runtime.InteropServices.JsonMarshal.GetRawUtf8Value(element).ToArray()); +#else + return BinaryData.FromString(element.GetRawText()); +#endif } } } diff --git a/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/Internal/Optional.cs b/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/Internal/Optional.cs index becc5a9ccd9e..38e4d429417d 100644 --- a/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/Internal/Optional.cs +++ b/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/Internal/Optional.cs @@ -10,7 +10,7 @@ namespace Azure.ResourceManager.DevTestLabs { - 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/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/Internal/PageableWrapper.cs b/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/Internal/PageableWrapper.cs new file mode 100644 index 000000000000..51cdf53d49cc --- /dev/null +++ b/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/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.DevTestLabs +{ + 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/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/Internal/RawRequestUriBuilderExtensions.cs b/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/Internal/RawRequestUriBuilderExtensions.cs new file mode 100644 index 000000000000..062a3d3a5199 --- /dev/null +++ b/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/Internal/RawRequestUriBuilderExtensions.cs @@ -0,0 +1,60 @@ +// 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.DevTestLabs +{ + 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); + } + + public static void UpdateQuery(this RawRequestUriBuilder builder, string name, string value) + { + string currentQuery = builder.Query; + string searchPattern = string.Concat(name, "="); + int paramStartIndex = -1; + if (currentQuery.StartsWith(string.Concat("?", searchPattern))) + { + paramStartIndex = 1; + } + if (paramStartIndex == -1) + { + string prefixedPattern = string.Concat("&", searchPattern); + int prefixedIndex = currentQuery.IndexOf(prefixedPattern); + if (prefixedIndex >= 0) + { + paramStartIndex = prefixedIndex + 1; + } + } + if (paramStartIndex >= 0) + { + int valueStartIndex = paramStartIndex + searchPattern.Length; + int valueEndIndex = currentQuery.IndexOf('&', valueStartIndex); + if (valueEndIndex == -1) + { + valueEndIndex = currentQuery.Length; + } + string beforeParam = currentQuery.Substring(0, valueStartIndex); + string afterParam = currentQuery.Substring(valueEndIndex); + string newQuery = string.Concat(beforeParam, value, afterParam); + builder.Query = newQuery; + } + else + { + builder.AppendQuery(name, value, true); + } + } + } +} diff --git a/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/Internal/RequestContextExtensions.cs b/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/Internal/RequestContextExtensions.cs new file mode 100644 index 000000000000..d4e64e2578d0 --- /dev/null +++ b/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/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.DevTestLabs +{ + 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/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/Internal/SerializationFormat.cs b/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/Internal/SerializationFormat.cs new file mode 100644 index 000000000000..17821f29377f --- /dev/null +++ b/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/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.DevTestLabs +{ + 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/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/Internal/TypeFormatters.cs b/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/Internal/TypeFormatters.cs new file mode 100644 index 000000000000..4b4804e7705b --- /dev/null +++ b/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/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.DevTestLabs +{ + 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/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/Internal/Utf8JsonRequestContent.cs b/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/Internal/Utf8JsonRequestContent.cs index 0519fc3819df..041ad3a4e8a1 100644 --- a/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/Internal/Utf8JsonRequestContent.cs +++ b/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/Internal/Utf8JsonRequestContent.cs @@ -13,7 +13,7 @@ namespace Azure.ResourceManager.DevTestLabs { - 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/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/LongRunningOperation/DevTestLabCustomImageOperationSource.cs b/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/LongRunningOperation/DevTestLabCustomImageOperationSource.cs index bcbd4f85460b..e49ce6fe6688 100644 --- a/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/LongRunningOperation/DevTestLabCustomImageOperationSource.cs +++ b/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/LongRunningOperation/DevTestLabCustomImageOperationSource.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.DevTestLabs { - internal class DevTestLabCustomImageOperationSource : IOperationSource + /// + internal partial class DevTestLabCustomImageOperationSource : IOperationSource { private readonly ArmClient _client; + /// + /// internal DevTestLabCustomImageOperationSource(ArmClient client) { _client = client; } + /// The response from the service. + /// The cancellation token to use. + /// DevTestLabCustomImageResource IOperationSource.CreateResult(Response response, CancellationToken cancellationToken) { - var data = ModelReaderWriter.Read(response.Content, ModelReaderWriterOptions.Json, AzureResourceManagerDevTestLabsContext.Default); + using JsonDocument document = JsonDocument.Parse(response.ContentStream); + DevTestLabCustomImageData data = DevTestLabCustomImageData.DeserializeDevTestLabCustomImageData(document.RootElement, ModelSerializationExtensions.WireOptions); return new DevTestLabCustomImageResource(_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, AzureResourceManagerDevTestLabsContext.Default); - return await Task.FromResult(new DevTestLabCustomImageResource(_client, data)).ConfigureAwait(false); + using JsonDocument document = await JsonDocument.ParseAsync(response.ContentStream, default, cancellationToken).ConfigureAwait(false); + DevTestLabCustomImageData data = DevTestLabCustomImageData.DeserializeDevTestLabCustomImageData(document.RootElement, ModelSerializationExtensions.WireOptions); + return new DevTestLabCustomImageResource(_client, data); } } } diff --git a/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/LongRunningOperation/DevTestLabDiskOperationSource.cs b/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/LongRunningOperation/DevTestLabDiskOperationSource.cs index 1b216947efae..ca0699f07c59 100644 --- a/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/LongRunningOperation/DevTestLabDiskOperationSource.cs +++ b/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/LongRunningOperation/DevTestLabDiskOperationSource.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.DevTestLabs { - internal class DevTestLabDiskOperationSource : IOperationSource + /// + internal partial class DevTestLabDiskOperationSource : IOperationSource { private readonly ArmClient _client; + /// + /// internal DevTestLabDiskOperationSource(ArmClient client) { _client = client; } + /// The response from the service. + /// The cancellation token to use. + /// DevTestLabDiskResource IOperationSource.CreateResult(Response response, CancellationToken cancellationToken) { - var data = ModelReaderWriter.Read(response.Content, ModelReaderWriterOptions.Json, AzureResourceManagerDevTestLabsContext.Default); + using JsonDocument document = JsonDocument.Parse(response.ContentStream); + DevTestLabDiskData data = DevTestLabDiskData.DeserializeDevTestLabDiskData(document.RootElement, ModelSerializationExtensions.WireOptions); return new DevTestLabDiskResource(_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, AzureResourceManagerDevTestLabsContext.Default); - return await Task.FromResult(new DevTestLabDiskResource(_client, data)).ConfigureAwait(false); + using JsonDocument document = await JsonDocument.ParseAsync(response.ContentStream, default, cancellationToken).ConfigureAwait(false); + DevTestLabDiskData data = DevTestLabDiskData.DeserializeDevTestLabDiskData(document.RootElement, ModelSerializationExtensions.WireOptions); + return new DevTestLabDiskResource(_client, data); } } } diff --git a/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/LongRunningOperation/DevTestLabEnvironmentOperationSource.cs b/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/LongRunningOperation/DevTestLabEnvironmentOperationSource.cs index 0ac2d38ed75b..83e19208a8fa 100644 --- a/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/LongRunningOperation/DevTestLabEnvironmentOperationSource.cs +++ b/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/LongRunningOperation/DevTestLabEnvironmentOperationSource.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.DevTestLabs { - internal class DevTestLabEnvironmentOperationSource : IOperationSource + /// + internal partial class DevTestLabEnvironmentOperationSource : IOperationSource { private readonly ArmClient _client; + /// + /// internal DevTestLabEnvironmentOperationSource(ArmClient client) { _client = client; } + /// The response from the service. + /// The cancellation token to use. + /// DevTestLabEnvironmentResource IOperationSource.CreateResult(Response response, CancellationToken cancellationToken) { - var data = ModelReaderWriter.Read(response.Content, ModelReaderWriterOptions.Json, AzureResourceManagerDevTestLabsContext.Default); + using JsonDocument document = JsonDocument.Parse(response.ContentStream); + DevTestLabEnvironmentData data = DevTestLabEnvironmentData.DeserializeDevTestLabEnvironmentData(document.RootElement, ModelSerializationExtensions.WireOptions); return new DevTestLabEnvironmentResource(_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, AzureResourceManagerDevTestLabsContext.Default); - return await Task.FromResult(new DevTestLabEnvironmentResource(_client, data)).ConfigureAwait(false); + using JsonDocument document = await JsonDocument.ParseAsync(response.ContentStream, default, cancellationToken).ConfigureAwait(false); + DevTestLabEnvironmentData data = DevTestLabEnvironmentData.DeserializeDevTestLabEnvironmentData(document.RootElement, ModelSerializationExtensions.WireOptions); + return new DevTestLabEnvironmentResource(_client, data); } } } diff --git a/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/LongRunningOperation/DevTestLabFormulaOperationSource.cs b/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/LongRunningOperation/DevTestLabFormulaOperationSource.cs index 7ddf13441a58..67d89b4c6dc6 100644 --- a/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/LongRunningOperation/DevTestLabFormulaOperationSource.cs +++ b/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/LongRunningOperation/DevTestLabFormulaOperationSource.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.DevTestLabs { - internal class DevTestLabFormulaOperationSource : IOperationSource + /// + internal partial class DevTestLabFormulaOperationSource : IOperationSource { private readonly ArmClient _client; + /// + /// internal DevTestLabFormulaOperationSource(ArmClient client) { _client = client; } + /// The response from the service. + /// The cancellation token to use. + /// DevTestLabFormulaResource IOperationSource.CreateResult(Response response, CancellationToken cancellationToken) { - var data = ModelReaderWriter.Read(response.Content, ModelReaderWriterOptions.Json, AzureResourceManagerDevTestLabsContext.Default); + using JsonDocument document = JsonDocument.Parse(response.ContentStream); + DevTestLabFormulaData data = DevTestLabFormulaData.DeserializeDevTestLabFormulaData(document.RootElement, ModelSerializationExtensions.WireOptions); return new DevTestLabFormulaResource(_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, AzureResourceManagerDevTestLabsContext.Default); - return await Task.FromResult(new DevTestLabFormulaResource(_client, data)).ConfigureAwait(false); + using JsonDocument document = await JsonDocument.ParseAsync(response.ContentStream, default, cancellationToken).ConfigureAwait(false); + DevTestLabFormulaData data = DevTestLabFormulaData.DeserializeDevTestLabFormulaData(document.RootElement, ModelSerializationExtensions.WireOptions); + return new DevTestLabFormulaResource(_client, data); } } } diff --git a/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/LongRunningOperation/DevTestLabOperationSource.cs b/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/LongRunningOperation/DevTestLabOperationSource.cs index deca4deec2fb..63c0e5ea736f 100644 --- a/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/LongRunningOperation/DevTestLabOperationSource.cs +++ b/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/LongRunningOperation/DevTestLabOperationSource.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.DevTestLabs { - internal class DevTestLabOperationSource : IOperationSource + /// + internal partial class DevTestLabOperationSource : IOperationSource { private readonly ArmClient _client; + /// + /// internal DevTestLabOperationSource(ArmClient client) { _client = client; } + /// The response from the service. + /// The cancellation token to use. + /// DevTestLabResource IOperationSource.CreateResult(Response response, CancellationToken cancellationToken) { - var data = ModelReaderWriter.Read(response.Content, ModelReaderWriterOptions.Json, AzureResourceManagerDevTestLabsContext.Default); + using JsonDocument document = JsonDocument.Parse(response.ContentStream); + DevTestLabData data = DevTestLabData.DeserializeDevTestLabData(document.RootElement, ModelSerializationExtensions.WireOptions); return new DevTestLabResource(_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, AzureResourceManagerDevTestLabsContext.Default); - return await Task.FromResult(new DevTestLabResource(_client, data)).ConfigureAwait(false); + using JsonDocument document = await JsonDocument.ParseAsync(response.ContentStream, default, cancellationToken).ConfigureAwait(false); + DevTestLabData data = DevTestLabData.DeserializeDevTestLabData(document.RootElement, ModelSerializationExtensions.WireOptions); + return new DevTestLabResource(_client, data); } } } diff --git a/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/LongRunningOperation/DevTestLabSecretOperationSource.cs b/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/LongRunningOperation/DevTestLabSecretOperationSource.cs index f29b0d533894..9643bbead022 100644 --- a/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/LongRunningOperation/DevTestLabSecretOperationSource.cs +++ b/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/LongRunningOperation/DevTestLabSecretOperationSource.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.DevTestLabs { - internal class DevTestLabSecretOperationSource : IOperationSource + /// + internal partial class DevTestLabSecretOperationSource : IOperationSource { private readonly ArmClient _client; + /// + /// internal DevTestLabSecretOperationSource(ArmClient client) { _client = client; } + /// The response from the service. + /// The cancellation token to use. + /// DevTestLabSecretResource IOperationSource.CreateResult(Response response, CancellationToken cancellationToken) { - var data = ModelReaderWriter.Read(response.Content, ModelReaderWriterOptions.Json, AzureResourceManagerDevTestLabsContext.Default); + using JsonDocument document = JsonDocument.Parse(response.ContentStream); + DevTestLabSecretData data = DevTestLabSecretData.DeserializeDevTestLabSecretData(document.RootElement, ModelSerializationExtensions.WireOptions); return new DevTestLabSecretResource(_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, AzureResourceManagerDevTestLabsContext.Default); - return await Task.FromResult(new DevTestLabSecretResource(_client, data)).ConfigureAwait(false); + using JsonDocument document = await JsonDocument.ParseAsync(response.ContentStream, default, cancellationToken).ConfigureAwait(false); + DevTestLabSecretData data = DevTestLabSecretData.DeserializeDevTestLabSecretData(document.RootElement, ModelSerializationExtensions.WireOptions); + return new DevTestLabSecretResource(_client, data); } } } diff --git a/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/LongRunningOperation/DevTestLabServiceFabricOperationSource.cs b/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/LongRunningOperation/DevTestLabServiceFabricOperationSource.cs index 2c48d1c391d5..21f755f7b1fa 100644 --- a/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/LongRunningOperation/DevTestLabServiceFabricOperationSource.cs +++ b/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/LongRunningOperation/DevTestLabServiceFabricOperationSource.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.DevTestLabs { - internal class DevTestLabServiceFabricOperationSource : IOperationSource + /// + internal partial class DevTestLabServiceFabricOperationSource : IOperationSource { private readonly ArmClient _client; + /// + /// internal DevTestLabServiceFabricOperationSource(ArmClient client) { _client = client; } + /// The response from the service. + /// The cancellation token to use. + /// DevTestLabServiceFabricResource IOperationSource.CreateResult(Response response, CancellationToken cancellationToken) { - var data = ModelReaderWriter.Read(response.Content, ModelReaderWriterOptions.Json, AzureResourceManagerDevTestLabsContext.Default); + using JsonDocument document = JsonDocument.Parse(response.ContentStream); + DevTestLabServiceFabricData data = DevTestLabServiceFabricData.DeserializeDevTestLabServiceFabricData(document.RootElement, ModelSerializationExtensions.WireOptions); return new DevTestLabServiceFabricResource(_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, AzureResourceManagerDevTestLabsContext.Default); - return await Task.FromResult(new DevTestLabServiceFabricResource(_client, data)).ConfigureAwait(false); + using JsonDocument document = await JsonDocument.ParseAsync(response.ContentStream, default, cancellationToken).ConfigureAwait(false); + DevTestLabServiceFabricData data = DevTestLabServiceFabricData.DeserializeDevTestLabServiceFabricData(document.RootElement, ModelSerializationExtensions.WireOptions); + return new DevTestLabServiceFabricResource(_client, data); } } } diff --git a/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/LongRunningOperation/DevTestLabUserOperationSource.cs b/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/LongRunningOperation/DevTestLabUserOperationSource.cs index 88363427004d..01442d483013 100644 --- a/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/LongRunningOperation/DevTestLabUserOperationSource.cs +++ b/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/LongRunningOperation/DevTestLabUserOperationSource.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.DevTestLabs { - internal class DevTestLabUserOperationSource : IOperationSource + /// + internal partial class DevTestLabUserOperationSource : IOperationSource { private readonly ArmClient _client; + /// + /// internal DevTestLabUserOperationSource(ArmClient client) { _client = client; } + /// The response from the service. + /// The cancellation token to use. + /// DevTestLabUserResource IOperationSource.CreateResult(Response response, CancellationToken cancellationToken) { - var data = ModelReaderWriter.Read(response.Content, ModelReaderWriterOptions.Json, AzureResourceManagerDevTestLabsContext.Default); + using JsonDocument document = JsonDocument.Parse(response.ContentStream); + DevTestLabUserData data = DevTestLabUserData.DeserializeDevTestLabUserData(document.RootElement, ModelSerializationExtensions.WireOptions); return new DevTestLabUserResource(_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, AzureResourceManagerDevTestLabsContext.Default); - return await Task.FromResult(new DevTestLabUserResource(_client, data)).ConfigureAwait(false); + using JsonDocument document = await JsonDocument.ParseAsync(response.ContentStream, default, cancellationToken).ConfigureAwait(false); + DevTestLabUserData data = DevTestLabUserData.DeserializeDevTestLabUserData(document.RootElement, ModelSerializationExtensions.WireOptions); + return new DevTestLabUserResource(_client, data); } } } diff --git a/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/LongRunningOperation/DevTestLabVirtualNetworkOperationSource.cs b/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/LongRunningOperation/DevTestLabVirtualNetworkOperationSource.cs index 931e7535f04d..b98a03926dbc 100644 --- a/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/LongRunningOperation/DevTestLabVirtualNetworkOperationSource.cs +++ b/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/LongRunningOperation/DevTestLabVirtualNetworkOperationSource.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.DevTestLabs { - internal class DevTestLabVirtualNetworkOperationSource : IOperationSource + /// + internal partial class DevTestLabVirtualNetworkOperationSource : IOperationSource { private readonly ArmClient _client; + /// + /// internal DevTestLabVirtualNetworkOperationSource(ArmClient client) { _client = client; } + /// The response from the service. + /// The cancellation token to use. + /// DevTestLabVirtualNetworkResource IOperationSource.CreateResult(Response response, CancellationToken cancellationToken) { - var data = ModelReaderWriter.Read(response.Content, ModelReaderWriterOptions.Json, AzureResourceManagerDevTestLabsContext.Default); + using JsonDocument document = JsonDocument.Parse(response.ContentStream); + DevTestLabVirtualNetworkData data = DevTestLabVirtualNetworkData.DeserializeDevTestLabVirtualNetworkData(document.RootElement, ModelSerializationExtensions.WireOptions); return new DevTestLabVirtualNetworkResource(_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, AzureResourceManagerDevTestLabsContext.Default); - return await Task.FromResult(new DevTestLabVirtualNetworkResource(_client, data)).ConfigureAwait(false); + using JsonDocument document = await JsonDocument.ParseAsync(response.ContentStream, default, cancellationToken).ConfigureAwait(false); + DevTestLabVirtualNetworkData data = DevTestLabVirtualNetworkData.DeserializeDevTestLabVirtualNetworkData(document.RootElement, ModelSerializationExtensions.WireOptions); + return new DevTestLabVirtualNetworkResource(_client, data); } } } diff --git a/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/LongRunningOperation/DevTestLabVmOperationSource.cs b/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/LongRunningOperation/DevTestLabVmOperationSource.cs index bc7f137fa3c1..e57c0aa02a67 100644 --- a/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/LongRunningOperation/DevTestLabVmOperationSource.cs +++ b/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/LongRunningOperation/DevTestLabVmOperationSource.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.DevTestLabs { - internal class DevTestLabVmOperationSource : IOperationSource + /// + internal partial class DevTestLabVmOperationSource : IOperationSource { private readonly ArmClient _client; + /// + /// internal DevTestLabVmOperationSource(ArmClient client) { _client = client; } + /// The response from the service. + /// The cancellation token to use. + /// DevTestLabVmResource IOperationSource.CreateResult(Response response, CancellationToken cancellationToken) { - var data = ModelReaderWriter.Read(response.Content, ModelReaderWriterOptions.Json, AzureResourceManagerDevTestLabsContext.Default); + using JsonDocument document = JsonDocument.Parse(response.ContentStream); + DevTestLabVmData data = DevTestLabVmData.DeserializeDevTestLabVmData(document.RootElement, ModelSerializationExtensions.WireOptions); return new DevTestLabVmResource(_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, AzureResourceManagerDevTestLabsContext.Default); - return await Task.FromResult(new DevTestLabVmResource(_client, data)).ConfigureAwait(false); + using JsonDocument document = await JsonDocument.ParseAsync(response.ContentStream, default, cancellationToken).ConfigureAwait(false); + DevTestLabVmData data = DevTestLabVmData.DeserializeDevTestLabVmData(document.RootElement, ModelSerializationExtensions.WireOptions); + return new DevTestLabVmResource(_client, data); } } } diff --git a/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/LongRunningOperation/DevTestLabsArmOperation.cs b/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/LongRunningOperation/DevTestLabsArmOperation.cs index 179543e70594..9ecd7cc2a035 100644 --- a/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/LongRunningOperation/DevTestLabsArmOperation.cs +++ b/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/LongRunningOperation/DevTestLabsArmOperation.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.DevTestLabs { -#pragma warning disable SA1649 // File name should match first type name - internal class DevTestLabsArmOperation : ArmOperation -#pragma warning restore SA1649 // File name should match first type name + internal partial class DevTestLabsArmOperation : ArmOperation { private readonly OperationInternal _operation; private readonly RehydrationToken? _completeRehydrationToken; @@ -29,6 +27,9 @@ protected DevTestLabsArmOperation() { } + /// + /// The operation response. + /// The token to rehydrate the operation. internal DevTestLabsArmOperation(Response response, RehydrationToken? rehydrationToken = null) { _operation = OperationInternal.Succeeded(response); @@ -36,12 +37,20 @@ internal DevTestLabsArmOperation(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 DevTestLabsArmOperation(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 DevTestLabsArmOperation(ClientDiagnostics clientDiagnostics, HttpPipeli _completeRehydrationToken = NextLinkOperationImplementation.GetRehydrationToken(request.Method, request.Uri.ToUri(), response, finalStateVia); _operationId = GetOperationId(_completeRehydrationToken); } - _operation = new OperationInternal(nextLinkOperation, clientDiagnostics, response, "DevTestLabsArmOperation", fallbackStrategy: new SequentialDelayStrategy()); + _operation = new OperationInternal( + nextLinkOperation, + clientDiagnostics, + response, + "DevTestLabsArmOperation", + 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, AzureResourceManagerDevTestLabsContext.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/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/LongRunningOperation/DevTestLabsArmOperationOfT.cs b/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/LongRunningOperation/DevTestLabsArmOperationOfT.cs index b567a3dc16db..5c8a5b17ae06 100644 --- a/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/LongRunningOperation/DevTestLabsArmOperationOfT.cs +++ b/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/LongRunningOperation/DevTestLabsArmOperationOfT.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.DevTestLabs { -#pragma warning disable SA1649 // File name should match first type name - internal class DevTestLabsArmOperation : ArmOperation -#pragma warning restore SA1649 // File name should match first type name + internal partial class DevTestLabsArmOperation : ArmOperation { private readonly OperationInternal _operation; private readonly RehydrationToken? _completeRehydrationToken; @@ -29,6 +27,9 @@ protected DevTestLabsArmOperation() { } + /// + /// The operation response. + /// The token to rehydrate the operation. internal DevTestLabsArmOperation(Response response, RehydrationToken? rehydrationToken = null) { _operation = OperationInternal.Succeeded(response.GetRawResponse(), response.Value); @@ -36,12 +37,21 @@ internal DevTestLabsArmOperation(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 DevTestLabsArmOperation(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 DevTestLabsArmOperation(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, "DevTestLabsArmOperation", fallbackStrategy: new SequentialDelayStrategy()); + _operation = new OperationInternal( + NextLinkOperationImplementation.Create(source, nextLinkOperation), + clientDiagnostics, + response, + "DevTestLabsArmOperation", + null, + new SequentialDelayStrategy()); } - private string GetOperationId(RehydrationToken? rehydrationToken) - { - if (rehydrationToken is null) - { - return null; - } - var data = ModelReaderWriter.Write(rehydrationToken, ModelReaderWriterOptions.Json, AzureResourceManagerDevTestLabsContext.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/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/Models/ApplicableScheduleProperties.Serialization.cs b/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/Models/ApplicableScheduleProperties.Serialization.cs new file mode 100644 index 000000000000..c3165812d93c --- /dev/null +++ b/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/Models/ApplicableScheduleProperties.Serialization.cs @@ -0,0 +1,160 @@ +// 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.DevTestLabs; + +namespace Azure.ResourceManager.DevTestLabs.Models +{ + /// Properties of a schedules applicable to a virtual machine. + internal partial class ApplicableScheduleProperties : IJsonModel + { + /// The data to parse. + /// The client options for reading and writing models. + protected virtual ApplicableScheduleProperties 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 DeserializeApplicableScheduleProperties(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(ApplicableScheduleProperties)} does not support reading '{options.Format}' format."); + } + } + + /// 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(ApplicableScheduleProperties)} does not support writing '{format}' format."); + } + if (Optional.IsDefined(LabVmsShutdown)) + { + writer.WritePropertyName("labVmsShutdown"u8); + writer.WriteObjectValue(LabVmsShutdown, options); + } + if (Optional.IsDefined(LabVmsStartup)) + { + writer.WritePropertyName("labVmsStartup"u8); + writer.WriteObjectValue(LabVmsStartup, options); + } + 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. + ApplicableScheduleProperties IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) => JsonModelCreateCore(ref reader, options); + + /// The JSON reader. + /// The client options for reading and writing models. + protected virtual ApplicableScheduleProperties 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(ApplicableScheduleProperties)} does not support reading '{format}' format."); + } + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeApplicableScheduleProperties(document.RootElement, options); + } + + /// The JSON element to deserialize. + /// The client options for reading and writing models. + internal static ApplicableScheduleProperties DeserializeApplicableScheduleProperties(JsonElement element, ModelReaderWriterOptions options) + { + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + DevTestLabScheduleData labVmsShutdown = default; + DevTestLabScheduleData labVmsStartup = default; + IDictionary additionalBinaryDataProperties = new ChangeTrackingDictionary(); + foreach (var prop in element.EnumerateObject()) + { + if (prop.NameEquals("labVmsShutdown"u8)) + { + if (prop.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + labVmsShutdown = DevTestLabScheduleData.DeserializeDevTestLabScheduleData(prop.Value, options); + continue; + } + if (prop.NameEquals("labVmsStartup"u8)) + { + if (prop.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + labVmsStartup = DevTestLabScheduleData.DeserializeDevTestLabScheduleData(prop.Value, options); + continue; + } + if (options.Format != "W") + { + additionalBinaryDataProperties.Add(prop.Name, BinaryData.FromString(prop.Value.GetRawText())); + } + } + return new ApplicableScheduleProperties(labVmsShutdown, labVmsStartup, 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, AzureResourceManagerDevTestLabsContext.Default); + default: + throw new FormatException($"The model {nameof(ApplicableScheduleProperties)} does not support writing '{options.Format}' format."); + } + } + + /// The data to parse. + /// The client options for reading and writing models. + ApplicableScheduleProperties IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) => PersistableModelCreateCore(data, options); + + /// The client options for reading and writing models. + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + } +} diff --git a/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/Models/ApplicableScheduleProperties.cs b/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/Models/ApplicableScheduleProperties.cs new file mode 100644 index 000000000000..924b8f49600a --- /dev/null +++ b/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/Models/ApplicableScheduleProperties.cs @@ -0,0 +1,42 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; +using Azure.ResourceManager.DevTestLabs; + +namespace Azure.ResourceManager.DevTestLabs.Models +{ + /// Properties of a schedules applicable to a virtual machine. + internal partial class ApplicableScheduleProperties + { + /// Keeps track of any properties unknown to the library. + private protected readonly IDictionary _additionalBinaryDataProperties; + + /// Initializes a new instance of . + public ApplicableScheduleProperties() + { + } + + /// Initializes a new instance of . + /// The auto-shutdown schedule, if one has been set at the lab or lab resource level. + /// The auto-startup schedule, if one has been set at the lab or lab resource level. + /// Keeps track of any properties unknown to the library. + internal ApplicableScheduleProperties(DevTestLabScheduleData labVmsShutdown, DevTestLabScheduleData labVmsStartup, IDictionary additionalBinaryDataProperties) + { + LabVmsShutdown = labVmsShutdown; + LabVmsStartup = labVmsStartup; + _additionalBinaryDataProperties = additionalBinaryDataProperties; + } + + /// The auto-shutdown schedule, if one has been set at the lab or lab resource level. + public DevTestLabScheduleData LabVmsShutdown { get; set; } + + /// The auto-startup schedule, if one has been set at the lab or lab resource level. + public DevTestLabScheduleData LabVmsStartup { get; set; } + } +} diff --git a/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/Models/ArmTemplateList.Serialization.cs b/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/Models/ArmTemplateList.Serialization.cs index e127960fa80e..4d1574e3bcdf 100644 --- a/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/Models/ArmTemplateList.Serialization.cs +++ b/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/Models/ArmTemplateList.Serialization.cs @@ -9,14 +9,45 @@ using System.ClientModel.Primitives; using System.Collections.Generic; using System.Text.Json; -using Azure.Core; +using Azure; +using Azure.ResourceManager.DevTestLabs; namespace Azure.ResourceManager.DevTestLabs.Models { - internal partial class ArmTemplateList : IUtf8JsonSerializable, IJsonModel + /// The response of a list operation. + internal partial class ArmTemplateList : IJsonModel { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + /// Initializes a new instance of for deserialization. + internal ArmTemplateList() + { + } + /// The data to parse. + /// The client options for reading and writing models. + protected virtual ArmTemplateList 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 DeserializeArmTemplateList(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(ArmTemplateList)} does not support reading '{options.Format}' format."); + } + } + + /// The to deserialize the from. + internal static ArmTemplateList FromResponse(Response response) + { + using JsonDocument document = JsonDocument.Parse(response.Content, ModelSerializationExtensions.JsonDocumentOptions); + return DeserializeArmTemplateList(document.RootElement, ModelSerializationExtensions.WireOptions); + } + + /// The JSON writer. + /// The client options for reading and writing models. void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) { writer.WriteStartObject(); @@ -28,36 +59,32 @@ void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterO /// 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(ArmTemplateList)} does not support writing '{format}' format."); } - - if (Optional.IsCollectionDefined(Value)) + writer.WritePropertyName("value"u8); + writer.WriteStartArray(); + foreach (DevTestLabArmTemplateData item in Value) { - writer.WritePropertyName("value"u8); - writer.WriteStartArray(); - foreach (var item in Value) - { - writer.WriteObjectValue(item, options); - } - writer.WriteEndArray(); + writer.WriteObjectValue(item, options); } + writer.WriteEndArray(); if (Optional.IsDefined(NextLink)) { writer.WritePropertyName("nextLink"u8); - writer.WriteStringValue(NextLink); + 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); } @@ -66,64 +93,70 @@ protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWrit } } - ArmTemplateList IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + /// The JSON reader. + /// The client options for reading and writing models. + ArmTemplateList IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) => JsonModelCreateCore(ref reader, options); + + /// The JSON reader. + /// The client options for reading and writing models. + protected virtual ArmTemplateList 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(ArmTemplateList)} does not support reading '{format}' format."); } - using JsonDocument document = JsonDocument.ParseValue(ref reader); return DeserializeArmTemplateList(document.RootElement, options); } - internal static ArmTemplateList DeserializeArmTemplateList(JsonElement element, ModelReaderWriterOptions options = null) + /// The JSON element to deserialize. + /// The client options for reading and writing models. + internal static ArmTemplateList DeserializeArmTemplateList(JsonElement element, ModelReaderWriterOptions options) { - options ??= ModelSerializationExtensions.WireOptions; - if (element.ValueKind == JsonValueKind.Null) { return null; } - IReadOnlyList value = default; - string nextLink = default; - IDictionary serializedAdditionalRawData = default; - Dictionary rawDataDictionary = new Dictionary(); - foreach (var property in element.EnumerateObject()) + IList value = default; + Uri nextLink = default; + IDictionary additionalBinaryDataProperties = new ChangeTrackingDictionary(); + foreach (var prop in element.EnumerateObject()) { - if (property.NameEquals("value"u8)) + if (prop.NameEquals("value"u8)) { - if (property.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(DevTestLabArmTemplateData.DeserializeDevTestLabArmTemplateData(item, options)); } value = array; continue; } - if (property.NameEquals("nextLink"u8)) + if (prop.NameEquals("nextLink"u8)) { - nextLink = property.Value.GetString(); + if (prop.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + nextLink = string.IsNullOrEmpty(prop.Value.GetString()) ? null : 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 ArmTemplateList(value ?? new ChangeTrackingList(), nextLink, serializedAdditionalRawData); + return new ArmTemplateList(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": @@ -133,22 +166,11 @@ BinaryData IPersistableModel.Write(ModelReaderWriterOptions opt } } - ArmTemplateList 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 DeserializeArmTemplateList(document.RootElement, options); - } - default: - throw new FormatException($"The model {nameof(ArmTemplateList)} does not support reading '{options.Format}' format."); - } - } + /// The data to parse. + /// The client options for reading and writing models. + ArmTemplateList IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) => PersistableModelCreateCore(data, options); + /// The client options for reading and writing models. string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; } } diff --git a/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/Models/ArmTemplateList.cs b/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/Models/ArmTemplateList.cs index 982136e39329..b24df634714c 100644 --- a/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/Models/ArmTemplateList.cs +++ b/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/Models/ArmTemplateList.cs @@ -7,64 +7,39 @@ using System; using System.Collections.Generic; +using System.Linq; +using Azure.ResourceManager.DevTestLabs; namespace Azure.ResourceManager.DevTestLabs.Models { /// The response of a list operation. internal partial class ArmTemplateList { - /// - /// 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 ArmTemplateList() + /// The ArmTemplate items on this page. + internal ArmTemplateList(IEnumerable value) { - Value = new ChangeTrackingList(); + Value = value.ToList(); } /// Initializes a new instance of . - /// Results of the list operation. - /// Link for next set of results. - /// Keeps track of any properties unknown to the library. - internal ArmTemplateList(IReadOnlyList value, string nextLink, IDictionary serializedAdditionalRawData) + /// The ArmTemplate items on this page. + /// The link to the next page of items. + /// Keeps track of any properties unknown to the library. + internal ArmTemplateList(IList value, Uri nextLink, IDictionary additionalBinaryDataProperties) { Value = value; NextLink = nextLink; - _serializedAdditionalRawData = serializedAdditionalRawData; + _additionalBinaryDataProperties = additionalBinaryDataProperties; } - /// Results of the list operation. - public IReadOnlyList Value { get; } - /// Link for next set of results. - public string NextLink { get; } + /// The ArmTemplate items on this page. + public IList Value { get; } + + /// The link to the next page of items. + public Uri NextLink { get; } } } diff --git a/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/Models/ArmTemplateProperties.Serialization.cs b/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/Models/ArmTemplateProperties.Serialization.cs new file mode 100644 index 000000000000..18f5ca2f0310 --- /dev/null +++ b/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/Models/ArmTemplateProperties.Serialization.cs @@ -0,0 +1,260 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Text.Json; +using Azure.ResourceManager.DevTestLabs; + +namespace Azure.ResourceManager.DevTestLabs.Models +{ + /// Properties of an Azure Resource Manager template. + internal partial class ArmTemplateProperties : IJsonModel + { + /// The data to parse. + /// The client options for reading and writing models. + protected virtual ArmTemplateProperties 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 DeserializeArmTemplateProperties(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(ArmTemplateProperties)} does not support reading '{options.Format}' format."); + } + } + + /// 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(ArmTemplateProperties)} does not support writing '{format}' format."); + } + if (options.Format != "W" && Optional.IsDefined(DisplayName)) + { + writer.WritePropertyName("displayName"u8); + writer.WriteStringValue(DisplayName); + } + if (options.Format != "W" && Optional.IsDefined(Description)) + { + writer.WritePropertyName("description"u8); + writer.WriteStringValue(Description); + } + if (options.Format != "W" && Optional.IsDefined(Publisher)) + { + writer.WritePropertyName("publisher"u8); + writer.WriteStringValue(Publisher); + } + if (options.Format != "W" && Optional.IsDefined(Icon)) + { + writer.WritePropertyName("icon"u8); + writer.WriteStringValue(Icon); + } + if (options.Format != "W" && Optional.IsDefined(Contents)) + { + writer.WritePropertyName("contents"u8); +#if NET6_0_OR_GREATER + writer.WriteRawValue(Contents); +#else + using (JsonDocument document = JsonDocument.Parse(Contents)) + { + JsonSerializer.Serialize(writer, document.RootElement); + } +#endif + } + if (options.Format != "W" && Optional.IsDefined(CreatedOn)) + { + writer.WritePropertyName("createdDate"u8); + writer.WriteStringValue(CreatedOn.Value, "O"); + } + if (options.Format != "W" && Optional.IsCollectionDefined(ParametersValueFilesInfo)) + { + writer.WritePropertyName("parametersValueFilesInfo"u8); + writer.WriteStartArray(); + foreach (DevTestLabParametersValueFileInfo item in ParametersValueFilesInfo) + { + writer.WriteObjectValue(item, options); + } + writer.WriteEndArray(); + } + if (options.Format != "W" && Optional.IsDefined(IsEnabled)) + { + writer.WritePropertyName("enabled"u8); + writer.WriteBooleanValue(IsEnabled.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. + ArmTemplateProperties IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) => JsonModelCreateCore(ref reader, options); + + /// The JSON reader. + /// The client options for reading and writing models. + protected virtual ArmTemplateProperties 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(ArmTemplateProperties)} does not support reading '{format}' format."); + } + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeArmTemplateProperties(document.RootElement, options); + } + + /// The JSON element to deserialize. + /// The client options for reading and writing models. + internal static ArmTemplateProperties DeserializeArmTemplateProperties(JsonElement element, ModelReaderWriterOptions options) + { + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + string displayName = default; + string description = default; + string publisher = default; + string icon = default; + BinaryData contents = default; + DateTimeOffset? createdOn = default; + IReadOnlyList parametersValueFilesInfo = default; + bool? isEnabled = default; + IDictionary additionalBinaryDataProperties = new ChangeTrackingDictionary(); + foreach (var prop in element.EnumerateObject()) + { + if (prop.NameEquals("displayName"u8)) + { + displayName = prop.Value.GetString(); + continue; + } + if (prop.NameEquals("description"u8)) + { + description = prop.Value.GetString(); + continue; + } + if (prop.NameEquals("publisher"u8)) + { + publisher = prop.Value.GetString(); + continue; + } + if (prop.NameEquals("icon"u8)) + { + icon = prop.Value.GetString(); + continue; + } + if (prop.NameEquals("contents"u8)) + { + if (prop.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + contents = BinaryData.FromString(prop.Value.GetRawText()); + continue; + } + if (prop.NameEquals("createdDate"u8)) + { + if (prop.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + createdOn = prop.Value.GetDateTimeOffset("O"); + continue; + } + if (prop.NameEquals("parametersValueFilesInfo"u8)) + { + if (prop.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + List array = new List(); + foreach (var item in prop.Value.EnumerateArray()) + { + array.Add(DevTestLabParametersValueFileInfo.DeserializeDevTestLabParametersValueFileInfo(item, options)); + } + parametersValueFilesInfo = array; + continue; + } + if (prop.NameEquals("enabled"u8)) + { + if (prop.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + isEnabled = prop.Value.GetBoolean(); + continue; + } + if (options.Format != "W") + { + additionalBinaryDataProperties.Add(prop.Name, BinaryData.FromString(prop.Value.GetRawText())); + } + } + return new ArmTemplateProperties( + displayName, + description, + publisher, + icon, + contents, + createdOn, + parametersValueFilesInfo ?? new ChangeTrackingList(), + isEnabled, + 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, AzureResourceManagerDevTestLabsContext.Default); + default: + throw new FormatException($"The model {nameof(ArmTemplateProperties)} does not support writing '{options.Format}' format."); + } + } + + /// The data to parse. + /// The client options for reading and writing models. + ArmTemplateProperties IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) => PersistableModelCreateCore(data, options); + + /// The client options for reading and writing models. + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + } +} diff --git a/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/Models/ArmTemplateProperties.cs b/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/Models/ArmTemplateProperties.cs new file mode 100644 index 000000000000..3bdd9507f1e9 --- /dev/null +++ b/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/Models/ArmTemplateProperties.cs @@ -0,0 +1,99 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; +using System.Text.Json; +using Azure.ResourceManager.DevTestLabs; + +namespace Azure.ResourceManager.DevTestLabs.Models +{ + /// Properties of an Azure Resource Manager template. + internal partial class ArmTemplateProperties + { + /// Keeps track of any properties unknown to the library. + private protected readonly IDictionary _additionalBinaryDataProperties; + + /// Initializes a new instance of . + internal ArmTemplateProperties() + { + ParametersValueFilesInfo = new ChangeTrackingList(); + } + + /// Initializes a new instance of . + /// The display name of the ARM template. + /// The description of the ARM template. + /// The publisher of the ARM template. + /// The URI to the icon of the ARM template. + /// The contents of the ARM template. + /// The creation date of the armTemplate. + /// File name and parameter values information from all azuredeploy.*.parameters.json for the ARM template. + /// Whether or not ARM template is enabled for use by lab user. + /// Keeps track of any properties unknown to the library. + internal ArmTemplateProperties(string displayName, string description, string publisher, string icon, BinaryData contents, DateTimeOffset? createdOn, IReadOnlyList parametersValueFilesInfo, bool? isEnabled, IDictionary additionalBinaryDataProperties) + { + DisplayName = displayName; + Description = description; + Publisher = publisher; + Icon = icon; + Contents = contents; + CreatedOn = createdOn; + ParametersValueFilesInfo = parametersValueFilesInfo; + IsEnabled = isEnabled; + _additionalBinaryDataProperties = additionalBinaryDataProperties; + } + + /// The display name of the ARM template. + public string DisplayName { get; } + + /// The description of the ARM template. + public string Description { get; } + + /// The publisher of the ARM template. + public string Publisher { get; } + + /// The URI to the icon of the ARM template. + public string Icon { get; } + + /// + /// The contents of the ARM template. + /// To assign an object to 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" }. + /// + /// + /// + /// + public BinaryData Contents { get; } + + /// The creation date of the armTemplate. + public DateTimeOffset? CreatedOn { get; } + + /// File name and parameter values information from all azuredeploy.*.parameters.json for the ARM template. + public IReadOnlyList ParametersValueFilesInfo { get; } = new ChangeTrackingList(); + + /// Whether or not ARM template is enabled for use by lab user. + public bool? IsEnabled { get; } + } +} diff --git a/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/Models/ArtifactList.Serialization.cs b/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/Models/ArtifactList.Serialization.cs index d594832843d4..c748ed20e60d 100644 --- a/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/Models/ArtifactList.Serialization.cs +++ b/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/Models/ArtifactList.Serialization.cs @@ -9,14 +9,45 @@ using System.ClientModel.Primitives; using System.Collections.Generic; using System.Text.Json; -using Azure.Core; +using Azure; +using Azure.ResourceManager.DevTestLabs; namespace Azure.ResourceManager.DevTestLabs.Models { - internal partial class ArtifactList : IUtf8JsonSerializable, IJsonModel + /// The response of a list operation. + internal partial class ArtifactList : IJsonModel { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + /// Initializes a new instance of for deserialization. + internal ArtifactList() + { + } + /// The data to parse. + /// The client options for reading and writing models. + protected virtual ArtifactList 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 DeserializeArtifactList(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(ArtifactList)} does not support reading '{options.Format}' format."); + } + } + + /// The to deserialize the from. + internal static ArtifactList FromResponse(Response response) + { + using JsonDocument document = JsonDocument.Parse(response.Content, ModelSerializationExtensions.JsonDocumentOptions); + return DeserializeArtifactList(document.RootElement, ModelSerializationExtensions.WireOptions); + } + + /// The JSON writer. + /// The client options for reading and writing models. void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) { writer.WriteStartObject(); @@ -28,36 +59,32 @@ void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOpti /// 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(ArtifactList)} does not support writing '{format}' format."); } - - if (Optional.IsCollectionDefined(Value)) + writer.WritePropertyName("value"u8); + writer.WriteStartArray(); + foreach (DevTestLabArtifactData item in Value) { - writer.WritePropertyName("value"u8); - writer.WriteStartArray(); - foreach (var item in Value) - { - writer.WriteObjectValue(item, options); - } - writer.WriteEndArray(); + writer.WriteObjectValue(item, options); } + writer.WriteEndArray(); if (Optional.IsDefined(NextLink)) { writer.WritePropertyName("nextLink"u8); - writer.WriteStringValue(NextLink); + 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); } @@ -66,64 +93,70 @@ protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWrit } } - ArtifactList IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + /// The JSON reader. + /// The client options for reading and writing models. + ArtifactList IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) => JsonModelCreateCore(ref reader, options); + + /// The JSON reader. + /// The client options for reading and writing models. + protected virtual ArtifactList 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(ArtifactList)} does not support reading '{format}' format."); } - using JsonDocument document = JsonDocument.ParseValue(ref reader); return DeserializeArtifactList(document.RootElement, options); } - internal static ArtifactList DeserializeArtifactList(JsonElement element, ModelReaderWriterOptions options = null) + /// The JSON element to deserialize. + /// The client options for reading and writing models. + internal static ArtifactList DeserializeArtifactList(JsonElement element, ModelReaderWriterOptions options) { - options ??= ModelSerializationExtensions.WireOptions; - if (element.ValueKind == JsonValueKind.Null) { return null; } - IReadOnlyList value = default; - string nextLink = default; - IDictionary serializedAdditionalRawData = default; - Dictionary rawDataDictionary = new Dictionary(); - foreach (var property in element.EnumerateObject()) + IList value = default; + Uri nextLink = default; + IDictionary additionalBinaryDataProperties = new ChangeTrackingDictionary(); + foreach (var prop in element.EnumerateObject()) { - if (property.NameEquals("value"u8)) + if (prop.NameEquals("value"u8)) { - if (property.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(DevTestLabArtifactData.DeserializeDevTestLabArtifactData(item, options)); } value = array; continue; } - if (property.NameEquals("nextLink"u8)) + if (prop.NameEquals("nextLink"u8)) { - nextLink = property.Value.GetString(); + if (prop.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + nextLink = string.IsNullOrEmpty(prop.Value.GetString()) ? null : 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 ArtifactList(value ?? new ChangeTrackingList(), nextLink, serializedAdditionalRawData); + return new ArtifactList(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": @@ -133,22 +166,11 @@ BinaryData IPersistableModel.Write(ModelReaderWriterOptions option } } - ArtifactList 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 DeserializeArtifactList(document.RootElement, options); - } - default: - throw new FormatException($"The model {nameof(ArtifactList)} does not support reading '{options.Format}' format."); - } - } + /// The data to parse. + /// The client options for reading and writing models. + ArtifactList IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) => PersistableModelCreateCore(data, options); + /// The client options for reading and writing models. string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; } } diff --git a/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/Models/ArtifactList.cs b/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/Models/ArtifactList.cs index a07695d4f5f0..e7ec93962e93 100644 --- a/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/Models/ArtifactList.cs +++ b/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/Models/ArtifactList.cs @@ -7,64 +7,39 @@ using System; using System.Collections.Generic; +using System.Linq; +using Azure.ResourceManager.DevTestLabs; namespace Azure.ResourceManager.DevTestLabs.Models { /// The response of a list operation. internal partial class ArtifactList { - /// - /// 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 ArtifactList() + /// The Artifact items on this page. + internal ArtifactList(IEnumerable value) { - Value = new ChangeTrackingList(); + Value = value.ToList(); } /// Initializes a new instance of . - /// Results of the list operation. - /// Link for next set of results. - /// Keeps track of any properties unknown to the library. - internal ArtifactList(IReadOnlyList value, string nextLink, IDictionary serializedAdditionalRawData) + /// The Artifact items on this page. + /// The link to the next page of items. + /// Keeps track of any properties unknown to the library. + internal ArtifactList(IList value, Uri nextLink, IDictionary additionalBinaryDataProperties) { Value = value; NextLink = nextLink; - _serializedAdditionalRawData = serializedAdditionalRawData; + _additionalBinaryDataProperties = additionalBinaryDataProperties; } - /// Results of the list operation. - public IReadOnlyList Value { get; } - /// Link for next set of results. - public string NextLink { get; } + /// The Artifact items on this page. + public IList Value { get; } + + /// The link to the next page of items. + public Uri NextLink { get; } } } diff --git a/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/Models/ArtifactProperties.Serialization.cs b/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/Models/ArtifactProperties.Serialization.cs new file mode 100644 index 000000000000..acc2c7945906 --- /dev/null +++ b/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/Models/ArtifactProperties.Serialization.cs @@ -0,0 +1,242 @@ +// 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.DevTestLabs; + +namespace Azure.ResourceManager.DevTestLabs.Models +{ + /// Properties of an artifact. + internal partial class ArtifactProperties : IJsonModel + { + /// The data to parse. + /// The client options for reading and writing models. + protected virtual ArtifactProperties 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 DeserializeArtifactProperties(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(ArtifactProperties)} does not support reading '{options.Format}' format."); + } + } + + /// 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(ArtifactProperties)} does not support writing '{format}' format."); + } + if (options.Format != "W" && Optional.IsDefined(Title)) + { + writer.WritePropertyName("title"u8); + writer.WriteStringValue(Title); + } + if (options.Format != "W" && Optional.IsDefined(Description)) + { + writer.WritePropertyName("description"u8); + writer.WriteStringValue(Description); + } + if (options.Format != "W" && Optional.IsDefined(Publisher)) + { + writer.WritePropertyName("publisher"u8); + writer.WriteStringValue(Publisher); + } + if (options.Format != "W" && Optional.IsDefined(FilePath)) + { + writer.WritePropertyName("filePath"u8); + writer.WriteStringValue(FilePath); + } + if (options.Format != "W" && Optional.IsDefined(Icon)) + { + writer.WritePropertyName("icon"u8); + writer.WriteStringValue(Icon); + } + if (options.Format != "W" && Optional.IsDefined(TargetOSType)) + { + writer.WritePropertyName("targetOsType"u8); + writer.WriteStringValue(TargetOSType); + } + if (options.Format != "W" && Optional.IsDefined(Parameters)) + { + writer.WritePropertyName("parameters"u8); +#if NET6_0_OR_GREATER + writer.WriteRawValue(Parameters); +#else + using (JsonDocument document = JsonDocument.Parse(Parameters)) + { + JsonSerializer.Serialize(writer, document.RootElement); + } +#endif + } + if (options.Format != "W" && Optional.IsDefined(CreatedOn)) + { + writer.WritePropertyName("createdDate"u8); + writer.WriteStringValue(CreatedOn.Value, "O"); + } + 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. + ArtifactProperties IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) => JsonModelCreateCore(ref reader, options); + + /// The JSON reader. + /// The client options for reading and writing models. + protected virtual ArtifactProperties 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(ArtifactProperties)} does not support reading '{format}' format."); + } + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeArtifactProperties(document.RootElement, options); + } + + /// The JSON element to deserialize. + /// The client options for reading and writing models. + internal static ArtifactProperties DeserializeArtifactProperties(JsonElement element, ModelReaderWriterOptions options) + { + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + string title = default; + string description = default; + string publisher = default; + string filePath = default; + string icon = default; + string targetOSType = default; + BinaryData parameters = default; + DateTimeOffset? createdOn = default; + IDictionary additionalBinaryDataProperties = new ChangeTrackingDictionary(); + foreach (var prop in element.EnumerateObject()) + { + if (prop.NameEquals("title"u8)) + { + title = prop.Value.GetString(); + continue; + } + if (prop.NameEquals("description"u8)) + { + description = prop.Value.GetString(); + continue; + } + if (prop.NameEquals("publisher"u8)) + { + publisher = prop.Value.GetString(); + continue; + } + if (prop.NameEquals("filePath"u8)) + { + filePath = prop.Value.GetString(); + continue; + } + if (prop.NameEquals("icon"u8)) + { + icon = prop.Value.GetString(); + continue; + } + if (prop.NameEquals("targetOsType"u8)) + { + targetOSType = prop.Value.GetString(); + continue; + } + if (prop.NameEquals("parameters"u8)) + { + if (prop.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + parameters = BinaryData.FromString(prop.Value.GetRawText()); + continue; + } + if (prop.NameEquals("createdDate"u8)) + { + if (prop.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + createdOn = prop.Value.GetDateTimeOffset("O"); + continue; + } + if (options.Format != "W") + { + additionalBinaryDataProperties.Add(prop.Name, BinaryData.FromString(prop.Value.GetRawText())); + } + } + return new ArtifactProperties( + title, + description, + publisher, + filePath, + icon, + targetOSType, + parameters, + createdOn, + 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, AzureResourceManagerDevTestLabsContext.Default); + default: + throw new FormatException($"The model {nameof(ArtifactProperties)} does not support writing '{options.Format}' format."); + } + } + + /// The data to parse. + /// The client options for reading and writing models. + ArtifactProperties IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) => PersistableModelCreateCore(data, options); + + /// The client options for reading and writing models. + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + } +} diff --git a/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/Models/ArtifactProperties.cs b/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/Models/ArtifactProperties.cs new file mode 100644 index 000000000000..93f19834f40d --- /dev/null +++ b/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/Models/ArtifactProperties.cs @@ -0,0 +1,97 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; +using System.Text.Json; + +namespace Azure.ResourceManager.DevTestLabs.Models +{ + /// Properties of an artifact. + internal partial class ArtifactProperties + { + /// Keeps track of any properties unknown to the library. + private protected readonly IDictionary _additionalBinaryDataProperties; + + /// Initializes a new instance of . + internal ArtifactProperties() + { + } + + /// Initializes a new instance of . + /// The artifact's title. + /// The artifact's description. + /// The artifact's publisher. + /// The file path to the artifact. + /// The URI to the artifact icon. + /// The artifact's target OS. + /// The artifact's parameters. + /// The artifact's creation date. + /// Keeps track of any properties unknown to the library. + internal ArtifactProperties(string title, string description, string publisher, string filePath, string icon, string targetOSType, BinaryData parameters, DateTimeOffset? createdOn, IDictionary additionalBinaryDataProperties) + { + Title = title; + Description = description; + Publisher = publisher; + FilePath = filePath; + Icon = icon; + TargetOSType = targetOSType; + Parameters = parameters; + CreatedOn = createdOn; + _additionalBinaryDataProperties = additionalBinaryDataProperties; + } + + /// The artifact's title. + public string Title { get; } + + /// The artifact's description. + public string Description { get; } + + /// The artifact's publisher. + public string Publisher { get; } + + /// The file path to the artifact. + public string FilePath { get; } + + /// The URI to the artifact icon. + public string Icon { get; } + + /// The artifact's target OS. + public string TargetOSType { get; } + + /// + /// The artifact's parameters. + /// To assign an object to 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" }. + /// + /// + /// + /// + public BinaryData Parameters { get; } + + /// The artifact's creation date. + public DateTimeOffset? CreatedOn { get; } + } +} diff --git a/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/Models/ArtifactSourceList.Serialization.cs b/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/Models/ArtifactSourceList.Serialization.cs index b5718f63c903..340546f67e4c 100644 --- a/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/Models/ArtifactSourceList.Serialization.cs +++ b/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/Models/ArtifactSourceList.Serialization.cs @@ -9,14 +9,45 @@ using System.ClientModel.Primitives; using System.Collections.Generic; using System.Text.Json; -using Azure.Core; +using Azure; +using Azure.ResourceManager.DevTestLabs; namespace Azure.ResourceManager.DevTestLabs.Models { - internal partial class ArtifactSourceList : IUtf8JsonSerializable, IJsonModel + /// The response of a list operation. + internal partial class ArtifactSourceList : IJsonModel { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + /// Initializes a new instance of for deserialization. + internal ArtifactSourceList() + { + } + /// The data to parse. + /// The client options for reading and writing models. + protected virtual ArtifactSourceList 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 DeserializeArtifactSourceList(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(ArtifactSourceList)} does not support reading '{options.Format}' format."); + } + } + + /// The to deserialize the from. + internal static ArtifactSourceList FromResponse(Response response) + { + using JsonDocument document = JsonDocument.Parse(response.Content, ModelSerializationExtensions.JsonDocumentOptions); + return DeserializeArtifactSourceList(document.RootElement, ModelSerializationExtensions.WireOptions); + } + + /// The JSON writer. + /// The client options for reading and writing models. void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) { writer.WriteStartObject(); @@ -28,36 +59,32 @@ void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWrit /// 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(ArtifactSourceList)} does not support writing '{format}' format."); } - - if (Optional.IsCollectionDefined(Value)) + writer.WritePropertyName("value"u8); + writer.WriteStartArray(); + foreach (DevTestLabArtifactSourceData item in Value) { - writer.WritePropertyName("value"u8); - writer.WriteStartArray(); - foreach (var item in Value) - { - writer.WriteObjectValue(item, options); - } - writer.WriteEndArray(); + writer.WriteObjectValue(item, options); } + writer.WriteEndArray(); if (Optional.IsDefined(NextLink)) { writer.WritePropertyName("nextLink"u8); - writer.WriteStringValue(NextLink); + 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); } @@ -66,64 +93,70 @@ protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWrit } } - ArtifactSourceList IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + /// The JSON reader. + /// The client options for reading and writing models. + ArtifactSourceList IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) => JsonModelCreateCore(ref reader, options); + + /// The JSON reader. + /// The client options for reading and writing models. + protected virtual ArtifactSourceList 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(ArtifactSourceList)} does not support reading '{format}' format."); } - using JsonDocument document = JsonDocument.ParseValue(ref reader); return DeserializeArtifactSourceList(document.RootElement, options); } - internal static ArtifactSourceList DeserializeArtifactSourceList(JsonElement element, ModelReaderWriterOptions options = null) + /// The JSON element to deserialize. + /// The client options for reading and writing models. + internal static ArtifactSourceList DeserializeArtifactSourceList(JsonElement element, ModelReaderWriterOptions options) { - options ??= ModelSerializationExtensions.WireOptions; - if (element.ValueKind == JsonValueKind.Null) { return null; } - IReadOnlyList value = default; - string nextLink = default; - IDictionary serializedAdditionalRawData = default; - Dictionary rawDataDictionary = new Dictionary(); - foreach (var property in element.EnumerateObject()) + IList value = default; + Uri nextLink = default; + IDictionary additionalBinaryDataProperties = new ChangeTrackingDictionary(); + foreach (var prop in element.EnumerateObject()) { - if (property.NameEquals("value"u8)) + if (prop.NameEquals("value"u8)) { - if (property.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(DevTestLabArtifactSourceData.DeserializeDevTestLabArtifactSourceData(item, options)); } value = array; continue; } - if (property.NameEquals("nextLink"u8)) + if (prop.NameEquals("nextLink"u8)) { - nextLink = property.Value.GetString(); + if (prop.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + nextLink = string.IsNullOrEmpty(prop.Value.GetString()) ? null : 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 ArtifactSourceList(value ?? new ChangeTrackingList(), nextLink, serializedAdditionalRawData); + return new ArtifactSourceList(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": @@ -133,22 +166,11 @@ BinaryData IPersistableModel.Write(ModelReaderWriterOptions } } - ArtifactSourceList 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 DeserializeArtifactSourceList(document.RootElement, options); - } - default: - throw new FormatException($"The model {nameof(ArtifactSourceList)} does not support reading '{options.Format}' format."); - } - } + /// The data to parse. + /// The client options for reading and writing models. + ArtifactSourceList IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) => PersistableModelCreateCore(data, options); + /// The client options for reading and writing models. string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; } } diff --git a/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/Models/ArtifactSourceList.cs b/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/Models/ArtifactSourceList.cs index 9e103338069e..e1ce2160d268 100644 --- a/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/Models/ArtifactSourceList.cs +++ b/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/Models/ArtifactSourceList.cs @@ -7,64 +7,39 @@ using System; using System.Collections.Generic; +using System.Linq; +using Azure.ResourceManager.DevTestLabs; namespace Azure.ResourceManager.DevTestLabs.Models { /// The response of a list operation. internal partial class ArtifactSourceList { - /// - /// 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 ArtifactSourceList() + /// The ArtifactSource items on this page. + internal ArtifactSourceList(IEnumerable value) { - Value = new ChangeTrackingList(); + Value = value.ToList(); } /// Initializes a new instance of . - /// Results of the list operation. - /// Link for next set of results. - /// Keeps track of any properties unknown to the library. - internal ArtifactSourceList(IReadOnlyList value, string nextLink, IDictionary serializedAdditionalRawData) + /// The ArtifactSource items on this page. + /// The link to the next page of items. + /// Keeps track of any properties unknown to the library. + internal ArtifactSourceList(IList value, Uri nextLink, IDictionary additionalBinaryDataProperties) { Value = value; NextLink = nextLink; - _serializedAdditionalRawData = serializedAdditionalRawData; + _additionalBinaryDataProperties = additionalBinaryDataProperties; } - /// Results of the list operation. - public IReadOnlyList Value { get; } - /// Link for next set of results. - public string NextLink { get; } + /// The ArtifactSource items on this page. + public IList Value { get; } + + /// The link to the next page of items. + public Uri NextLink { get; } } } diff --git a/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/Models/ArtifactSourceProperties.Serialization.cs b/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/Models/ArtifactSourceProperties.Serialization.cs new file mode 100644 index 000000000000..75ce20bbd10e --- /dev/null +++ b/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/Models/ArtifactSourceProperties.Serialization.cs @@ -0,0 +1,283 @@ +// 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.DevTestLabs; + +namespace Azure.ResourceManager.DevTestLabs.Models +{ + /// Properties of an artifact source. + internal partial class ArtifactSourceProperties : IJsonModel + { + /// The data to parse. + /// The client options for reading and writing models. + protected virtual ArtifactSourceProperties 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 DeserializeArtifactSourceProperties(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(ArtifactSourceProperties)} does not support reading '{options.Format}' format."); + } + } + + /// 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(ArtifactSourceProperties)} does not support writing '{format}' format."); + } + if (Optional.IsDefined(DisplayName)) + { + writer.WritePropertyName("displayName"u8); + writer.WriteStringValue(DisplayName); + } + if (Optional.IsDefined(Uri)) + { + writer.WritePropertyName("uri"u8); + writer.WriteStringValue(Uri.AbsoluteUri); + } + if (Optional.IsDefined(SourceType)) + { + writer.WritePropertyName("sourceType"u8); + writer.WriteStringValue(SourceType.Value.ToString()); + } + if (Optional.IsDefined(FolderPath)) + { + writer.WritePropertyName("folderPath"u8); + writer.WriteStringValue(FolderPath); + } + if (Optional.IsDefined(ArmTemplateFolderPath)) + { + writer.WritePropertyName("armTemplateFolderPath"u8); + writer.WriteStringValue(ArmTemplateFolderPath); + } + if (Optional.IsDefined(BranchRef)) + { + writer.WritePropertyName("branchRef"u8); + writer.WriteStringValue(BranchRef); + } + if (Optional.IsDefined(SecurityToken)) + { + writer.WritePropertyName("securityToken"u8); + writer.WriteStringValue(SecurityToken); + } + if (Optional.IsDefined(Status)) + { + writer.WritePropertyName("status"u8); + writer.WriteStringValue(Status.Value.ToString()); + } + if (options.Format != "W" && Optional.IsDefined(CreatedOn)) + { + writer.WritePropertyName("createdDate"u8); + writer.WriteStringValue(CreatedOn.Value, "O"); + } + if (options.Format != "W" && Optional.IsDefined(ProvisioningState)) + { + writer.WritePropertyName("provisioningState"u8); + writer.WriteStringValue(ProvisioningState); + } + if (options.Format != "W" && Optional.IsDefined(UniqueIdentifier)) + { + writer.WritePropertyName("uniqueIdentifier"u8); + writer.WriteStringValue(UniqueIdentifier.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. + ArtifactSourceProperties IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) => JsonModelCreateCore(ref reader, options); + + /// The JSON reader. + /// The client options for reading and writing models. + protected virtual ArtifactSourceProperties 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(ArtifactSourceProperties)} does not support reading '{format}' format."); + } + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeArtifactSourceProperties(document.RootElement, options); + } + + /// The JSON element to deserialize. + /// The client options for reading and writing models. + internal static ArtifactSourceProperties DeserializeArtifactSourceProperties(JsonElement element, ModelReaderWriterOptions options) + { + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + string displayName = default; + Uri uri = default; + DevTestLabSourceControlType? sourceType = default; + string folderPath = default; + string armTemplateFolderPath = default; + string branchRef = default; + string securityToken = default; + DevTestLabEnableStatus? status = default; + DateTimeOffset? createdOn = default; + string provisioningState = default; + Guid? uniqueIdentifier = default; + IDictionary additionalBinaryDataProperties = new ChangeTrackingDictionary(); + foreach (var prop in element.EnumerateObject()) + { + if (prop.NameEquals("displayName"u8)) + { + displayName = prop.Value.GetString(); + continue; + } + if (prop.NameEquals("uri"u8)) + { + if (prop.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + uri = string.IsNullOrEmpty(prop.Value.GetString()) ? null : new Uri(prop.Value.GetString()); + continue; + } + if (prop.NameEquals("sourceType"u8)) + { + if (prop.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + sourceType = new DevTestLabSourceControlType(prop.Value.GetString()); + continue; + } + if (prop.NameEquals("folderPath"u8)) + { + folderPath = prop.Value.GetString(); + continue; + } + if (prop.NameEquals("armTemplateFolderPath"u8)) + { + armTemplateFolderPath = prop.Value.GetString(); + continue; + } + if (prop.NameEquals("branchRef"u8)) + { + branchRef = prop.Value.GetString(); + continue; + } + if (prop.NameEquals("securityToken"u8)) + { + securityToken = prop.Value.GetString(); + continue; + } + if (prop.NameEquals("status"u8)) + { + if (prop.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + status = new DevTestLabEnableStatus(prop.Value.GetString()); + continue; + } + if (prop.NameEquals("createdDate"u8)) + { + if (prop.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + createdOn = prop.Value.GetDateTimeOffset("O"); + continue; + } + if (prop.NameEquals("provisioningState"u8)) + { + provisioningState = prop.Value.GetString(); + continue; + } + if (prop.NameEquals("uniqueIdentifier"u8)) + { + if (prop.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + uniqueIdentifier = new Guid(prop.Value.GetString()); + continue; + } + if (options.Format != "W") + { + additionalBinaryDataProperties.Add(prop.Name, BinaryData.FromString(prop.Value.GetRawText())); + } + } + return new ArtifactSourceProperties( + displayName, + uri, + sourceType, + folderPath, + armTemplateFolderPath, + branchRef, + securityToken, + status, + createdOn, + provisioningState, + uniqueIdentifier, + 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, AzureResourceManagerDevTestLabsContext.Default); + default: + throw new FormatException($"The model {nameof(ArtifactSourceProperties)} does not support writing '{options.Format}' format."); + } + } + + /// The data to parse. + /// The client options for reading and writing models. + ArtifactSourceProperties IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) => PersistableModelCreateCore(data, options); + + /// The client options for reading and writing models. + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + } +} diff --git a/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/Models/ArtifactSourceProperties.cs b/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/Models/ArtifactSourceProperties.cs new file mode 100644 index 000000000000..c92090c7074e --- /dev/null +++ b/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/Models/ArtifactSourceProperties.cs @@ -0,0 +1,86 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; + +namespace Azure.ResourceManager.DevTestLabs.Models +{ + /// Properties of an artifact source. + internal partial class ArtifactSourceProperties + { + /// Keeps track of any properties unknown to the library. + private protected readonly IDictionary _additionalBinaryDataProperties; + + /// Initializes a new instance of . + public ArtifactSourceProperties() + { + } + + /// Initializes a new instance of . + /// The artifact source's display name. + /// The artifact source's URI. + /// The artifact source's type. + /// The folder containing artifacts. + /// The folder containing Azure Resource Manager templates. + /// The artifact source's branch reference. + /// The security token to authenticate to the artifact source. + /// Indicates if the artifact source is enabled (values: Enabled, Disabled). + /// The artifact source's creation date. + /// The provisioning status of the resource. + /// The unique immutable identifier of a resource (Guid). + /// Keeps track of any properties unknown to the library. + internal ArtifactSourceProperties(string displayName, Uri uri, DevTestLabSourceControlType? sourceType, string folderPath, string armTemplateFolderPath, string branchRef, string securityToken, DevTestLabEnableStatus? status, DateTimeOffset? createdOn, string provisioningState, Guid? uniqueIdentifier, IDictionary additionalBinaryDataProperties) + { + DisplayName = displayName; + Uri = uri; + SourceType = sourceType; + FolderPath = folderPath; + ArmTemplateFolderPath = armTemplateFolderPath; + BranchRef = branchRef; + SecurityToken = securityToken; + Status = status; + CreatedOn = createdOn; + ProvisioningState = provisioningState; + UniqueIdentifier = uniqueIdentifier; + _additionalBinaryDataProperties = additionalBinaryDataProperties; + } + + /// The artifact source's display name. + public string DisplayName { get; set; } + + /// The artifact source's URI. + public Uri Uri { get; set; } + + /// The artifact source's type. + public DevTestLabSourceControlType? SourceType { get; set; } + + /// The folder containing artifacts. + public string FolderPath { get; set; } + + /// The folder containing Azure Resource Manager templates. + public string ArmTemplateFolderPath { get; set; } + + /// The artifact source's branch reference. + public string BranchRef { get; set; } + + /// The security token to authenticate to the artifact source. + public string SecurityToken { get; set; } + + /// Indicates if the artifact source is enabled (values: Enabled, Disabled). + public DevTestLabEnableStatus? Status { get; set; } + + /// The artifact source's creation date. + public DateTimeOffset? CreatedOn { get; } + + /// The provisioning status of the resource. + public string ProvisioningState { get; } + + /// The unique immutable identifier of a resource (Guid). + public Guid? UniqueIdentifier { get; } + } +} diff --git a/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/Models/AttachNewDataDiskDetails.Serialization.cs b/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/Models/AttachNewDataDiskDetails.Serialization.cs index 6482564cf579..488c0f8803c3 100644 --- a/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/Models/AttachNewDataDiskDetails.Serialization.cs +++ b/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/Models/AttachNewDataDiskDetails.Serialization.cs @@ -9,14 +9,32 @@ using System.ClientModel.Primitives; using System.Collections.Generic; using System.Text.Json; -using Azure.Core; +using Azure.ResourceManager.DevTestLabs; namespace Azure.ResourceManager.DevTestLabs.Models { - public partial class AttachNewDataDiskDetails : IUtf8JsonSerializable, IJsonModel + /// Properties to attach new disk to the Virtual Machine. + public partial class AttachNewDataDiskDetails : IJsonModel { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + /// The data to parse. + /// The client options for reading and writing models. + protected virtual AttachNewDataDiskDetails 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 DeserializeAttachNewDataDiskDetails(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(AttachNewDataDiskDetails)} does not support reading '{options.Format}' format."); + } + } + /// The JSON writer. + /// The client options for reading and writing models. void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) { writer.WriteStartObject(); @@ -28,12 +46,11 @@ void IJsonModel.Write(Utf8JsonWriter writer, ModelRead /// 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(AttachNewDataDiskDetails)} does not support writing '{format}' format."); } - if (Optional.IsDefined(DiskSizeGiB)) { writer.WritePropertyName("diskSizeGiB"u8); @@ -49,15 +66,15 @@ protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWrit writer.WritePropertyName("diskType"u8); writer.WriteStringValue(DiskType.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); } @@ -66,22 +83,27 @@ protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWrit } } - AttachNewDataDiskDetails IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + /// The JSON reader. + /// The client options for reading and writing models. + AttachNewDataDiskDetails IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) => JsonModelCreateCore(ref reader, options); + + /// The JSON reader. + /// The client options for reading and writing models. + protected virtual AttachNewDataDiskDetails 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(AttachNewDataDiskDetails)} does not support reading '{format}' format."); } - using JsonDocument document = JsonDocument.ParseValue(ref reader); return DeserializeAttachNewDataDiskDetails(document.RootElement, options); } - internal static AttachNewDataDiskDetails DeserializeAttachNewDataDiskDetails(JsonElement element, ModelReaderWriterOptions options = null) + /// The JSON element to deserialize. + /// The client options for reading and writing models. + internal static AttachNewDataDiskDetails DeserializeAttachNewDataDiskDetails(JsonElement element, ModelReaderWriterOptions options) { - options ??= ModelSerializationExtensions.WireOptions; - if (element.ValueKind == JsonValueKind.Null) { return null; @@ -89,46 +111,47 @@ internal static AttachNewDataDiskDetails DeserializeAttachNewDataDiskDetails(Jso int? diskSizeGiB = default; string diskName = default; DevTestLabStorageType? diskType = 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("diskSizeGiB"u8)) + if (prop.NameEquals("diskSizeGiB"u8)) { - if (property.Value.ValueKind == JsonValueKind.Null) + if (prop.Value.ValueKind == JsonValueKind.Null) { continue; } - diskSizeGiB = property.Value.GetInt32(); + diskSizeGiB = prop.Value.GetInt32(); continue; } - if (property.NameEquals("diskName"u8)) + if (prop.NameEquals("diskName"u8)) { - diskName = property.Value.GetString(); + diskName = prop.Value.GetString(); continue; } - if (property.NameEquals("diskType"u8)) + if (prop.NameEquals("diskType"u8)) { - if (property.Value.ValueKind == JsonValueKind.Null) + if (prop.Value.ValueKind == JsonValueKind.Null) { continue; } - diskType = new DevTestLabStorageType(property.Value.GetString()); + diskType = new DevTestLabStorageType(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 AttachNewDataDiskDetails(diskSizeGiB, diskName, diskType, serializedAdditionalRawData); + return new AttachNewDataDiskDetails(diskSizeGiB, diskName, diskType, 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,22 +161,11 @@ BinaryData IPersistableModel.Write(ModelReaderWriterOp } } - AttachNewDataDiskDetails 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 DeserializeAttachNewDataDiskDetails(document.RootElement, options); - } - default: - throw new FormatException($"The model {nameof(AttachNewDataDiskDetails)} does not support reading '{options.Format}' format."); - } - } + /// The data to parse. + /// The client options for reading and writing models. + AttachNewDataDiskDetails IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) => PersistableModelCreateCore(data, options); + /// The client options for reading and writing models. string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; } } diff --git a/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/Models/AttachNewDataDiskDetails.cs b/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/Models/AttachNewDataDiskDetails.cs index 706f4844ffa4..23b43a60c587 100644 --- a/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/Models/AttachNewDataDiskDetails.cs +++ b/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/Models/AttachNewDataDiskDetails.cs @@ -13,37 +13,8 @@ namespace Azure.ResourceManager.DevTestLabs.Models /// Properties to attach new disk to the Virtual Machine. public partial class AttachNewDataDiskDetails { - /// - /// 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 AttachNewDataDiskDetails() @@ -54,19 +25,21 @@ public AttachNewDataDiskDetails() /// Size of the disk to be attached in Gibibytes. /// The name of the disk to be attached. /// The storage type for the disk (i.e. Standard, Premium). - /// Keeps track of any properties unknown to the library. - internal AttachNewDataDiskDetails(int? diskSizeGiB, string diskName, DevTestLabStorageType? diskType, IDictionary serializedAdditionalRawData) + /// Keeps track of any properties unknown to the library. + internal AttachNewDataDiskDetails(int? diskSizeGiB, string diskName, DevTestLabStorageType? diskType, IDictionary additionalBinaryDataProperties) { DiskSizeGiB = diskSizeGiB; DiskName = diskName; DiskType = diskType; - _serializedAdditionalRawData = serializedAdditionalRawData; + _additionalBinaryDataProperties = additionalBinaryDataProperties; } /// Size of the disk to be attached in Gibibytes. public int? DiskSizeGiB { get; set; } + /// The name of the disk to be attached. public string DiskName { get; set; } + /// The storage type for the disk (i.e. Standard, Premium). public DevTestLabStorageType? DiskType { get; set; } } diff --git a/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/Models/AzureResourceManagerDevTestLabsContext.cs b/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/Models/AzureResourceManagerDevTestLabsContext.cs index a74f3c403f0b..0bdd6bb5316c 100644 --- a/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/Models/AzureResourceManagerDevTestLabsContext.cs +++ b/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/Models/AzureResourceManagerDevTestLabsContext.cs @@ -6,25 +6,30 @@ #nullable disable using System.ClientModel.Primitives; +using Azure; using Azure.ResourceManager.DevTestLabs.Models; using Azure.ResourceManager.Models; -using Azure.ResourceManager.Resources.Models; namespace Azure.ResourceManager.DevTestLabs { /// /// 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(ApplicableScheduleProperties))] [ModelReaderWriterBuildable(typeof(ArmTemplateList))] + [ModelReaderWriterBuildable(typeof(ArmTemplateProperties))] [ModelReaderWriterBuildable(typeof(ArtifactList))] + [ModelReaderWriterBuildable(typeof(ArtifactProperties))] [ModelReaderWriterBuildable(typeof(ArtifactSourceList))] + [ModelReaderWriterBuildable(typeof(ArtifactSourceProperties))] [ModelReaderWriterBuildable(typeof(AttachNewDataDiskDetails))] [ModelReaderWriterBuildable(typeof(BulkCreationParameters))] [ModelReaderWriterBuildable(typeof(ComputeDataDisk))] [ModelReaderWriterBuildable(typeof(ComputeVmInstanceViewStatus))] [ModelReaderWriterBuildable(typeof(ComputeVmProperties))] [ModelReaderWriterBuildable(typeof(CustomImageList))] + [ModelReaderWriterBuildable(typeof(CustomImageProperties))] [ModelReaderWriterBuildable(typeof(DayDetails))] [ModelReaderWriterBuildable(typeof(DevTestLabAnnouncement))] [ModelReaderWriterBuildable(typeof(DevTestLabApplicableSchedule))] @@ -79,6 +84,8 @@ namespace Azure.ResourceManager.DevTestLabs [ModelReaderWriterBuildable(typeof(DevTestLabGlobalScheduleRetargetContent))] [ModelReaderWriterBuildable(typeof(DevTestLabImportVmContent))] [ModelReaderWriterBuildable(typeof(DevTestLabInboundNatRule))] + [ModelReaderWriterBuildable(typeof(DevTestLabLinuxOSInfo))] + [ModelReaderWriterBuildable(typeof(DevTestLabManagedIdentity))] [ModelReaderWriterBuildable(typeof(DevTestLabNetworkInterface))] [ModelReaderWriterBuildable(typeof(DevTestLabNotificationChannelData))] [ModelReaderWriterBuildable(typeof(DevTestLabNotificationChannelEvent))] @@ -121,6 +128,7 @@ namespace Azure.ResourceManager.DevTestLabs [ModelReaderWriterBuildable(typeof(DevTestLabUserPatch))] [ModelReaderWriterBuildable(typeof(DevTestLabUserResource))] [ModelReaderWriterBuildable(typeof(DevTestLabUserSecretStore))] + [ModelReaderWriterBuildable(typeof(DevTestLabVhd))] [ModelReaderWriterBuildable(typeof(DevTestLabVirtualNetworkData))] [ModelReaderWriterBuildable(typeof(DevTestLabVirtualNetworkPatch))] [ModelReaderWriterBuildable(typeof(DevTestLabVirtualNetworkResource))] @@ -133,31 +141,45 @@ namespace Azure.ResourceManager.DevTestLabs [ModelReaderWriterBuildable(typeof(DevTestLabVmResource))] [ModelReaderWriterBuildable(typeof(DevTestLabVmScheduleResource))] [ModelReaderWriterBuildable(typeof(DevTestLabWeekDetails))] + [ModelReaderWriterBuildable(typeof(DevTestLabWindowsOSInfo))] [ModelReaderWriterBuildable(typeof(DiskList))] + [ModelReaderWriterBuildable(typeof(DiskProperties))] [ModelReaderWriterBuildable(typeof(DtlEnvironmentList))] + [ModelReaderWriterBuildable(typeof(EnvironmentProperties))] [ModelReaderWriterBuildable(typeof(FormulaList))] + [ModelReaderWriterBuildable(typeof(FormulaProperties))] [ModelReaderWriterBuildable(typeof(FormulaPropertiesFromVm))] [ModelReaderWriterBuildable(typeof(GalleryImageList))] + [ModelReaderWriterBuildable(typeof(GalleryImageProperties))] [ModelReaderWriterBuildable(typeof(HourDetails))] + [ModelReaderWriterBuildable(typeof(LabCostProperties))] [ModelReaderWriterBuildable(typeof(LabCostSummaryProperties))] [ModelReaderWriterBuildable(typeof(LabList))] + [ModelReaderWriterBuildable(typeof(LabProperties))] [ModelReaderWriterBuildable(typeof(LabVhdList))] - [ModelReaderWriterBuildable(typeof(LabVmList))] - [ModelReaderWriterBuildable(typeof(LinuxOSInfo))] + [ModelReaderWriterBuildable(typeof(LabVirtualMachineCreationParameterProperties))] + [ModelReaderWriterBuildable(typeof(LabVirtualMachineList))] + [ModelReaderWriterBuildable(typeof(LabVirtualMachineProperties))] [ModelReaderWriterBuildable(typeof(NotificationChannelList))] + [ModelReaderWriterBuildable(typeof(NotificationChannelProperties))] [ModelReaderWriterBuildable(typeof(PercentageCostThresholdProperties))] [ModelReaderWriterBuildable(typeof(PolicyList))] + [ModelReaderWriterBuildable(typeof(PolicyProperties))] [ModelReaderWriterBuildable(typeof(ResponseError))] + [ModelReaderWriterBuildable(typeof(ScheduleCreationParameterProperties))] [ModelReaderWriterBuildable(typeof(ScheduleList))] + [ModelReaderWriterBuildable(typeof(ScheduleProperties))] [ModelReaderWriterBuildable(typeof(SecretList))] + [ModelReaderWriterBuildable(typeof(SecretProperties))] [ModelReaderWriterBuildable(typeof(ServiceFabricList))] - [ModelReaderWriterBuildable(typeof(SharedPublicIPAddressConfiguration))] + [ModelReaderWriterBuildable(typeof(ServiceFabricProperties))] + [ModelReaderWriterBuildable(typeof(SharedPublicIpAddressConfiguration))] [ModelReaderWriterBuildable(typeof(SubnetSharedPublicIPAddressConfiguration))] - [ModelReaderWriterBuildable(typeof(SubResource))] [ModelReaderWriterBuildable(typeof(SystemData))] [ModelReaderWriterBuildable(typeof(UserList))] + [ModelReaderWriterBuildable(typeof(UserProperties))] [ModelReaderWriterBuildable(typeof(VirtualNetworkList))] - [ModelReaderWriterBuildable(typeof(WindowsOSInfo))] + [ModelReaderWriterBuildable(typeof(VirtualNetworkProperties))] public partial class AzureResourceManagerDevTestLabsContext : ModelReaderWriterContext { } diff --git a/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/Models/BulkCreationParameters.Serialization.cs b/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/Models/BulkCreationParameters.Serialization.cs index 73219f391a2a..8cfbecc4282d 100644 --- a/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/Models/BulkCreationParameters.Serialization.cs +++ b/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/Models/BulkCreationParameters.Serialization.cs @@ -9,14 +9,32 @@ using System.ClientModel.Primitives; using System.Collections.Generic; using System.Text.Json; -using Azure.Core; +using Azure.ResourceManager.DevTestLabs; namespace Azure.ResourceManager.DevTestLabs.Models { - internal partial class BulkCreationParameters : IUtf8JsonSerializable, IJsonModel + /// Parameters for creating multiple virtual machines as a single action. + internal partial class BulkCreationParameters : IJsonModel { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + /// The data to parse. + /// The client options for reading and writing models. + protected virtual BulkCreationParameters 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 DeserializeBulkCreationParameters(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(BulkCreationParameters)} does not support reading '{options.Format}' format."); + } + } + /// The JSON writer. + /// The client options for reading and writing models. void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) { writer.WriteStartObject(); @@ -28,26 +46,25 @@ void IJsonModel.Write(Utf8JsonWriter writer, ModelReader /// 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(BulkCreationParameters)} does not support writing '{format}' format."); } - if (Optional.IsDefined(InstanceCount)) { writer.WritePropertyName("instanceCount"u8); writer.WriteNumberValue(InstanceCount.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); } @@ -56,53 +73,59 @@ protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWrit } } - BulkCreationParameters IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + /// The JSON reader. + /// The client options for reading and writing models. + BulkCreationParameters IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) => JsonModelCreateCore(ref reader, options); + + /// The JSON reader. + /// The client options for reading and writing models. + protected virtual BulkCreationParameters 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(BulkCreationParameters)} does not support reading '{format}' format."); } - using JsonDocument document = JsonDocument.ParseValue(ref reader); return DeserializeBulkCreationParameters(document.RootElement, options); } - internal static BulkCreationParameters DeserializeBulkCreationParameters(JsonElement element, ModelReaderWriterOptions options = null) + /// The JSON element to deserialize. + /// The client options for reading and writing models. + internal static BulkCreationParameters DeserializeBulkCreationParameters(JsonElement element, ModelReaderWriterOptions options) { - options ??= ModelSerializationExtensions.WireOptions; - if (element.ValueKind == JsonValueKind.Null) { return null; } int? instanceCount = 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("instanceCount"u8)) + if (prop.NameEquals("instanceCount"u8)) { - if (property.Value.ValueKind == JsonValueKind.Null) + if (prop.Value.ValueKind == JsonValueKind.Null) { continue; } - instanceCount = property.Value.GetInt32(); + instanceCount = prop.Value.GetInt32(); 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 BulkCreationParameters(instanceCount, serializedAdditionalRawData); + return new BulkCreationParameters(instanceCount, 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": @@ -112,22 +135,11 @@ BinaryData IPersistableModel.Write(ModelReaderWriterOpti } } - BulkCreationParameters 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 DeserializeBulkCreationParameters(document.RootElement, options); - } - default: - throw new FormatException($"The model {nameof(BulkCreationParameters)} does not support reading '{options.Format}' format."); - } - } + /// The data to parse. + /// The client options for reading and writing models. + BulkCreationParameters IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) => PersistableModelCreateCore(data, options); + /// The client options for reading and writing models. string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; } } diff --git a/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/Models/BulkCreationParameters.cs b/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/Models/BulkCreationParameters.cs index 8e12121a3002..149122dc12c4 100644 --- a/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/Models/BulkCreationParameters.cs +++ b/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/Models/BulkCreationParameters.cs @@ -13,37 +13,8 @@ namespace Azure.ResourceManager.DevTestLabs.Models /// Parameters for creating multiple virtual machines as a single action. internal partial class BulkCreationParameters { - /// - /// 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 BulkCreationParameters() @@ -52,11 +23,11 @@ public BulkCreationParameters() /// Initializes a new instance of . /// The number of virtual machine instances to create. - /// Keeps track of any properties unknown to the library. - internal BulkCreationParameters(int? instanceCount, IDictionary serializedAdditionalRawData) + /// Keeps track of any properties unknown to the library. + internal BulkCreationParameters(int? instanceCount, IDictionary additionalBinaryDataProperties) { InstanceCount = instanceCount; - _serializedAdditionalRawData = serializedAdditionalRawData; + _additionalBinaryDataProperties = additionalBinaryDataProperties; } /// The number of virtual machine instances to create. diff --git a/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/Models/ComputeDataDisk.Serialization.cs b/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/Models/ComputeDataDisk.Serialization.cs index 3ed514238fc6..be7f570ebc5d 100644 --- a/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/Models/ComputeDataDisk.Serialization.cs +++ b/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/Models/ComputeDataDisk.Serialization.cs @@ -9,14 +9,32 @@ using System.ClientModel.Primitives; using System.Collections.Generic; using System.Text.Json; -using Azure.Core; +using Azure.ResourceManager.DevTestLabs; namespace Azure.ResourceManager.DevTestLabs.Models { - public partial class ComputeDataDisk : IUtf8JsonSerializable, IJsonModel + /// A data disks attached to a virtual machine. + public partial class ComputeDataDisk : IJsonModel { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + /// The data to parse. + /// The client options for reading and writing models. + protected virtual ComputeDataDisk 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 DeserializeComputeDataDisk(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(ComputeDataDisk)} does not support reading '{options.Format}' format."); + } + } + /// The JSON writer. + /// The client options for reading and writing models. void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) { writer.WriteStartObject(); @@ -28,12 +46,11 @@ void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterO /// 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(ComputeDataDisk)} does not support writing '{format}' format."); } - if (Optional.IsDefined(Name)) { writer.WritePropertyName("name"u8); @@ -54,15 +71,15 @@ protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWrit writer.WritePropertyName("diskSizeGiB"u8); writer.WriteNumberValue(DiskSizeGiB.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); } @@ -71,22 +88,27 @@ protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWrit } } - ComputeDataDisk IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + /// The JSON reader. + /// The client options for reading and writing models. + ComputeDataDisk IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) => JsonModelCreateCore(ref reader, options); + + /// The JSON reader. + /// The client options for reading and writing models. + protected virtual ComputeDataDisk 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(ComputeDataDisk)} does not support reading '{format}' format."); } - using JsonDocument document = JsonDocument.ParseValue(ref reader); return DeserializeComputeDataDisk(document.RootElement, options); } - internal static ComputeDataDisk DeserializeComputeDataDisk(JsonElement element, ModelReaderWriterOptions options = null) + /// The JSON element to deserialize. + /// The client options for reading and writing models. + internal static ComputeDataDisk DeserializeComputeDataDisk(JsonElement element, ModelReaderWriterOptions options) { - options ??= ModelSerializationExtensions.WireOptions; - if (element.ValueKind == JsonValueKind.Null) { return null; @@ -95,51 +117,52 @@ internal static ComputeDataDisk DeserializeComputeDataDisk(JsonElement element, Uri diskUri = default; string managedDiskId = default; int? diskSizeGiB = 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("name"u8)) + if (prop.NameEquals("name"u8)) { - name = property.Value.GetString(); + name = prop.Value.GetString(); continue; } - if (property.NameEquals("diskUri"u8)) + if (prop.NameEquals("diskUri"u8)) { - if (property.Value.ValueKind == JsonValueKind.Null) + if (prop.Value.ValueKind == JsonValueKind.Null) { continue; } - diskUri = new Uri(property.Value.GetString()); + diskUri = string.IsNullOrEmpty(prop.Value.GetString()) ? null : new Uri(prop.Value.GetString()); continue; } - if (property.NameEquals("managedDiskId"u8)) + if (prop.NameEquals("managedDiskId"u8)) { - managedDiskId = property.Value.GetString(); + managedDiskId = prop.Value.GetString(); continue; } - if (property.NameEquals("diskSizeGiB"u8)) + if (prop.NameEquals("diskSizeGiB"u8)) { - if (property.Value.ValueKind == JsonValueKind.Null) + if (prop.Value.ValueKind == JsonValueKind.Null) { continue; } - diskSizeGiB = property.Value.GetInt32(); + diskSizeGiB = prop.Value.GetInt32(); 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 ComputeDataDisk(name, diskUri, managedDiskId, diskSizeGiB, serializedAdditionalRawData); + return new ComputeDataDisk(name, diskUri, managedDiskId, diskSizeGiB, 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": @@ -149,22 +172,11 @@ BinaryData IPersistableModel.Write(ModelReaderWriterOptions opt } } - ComputeDataDisk 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 DeserializeComputeDataDisk(document.RootElement, options); - } - default: - throw new FormatException($"The model {nameof(ComputeDataDisk)} does not support reading '{options.Format}' format."); - } - } + /// The data to parse. + /// The client options for reading and writing models. + ComputeDataDisk IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) => PersistableModelCreateCore(data, options); + /// The client options for reading and writing models. string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; } } diff --git a/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/Models/ComputeDataDisk.cs b/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/Models/ComputeDataDisk.cs index a157fb809c95..c3d3b591def4 100644 --- a/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/Models/ComputeDataDisk.cs +++ b/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/Models/ComputeDataDisk.cs @@ -13,37 +13,8 @@ namespace Azure.ResourceManager.DevTestLabs.Models /// A data disks attached to a virtual machine. public partial class ComputeDataDisk { - /// - /// 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 ComputeDataDisk() @@ -55,22 +26,25 @@ internal ComputeDataDisk() /// When backed by a blob, the URI of underlying blob. /// When backed by managed disk, this is the ID of the compute disk resource. /// Gets data disk size in GiB. - /// Keeps track of any properties unknown to the library. - internal ComputeDataDisk(string name, Uri diskUri, string managedDiskId, int? diskSizeGiB, IDictionary serializedAdditionalRawData) + /// Keeps track of any properties unknown to the library. + internal ComputeDataDisk(string name, Uri diskUri, string managedDiskId, int? diskSizeGiB, IDictionary additionalBinaryDataProperties) { Name = name; DiskUri = diskUri; ManagedDiskId = managedDiskId; DiskSizeGiB = diskSizeGiB; - _serializedAdditionalRawData = serializedAdditionalRawData; + _additionalBinaryDataProperties = additionalBinaryDataProperties; } /// Gets data disk name. public string Name { get; } + /// When backed by a blob, the URI of underlying blob. public Uri DiskUri { get; } + /// When backed by managed disk, this is the ID of the compute disk resource. public string ManagedDiskId { get; } + /// Gets data disk size in GiB. public int? DiskSizeGiB { get; } } diff --git a/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/Models/ComputeVmInstanceViewStatus.Serialization.cs b/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/Models/ComputeVmInstanceViewStatus.Serialization.cs index 588e46a3fc29..b08395f2faf3 100644 --- a/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/Models/ComputeVmInstanceViewStatus.Serialization.cs +++ b/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/Models/ComputeVmInstanceViewStatus.Serialization.cs @@ -9,14 +9,32 @@ using System.ClientModel.Primitives; using System.Collections.Generic; using System.Text.Json; -using Azure.Core; +using Azure.ResourceManager.DevTestLabs; namespace Azure.ResourceManager.DevTestLabs.Models { - public partial class ComputeVmInstanceViewStatus : IUtf8JsonSerializable, IJsonModel + /// Status information about a virtual machine. + public partial class ComputeVmInstanceViewStatus : IJsonModel { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + /// The data to parse. + /// The client options for reading and writing models. + protected virtual ComputeVmInstanceViewStatus 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 DeserializeComputeVmInstanceViewStatus(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(ComputeVmInstanceViewStatus)} does not support reading '{options.Format}' format."); + } + } + /// The JSON writer. + /// The client options for reading and writing models. void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) { writer.WriteStartObject(); @@ -28,12 +46,11 @@ void IJsonModel.Write(Utf8JsonWriter writer, ModelR /// 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(ComputeVmInstanceViewStatus)} does not support writing '{format}' format."); } - if (Optional.IsDefined(Code)) { writer.WritePropertyName("code"u8); @@ -49,15 +66,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); } @@ -66,22 +83,27 @@ protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWrit } } - ComputeVmInstanceViewStatus IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + /// The JSON reader. + /// The client options for reading and writing models. + ComputeVmInstanceViewStatus IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) => JsonModelCreateCore(ref reader, options); + + /// The JSON reader. + /// The client options for reading and writing models. + protected virtual ComputeVmInstanceViewStatus 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(ComputeVmInstanceViewStatus)} does not support reading '{format}' format."); } - using JsonDocument document = JsonDocument.ParseValue(ref reader); return DeserializeComputeVmInstanceViewStatus(document.RootElement, options); } - internal static ComputeVmInstanceViewStatus DeserializeComputeVmInstanceViewStatus(JsonElement element, ModelReaderWriterOptions options = null) + /// The JSON element to deserialize. + /// The client options for reading and writing models. + internal static ComputeVmInstanceViewStatus DeserializeComputeVmInstanceViewStatus(JsonElement element, ModelReaderWriterOptions options) { - options ??= ModelSerializationExtensions.WireOptions; - if (element.ValueKind == JsonValueKind.Null) { return null; @@ -89,38 +111,39 @@ internal static ComputeVmInstanceViewStatus DeserializeComputeVmInstanceViewStat string code = default; string displayStatus = 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 = property.Value.GetString(); + code = prop.Value.GetString(); continue; } - if (property.NameEquals("displayStatus"u8)) + if (prop.NameEquals("displayStatus"u8)) { - displayStatus = property.Value.GetString(); + displayStatus = 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 ComputeVmInstanceViewStatus(code, displayStatus, message, serializedAdditionalRawData); + return new ComputeVmInstanceViewStatus(code, displayStatus, 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": @@ -130,22 +153,11 @@ BinaryData IPersistableModel.Write(ModelReaderWrite } } - ComputeVmInstanceViewStatus 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 DeserializeComputeVmInstanceViewStatus(document.RootElement, options); - } - default: - throw new FormatException($"The model {nameof(ComputeVmInstanceViewStatus)} does not support reading '{options.Format}' format."); - } - } + /// The data to parse. + /// The client options for reading and writing models. + ComputeVmInstanceViewStatus IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) => PersistableModelCreateCore(data, options); + /// The client options for reading and writing models. string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; } } diff --git a/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/Models/ComputeVmInstanceViewStatus.cs b/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/Models/ComputeVmInstanceViewStatus.cs index ac47166b75e8..c4fb7b417153 100644 --- a/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/Models/ComputeVmInstanceViewStatus.cs +++ b/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/Models/ComputeVmInstanceViewStatus.cs @@ -13,37 +13,8 @@ namespace Azure.ResourceManager.DevTestLabs.Models /// Status information about a virtual machine. public partial class ComputeVmInstanceViewStatus { - /// - /// 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 ComputeVmInstanceViewStatus() @@ -54,19 +25,21 @@ internal ComputeVmInstanceViewStatus() /// Gets the status Code. /// Gets the short localizable label for the status. /// Gets the message associated with the status. - /// Keeps track of any properties unknown to the library. - internal ComputeVmInstanceViewStatus(string code, string displayStatus, string message, IDictionary serializedAdditionalRawData) + /// Keeps track of any properties unknown to the library. + internal ComputeVmInstanceViewStatus(string code, string displayStatus, string message, IDictionary additionalBinaryDataProperties) { Code = code; DisplayStatus = displayStatus; Message = message; - _serializedAdditionalRawData = serializedAdditionalRawData; + _additionalBinaryDataProperties = additionalBinaryDataProperties; } /// Gets the status Code. public string Code { get; } + /// Gets the short localizable label for the status. public string DisplayStatus { get; } + /// Gets the message associated with the status. public string Message { get; } } diff --git a/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/Models/ComputeVmProperties.Serialization.cs b/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/Models/ComputeVmProperties.Serialization.cs index 92f1a5ea6344..efe952ec2df6 100644 --- a/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/Models/ComputeVmProperties.Serialization.cs +++ b/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/Models/ComputeVmProperties.Serialization.cs @@ -9,14 +9,32 @@ using System.ClientModel.Primitives; using System.Collections.Generic; using System.Text.Json; -using Azure.Core; +using Azure.ResourceManager.DevTestLabs; namespace Azure.ResourceManager.DevTestLabs.Models { - public partial class ComputeVmProperties : IUtf8JsonSerializable, IJsonModel + /// Properties of a virtual machine returned by the Microsoft.Compute API. + public partial class ComputeVmProperties : IJsonModel { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + /// The data to parse. + /// The client options for reading and writing models. + protected virtual ComputeVmProperties 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 DeserializeComputeVmProperties(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(ComputeVmProperties)} does not support reading '{options.Format}' format."); + } + } + /// The JSON writer. + /// The client options for reading and writing models. void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) { writer.WriteStartObject(); @@ -28,17 +46,16 @@ void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWri /// 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(ComputeVmProperties)} does not support writing '{format}' format."); } - if (Optional.IsCollectionDefined(Statuses)) { writer.WritePropertyName("statuses"u8); writer.WriteStartArray(); - foreach (var item in Statuses) + foreach (ComputeVmInstanceViewStatus item in Statuses) { writer.WriteObjectValue(item, options); } @@ -68,8 +85,13 @@ protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWrit { writer.WritePropertyName("dataDiskIds"u8); writer.WriteStartArray(); - foreach (var item in DataDiskIds) + foreach (string item in DataDiskIds) { + if (item == null) + { + writer.WriteNullValue(); + continue; + } writer.WriteStringValue(item); } writer.WriteEndArray(); @@ -78,21 +100,21 @@ protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWrit { writer.WritePropertyName("dataDisks"u8); writer.WriteStartArray(); - foreach (var item in DataDisks) + foreach (ComputeDataDisk item in DataDisks) { 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); } @@ -101,22 +123,27 @@ protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWrit } } - ComputeVmProperties IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + /// The JSON reader. + /// The client options for reading and writing models. + ComputeVmProperties IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) => JsonModelCreateCore(ref reader, options); + + /// The JSON reader. + /// The client options for reading and writing models. + protected virtual ComputeVmProperties 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(ComputeVmProperties)} does not support reading '{format}' format."); } - using JsonDocument document = JsonDocument.ParseValue(ref reader); return DeserializeComputeVmProperties(document.RootElement, options); } - internal static ComputeVmProperties DeserializeComputeVmProperties(JsonElement element, ModelReaderWriterOptions options = null) + /// The JSON element to deserialize. + /// The client options for reading and writing models. + internal static ComputeVmProperties DeserializeComputeVmProperties(JsonElement element, ModelReaderWriterOptions options) { - options ??= ModelSerializationExtensions.WireOptions; - if (element.ValueKind == JsonValueKind.Null) { return null; @@ -128,66 +155,72 @@ internal static ComputeVmProperties DeserializeComputeVmProperties(JsonElement e string osDiskId = default; IReadOnlyList dataDiskIds = default; IReadOnlyList dataDisks = 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("statuses"u8)) + if (prop.NameEquals("statuses"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(ComputeVmInstanceViewStatus.DeserializeComputeVmInstanceViewStatus(item, options)); } statuses = array; continue; } - if (property.NameEquals("osType"u8)) + if (prop.NameEquals("osType"u8)) { - osType = property.Value.GetString(); + osType = prop.Value.GetString(); continue; } - if (property.NameEquals("vmSize"u8)) + if (prop.NameEquals("vmSize"u8)) { - vmSize = property.Value.GetString(); + vmSize = prop.Value.GetString(); continue; } - if (property.NameEquals("networkInterfaceId"u8)) + if (prop.NameEquals("networkInterfaceId"u8)) { - networkInterfaceId = property.Value.GetString(); + networkInterfaceId = prop.Value.GetString(); continue; } - if (property.NameEquals("osDiskId"u8)) + if (prop.NameEquals("osDiskId"u8)) { - osDiskId = property.Value.GetString(); + osDiskId = prop.Value.GetString(); continue; } - if (property.NameEquals("dataDiskIds"u8)) + if (prop.NameEquals("dataDiskIds"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()); + } } dataDiskIds = array; continue; } - if (property.NameEquals("dataDisks"u8)) + if (prop.NameEquals("dataDisks"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(ComputeDataDisk.DeserializeComputeDataDisk(item, options)); } @@ -196,10 +229,9 @@ internal static ComputeVmProperties DeserializeComputeVmProperties(JsonElement e } 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 ComputeVmProperties( statuses ?? new ChangeTrackingList(), osType, @@ -208,13 +240,16 @@ internal static ComputeVmProperties DeserializeComputeVmProperties(JsonElement e osDiskId, dataDiskIds ?? new ChangeTrackingList(), dataDisks ?? new ChangeTrackingList(), - serializedAdditionalRawData); + 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": @@ -224,22 +259,11 @@ BinaryData IPersistableModel.Write(ModelReaderWriterOptions } } - ComputeVmProperties 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 DeserializeComputeVmProperties(document.RootElement, options); - } - default: - throw new FormatException($"The model {nameof(ComputeVmProperties)} does not support reading '{options.Format}' format."); - } - } + /// The data to parse. + /// The client options for reading and writing models. + ComputeVmProperties IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) => PersistableModelCreateCore(data, options); + /// The client options for reading and writing models. string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; } } diff --git a/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/Models/ComputeVmProperties.cs b/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/Models/ComputeVmProperties.cs index 55d7d0a092a2..4122bb24b955 100644 --- a/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/Models/ComputeVmProperties.cs +++ b/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/Models/ComputeVmProperties.cs @@ -7,43 +7,15 @@ using System; using System.Collections.Generic; +using Azure.ResourceManager.DevTestLabs; namespace Azure.ResourceManager.DevTestLabs.Models { /// Properties of a virtual machine returned by the Microsoft.Compute API. public partial class ComputeVmProperties { - /// - /// 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 ComputeVmProperties() @@ -61,8 +33,8 @@ internal ComputeVmProperties() /// Gets OS disk blob uri for the virtual machine. /// Gets data disks blob uri for the virtual machine. /// Gets all data disks attached to the virtual machine. - /// Keeps track of any properties unknown to the library. - internal ComputeVmProperties(IReadOnlyList statuses, string osType, string vmSize, string networkInterfaceId, string osDiskId, IReadOnlyList dataDiskIds, IReadOnlyList dataDisks, IDictionary serializedAdditionalRawData) + /// Keeps track of any properties unknown to the library. + internal ComputeVmProperties(IReadOnlyList statuses, string osType, string vmSize, string networkInterfaceId, string osDiskId, IReadOnlyList dataDiskIds, IReadOnlyList dataDisks, IDictionary additionalBinaryDataProperties) { Statuses = statuses; OSType = osType; @@ -71,21 +43,27 @@ internal ComputeVmProperties(IReadOnlyList statuses OSDiskId = osDiskId; DataDiskIds = dataDiskIds; DataDisks = dataDisks; - _serializedAdditionalRawData = serializedAdditionalRawData; + _additionalBinaryDataProperties = additionalBinaryDataProperties; } /// Gets the statuses of the virtual machine. public IReadOnlyList Statuses { get; } + /// Gets the OS type of the virtual machine. public string OSType { get; } + /// Gets the size of the virtual machine. public string VmSize { get; } + /// Gets the network interface ID of the virtual machine. public string NetworkInterfaceId { get; } + /// Gets OS disk blob uri for the virtual machine. public string OSDiskId { get; } + /// Gets data disks blob uri for the virtual machine. public IReadOnlyList DataDiskIds { get; } + /// Gets all data disks attached to the virtual machine. public IReadOnlyList DataDisks { get; } } diff --git a/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/Models/CustomImageList.Serialization.cs b/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/Models/CustomImageList.Serialization.cs index 30e2721c4fe3..337ff49b5ac6 100644 --- a/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/Models/CustomImageList.Serialization.cs +++ b/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/Models/CustomImageList.Serialization.cs @@ -9,14 +9,45 @@ using System.ClientModel.Primitives; using System.Collections.Generic; using System.Text.Json; -using Azure.Core; +using Azure; +using Azure.ResourceManager.DevTestLabs; namespace Azure.ResourceManager.DevTestLabs.Models { - internal partial class CustomImageList : IUtf8JsonSerializable, IJsonModel + /// The response of a list operation. + internal partial class CustomImageList : IJsonModel { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + /// Initializes a new instance of for deserialization. + internal CustomImageList() + { + } + /// The data to parse. + /// The client options for reading and writing models. + protected virtual CustomImageList 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 DeserializeCustomImageList(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(CustomImageList)} does not support reading '{options.Format}' format."); + } + } + + /// The to deserialize the from. + internal static CustomImageList FromResponse(Response response) + { + using JsonDocument document = JsonDocument.Parse(response.Content, ModelSerializationExtensions.JsonDocumentOptions); + return DeserializeCustomImageList(document.RootElement, ModelSerializationExtensions.WireOptions); + } + + /// The JSON writer. + /// The client options for reading and writing models. void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) { writer.WriteStartObject(); @@ -28,36 +59,32 @@ void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterO /// 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(CustomImageList)} does not support writing '{format}' format."); } - - if (Optional.IsCollectionDefined(Value)) + writer.WritePropertyName("value"u8); + writer.WriteStartArray(); + foreach (DevTestLabCustomImageData item in Value) { - writer.WritePropertyName("value"u8); - writer.WriteStartArray(); - foreach (var item in Value) - { - writer.WriteObjectValue(item, options); - } - writer.WriteEndArray(); + writer.WriteObjectValue(item, options); } + writer.WriteEndArray(); if (Optional.IsDefined(NextLink)) { writer.WritePropertyName("nextLink"u8); - writer.WriteStringValue(NextLink); + 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); } @@ -66,64 +93,70 @@ protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWrit } } - CustomImageList IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + /// The JSON reader. + /// The client options for reading and writing models. + CustomImageList IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) => JsonModelCreateCore(ref reader, options); + + /// The JSON reader. + /// The client options for reading and writing models. + protected virtual CustomImageList 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(CustomImageList)} does not support reading '{format}' format."); } - using JsonDocument document = JsonDocument.ParseValue(ref reader); return DeserializeCustomImageList(document.RootElement, options); } - internal static CustomImageList DeserializeCustomImageList(JsonElement element, ModelReaderWriterOptions options = null) + /// The JSON element to deserialize. + /// The client options for reading and writing models. + internal static CustomImageList DeserializeCustomImageList(JsonElement element, ModelReaderWriterOptions options) { - options ??= ModelSerializationExtensions.WireOptions; - if (element.ValueKind == JsonValueKind.Null) { return null; } - IReadOnlyList value = default; - string nextLink = default; - IDictionary serializedAdditionalRawData = default; - Dictionary rawDataDictionary = new Dictionary(); - foreach (var property in element.EnumerateObject()) + IList value = default; + Uri nextLink = default; + IDictionary additionalBinaryDataProperties = new ChangeTrackingDictionary(); + foreach (var prop in element.EnumerateObject()) { - if (property.NameEquals("value"u8)) + if (prop.NameEquals("value"u8)) { - if (property.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(DevTestLabCustomImageData.DeserializeDevTestLabCustomImageData(item, options)); } value = array; continue; } - if (property.NameEquals("nextLink"u8)) + if (prop.NameEquals("nextLink"u8)) { - nextLink = property.Value.GetString(); + if (prop.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + nextLink = string.IsNullOrEmpty(prop.Value.GetString()) ? null : 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 CustomImageList(value ?? new ChangeTrackingList(), nextLink, serializedAdditionalRawData); + return new CustomImageList(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": @@ -133,22 +166,11 @@ BinaryData IPersistableModel.Write(ModelReaderWriterOptions opt } } - CustomImageList 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 DeserializeCustomImageList(document.RootElement, options); - } - default: - throw new FormatException($"The model {nameof(CustomImageList)} does not support reading '{options.Format}' format."); - } - } + /// The data to parse. + /// The client options for reading and writing models. + CustomImageList IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) => PersistableModelCreateCore(data, options); + /// The client options for reading and writing models. string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; } } diff --git a/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/Models/CustomImageList.cs b/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/Models/CustomImageList.cs index 4b1ea75f9101..999b019a19c8 100644 --- a/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/Models/CustomImageList.cs +++ b/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/Models/CustomImageList.cs @@ -7,64 +7,39 @@ using System; using System.Collections.Generic; +using System.Linq; +using Azure.ResourceManager.DevTestLabs; namespace Azure.ResourceManager.DevTestLabs.Models { /// The response of a list operation. internal partial class CustomImageList { - /// - /// 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 CustomImageList() + /// The CustomImage items on this page. + internal CustomImageList(IEnumerable value) { - Value = new ChangeTrackingList(); + Value = value.ToList(); } /// Initializes a new instance of . - /// Results of the list operation. - /// Link for next set of results. - /// Keeps track of any properties unknown to the library. - internal CustomImageList(IReadOnlyList value, string nextLink, IDictionary serializedAdditionalRawData) + /// The CustomImage items on this page. + /// The link to the next page of items. + /// Keeps track of any properties unknown to the library. + internal CustomImageList(IList value, Uri nextLink, IDictionary additionalBinaryDataProperties) { Value = value; NextLink = nextLink; - _serializedAdditionalRawData = serializedAdditionalRawData; + _additionalBinaryDataProperties = additionalBinaryDataProperties; } - /// Results of the list operation. - public IReadOnlyList Value { get; } - /// Link for next set of results. - public string NextLink { get; } + /// The CustomImage items on this page. + public IList Value { get; } + + /// The link to the next page of items. + public Uri NextLink { get; } } } diff --git a/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/Models/CustomImageProperties.Serialization.cs b/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/Models/CustomImageProperties.Serialization.cs new file mode 100644 index 000000000000..c85c222d6547 --- /dev/null +++ b/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/Models/CustomImageProperties.Serialization.cs @@ -0,0 +1,313 @@ +// 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.DevTestLabs; + +namespace Azure.ResourceManager.DevTestLabs.Models +{ + /// Properties of a custom image. + internal partial class CustomImageProperties : IJsonModel + { + /// The data to parse. + /// The client options for reading and writing models. + protected virtual CustomImageProperties 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 DeserializeCustomImageProperties(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(CustomImageProperties)} does not support reading '{options.Format}' format."); + } + } + + /// 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(CustomImageProperties)} does not support writing '{format}' format."); + } + if (Optional.IsDefined(Vm)) + { + writer.WritePropertyName("vm"u8); + writer.WriteObjectValue(Vm, options); + } + if (Optional.IsDefined(Vhd)) + { + writer.WritePropertyName("vhd"u8); + writer.WriteObjectValue(Vhd, options); + } + if (Optional.IsDefined(Description)) + { + writer.WritePropertyName("description"u8); + writer.WriteStringValue(Description); + } + if (Optional.IsDefined(Author)) + { + writer.WritePropertyName("author"u8); + writer.WriteStringValue(Author); + } + if (options.Format != "W" && Optional.IsDefined(CreatedOn)) + { + writer.WritePropertyName("creationDate"u8); + writer.WriteStringValue(CreatedOn.Value, "O"); + } + if (Optional.IsDefined(ManagedImageId)) + { + writer.WritePropertyName("managedImageId"u8); + writer.WriteStringValue(ManagedImageId); + } + if (Optional.IsDefined(ManagedSnapshotId)) + { + writer.WritePropertyName("managedSnapshotId"u8); + writer.WriteStringValue(ManagedSnapshotId); + } + if (Optional.IsCollectionDefined(DataDiskStorageInfo)) + { + writer.WritePropertyName("dataDiskStorageInfo"u8); + writer.WriteStartArray(); + foreach (DevTestLabDataDiskStorageTypeInfo item in DataDiskStorageInfo) + { + writer.WriteObjectValue(item, options); + } + writer.WriteEndArray(); + } + if (Optional.IsDefined(CustomImagePlan)) + { + writer.WritePropertyName("customImagePlan"u8); + writer.WriteObjectValue(CustomImagePlan, options); + } + if (Optional.IsDefined(IsPlanAuthorized)) + { + writer.WritePropertyName("isPlanAuthorized"u8); + writer.WriteBooleanValue(IsPlanAuthorized.Value); + } + if (options.Format != "W" && Optional.IsDefined(ProvisioningState)) + { + writer.WritePropertyName("provisioningState"u8); + writer.WriteStringValue(ProvisioningState); + } + if (options.Format != "W" && Optional.IsDefined(UniqueIdentifier)) + { + writer.WritePropertyName("uniqueIdentifier"u8); + writer.WriteStringValue(UniqueIdentifier.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. + CustomImageProperties IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) => JsonModelCreateCore(ref reader, options); + + /// The JSON reader. + /// The client options for reading and writing models. + protected virtual CustomImageProperties 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(CustomImageProperties)} does not support reading '{format}' format."); + } + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeCustomImageProperties(document.RootElement, options); + } + + /// The JSON element to deserialize. + /// The client options for reading and writing models. + internal static CustomImageProperties DeserializeCustomImageProperties(JsonElement element, ModelReaderWriterOptions options) + { + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + DevTestLabCustomImageVm vm = default; + DevTestLabCustomImageVhd vhd = default; + string description = default; + string author = default; + DateTimeOffset? createdOn = default; + string managedImageId = default; + string managedSnapshotId = default; + IList dataDiskStorageInfo = default; + DevTestLabCustomImagePlan customImagePlan = default; + bool? isPlanAuthorized = default; + string provisioningState = default; + Guid? uniqueIdentifier = default; + IDictionary additionalBinaryDataProperties = new ChangeTrackingDictionary(); + foreach (var prop in element.EnumerateObject()) + { + if (prop.NameEquals("vm"u8)) + { + if (prop.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + vm = DevTestLabCustomImageVm.DeserializeDevTestLabCustomImageVm(prop.Value, options); + continue; + } + if (prop.NameEquals("vhd"u8)) + { + if (prop.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + vhd = DevTestLabCustomImageVhd.DeserializeDevTestLabCustomImageVhd(prop.Value, options); + continue; + } + if (prop.NameEquals("description"u8)) + { + description = prop.Value.GetString(); + continue; + } + if (prop.NameEquals("author"u8)) + { + author = prop.Value.GetString(); + continue; + } + if (prop.NameEquals("creationDate"u8)) + { + if (prop.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + createdOn = prop.Value.GetDateTimeOffset("O"); + continue; + } + if (prop.NameEquals("managedImageId"u8)) + { + managedImageId = prop.Value.GetString(); + continue; + } + if (prop.NameEquals("managedSnapshotId"u8)) + { + managedSnapshotId = prop.Value.GetString(); + continue; + } + if (prop.NameEquals("dataDiskStorageInfo"u8)) + { + if (prop.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + List array = new List(); + foreach (var item in prop.Value.EnumerateArray()) + { + array.Add(DevTestLabDataDiskStorageTypeInfo.DeserializeDevTestLabDataDiskStorageTypeInfo(item, options)); + } + dataDiskStorageInfo = array; + continue; + } + if (prop.NameEquals("customImagePlan"u8)) + { + if (prop.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + customImagePlan = DevTestLabCustomImagePlan.DeserializeDevTestLabCustomImagePlan(prop.Value, options); + continue; + } + if (prop.NameEquals("isPlanAuthorized"u8)) + { + if (prop.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + isPlanAuthorized = prop.Value.GetBoolean(); + continue; + } + if (prop.NameEquals("provisioningState"u8)) + { + provisioningState = prop.Value.GetString(); + continue; + } + if (prop.NameEquals("uniqueIdentifier"u8)) + { + if (prop.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + uniqueIdentifier = new Guid(prop.Value.GetString()); + continue; + } + if (options.Format != "W") + { + additionalBinaryDataProperties.Add(prop.Name, BinaryData.FromString(prop.Value.GetRawText())); + } + } + return new CustomImageProperties( + vm, + vhd, + description, + author, + createdOn, + managedImageId, + managedSnapshotId, + dataDiskStorageInfo ?? new ChangeTrackingList(), + customImagePlan, + isPlanAuthorized, + provisioningState, + uniqueIdentifier, + 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, AzureResourceManagerDevTestLabsContext.Default); + default: + throw new FormatException($"The model {nameof(CustomImageProperties)} does not support writing '{options.Format}' format."); + } + } + + /// The data to parse. + /// The client options for reading and writing models. + CustomImageProperties IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) => PersistableModelCreateCore(data, options); + + /// The client options for reading and writing models. + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + } +} diff --git a/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/Models/CustomImageProperties.cs b/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/Models/CustomImageProperties.cs new file mode 100644 index 000000000000..12765bf10344 --- /dev/null +++ b/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/Models/CustomImageProperties.cs @@ -0,0 +1,93 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; +using Azure.ResourceManager.DevTestLabs; + +namespace Azure.ResourceManager.DevTestLabs.Models +{ + /// Properties of a custom image. + internal partial class CustomImageProperties + { + /// Keeps track of any properties unknown to the library. + private protected readonly IDictionary _additionalBinaryDataProperties; + + /// Initializes a new instance of . + public CustomImageProperties() + { + DataDiskStorageInfo = new ChangeTrackingList(); + } + + /// Initializes a new instance of . + /// The virtual machine from which the image is to be created. + /// The VHD from which the image is to be created. + /// The description of the custom image. + /// The author of the custom image. + /// The creation date of the custom image. + /// The Managed Image Id backing the custom image. + /// The Managed Snapshot Id backing the custom image. + /// Storage information about the data disks present in the custom image. + /// Storage information about the plan related to this custom image. + /// Whether or not the custom images underlying offer/plan has been enabled for programmatic deployment. + /// The provisioning status of the resource. + /// The unique immutable identifier of a resource (Guid). + /// Keeps track of any properties unknown to the library. + internal CustomImageProperties(DevTestLabCustomImageVm vm, DevTestLabCustomImageVhd vhd, string description, string author, DateTimeOffset? createdOn, string managedImageId, string managedSnapshotId, IList dataDiskStorageInfo, DevTestLabCustomImagePlan customImagePlan, bool? isPlanAuthorized, string provisioningState, Guid? uniqueIdentifier, IDictionary additionalBinaryDataProperties) + { + Vm = vm; + Vhd = vhd; + Description = description; + Author = author; + CreatedOn = createdOn; + ManagedImageId = managedImageId; + ManagedSnapshotId = managedSnapshotId; + DataDiskStorageInfo = dataDiskStorageInfo; + CustomImagePlan = customImagePlan; + IsPlanAuthorized = isPlanAuthorized; + ProvisioningState = provisioningState; + UniqueIdentifier = uniqueIdentifier; + _additionalBinaryDataProperties = additionalBinaryDataProperties; + } + + /// The virtual machine from which the image is to be created. + public DevTestLabCustomImageVm Vm { get; set; } + + /// The VHD from which the image is to be created. + public DevTestLabCustomImageVhd Vhd { get; set; } + + /// The description of the custom image. + public string Description { get; set; } + + /// The author of the custom image. + public string Author { get; set; } + + /// The creation date of the custom image. + public DateTimeOffset? CreatedOn { get; } + + /// The Managed Image Id backing the custom image. + public string ManagedImageId { get; set; } + + /// The Managed Snapshot Id backing the custom image. + public string ManagedSnapshotId { get; set; } + + /// Storage information about the data disks present in the custom image. + public IList DataDiskStorageInfo { get; } = new ChangeTrackingList(); + + /// Storage information about the plan related to this custom image. + public DevTestLabCustomImagePlan CustomImagePlan { get; set; } + + /// Whether or not the custom images underlying offer/plan has been enabled for programmatic deployment. + public bool? IsPlanAuthorized { get; set; } + + /// The provisioning status of the resource. + public string ProvisioningState { get; } + + /// The unique immutable identifier of a resource (Guid). + public Guid? UniqueIdentifier { get; } + } +} diff --git a/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/Models/DayDetails.Serialization.cs b/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/Models/DayDetails.Serialization.cs index ce56f4cddc0b..0ace8374155e 100644 --- a/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/Models/DayDetails.Serialization.cs +++ b/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/Models/DayDetails.Serialization.cs @@ -9,14 +9,32 @@ using System.ClientModel.Primitives; using System.Collections.Generic; using System.Text.Json; -using Azure.Core; +using Azure.ResourceManager.DevTestLabs; namespace Azure.ResourceManager.DevTestLabs.Models { - internal partial class DayDetails : IUtf8JsonSerializable, IJsonModel + /// Properties of a daily schedule. + internal partial class DayDetails : IJsonModel { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + /// The data to parse. + /// The client options for reading and writing models. + protected virtual DayDetails 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 DeserializeDayDetails(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(DayDetails)} does not support reading '{options.Format}' format."); + } + } + /// The JSON writer. + /// The client options for reading and writing models. void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) { writer.WriteStartObject(); @@ -28,26 +46,25 @@ void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOption /// 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(DayDetails)} does not support writing '{format}' format."); } - if (Optional.IsDefined(Time)) { writer.WritePropertyName("time"u8); writer.WriteStringValue(Time); } - 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); } @@ -56,49 +73,55 @@ protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWrit } } - DayDetails IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + /// The JSON reader. + /// The client options for reading and writing models. + DayDetails IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) => JsonModelCreateCore(ref reader, options); + + /// The JSON reader. + /// The client options for reading and writing models. + protected virtual DayDetails 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(DayDetails)} does not support reading '{format}' format."); } - using JsonDocument document = JsonDocument.ParseValue(ref reader); return DeserializeDayDetails(document.RootElement, options); } - internal static DayDetails DeserializeDayDetails(JsonElement element, ModelReaderWriterOptions options = null) + /// The JSON element to deserialize. + /// The client options for reading and writing models. + internal static DayDetails DeserializeDayDetails(JsonElement element, ModelReaderWriterOptions options) { - options ??= ModelSerializationExtensions.WireOptions; - if (element.ValueKind == JsonValueKind.Null) { return null; } string time = 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("time"u8)) + if (prop.NameEquals("time"u8)) { - time = property.Value.GetString(); + time = 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 DayDetails(time, serializedAdditionalRawData); + return new DayDetails(time, 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": @@ -108,22 +131,11 @@ BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) } } - DayDetails 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 DeserializeDayDetails(document.RootElement, options); - } - default: - throw new FormatException($"The model {nameof(DayDetails)} does not support reading '{options.Format}' format."); - } - } + /// The data to parse. + /// The client options for reading and writing models. + DayDetails IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) => PersistableModelCreateCore(data, options); + /// The client options for reading and writing models. string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; } } diff --git a/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/Models/DayDetails.cs b/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/Models/DayDetails.cs index 142d20c6ef9d..503f3faad782 100644 --- a/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/Models/DayDetails.cs +++ b/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/Models/DayDetails.cs @@ -13,37 +13,8 @@ namespace Azure.ResourceManager.DevTestLabs.Models /// Properties of a daily schedule. internal partial class DayDetails { - /// - /// 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 DayDetails() @@ -52,11 +23,11 @@ public DayDetails() /// Initializes a new instance of . /// The time of day the schedule will occur. - /// Keeps track of any properties unknown to the library. - internal DayDetails(string time, IDictionary serializedAdditionalRawData) + /// Keeps track of any properties unknown to the library. + internal DayDetails(string time, IDictionary additionalBinaryDataProperties) { Time = time; - _serializedAdditionalRawData = serializedAdditionalRawData; + _additionalBinaryDataProperties = additionalBinaryDataProperties; } /// The time of day the schedule will occur. diff --git a/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/Models/DevTestLabAnnouncement.Serialization.cs b/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/Models/DevTestLabAnnouncement.Serialization.cs index a6905716a985..d0c113f439fa 100644 --- a/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/Models/DevTestLabAnnouncement.Serialization.cs +++ b/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/Models/DevTestLabAnnouncement.Serialization.cs @@ -9,14 +9,32 @@ using System.ClientModel.Primitives; using System.Collections.Generic; using System.Text.Json; -using Azure.Core; +using Azure.ResourceManager.DevTestLabs; namespace Azure.ResourceManager.DevTestLabs.Models { - public partial class DevTestLabAnnouncement : IUtf8JsonSerializable, IJsonModel + /// Properties of a lab's announcement banner. + public partial class DevTestLabAnnouncement : IJsonModel { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + /// The data to parse. + /// The client options for reading and writing models. + protected virtual DevTestLabAnnouncement 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 DeserializeDevTestLabAnnouncement(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(DevTestLabAnnouncement)} does not support reading '{options.Format}' format."); + } + } + /// The JSON writer. + /// The client options for reading and writing models. void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) { writer.WriteStartObject(); @@ -28,12 +46,11 @@ void IJsonModel.Write(Utf8JsonWriter writer, ModelReader /// 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(DevTestLabAnnouncement)} does not support writing '{format}' format."); } - if (Optional.IsDefined(Title)) { writer.WritePropertyName("title"u8); @@ -69,15 +86,15 @@ protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWrit writer.WritePropertyName("uniqueIdentifier"u8); writer.WriteStringValue(UniqueIdentifier.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); } @@ -86,22 +103,27 @@ protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWrit } } - DevTestLabAnnouncement IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + /// The JSON reader. + /// The client options for reading and writing models. + DevTestLabAnnouncement IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) => JsonModelCreateCore(ref reader, options); + + /// The JSON reader. + /// The client options for reading and writing models. + protected virtual DevTestLabAnnouncement 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(DevTestLabAnnouncement)} does not support reading '{format}' format."); } - using JsonDocument document = JsonDocument.ParseValue(ref reader); return DeserializeDevTestLabAnnouncement(document.RootElement, options); } - internal static DevTestLabAnnouncement DeserializeDevTestLabAnnouncement(JsonElement element, ModelReaderWriterOptions options = null) + /// The JSON element to deserialize. + /// The client options for reading and writing models. + internal static DevTestLabAnnouncement DeserializeDevTestLabAnnouncement(JsonElement element, ModelReaderWriterOptions options) { - options ??= ModelSerializationExtensions.WireOptions; - if (element.ValueKind == JsonValueKind.Null) { return null; @@ -109,86 +131,87 @@ internal static DevTestLabAnnouncement DeserializeDevTestLabAnnouncement(JsonEle string title = default; string markdown = default; DevTestLabEnableStatus? enabled = default; - DateTimeOffset? expirationDate = default; - bool? expired = default; + DateTimeOffset? expireOn = default; + bool? isExpired = default; string provisioningState = default; Guid? uniqueIdentifier = 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("title"u8)) + if (prop.NameEquals("title"u8)) { - title = property.Value.GetString(); + title = prop.Value.GetString(); continue; } - if (property.NameEquals("markdown"u8)) + if (prop.NameEquals("markdown"u8)) { - markdown = property.Value.GetString(); + markdown = prop.Value.GetString(); continue; } - if (property.NameEquals("enabled"u8)) + if (prop.NameEquals("enabled"u8)) { - if (property.Value.ValueKind == JsonValueKind.Null) + if (prop.Value.ValueKind == JsonValueKind.Null) { continue; } - enabled = new DevTestLabEnableStatus(property.Value.GetString()); + enabled = new DevTestLabEnableStatus(prop.Value.GetString()); continue; } - if (property.NameEquals("expirationDate"u8)) + if (prop.NameEquals("expirationDate"u8)) { - if (property.Value.ValueKind == JsonValueKind.Null) + if (prop.Value.ValueKind == JsonValueKind.Null) { continue; } - expirationDate = property.Value.GetDateTimeOffset("O"); + expireOn = prop.Value.GetDateTimeOffset("O"); continue; } - if (property.NameEquals("expired"u8)) + if (prop.NameEquals("expired"u8)) { - if (property.Value.ValueKind == JsonValueKind.Null) + if (prop.Value.ValueKind == JsonValueKind.Null) { continue; } - expired = property.Value.GetBoolean(); + isExpired = prop.Value.GetBoolean(); continue; } - if (property.NameEquals("provisioningState"u8)) + if (prop.NameEquals("provisioningState"u8)) { - provisioningState = property.Value.GetString(); + provisioningState = prop.Value.GetString(); continue; } - if (property.NameEquals("uniqueIdentifier"u8)) + if (prop.NameEquals("uniqueIdentifier"u8)) { - if (property.Value.ValueKind == JsonValueKind.Null) + if (prop.Value.ValueKind == JsonValueKind.Null) { continue; } - uniqueIdentifier = property.Value.GetGuid(); + uniqueIdentifier = new Guid(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 DevTestLabAnnouncement( title, markdown, enabled, - expirationDate, - expired, + expireOn, + isExpired, provisioningState, uniqueIdentifier, - serializedAdditionalRawData); + 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": @@ -198,22 +221,11 @@ BinaryData IPersistableModel.Write(ModelReaderWriterOpti } } - DevTestLabAnnouncement 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 DeserializeDevTestLabAnnouncement(document.RootElement, options); - } - default: - throw new FormatException($"The model {nameof(DevTestLabAnnouncement)} does not support reading '{options.Format}' format."); - } - } + /// The data to parse. + /// The client options for reading and writing models. + DevTestLabAnnouncement IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) => PersistableModelCreateCore(data, options); + /// The client options for reading and writing models. string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; } } diff --git a/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/Models/DevTestLabAnnouncement.cs b/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/Models/DevTestLabAnnouncement.cs index dbfab5347ab3..e32e91b574eb 100644 --- a/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/Models/DevTestLabAnnouncement.cs +++ b/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/Models/DevTestLabAnnouncement.cs @@ -13,37 +13,8 @@ namespace Azure.ResourceManager.DevTestLabs.Models /// Properties of a lab's announcement banner. public partial class DevTestLabAnnouncement { - /// - /// 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 DevTestLabAnnouncement() @@ -58,8 +29,8 @@ public DevTestLabAnnouncement() /// Has this announcement expired?. /// The provisioning status of the resource. /// The unique immutable identifier of a resource (Guid). - /// Keeps track of any properties unknown to the library. - internal DevTestLabAnnouncement(string title, string markdown, DevTestLabEnableStatus? enabled, DateTimeOffset? expireOn, bool? isExpired, string provisioningState, Guid? uniqueIdentifier, IDictionary serializedAdditionalRawData) + /// Keeps track of any properties unknown to the library. + internal DevTestLabAnnouncement(string title, string markdown, DevTestLabEnableStatus? enabled, DateTimeOffset? expireOn, bool? isExpired, string provisioningState, Guid? uniqueIdentifier, IDictionary additionalBinaryDataProperties) { Title = title; Markdown = markdown; @@ -68,21 +39,27 @@ internal DevTestLabAnnouncement(string title, string markdown, DevTestLabEnableS IsExpired = isExpired; ProvisioningState = provisioningState; UniqueIdentifier = uniqueIdentifier; - _serializedAdditionalRawData = serializedAdditionalRawData; + _additionalBinaryDataProperties = additionalBinaryDataProperties; } /// The plain text title for the lab announcement. public string Title { get; set; } + /// The markdown text (if any) that this lab displays in the UI. If left empty/null, nothing will be shown. public string Markdown { get; set; } + /// Is the lab announcement active/enabled at this time?. public DevTestLabEnableStatus? Enabled { get; set; } + /// The time at which the announcement expires (null for never). public DateTimeOffset? ExpireOn { get; set; } + /// Has this announcement expired?. public bool? IsExpired { get; set; } + /// The provisioning status of the resource. public string ProvisioningState { get; } + /// The unique immutable identifier of a resource (Guid). public Guid? UniqueIdentifier { get; } } diff --git a/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/Models/DevTestLabApplicableSchedule.Serialization.cs b/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/Models/DevTestLabApplicableSchedule.Serialization.cs index a0138125f003..5e6a23587f0b 100644 --- a/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/Models/DevTestLabApplicableSchedule.Serialization.cs +++ b/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/Models/DevTestLabApplicableSchedule.Serialization.cs @@ -10,15 +10,47 @@ using System.Collections.Generic; using System.Text; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.ResourceManager.DevTestLabs; using Azure.ResourceManager.Models; namespace Azure.ResourceManager.DevTestLabs.Models { - public partial class DevTestLabApplicableSchedule : IUtf8JsonSerializable, IJsonModel + /// Schedules applicable to a virtual machine. The schedules may have been defined on a VM or on lab level. + public partial class DevTestLabApplicableSchedule : TrackedResourceData, IJsonModel { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + /// Initializes a new instance of for deserialization. + internal DevTestLabApplicableSchedule() + { + } + /// 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)) + { + return DeserializeDevTestLabApplicableSchedule(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(DevTestLabApplicableSchedule)} does not support reading '{options.Format}' format."); + } + } + + /// The to deserialize the from. + internal static DevTestLabApplicableSchedule FromResponse(Response response) + { + using JsonDocument document = JsonDocument.Parse(response.Content, ModelSerializationExtensions.JsonDocumentOptions); + return DeserializeDevTestLabApplicableSchedule(document.RootElement, ModelSerializationExtensions.WireOptions); + } + + /// The JSON writer. + /// The client options for reading and writing models. void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) { writer.WriteStartObject(); @@ -30,155 +62,153 @@ void IJsonModel.Write(Utf8JsonWriter writer, Model /// 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(DevTestLabApplicableSchedule)} does not support writing '{format}' format."); } - base.JsonModelWriteCore(writer, options); - writer.WritePropertyName("properties"u8); - writer.WriteStartObject(); - if (Optional.IsDefined(LabVmsShutdown)) - { - writer.WritePropertyName("labVmsShutdown"u8); - writer.WriteObjectValue(LabVmsShutdown, options); - } - if (Optional.IsDefined(LabVmsStartup)) + if (Optional.IsCollectionDefined(Tags)) { - writer.WritePropertyName("labVmsStartup"u8); - writer.WriteObjectValue(LabVmsStartup, options); + writer.WritePropertyName("tags"u8); + writer.WriteStartObject(); + foreach (var item in Tags) + { + writer.WritePropertyName(item.Key); + if (item.Value == null) + { + writer.WriteNullValue(); + continue; + } + writer.WriteStringValue(item.Value); + } + writer.WriteEndObject(); } - writer.WriteEndObject(); + writer.WritePropertyName("properties"u8); + writer.WriteObjectValue(Properties, options); } - DevTestLabApplicableSchedule IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + /// The JSON reader. + /// The client options for reading and writing models. + DevTestLabApplicableSchedule IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) => (DevTestLabApplicableSchedule)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(DevTestLabApplicableSchedule)} does not support reading '{format}' format."); } - using JsonDocument document = JsonDocument.ParseValue(ref reader); return DeserializeDevTestLabApplicableSchedule(document.RootElement, options); } - internal static DevTestLabApplicableSchedule DeserializeDevTestLabApplicableSchedule(JsonElement element, ModelReaderWriterOptions options = null) + /// The JSON element to deserialize. + /// The client options for reading and writing models. + internal static DevTestLabApplicableSchedule DeserializeDevTestLabApplicableSchedule(JsonElement element, ModelReaderWriterOptions options) { - options ??= ModelSerializationExtensions.WireOptions; - if (element.ValueKind == JsonValueKind.Null) { return null; } - IDictionary tags = default; - AzureLocation location = default; ResourceIdentifier id = default; string name = default; - ResourceType type = default; + ResourceType resourceType = default; SystemData systemData = default; - DevTestLabScheduleData labVmsShutdown = default; - DevTestLabScheduleData labVmsStartup = default; - IDictionary serializedAdditionalRawData = default; - Dictionary rawDataDictionary = new Dictionary(); - foreach (var property in element.EnumerateObject()) + IDictionary additionalBinaryDataProperties = new ChangeTrackingDictionary(); + AzureLocation location = default; + IDictionary tags = default; + ApplicableScheduleProperties properties = default; + foreach (var prop in element.EnumerateObject()) { - if (property.NameEquals("tags"u8)) + if (prop.NameEquals("id"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()) - { - dictionary.Add(property0.Name, property0.Value.GetString()); - } - tags = dictionary; + id = new ResourceIdentifier(prop.Value.GetString()); continue; } - if (property.NameEquals("location"u8)) + if (prop.NameEquals("name"u8)) { - location = new AzureLocation(property.Value.GetString()); + name = prop.Value.GetString(); continue; } - if (property.NameEquals("id"u8)) + if (prop.NameEquals("type"u8)) { - id = new ResourceIdentifier(property.Value.GetString()); - continue; - } - if (property.NameEquals("name"u8)) - { - name = property.Value.GetString(); - continue; - } - if (property.NameEquals("type"u8)) - { - type = new ResourceType(property.Value.GetString()); + if (prop.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + resourceType = new ResourceType(prop.Value.GetString()); continue; } - if (property.NameEquals("systemData"u8)) + if (prop.NameEquals("systemData"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, AzureResourceManagerDevTestLabsContext.Default); + systemData = ModelReaderWriter.Read(new BinaryData(Encoding.UTF8.GetBytes(prop.Value.GetRawText())), ModelSerializationExtensions.WireOptions, AzureResourceManagerDevTestLabsContext.Default); + continue; + } + if (prop.NameEquals("location"u8)) + { + location = new AzureLocation(prop.Value.GetString()); continue; } - if (property.NameEquals("properties"u8)) + if (prop.NameEquals("tags"u8)) { - if (property.Value.ValueKind == JsonValueKind.Null) + if (prop.Value.ValueKind == JsonValueKind.Null) { - property.ThrowNonNullablePropertyIsNull(); continue; } - foreach (var property0 in property.Value.EnumerateObject()) + Dictionary dictionary = new Dictionary(); + foreach (var prop0 in prop.Value.EnumerateObject()) { - if (property0.NameEquals("labVmsShutdown"u8)) + if (prop0.Value.ValueKind == JsonValueKind.Null) { - if (property0.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - labVmsShutdown = DevTestLabScheduleData.DeserializeDevTestLabScheduleData(property0.Value, options); - continue; + dictionary.Add(prop0.Name, null); } - if (property0.NameEquals("labVmsStartup"u8)) + else { - if (property0.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - labVmsStartup = DevTestLabScheduleData.DeserializeDevTestLabScheduleData(property0.Value, options); - continue; + dictionary.Add(prop0.Name, prop0.Value.GetString()); } } + tags = dictionary; + continue; + } + if (prop.NameEquals("properties"u8)) + { + properties = ApplicableScheduleProperties.DeserializeApplicableScheduleProperties(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 DevTestLabApplicableSchedule( id, name, - type, + resourceType, systemData, - tags ?? new ChangeTrackingDictionary(), + additionalBinaryDataProperties, location, - labVmsShutdown, - labVmsStartup, - serializedAdditionalRawData); + tags ?? new ChangeTrackingDictionary(), + 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": @@ -188,22 +218,11 @@ BinaryData IPersistableModel.Write(ModelReaderWrit } } - DevTestLabApplicableSchedule 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 DeserializeDevTestLabApplicableSchedule(document.RootElement, options); - } - default: - throw new FormatException($"The model {nameof(DevTestLabApplicableSchedule)} does not support reading '{options.Format}' format."); - } - } + /// The data to parse. + /// The client options for reading and writing models. + DevTestLabApplicableSchedule IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) => (DevTestLabApplicableSchedule)PersistableModelCreateCore(data, options); + /// The client options for reading and writing models. string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; } } diff --git a/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/Models/DevTestLabApplicableSchedule.cs b/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/Models/DevTestLabApplicableSchedule.cs index f0490946c591..f08b7033b1e6 100644 --- a/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/Models/DevTestLabApplicableSchedule.cs +++ b/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/Models/DevTestLabApplicableSchedule.cs @@ -8,6 +8,7 @@ using System; using System.Collections.Generic; using Azure.Core; +using Azure.ResourceManager.DevTestLabs; using Azure.ResourceManager.Models; namespace Azure.ResourceManager.DevTestLabs.Models @@ -15,69 +16,66 @@ namespace Azure.ResourceManager.DevTestLabs.Models /// Schedules applicable to a virtual machine. The schedules may have been defined on a VM or on lab level. public partial class DevTestLabApplicableSchedule : 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 DevTestLabApplicableSchedule(AzureLocation location) : base(location) { + } /// Initializes a new instance of . - /// The id. - /// The name. - /// The resourceType. - /// The systemData. - /// The tags. - /// The location. - /// The auto-shutdown schedule, if one has been set at the lab or lab resource level. - /// The auto-startup schedule, if one has been set at the lab or lab resource level. - /// Keeps track of any properties unknown to the library. - internal DevTestLabApplicableSchedule(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, IDictionary tags, AzureLocation location, DevTestLabScheduleData labVmsShutdown, DevTestLabScheduleData labVmsStartup, IDictionary serializedAdditionalRawData) : base(id, name, resourceType, systemData, tags, 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. + /// The geo-location where the resource lives. + /// The tags of the resource. + /// The properties of the resource. + internal DevTestLabApplicableSchedule(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, IDictionary additionalBinaryDataProperties, AzureLocation location, IDictionary tags, ApplicableScheduleProperties properties) : base(id, name, resourceType, systemData, tags, location) { - LabVmsShutdown = labVmsShutdown; - LabVmsStartup = labVmsStartup; - _serializedAdditionalRawData = serializedAdditionalRawData; + _additionalBinaryDataProperties = additionalBinaryDataProperties; + Properties = properties; } - /// Initializes a new instance of for deserialization. - internal DevTestLabApplicableSchedule() + /// The properties of the resource. + internal ApplicableScheduleProperties Properties { get; set; } + + /// The auto-shutdown schedule, if one has been set at the lab or lab resource level. + public DevTestLabScheduleData LabVmsShutdown { + get + { + return Properties is null ? default : Properties.LabVmsShutdown; + } + set + { + if (Properties is null) + { + Properties = new ApplicableScheduleProperties(); + } + Properties.LabVmsShutdown = value; + } } - /// The auto-shutdown schedule, if one has been set at the lab or lab resource level. - public DevTestLabScheduleData LabVmsShutdown { get; set; } /// The auto-startup schedule, if one has been set at the lab or lab resource level. - public DevTestLabScheduleData LabVmsStartup { get; set; } + public DevTestLabScheduleData LabVmsStartup + { + get + { + return Properties is null ? default : Properties.LabVmsStartup; + } + set + { + if (Properties is null) + { + Properties = new ApplicableScheduleProperties(); + } + Properties.LabVmsStartup = value; + } + } } } diff --git a/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/Models/DevTestLabArmTemplateInfo.Serialization.cs b/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/Models/DevTestLabArmTemplateInfo.Serialization.cs index 0ad7a75d5a9f..12d2071f5194 100644 --- a/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/Models/DevTestLabArmTemplateInfo.Serialization.cs +++ b/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/Models/DevTestLabArmTemplateInfo.Serialization.cs @@ -9,14 +9,40 @@ using System.ClientModel.Primitives; using System.Collections.Generic; using System.Text.Json; -using Azure.Core; +using Azure; +using Azure.ResourceManager.DevTestLabs; namespace Azure.ResourceManager.DevTestLabs.Models { - public partial class DevTestLabArmTemplateInfo : IUtf8JsonSerializable, IJsonModel + /// Information about a generated ARM template. + public partial class DevTestLabArmTemplateInfo : IJsonModel { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + /// The data to parse. + /// The client options for reading and writing models. + protected virtual DevTestLabArmTemplateInfo 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 DeserializeDevTestLabArmTemplateInfo(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(DevTestLabArmTemplateInfo)} does not support reading '{options.Format}' format."); + } + } + /// The to deserialize the from. + internal static DevTestLabArmTemplateInfo FromResponse(Response response) + { + using JsonDocument document = JsonDocument.Parse(response.Content, ModelSerializationExtensions.JsonDocumentOptions); + return DeserializeDevTestLabArmTemplateInfo(document.RootElement, ModelSerializationExtensions.WireOptions); + } + + /// The JSON writer. + /// The client options for reading and writing models. void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) { writer.WriteStartObject(); @@ -28,19 +54,18 @@ void IJsonModel.Write(Utf8JsonWriter writer, ModelRea /// 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(DevTestLabArmTemplateInfo)} does not support writing '{format}' format."); } - if (Optional.IsDefined(Template)) { writer.WritePropertyName("template"u8); #if NET6_0_OR_GREATER - writer.WriteRawValue(Template); + writer.WriteRawValue(Template); #else - using (JsonDocument document = JsonDocument.Parse(Template, ModelSerializationExtensions.JsonDocumentOptions)) + using (JsonDocument document = JsonDocument.Parse(Template)) { JsonSerializer.Serialize(writer, document.RootElement); } @@ -50,23 +75,23 @@ protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWrit { writer.WritePropertyName("parameters"u8); #if NET6_0_OR_GREATER - writer.WriteRawValue(Parameters); + writer.WriteRawValue(Parameters); #else - using (JsonDocument document = JsonDocument.Parse(Parameters, ModelSerializationExtensions.JsonDocumentOptions)) + using (JsonDocument document = JsonDocument.Parse(Parameters)) { JsonSerializer.Serialize(writer, document.RootElement); } #endif } - 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); } @@ -75,63 +100,69 @@ protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWrit } } - DevTestLabArmTemplateInfo IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + /// The JSON reader. + /// The client options for reading and writing models. + DevTestLabArmTemplateInfo IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) => JsonModelCreateCore(ref reader, options); + + /// The JSON reader. + /// The client options for reading and writing models. + protected virtual DevTestLabArmTemplateInfo 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(DevTestLabArmTemplateInfo)} does not support reading '{format}' format."); } - using JsonDocument document = JsonDocument.ParseValue(ref reader); return DeserializeDevTestLabArmTemplateInfo(document.RootElement, options); } - internal static DevTestLabArmTemplateInfo DeserializeDevTestLabArmTemplateInfo(JsonElement element, ModelReaderWriterOptions options = null) + /// The JSON element to deserialize. + /// The client options for reading and writing models. + internal static DevTestLabArmTemplateInfo DeserializeDevTestLabArmTemplateInfo(JsonElement element, ModelReaderWriterOptions options) { - options ??= ModelSerializationExtensions.WireOptions; - if (element.ValueKind == JsonValueKind.Null) { return null; } BinaryData template = default; BinaryData parameters = 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("template"u8)) + if (prop.NameEquals("template"u8)) { - if (property.Value.ValueKind == JsonValueKind.Null) + if (prop.Value.ValueKind == JsonValueKind.Null) { continue; } - template = BinaryData.FromString(property.Value.GetRawText()); + template = BinaryData.FromString(prop.Value.GetRawText()); continue; } - if (property.NameEquals("parameters"u8)) + if (prop.NameEquals("parameters"u8)) { - if (property.Value.ValueKind == JsonValueKind.Null) + if (prop.Value.ValueKind == JsonValueKind.Null) { continue; } - parameters = BinaryData.FromString(property.Value.GetRawText()); + parameters = BinaryData.FromString(prop.Value.GetRawText()); 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 DevTestLabArmTemplateInfo(template, parameters, serializedAdditionalRawData); + return new DevTestLabArmTemplateInfo(template, parameters, 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": @@ -141,22 +172,11 @@ BinaryData IPersistableModel.Write(ModelReaderWriterO } } - DevTestLabArmTemplateInfo 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 DeserializeDevTestLabArmTemplateInfo(document.RootElement, options); - } - default: - throw new FormatException($"The model {nameof(DevTestLabArmTemplateInfo)} does not support reading '{options.Format}' format."); - } - } + /// The data to parse. + /// The client options for reading and writing models. + DevTestLabArmTemplateInfo IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) => PersistableModelCreateCore(data, options); + /// The client options for reading and writing models. string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; } } diff --git a/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/Models/DevTestLabArmTemplateInfo.cs b/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/Models/DevTestLabArmTemplateInfo.cs index acd6464736e2..56e103baa169 100644 --- a/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/Models/DevTestLabArmTemplateInfo.cs +++ b/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/Models/DevTestLabArmTemplateInfo.cs @@ -7,43 +7,15 @@ using System; using System.Collections.Generic; +using System.Text.Json; namespace Azure.ResourceManager.DevTestLabs.Models { /// Information about a generated ARM template. public partial class DevTestLabArmTemplateInfo { - /// - /// 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 DevTestLabArmTemplateInfo() @@ -53,71 +25,64 @@ internal DevTestLabArmTemplateInfo() /// Initializes a new instance of . /// The template's contents. /// The parameters of the ARM template. - /// Keeps track of any properties unknown to the library. - internal DevTestLabArmTemplateInfo(BinaryData template, BinaryData parameters, IDictionary serializedAdditionalRawData) + /// Keeps track of any properties unknown to the library. + internal DevTestLabArmTemplateInfo(BinaryData template, BinaryData parameters, IDictionary additionalBinaryDataProperties) { Template = template; Parameters = parameters; - _serializedAdditionalRawData = serializedAdditionalRawData; + _additionalBinaryDataProperties = additionalBinaryDataProperties; } /// /// The template's contents. - /// - /// To assign an object to this property use . - /// - /// - /// To assign an already formatted json string to this property use . - /// + /// To assign an object to this property use . + /// To assign an already formatted json string to this property use . /// /// Examples: /// /// - /// BinaryData.FromObjectAsJson("foo") - /// Creates a payload of "foo". + /// BinaryData.FromObjectAsJson("foo"). + /// Creates a payload of "foo". /// /// - /// BinaryData.FromString("\"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.FromObjectAsJson(new { key = "value" }). + /// Creates a payload of { "key": "value" }. /// /// - /// BinaryData.FromString("{\"key\": \"value\"}") - /// Creates a payload of { "key": "value" }. + /// BinaryData.FromString("{\"key\": \"value\"}"). + /// Creates a payload of { "key": "value" }. /// /// /// /// public BinaryData Template { get; } + /// /// The parameters of the ARM template. - /// - /// To assign an object to this property use . - /// - /// - /// To assign an already formatted json string to this property use . - /// + /// To assign an object to this property use . + /// To assign an already formatted json string to this property use . /// /// Examples: /// /// - /// BinaryData.FromObjectAsJson("foo") - /// Creates a payload of "foo". + /// BinaryData.FromObjectAsJson("foo"). + /// Creates a payload of "foo". /// /// - /// BinaryData.FromString("\"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.FromObjectAsJson(new { key = "value" }). + /// Creates a payload of { "key": "value" }. /// /// - /// BinaryData.FromString("{\"key\": \"value\"}") - /// Creates a payload of { "key": "value" }. + /// BinaryData.FromString("{\"key\": \"value\"}"). + /// Creates a payload of { "key": "value" }. /// /// /// diff --git a/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/Models/DevTestLabArmTemplateParameter.Serialization.cs b/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/Models/DevTestLabArmTemplateParameter.Serialization.cs index ce2963a186f3..6d026eec03ce 100644 --- a/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/Models/DevTestLabArmTemplateParameter.Serialization.cs +++ b/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/Models/DevTestLabArmTemplateParameter.Serialization.cs @@ -9,14 +9,32 @@ using System.ClientModel.Primitives; using System.Collections.Generic; using System.Text.Json; -using Azure.Core; +using Azure.ResourceManager.DevTestLabs; namespace Azure.ResourceManager.DevTestLabs.Models { - public partial class DevTestLabArmTemplateParameter : IUtf8JsonSerializable, IJsonModel + /// Properties of an Azure Resource Manager template parameter. + public partial class DevTestLabArmTemplateParameter : IJsonModel { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + /// The data to parse. + /// The client options for reading and writing models. + protected virtual DevTestLabArmTemplateParameter 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 DeserializeDevTestLabArmTemplateParameter(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(DevTestLabArmTemplateParameter)} does not support reading '{options.Format}' format."); + } + } + /// The JSON writer. + /// The client options for reading and writing models. void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) { writer.WriteStartObject(); @@ -28,12 +46,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(DevTestLabArmTemplateParameter)} does not support writing '{format}' format."); } - if (Optional.IsDefined(Name)) { writer.WritePropertyName("name"u8); @@ -44,15 +61,15 @@ protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWrit writer.WritePropertyName("value"u8); writer.WriteStringValue(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); } @@ -61,55 +78,61 @@ protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWrit } } - DevTestLabArmTemplateParameter IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + /// The JSON reader. + /// The client options for reading and writing models. + DevTestLabArmTemplateParameter IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) => JsonModelCreateCore(ref reader, options); + + /// The JSON reader. + /// The client options for reading and writing models. + protected virtual DevTestLabArmTemplateParameter 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(DevTestLabArmTemplateParameter)} does not support reading '{format}' format."); } - using JsonDocument document = JsonDocument.ParseValue(ref reader); return DeserializeDevTestLabArmTemplateParameter(document.RootElement, options); } - internal static DevTestLabArmTemplateParameter DeserializeDevTestLabArmTemplateParameter(JsonElement element, ModelReaderWriterOptions options = null) + /// The JSON element to deserialize. + /// The client options for reading and writing models. + internal static DevTestLabArmTemplateParameter DeserializeDevTestLabArmTemplateParameter(JsonElement element, ModelReaderWriterOptions options) { - options ??= ModelSerializationExtensions.WireOptions; - if (element.ValueKind == JsonValueKind.Null) { return null; } string name = default; string value = 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("name"u8)) + if (prop.NameEquals("name"u8)) { - name = property.Value.GetString(); + name = prop.Value.GetString(); continue; } - if (property.NameEquals("value"u8)) + if (prop.NameEquals("value"u8)) { - value = property.Value.GetString(); + value = 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 DevTestLabArmTemplateParameter(name, value, serializedAdditionalRawData); + return new DevTestLabArmTemplateParameter(name, value, 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,22 +142,11 @@ BinaryData IPersistableModel.Write(ModelReaderWr } } - DevTestLabArmTemplateParameter 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 DeserializeDevTestLabArmTemplateParameter(document.RootElement, options); - } - default: - throw new FormatException($"The model {nameof(DevTestLabArmTemplateParameter)} does not support reading '{options.Format}' format."); - } - } + /// The data to parse. + /// The client options for reading and writing models. + DevTestLabArmTemplateParameter IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) => PersistableModelCreateCore(data, options); + /// The client options for reading and writing models. string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; } } diff --git a/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/Models/DevTestLabArmTemplateParameter.cs b/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/Models/DevTestLabArmTemplateParameter.cs index a628232376f9..c591cb55ab41 100644 --- a/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/Models/DevTestLabArmTemplateParameter.cs +++ b/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/Models/DevTestLabArmTemplateParameter.cs @@ -13,37 +13,8 @@ namespace Azure.ResourceManager.DevTestLabs.Models /// Properties of an Azure Resource Manager template parameter. public partial class DevTestLabArmTemplateParameter { - /// - /// 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 DevTestLabArmTemplateParameter() @@ -53,16 +24,17 @@ public DevTestLabArmTemplateParameter() /// Initializes a new instance of . /// The name of the template parameter. /// The value of the template parameter. - /// Keeps track of any properties unknown to the library. - internal DevTestLabArmTemplateParameter(string name, string value, IDictionary serializedAdditionalRawData) + /// Keeps track of any properties unknown to the library. + internal DevTestLabArmTemplateParameter(string name, string value, IDictionary additionalBinaryDataProperties) { Name = name; Value = value; - _serializedAdditionalRawData = serializedAdditionalRawData; + _additionalBinaryDataProperties = additionalBinaryDataProperties; } /// The name of the template parameter. public string Name { get; set; } + /// The value of the template parameter. public string Value { get; set; } } diff --git a/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/Models/DevTestLabArtifactDeploymentStatus.Serialization.cs b/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/Models/DevTestLabArtifactDeploymentStatus.Serialization.cs index e134d5ea9bd4..c1689b59f8a4 100644 --- a/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/Models/DevTestLabArtifactDeploymentStatus.Serialization.cs +++ b/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/Models/DevTestLabArtifactDeploymentStatus.Serialization.cs @@ -9,14 +9,32 @@ using System.ClientModel.Primitives; using System.Collections.Generic; using System.Text.Json; -using Azure.Core; +using Azure.ResourceManager.DevTestLabs; namespace Azure.ResourceManager.DevTestLabs.Models { - public partial class DevTestLabArtifactDeploymentStatus : IUtf8JsonSerializable, IJsonModel + /// Properties of an artifact deployment. + public partial class DevTestLabArtifactDeploymentStatus : IJsonModel { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + /// The data to parse. + /// The client options for reading and writing models. + protected virtual DevTestLabArtifactDeploymentStatus 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 DeserializeDevTestLabArtifactDeploymentStatus(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(DevTestLabArtifactDeploymentStatus)} does not support reading '{options.Format}' format."); + } + } + /// The JSON writer. + /// The client options for reading and writing models. void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) { writer.WriteStartObject(); @@ -28,12 +46,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(DevTestLabArtifactDeploymentStatus)} does not support writing '{format}' format."); } - if (Optional.IsDefined(DeploymentStatus)) { writer.WritePropertyName("deploymentStatus"u8); @@ -49,15 +66,15 @@ protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWrit writer.WritePropertyName("totalArtifacts"u8); writer.WriteNumberValue(TotalArtifacts.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); } @@ -66,22 +83,27 @@ protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWrit } } - DevTestLabArtifactDeploymentStatus IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + /// The JSON reader. + /// The client options for reading and writing models. + DevTestLabArtifactDeploymentStatus IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) => JsonModelCreateCore(ref reader, options); + + /// The JSON reader. + /// The client options for reading and writing models. + protected virtual DevTestLabArtifactDeploymentStatus 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(DevTestLabArtifactDeploymentStatus)} does not support reading '{format}' format."); } - using JsonDocument document = JsonDocument.ParseValue(ref reader); return DeserializeDevTestLabArtifactDeploymentStatus(document.RootElement, options); } - internal static DevTestLabArtifactDeploymentStatus DeserializeDevTestLabArtifactDeploymentStatus(JsonElement element, ModelReaderWriterOptions options = null) + /// The JSON element to deserialize. + /// The client options for reading and writing models. + internal static DevTestLabArtifactDeploymentStatus DeserializeDevTestLabArtifactDeploymentStatus(JsonElement element, ModelReaderWriterOptions options) { - options ??= ModelSerializationExtensions.WireOptions; - if (element.ValueKind == JsonValueKind.Null) { return null; @@ -89,46 +111,47 @@ internal static DevTestLabArtifactDeploymentStatus DeserializeDevTestLabArtifact string deploymentStatus = default; int? artifactsApplied = default; int? totalArtifacts = 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("deploymentStatus"u8)) + if (prop.NameEquals("deploymentStatus"u8)) { - deploymentStatus = property.Value.GetString(); + deploymentStatus = prop.Value.GetString(); continue; } - if (property.NameEquals("artifactsApplied"u8)) + if (prop.NameEquals("artifactsApplied"u8)) { - if (property.Value.ValueKind == JsonValueKind.Null) + if (prop.Value.ValueKind == JsonValueKind.Null) { continue; } - artifactsApplied = property.Value.GetInt32(); + artifactsApplied = prop.Value.GetInt32(); continue; } - if (property.NameEquals("totalArtifacts"u8)) + if (prop.NameEquals("totalArtifacts"u8)) { - if (property.Value.ValueKind == JsonValueKind.Null) + if (prop.Value.ValueKind == JsonValueKind.Null) { continue; } - totalArtifacts = property.Value.GetInt32(); + totalArtifacts = prop.Value.GetInt32(); 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 DevTestLabArtifactDeploymentStatus(deploymentStatus, artifactsApplied, totalArtifacts, serializedAdditionalRawData); + return new DevTestLabArtifactDeploymentStatus(deploymentStatus, artifactsApplied, totalArtifacts, 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,22 +161,11 @@ BinaryData IPersistableModel.Write(ModelRead } } - DevTestLabArtifactDeploymentStatus 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 DeserializeDevTestLabArtifactDeploymentStatus(document.RootElement, options); - } - default: - throw new FormatException($"The model {nameof(DevTestLabArtifactDeploymentStatus)} does not support reading '{options.Format}' format."); - } - } + /// The data to parse. + /// The client options for reading and writing models. + DevTestLabArtifactDeploymentStatus IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) => PersistableModelCreateCore(data, options); + /// The client options for reading and writing models. string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; } } diff --git a/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/Models/DevTestLabArtifactDeploymentStatus.cs b/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/Models/DevTestLabArtifactDeploymentStatus.cs index 6b9483b4d324..291c2184b075 100644 --- a/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/Models/DevTestLabArtifactDeploymentStatus.cs +++ b/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/Models/DevTestLabArtifactDeploymentStatus.cs @@ -13,37 +13,8 @@ namespace Azure.ResourceManager.DevTestLabs.Models /// Properties of an artifact deployment. public partial class DevTestLabArtifactDeploymentStatus { - /// - /// 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 DevTestLabArtifactDeploymentStatus() @@ -54,19 +25,21 @@ internal DevTestLabArtifactDeploymentStatus() /// The deployment status of the artifact. /// The total count of the artifacts that were successfully applied. /// The total count of the artifacts that were tentatively applied. - /// Keeps track of any properties unknown to the library. - internal DevTestLabArtifactDeploymentStatus(string deploymentStatus, int? artifactsApplied, int? totalArtifacts, IDictionary serializedAdditionalRawData) + /// Keeps track of any properties unknown to the library. + internal DevTestLabArtifactDeploymentStatus(string deploymentStatus, int? artifactsApplied, int? totalArtifacts, IDictionary additionalBinaryDataProperties) { DeploymentStatus = deploymentStatus; ArtifactsApplied = artifactsApplied; TotalArtifacts = totalArtifacts; - _serializedAdditionalRawData = serializedAdditionalRawData; + _additionalBinaryDataProperties = additionalBinaryDataProperties; } /// The deployment status of the artifact. public string DeploymentStatus { get; } + /// The total count of the artifacts that were successfully applied. public int? ArtifactsApplied { get; } + /// The total count of the artifacts that were tentatively applied. public int? TotalArtifacts { get; } } diff --git a/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/Models/DevTestLabArtifactGenerateArmTemplateContent.Serialization.cs b/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/Models/DevTestLabArtifactGenerateArmTemplateContent.Serialization.cs index ad45a64a429b..654d31ff76ee 100644 --- a/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/Models/DevTestLabArtifactGenerateArmTemplateContent.Serialization.cs +++ b/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/Models/DevTestLabArtifactGenerateArmTemplateContent.Serialization.cs @@ -10,13 +10,32 @@ using System.Collections.Generic; using System.Text.Json; using Azure.Core; +using Azure.ResourceManager.DevTestLabs; namespace Azure.ResourceManager.DevTestLabs.Models { - public partial class DevTestLabArtifactGenerateArmTemplateContent : IUtf8JsonSerializable, IJsonModel + /// Parameters for generating an ARM template for deploying artifacts. + public partial class DevTestLabArtifactGenerateArmTemplateContent : IJsonModel { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + /// The data to parse. + /// The client options for reading and writing models. + protected virtual DevTestLabArtifactGenerateArmTemplateContent 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 DeserializeDevTestLabArtifactGenerateArmTemplateContent(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(DevTestLabArtifactGenerateArmTemplateContent)} does not support reading '{options.Format}' format."); + } + } + /// The JSON writer. + /// The client options for reading and writing models. void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) { writer.WriteStartObject(); @@ -28,12 +47,11 @@ void IJsonModel.Write(Utf8JsonWrit /// 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(DevTestLabArtifactGenerateArmTemplateContent)} does not support writing '{format}' format."); } - if (Optional.IsDefined(VmName)) { writer.WritePropertyName("virtualMachineName"u8); @@ -43,7 +61,7 @@ protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWrit { writer.WritePropertyName("parameters"u8); writer.WriteStartArray(); - foreach (var item in Parameters) + foreach (DevTestLabParameter item in Parameters) { writer.WriteObjectValue(item, options); } @@ -59,15 +77,15 @@ protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWrit writer.WritePropertyName("fileUploadOptions"u8); writer.WriteStringValue(FileUploadOptions.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); } @@ -76,22 +94,27 @@ protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWrit } } - DevTestLabArtifactGenerateArmTemplateContent IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + /// The JSON reader. + /// The client options for reading and writing models. + DevTestLabArtifactGenerateArmTemplateContent IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) => JsonModelCreateCore(ref reader, options); + + /// The JSON reader. + /// The client options for reading and writing models. + protected virtual DevTestLabArtifactGenerateArmTemplateContent 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(DevTestLabArtifactGenerateArmTemplateContent)} does not support reading '{format}' format."); } - using JsonDocument document = JsonDocument.ParseValue(ref reader); return DeserializeDevTestLabArtifactGenerateArmTemplateContent(document.RootElement, options); } - internal static DevTestLabArtifactGenerateArmTemplateContent DeserializeDevTestLabArtifactGenerateArmTemplateContent(JsonElement element, ModelReaderWriterOptions options = null) + /// The JSON element to deserialize. + /// The client options for reading and writing models. + internal static DevTestLabArtifactGenerateArmTemplateContent DeserializeDevTestLabArtifactGenerateArmTemplateContent(JsonElement element, ModelReaderWriterOptions options) { - options ??= ModelSerializationExtensions.WireOptions; - if (element.ValueKind == JsonValueKind.Null) { return null; @@ -100,60 +123,61 @@ internal static DevTestLabArtifactGenerateArmTemplateContent DeserializeDevTestL IList parameters = default; AzureLocation? location = default; DevTestLabFileUploadOption? fileUploadOptions = 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("virtualMachineName"u8)) + if (prop.NameEquals("virtualMachineName"u8)) { - vmName = property.Value.GetString(); + vmName = prop.Value.GetString(); continue; } - if (property.NameEquals("parameters"u8)) + if (prop.NameEquals("parameters"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(DevTestLabParameter.DeserializeDevTestLabParameter(item, options)); } parameters = array; continue; } - if (property.NameEquals("location"u8)) + if (prop.NameEquals("location"u8)) { - if (property.Value.ValueKind == JsonValueKind.Null) + if (prop.Value.ValueKind == JsonValueKind.Null) { continue; } - location = new AzureLocation(property.Value.GetString()); + location = new AzureLocation(prop.Value.GetString()); continue; } - if (property.NameEquals("fileUploadOptions"u8)) + if (prop.NameEquals("fileUploadOptions"u8)) { - if (property.Value.ValueKind == JsonValueKind.Null) + if (prop.Value.ValueKind == JsonValueKind.Null) { continue; } - fileUploadOptions = new DevTestLabFileUploadOption(property.Value.GetString()); + fileUploadOptions = new DevTestLabFileUploadOption(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 DevTestLabArtifactGenerateArmTemplateContent(vmName, parameters ?? new ChangeTrackingList(), location, fileUploadOptions, serializedAdditionalRawData); + return new DevTestLabArtifactGenerateArmTemplateContent(vmName, parameters ?? new ChangeTrackingList(), location, fileUploadOptions, 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,22 +187,23 @@ BinaryData IPersistableModel.Write } } - DevTestLabArtifactGenerateArmTemplateContent 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. + DevTestLabArtifactGenerateArmTemplateContent IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) => PersistableModelCreateCore(data, options); - switch (format) + /// The client options for reading and writing models. + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + + /// The to serialize into . + internal static RequestContent ToRequestContent(DevTestLabArtifactGenerateArmTemplateContent devTestLabArtifactGenerateArmTemplateContent) + { + if (devTestLabArtifactGenerateArmTemplateContent == null) { - case "J": - { - using JsonDocument document = JsonDocument.Parse(data, ModelSerializationExtensions.JsonDocumentOptions); - return DeserializeDevTestLabArtifactGenerateArmTemplateContent(document.RootElement, options); - } - default: - throw new FormatException($"The model {nameof(DevTestLabArtifactGenerateArmTemplateContent)} does not support reading '{options.Format}' format."); + return null; } + Utf8JsonRequestContent content = new Utf8JsonRequestContent(); + content.JsonWriter.WriteObjectValue(devTestLabArtifactGenerateArmTemplateContent, ModelSerializationExtensions.WireOptions); + return content; } - - string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; } } diff --git a/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/Models/DevTestLabArtifactGenerateArmTemplateContent.cs b/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/Models/DevTestLabArtifactGenerateArmTemplateContent.cs index cec097393d75..02e818c71f50 100644 --- a/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/Models/DevTestLabArtifactGenerateArmTemplateContent.cs +++ b/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/Models/DevTestLabArtifactGenerateArmTemplateContent.cs @@ -8,43 +8,15 @@ using System; using System.Collections.Generic; using Azure.Core; +using Azure.ResourceManager.DevTestLabs; namespace Azure.ResourceManager.DevTestLabs.Models { /// Parameters for generating an ARM template for deploying artifacts. public partial class DevTestLabArtifactGenerateArmTemplateContent { - /// - /// 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 DevTestLabArtifactGenerateArmTemplateContent() @@ -57,22 +29,25 @@ public DevTestLabArtifactGenerateArmTemplateContent() /// The parameters of the ARM template. /// The location of the virtual machine. /// Options for uploading the files for the artifact. UploadFilesAndGenerateSasTokens is the default value. - /// Keeps track of any properties unknown to the library. - internal DevTestLabArtifactGenerateArmTemplateContent(string vmName, IList parameters, AzureLocation? location, DevTestLabFileUploadOption? fileUploadOptions, IDictionary serializedAdditionalRawData) + /// Keeps track of any properties unknown to the library. + internal DevTestLabArtifactGenerateArmTemplateContent(string vmName, IList parameters, AzureLocation? location, DevTestLabFileUploadOption? fileUploadOptions, IDictionary additionalBinaryDataProperties) { VmName = vmName; Parameters = parameters; Location = location; FileUploadOptions = fileUploadOptions; - _serializedAdditionalRawData = serializedAdditionalRawData; + _additionalBinaryDataProperties = additionalBinaryDataProperties; } /// The resource name of the virtual machine. public string VmName { get; set; } + /// The parameters of the ARM template. public IList Parameters { get; } + /// The location of the virtual machine. public AzureLocation? Location { get; set; } + /// Options for uploading the files for the artifact. UploadFilesAndGenerateSasTokens is the default value. public DevTestLabFileUploadOption? FileUploadOptions { get; set; } } diff --git a/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/Models/DevTestLabArtifactInstallInfo.Serialization.cs b/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/Models/DevTestLabArtifactInstallInfo.Serialization.cs index 4e4e81c332f3..b9348b1b9fdc 100644 --- a/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/Models/DevTestLabArtifactInstallInfo.Serialization.cs +++ b/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/Models/DevTestLabArtifactInstallInfo.Serialization.cs @@ -9,14 +9,32 @@ using System.ClientModel.Primitives; using System.Collections.Generic; using System.Text.Json; -using Azure.Core; +using Azure.ResourceManager.DevTestLabs; namespace Azure.ResourceManager.DevTestLabs.Models { - public partial class DevTestLabArtifactInstallInfo : IUtf8JsonSerializable, IJsonModel + /// Properties of an artifact. + public partial class DevTestLabArtifactInstallInfo : IJsonModel { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + /// The data to parse. + /// The client options for reading and writing models. + protected virtual DevTestLabArtifactInstallInfo 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 DeserializeDevTestLabArtifactInstallInfo(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(DevTestLabArtifactInstallInfo)} does not support reading '{options.Format}' format."); + } + } + /// The JSON writer. + /// The client options for reading and writing models. void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) { writer.WriteStartObject(); @@ -28,12 +46,11 @@ void IJsonModel.Write(Utf8JsonWriter writer, Mode /// 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(DevTestLabArtifactInstallInfo)} does not support writing '{format}' format."); } - if (Optional.IsDefined(ArtifactId)) { writer.WritePropertyName("artifactId"u8); @@ -48,7 +65,7 @@ protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWrit { writer.WritePropertyName("parameters"u8); writer.WriteStartArray(); - foreach (var item in Parameters) + foreach (DevTestLabArtifactParameter item in Parameters) { writer.WriteObjectValue(item, options); } @@ -74,15 +91,15 @@ protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWrit writer.WritePropertyName("installTime"u8); writer.WriteStringValue(InstallOn.Value, "O"); } - 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); } @@ -91,22 +108,27 @@ protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWrit } } - DevTestLabArtifactInstallInfo IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + /// The JSON reader. + /// The client options for reading and writing models. + DevTestLabArtifactInstallInfo IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) => JsonModelCreateCore(ref reader, options); + + /// The JSON reader. + /// The client options for reading and writing models. + protected virtual DevTestLabArtifactInstallInfo 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(DevTestLabArtifactInstallInfo)} does not support reading '{format}' format."); } - using JsonDocument document = JsonDocument.ParseValue(ref reader); return DeserializeDevTestLabArtifactInstallInfo(document.RootElement, options); } - internal static DevTestLabArtifactInstallInfo DeserializeDevTestLabArtifactInstallInfo(JsonElement element, ModelReaderWriterOptions options = null) + /// The JSON element to deserialize. + /// The client options for reading and writing models. + internal static DevTestLabArtifactInstallInfo DeserializeDevTestLabArtifactInstallInfo(JsonElement element, ModelReaderWriterOptions options) { - options ??= ModelSerializationExtensions.WireOptions; - if (element.ValueKind == JsonValueKind.Null) { return null; @@ -117,65 +139,63 @@ internal static DevTestLabArtifactInstallInfo DeserializeDevTestLabArtifactInsta string status = default; string deploymentStatusMessage = default; string vmExtensionStatusMessage = default; - DateTimeOffset? installTime = default; - IDictionary serializedAdditionalRawData = default; - Dictionary rawDataDictionary = new Dictionary(); - foreach (var property in element.EnumerateObject()) + DateTimeOffset? installOn = default; + IDictionary additionalBinaryDataProperties = new ChangeTrackingDictionary(); + foreach (var prop in element.EnumerateObject()) { - if (property.NameEquals("artifactId"u8)) + if (prop.NameEquals("artifactId"u8)) { - artifactId = property.Value.GetString(); + artifactId = prop.Value.GetString(); continue; } - if (property.NameEquals("artifactTitle"u8)) + if (prop.NameEquals("artifactTitle"u8)) { - artifactTitle = property.Value.GetString(); + artifactTitle = prop.Value.GetString(); continue; } - if (property.NameEquals("parameters"u8)) + if (prop.NameEquals("parameters"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(DevTestLabArtifactParameter.DeserializeDevTestLabArtifactParameter(item, options)); } parameters = array; continue; } - if (property.NameEquals("status"u8)) + if (prop.NameEquals("status"u8)) { - status = property.Value.GetString(); + status = prop.Value.GetString(); continue; } - if (property.NameEquals("deploymentStatusMessage"u8)) + if (prop.NameEquals("deploymentStatusMessage"u8)) { - deploymentStatusMessage = property.Value.GetString(); + deploymentStatusMessage = prop.Value.GetString(); continue; } - if (property.NameEquals("vmExtensionStatusMessage"u8)) + if (prop.NameEquals("vmExtensionStatusMessage"u8)) { - vmExtensionStatusMessage = property.Value.GetString(); + vmExtensionStatusMessage = prop.Value.GetString(); continue; } - if (property.NameEquals("installTime"u8)) + if (prop.NameEquals("installTime"u8)) { - if (property.Value.ValueKind == JsonValueKind.Null) + if (prop.Value.ValueKind == JsonValueKind.Null) { continue; } - installTime = property.Value.GetDateTimeOffset("O"); + installOn = prop.Value.GetDateTimeOffset("O"); 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 DevTestLabArtifactInstallInfo( artifactId, artifactTitle, @@ -183,14 +203,17 @@ internal static DevTestLabArtifactInstallInfo DeserializeDevTestLabArtifactInsta status, deploymentStatusMessage, vmExtensionStatusMessage, - installTime, - serializedAdditionalRawData); + installOn, + 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": @@ -200,22 +223,11 @@ BinaryData IPersistableModel.Write(ModelReaderWri } } - DevTestLabArtifactInstallInfo 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 DeserializeDevTestLabArtifactInstallInfo(document.RootElement, options); - } - default: - throw new FormatException($"The model {nameof(DevTestLabArtifactInstallInfo)} does not support reading '{options.Format}' format."); - } - } + /// The data to parse. + /// The client options for reading and writing models. + DevTestLabArtifactInstallInfo IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) => PersistableModelCreateCore(data, options); + /// The client options for reading and writing models. string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; } } diff --git a/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/Models/DevTestLabArtifactInstallInfo.cs b/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/Models/DevTestLabArtifactInstallInfo.cs index 72a943d6f1e4..d6ee8f7dd41f 100644 --- a/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/Models/DevTestLabArtifactInstallInfo.cs +++ b/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/Models/DevTestLabArtifactInstallInfo.cs @@ -7,43 +7,15 @@ using System; using System.Collections.Generic; +using Azure.ResourceManager.DevTestLabs; namespace Azure.ResourceManager.DevTestLabs.Models { /// Properties of an artifact. public partial class DevTestLabArtifactInstallInfo { - /// - /// 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 DevTestLabArtifactInstallInfo() @@ -59,8 +31,8 @@ public DevTestLabArtifactInstallInfo() /// The status message from the deployment. /// The status message from the virtual machine extension. /// The time that the artifact starts to install on the virtual machine. - /// Keeps track of any properties unknown to the library. - internal DevTestLabArtifactInstallInfo(string artifactId, string artifactTitle, IList parameters, string status, string deploymentStatusMessage, string vmExtensionStatusMessage, DateTimeOffset? installOn, IDictionary serializedAdditionalRawData) + /// Keeps track of any properties unknown to the library. + internal DevTestLabArtifactInstallInfo(string artifactId, string artifactTitle, IList parameters, string status, string deploymentStatusMessage, string vmExtensionStatusMessage, DateTimeOffset? installOn, IDictionary additionalBinaryDataProperties) { ArtifactId = artifactId; ArtifactTitle = artifactTitle; @@ -69,21 +41,27 @@ internal DevTestLabArtifactInstallInfo(string artifactId, string artifactTitle, DeploymentStatusMessage = deploymentStatusMessage; VmExtensionStatusMessage = vmExtensionStatusMessage; InstallOn = installOn; - _serializedAdditionalRawData = serializedAdditionalRawData; + _additionalBinaryDataProperties = additionalBinaryDataProperties; } /// The artifact's identifier. public string ArtifactId { get; set; } + /// The artifact's title. public string ArtifactTitle { get; set; } + /// The parameters of the artifact. public IList Parameters { get; } + /// The status of the artifact. public string Status { get; set; } + /// The status message from the deployment. public string DeploymentStatusMessage { get; set; } + /// The status message from the virtual machine extension. public string VmExtensionStatusMessage { get; set; } + /// The time that the artifact starts to install on the virtual machine. public DateTimeOffset? InstallOn { get; set; } } diff --git a/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/Models/DevTestLabArtifactParameter.Serialization.cs b/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/Models/DevTestLabArtifactParameter.Serialization.cs index 9f73e4a6a2ee..d96c3fe41149 100644 --- a/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/Models/DevTestLabArtifactParameter.Serialization.cs +++ b/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/Models/DevTestLabArtifactParameter.Serialization.cs @@ -9,14 +9,32 @@ using System.ClientModel.Primitives; using System.Collections.Generic; using System.Text.Json; -using Azure.Core; +using Azure.ResourceManager.DevTestLabs; namespace Azure.ResourceManager.DevTestLabs.Models { - public partial class DevTestLabArtifactParameter : IUtf8JsonSerializable, IJsonModel + /// Properties of an artifact parameter. + public partial class DevTestLabArtifactParameter : IJsonModel { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + /// The data to parse. + /// The client options for reading and writing models. + protected virtual DevTestLabArtifactParameter 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 DeserializeDevTestLabArtifactParameter(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(DevTestLabArtifactParameter)} does not support reading '{options.Format}' format."); + } + } + /// The JSON writer. + /// The client options for reading and writing models. void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) { writer.WriteStartObject(); @@ -28,12 +46,11 @@ void IJsonModel.Write(Utf8JsonWriter writer, ModelR /// 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(DevTestLabArtifactParameter)} does not support writing '{format}' format."); } - if (Optional.IsDefined(Name)) { writer.WritePropertyName("name"u8); @@ -44,15 +61,15 @@ protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWrit writer.WritePropertyName("value"u8); writer.WriteStringValue(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); } @@ -61,55 +78,61 @@ protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWrit } } - DevTestLabArtifactParameter IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + /// The JSON reader. + /// The client options for reading and writing models. + DevTestLabArtifactParameter IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) => JsonModelCreateCore(ref reader, options); + + /// The JSON reader. + /// The client options for reading and writing models. + protected virtual DevTestLabArtifactParameter 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(DevTestLabArtifactParameter)} does not support reading '{format}' format."); } - using JsonDocument document = JsonDocument.ParseValue(ref reader); return DeserializeDevTestLabArtifactParameter(document.RootElement, options); } - internal static DevTestLabArtifactParameter DeserializeDevTestLabArtifactParameter(JsonElement element, ModelReaderWriterOptions options = null) + /// The JSON element to deserialize. + /// The client options for reading and writing models. + internal static DevTestLabArtifactParameter DeserializeDevTestLabArtifactParameter(JsonElement element, ModelReaderWriterOptions options) { - options ??= ModelSerializationExtensions.WireOptions; - if (element.ValueKind == JsonValueKind.Null) { return null; } string name = default; string value = 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("name"u8)) + if (prop.NameEquals("name"u8)) { - name = property.Value.GetString(); + name = prop.Value.GetString(); continue; } - if (property.NameEquals("value"u8)) + if (prop.NameEquals("value"u8)) { - value = property.Value.GetString(); + value = 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 DevTestLabArtifactParameter(name, value, serializedAdditionalRawData); + return new DevTestLabArtifactParameter(name, value, 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,22 +142,11 @@ BinaryData IPersistableModel.Write(ModelReaderWrite } } - DevTestLabArtifactParameter 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 DeserializeDevTestLabArtifactParameter(document.RootElement, options); - } - default: - throw new FormatException($"The model {nameof(DevTestLabArtifactParameter)} does not support reading '{options.Format}' format."); - } - } + /// The data to parse. + /// The client options for reading and writing models. + DevTestLabArtifactParameter IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) => PersistableModelCreateCore(data, options); + /// The client options for reading and writing models. string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; } } diff --git a/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/Models/DevTestLabArtifactParameter.cs b/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/Models/DevTestLabArtifactParameter.cs index a9016f8a21db..5faeb986f1bf 100644 --- a/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/Models/DevTestLabArtifactParameter.cs +++ b/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/Models/DevTestLabArtifactParameter.cs @@ -13,37 +13,8 @@ namespace Azure.ResourceManager.DevTestLabs.Models /// Properties of an artifact parameter. public partial class DevTestLabArtifactParameter { - /// - /// 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 DevTestLabArtifactParameter() @@ -53,16 +24,17 @@ public DevTestLabArtifactParameter() /// Initializes a new instance of . /// The name of the artifact parameter. /// The value of the artifact parameter. - /// Keeps track of any properties unknown to the library. - internal DevTestLabArtifactParameter(string name, string value, IDictionary serializedAdditionalRawData) + /// Keeps track of any properties unknown to the library. + internal DevTestLabArtifactParameter(string name, string value, IDictionary additionalBinaryDataProperties) { Name = name; Value = value; - _serializedAdditionalRawData = serializedAdditionalRawData; + _additionalBinaryDataProperties = additionalBinaryDataProperties; } /// The name of the artifact parameter. public string Name { get; set; } + /// The value of the artifact parameter. public string Value { get; set; } } diff --git a/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/Models/DevTestLabArtifactSourcePatch.Serialization.cs b/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/Models/DevTestLabArtifactSourcePatch.Serialization.cs index 169d4d71d668..6c9909d7dc0e 100644 --- a/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/Models/DevTestLabArtifactSourcePatch.Serialization.cs +++ b/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/Models/DevTestLabArtifactSourcePatch.Serialization.cs @@ -10,13 +10,32 @@ using System.Collections.Generic; using System.Text.Json; using Azure.Core; +using Azure.ResourceManager.DevTestLabs; namespace Azure.ResourceManager.DevTestLabs.Models { - public partial class DevTestLabArtifactSourcePatch : IUtf8JsonSerializable, IJsonModel + /// Properties of an artifact source. + public partial class DevTestLabArtifactSourcePatch : DevTestLabResourcePatch, IJsonModel { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + /// The data to parse. + /// The client options for reading and writing models. + protected override DevTestLabResourcePatch 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 DeserializeDevTestLabArtifactSourcePatch(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(DevTestLabArtifactSourcePatch)} does not support reading '{options.Format}' format."); + } + } + /// The JSON writer. + /// The client options for reading and writing models. void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) { writer.WriteStartObject(); @@ -28,67 +47,79 @@ 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(DevTestLabArtifactSourcePatch)} does not support writing '{format}' format."); } - base.JsonModelWriteCore(writer, options); } - DevTestLabArtifactSourcePatch IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + /// The JSON reader. + /// The client options for reading and writing models. + DevTestLabArtifactSourcePatch IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) => (DevTestLabArtifactSourcePatch)JsonModelCreateCore(ref reader, options); + + /// The JSON reader. + /// The client options for reading and writing models. + protected override DevTestLabResourcePatch 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(DevTestLabArtifactSourcePatch)} does not support reading '{format}' format."); } - using JsonDocument document = JsonDocument.ParseValue(ref reader); return DeserializeDevTestLabArtifactSourcePatch(document.RootElement, options); } - internal static DevTestLabArtifactSourcePatch DeserializeDevTestLabArtifactSourcePatch(JsonElement element, ModelReaderWriterOptions options = null) + /// The JSON element to deserialize. + /// The client options for reading and writing models. + internal static DevTestLabArtifactSourcePatch DeserializeDevTestLabArtifactSourcePatch(JsonElement element, ModelReaderWriterOptions options) { - options ??= ModelSerializationExtensions.WireOptions; - if (element.ValueKind == JsonValueKind.Null) { return null; } IDictionary tags = 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("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 (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 DevTestLabArtifactSourcePatch(tags ?? new ChangeTrackingDictionary(), serializedAdditionalRawData); + return new DevTestLabArtifactSourcePatch(tags ?? new ChangeTrackingDictionary(), 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 override BinaryData PersistableModelWriteCore(ModelReaderWriterOptions options) + { + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; switch (format) { case "J": @@ -98,22 +129,23 @@ BinaryData IPersistableModel.Write(ModelReaderWri } } - DevTestLabArtifactSourcePatch 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. + DevTestLabArtifactSourcePatch IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) => (DevTestLabArtifactSourcePatch)PersistableModelCreateCore(data, options); - switch (format) + /// The client options for reading and writing models. + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + + /// The to serialize into . + internal static RequestContent ToRequestContent(DevTestLabArtifactSourcePatch devTestLabArtifactSourcePatch) + { + if (devTestLabArtifactSourcePatch == null) { - case "J": - { - using JsonDocument document = JsonDocument.Parse(data, ModelSerializationExtensions.JsonDocumentOptions); - return DeserializeDevTestLabArtifactSourcePatch(document.RootElement, options); - } - default: - throw new FormatException($"The model {nameof(DevTestLabArtifactSourcePatch)} does not support reading '{options.Format}' format."); + return null; } + Utf8JsonRequestContent content = new Utf8JsonRequestContent(); + content.JsonWriter.WriteObjectValue(devTestLabArtifactSourcePatch, ModelSerializationExtensions.WireOptions); + return content; } - - string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; } } diff --git a/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/Models/DevTestLabArtifactSourcePatch.cs b/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/Models/DevTestLabArtifactSourcePatch.cs index d5671c7f82a5..1201c2d80fe2 100644 --- a/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/Models/DevTestLabArtifactSourcePatch.cs +++ b/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/Models/DevTestLabArtifactSourcePatch.cs @@ -20,8 +20,8 @@ public DevTestLabArtifactSourcePatch() /// Initializes a new instance of . /// The tags of the resource. - /// Keeps track of any properties unknown to the library. - internal DevTestLabArtifactSourcePatch(IDictionary tags, IDictionary serializedAdditionalRawData) : base(tags, serializedAdditionalRawData) + /// Keeps track of any properties unknown to the library. + internal DevTestLabArtifactSourcePatch(IDictionary tags, IDictionary additionalBinaryDataProperties) : base(tags, additionalBinaryDataProperties) { } } diff --git a/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/Models/DevTestLabCostDetails.Serialization.cs b/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/Models/DevTestLabCostDetails.Serialization.cs index 4025feeb929c..90e10afc4653 100644 --- a/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/Models/DevTestLabCostDetails.Serialization.cs +++ b/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/Models/DevTestLabCostDetails.Serialization.cs @@ -9,14 +9,32 @@ using System.ClientModel.Primitives; using System.Collections.Generic; using System.Text.Json; -using Azure.Core; +using Azure.ResourceManager.DevTestLabs; namespace Azure.ResourceManager.DevTestLabs.Models { - public partial class DevTestLabCostDetails : IUtf8JsonSerializable, IJsonModel + /// The properties of a lab cost item. + public partial class DevTestLabCostDetails : IJsonModel { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + /// The data to parse. + /// The client options for reading and writing models. + protected virtual DevTestLabCostDetails 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 DeserializeDevTestLabCostDetails(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(DevTestLabCostDetails)} does not support reading '{options.Format}' format."); + } + } + /// The JSON writer. + /// The client options for reading and writing models. void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) { writer.WriteStartObject(); @@ -28,12 +46,11 @@ void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderW /// 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(DevTestLabCostDetails)} does not support writing '{format}' format."); } - if (Optional.IsDefined(On)) { writer.WritePropertyName("date"u8); @@ -49,15 +66,15 @@ protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWrit writer.WritePropertyName("costType"u8); writer.WriteStringValue(CostType.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); } @@ -66,73 +83,79 @@ protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWrit } } - DevTestLabCostDetails IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + /// The JSON reader. + /// The client options for reading and writing models. + DevTestLabCostDetails IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) => JsonModelCreateCore(ref reader, options); + + /// The JSON reader. + /// The client options for reading and writing models. + protected virtual DevTestLabCostDetails 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(DevTestLabCostDetails)} does not support reading '{format}' format."); } - using JsonDocument document = JsonDocument.ParseValue(ref reader); return DeserializeDevTestLabCostDetails(document.RootElement, options); } - internal static DevTestLabCostDetails DeserializeDevTestLabCostDetails(JsonElement element, ModelReaderWriterOptions options = null) + /// The JSON element to deserialize. + /// The client options for reading and writing models. + internal static DevTestLabCostDetails DeserializeDevTestLabCostDetails(JsonElement element, ModelReaderWriterOptions options) { - options ??= ModelSerializationExtensions.WireOptions; - if (element.ValueKind == JsonValueKind.Null) { return null; } - DateTimeOffset? date = default; + DateTimeOffset? @on = default; double? cost = default; DevTestLabCostType? costType = 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("date"u8)) + if (prop.NameEquals("date"u8)) { - if (property.Value.ValueKind == JsonValueKind.Null) + if (prop.Value.ValueKind == JsonValueKind.Null) { continue; } - date = property.Value.GetDateTimeOffset("O"); + @on = prop.Value.GetDateTimeOffset("O"); continue; } - if (property.NameEquals("cost"u8)) + if (prop.NameEquals("cost"u8)) { - if (property.Value.ValueKind == JsonValueKind.Null) + if (prop.Value.ValueKind == JsonValueKind.Null) { continue; } - cost = property.Value.GetDouble(); + cost = prop.Value.GetDouble(); continue; } - if (property.NameEquals("costType"u8)) + if (prop.NameEquals("costType"u8)) { - if (property.Value.ValueKind == JsonValueKind.Null) + if (prop.Value.ValueKind == JsonValueKind.Null) { continue; } - costType = new DevTestLabCostType(property.Value.GetString()); + costType = new DevTestLabCostType(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 DevTestLabCostDetails(date, cost, costType, serializedAdditionalRawData); + return new DevTestLabCostDetails(@on, cost, costType, 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": @@ -142,22 +165,11 @@ BinaryData IPersistableModel.Write(ModelReaderWriterOptio } } - DevTestLabCostDetails 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 DeserializeDevTestLabCostDetails(document.RootElement, options); - } - default: - throw new FormatException($"The model {nameof(DevTestLabCostDetails)} does not support reading '{options.Format}' format."); - } - } + /// The data to parse. + /// The client options for reading and writing models. + DevTestLabCostDetails IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) => PersistableModelCreateCore(data, options); + /// The client options for reading and writing models. string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; } } diff --git a/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/Models/DevTestLabCostDetails.cs b/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/Models/DevTestLabCostDetails.cs index 29d80ce75da6..b8216fc72256 100644 --- a/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/Models/DevTestLabCostDetails.cs +++ b/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/Models/DevTestLabCostDetails.cs @@ -13,37 +13,8 @@ namespace Azure.ResourceManager.DevTestLabs.Models /// The properties of a lab cost item. public partial class DevTestLabCostDetails { - /// - /// 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 DevTestLabCostDetails() @@ -54,19 +25,21 @@ internal DevTestLabCostDetails() /// The date of the cost item. /// The cost component of the cost item. /// The type of the cost. - /// Keeps track of any properties unknown to the library. - internal DevTestLabCostDetails(DateTimeOffset? @on, double? cost, DevTestLabCostType? costType, IDictionary serializedAdditionalRawData) + /// Keeps track of any properties unknown to the library. + internal DevTestLabCostDetails(DateTimeOffset? @on, double? cost, DevTestLabCostType? costType, IDictionary additionalBinaryDataProperties) { On = @on; Cost = cost; CostType = costType; - _serializedAdditionalRawData = serializedAdditionalRawData; + _additionalBinaryDataProperties = additionalBinaryDataProperties; } /// The date of the cost item. public DateTimeOffset? On { get; } + /// The cost component of the cost item. public double? Cost { get; } + /// The type of the cost. public DevTestLabCostType? CostType { get; } } diff --git a/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/Models/DevTestLabCostThreshold.Serialization.cs b/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/Models/DevTestLabCostThreshold.Serialization.cs index a250105639be..e8d7cecd6fe3 100644 --- a/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/Models/DevTestLabCostThreshold.Serialization.cs +++ b/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/Models/DevTestLabCostThreshold.Serialization.cs @@ -9,14 +9,32 @@ using System.ClientModel.Primitives; using System.Collections.Generic; using System.Text.Json; -using Azure.Core; +using Azure.ResourceManager.DevTestLabs; namespace Azure.ResourceManager.DevTestLabs.Models { - public partial class DevTestLabCostThreshold : IUtf8JsonSerializable, IJsonModel + /// Properties of a cost threshold item. + public partial class DevTestLabCostThreshold : IJsonModel { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + /// The data to parse. + /// The client options for reading and writing models. + protected virtual DevTestLabCostThreshold 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 DeserializeDevTestLabCostThreshold(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(DevTestLabCostThreshold)} does not support reading '{options.Format}' format."); + } + } + /// The JSON writer. + /// The client options for reading and writing models. void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) { writer.WriteStartObject(); @@ -28,12 +46,11 @@ void IJsonModel.Write(Utf8JsonWriter writer, ModelReade /// 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(DevTestLabCostThreshold)} does not support writing '{format}' format."); } - if (Optional.IsDefined(ThresholdId)) { writer.WritePropertyName("thresholdId"u8); @@ -59,15 +76,15 @@ protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWrit writer.WritePropertyName("notificationSent"u8); writer.WriteStringValue(NotificationSent); } - 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 +93,27 @@ protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWrit } } - DevTestLabCostThreshold IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + /// The JSON reader. + /// The client options for reading and writing models. + DevTestLabCostThreshold IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) => JsonModelCreateCore(ref reader, options); + + /// The JSON reader. + /// The client options for reading and writing models. + protected virtual DevTestLabCostThreshold 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(DevTestLabCostThreshold)} does not support reading '{format}' format."); } - using JsonDocument document = JsonDocument.ParseValue(ref reader); return DeserializeDevTestLabCostThreshold(document.RootElement, options); } - internal static DevTestLabCostThreshold DeserializeDevTestLabCostThreshold(JsonElement element, ModelReaderWriterOptions options = null) + /// The JSON element to deserialize. + /// The client options for reading and writing models. + internal static DevTestLabCostThreshold DeserializeDevTestLabCostThreshold(JsonElement element, ModelReaderWriterOptions options) { - options ??= ModelSerializationExtensions.WireOptions; - if (element.ValueKind == JsonValueKind.Null) { return null; @@ -101,66 +123,67 @@ internal static DevTestLabCostThreshold DeserializeDevTestLabCostThreshold(JsonE DevTestLabCostThresholdStatus? displayOnChart = default; DevTestLabCostThresholdStatus? sendNotificationWhenExceeded = default; string notificationSent = 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("thresholdId"u8)) + if (prop.NameEquals("thresholdId"u8)) { - thresholdId = property.Value.GetString(); + thresholdId = prop.Value.GetString(); continue; } - if (property.NameEquals("percentageThreshold"u8)) + if (prop.NameEquals("percentageThreshold"u8)) { - if (property.Value.ValueKind == JsonValueKind.Null) + if (prop.Value.ValueKind == JsonValueKind.Null) { continue; } - percentageThreshold = PercentageCostThresholdProperties.DeserializePercentageCostThresholdProperties(property.Value, options); + percentageThreshold = PercentageCostThresholdProperties.DeserializePercentageCostThresholdProperties(prop.Value, options); continue; } - if (property.NameEquals("displayOnChart"u8)) + if (prop.NameEquals("displayOnChart"u8)) { - if (property.Value.ValueKind == JsonValueKind.Null) + if (prop.Value.ValueKind == JsonValueKind.Null) { continue; } - displayOnChart = new DevTestLabCostThresholdStatus(property.Value.GetString()); + displayOnChart = new DevTestLabCostThresholdStatus(prop.Value.GetString()); continue; } - if (property.NameEquals("sendNotificationWhenExceeded"u8)) + if (prop.NameEquals("sendNotificationWhenExceeded"u8)) { - if (property.Value.ValueKind == JsonValueKind.Null) + if (prop.Value.ValueKind == JsonValueKind.Null) { continue; } - sendNotificationWhenExceeded = new DevTestLabCostThresholdStatus(property.Value.GetString()); + sendNotificationWhenExceeded = new DevTestLabCostThresholdStatus(prop.Value.GetString()); continue; } - if (property.NameEquals("notificationSent"u8)) + if (prop.NameEquals("notificationSent"u8)) { - notificationSent = property.Value.GetString(); + notificationSent = 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 DevTestLabCostThreshold( thresholdId, percentageThreshold, displayOnChart, sendNotificationWhenExceeded, notificationSent, - serializedAdditionalRawData); + 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": @@ -170,22 +193,11 @@ BinaryData IPersistableModel.Write(ModelReaderWriterOpt } } - DevTestLabCostThreshold 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 DeserializeDevTestLabCostThreshold(document.RootElement, options); - } - default: - throw new FormatException($"The model {nameof(DevTestLabCostThreshold)} does not support reading '{options.Format}' format."); - } - } + /// The data to parse. + /// The client options for reading and writing models. + DevTestLabCostThreshold IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) => PersistableModelCreateCore(data, options); + /// The client options for reading and writing models. string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; } } diff --git a/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/Models/DevTestLabCostThreshold.cs b/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/Models/DevTestLabCostThreshold.cs index 0d55a6e45df9..e9f8c2e3cda5 100644 --- a/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/Models/DevTestLabCostThreshold.cs +++ b/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/Models/DevTestLabCostThreshold.cs @@ -13,37 +13,8 @@ namespace Azure.ResourceManager.DevTestLabs.Models /// Properties of a cost threshold item. public partial class DevTestLabCostThreshold { - /// - /// 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 DevTestLabCostThreshold() @@ -56,38 +27,47 @@ public DevTestLabCostThreshold() /// Indicates whether this threshold will be displayed on cost charts. /// Indicates whether notifications will be sent when this threshold is exceeded. /// Indicates the datetime when notifications were last sent for this threshold. - /// Keeps track of any properties unknown to the library. - internal DevTestLabCostThreshold(string thresholdId, PercentageCostThresholdProperties percentageThreshold, DevTestLabCostThresholdStatus? displayOnChart, DevTestLabCostThresholdStatus? sendNotificationWhenExceeded, string notificationSent, IDictionary serializedAdditionalRawData) + /// Keeps track of any properties unknown to the library. + internal DevTestLabCostThreshold(string thresholdId, PercentageCostThresholdProperties percentageThreshold, DevTestLabCostThresholdStatus? displayOnChart, DevTestLabCostThresholdStatus? sendNotificationWhenExceeded, string notificationSent, IDictionary additionalBinaryDataProperties) { ThresholdId = thresholdId; PercentageThreshold = percentageThreshold; DisplayOnChart = displayOnChart; SendNotificationWhenExceeded = sendNotificationWhenExceeded; NotificationSent = notificationSent; - _serializedAdditionalRawData = serializedAdditionalRawData; + _additionalBinaryDataProperties = additionalBinaryDataProperties; } /// The ID of the cost threshold item. public string ThresholdId { get; set; } + /// The value of the percentage cost threshold. internal PercentageCostThresholdProperties PercentageThreshold { get; set; } + + /// Indicates whether this threshold will be displayed on cost charts. + public DevTestLabCostThresholdStatus? DisplayOnChart { get; set; } + + /// Indicates whether notifications will be sent when this threshold is exceeded. + public DevTestLabCostThresholdStatus? SendNotificationWhenExceeded { get; set; } + + /// Indicates the datetime when notifications were last sent for this threshold. + public string NotificationSent { get; set; } + /// The cost threshold value. public double? ThresholdValue { - get => PercentageThreshold is null ? default : PercentageThreshold.ThresholdValue; + get + { + return PercentageThreshold is null ? default : PercentageThreshold.ThresholdValue; + } set { if (PercentageThreshold is null) + { PercentageThreshold = new PercentageCostThresholdProperties(); + } PercentageThreshold.ThresholdValue = value; } } - - /// Indicates whether this threshold will be displayed on cost charts. - public DevTestLabCostThresholdStatus? DisplayOnChart { get; set; } - /// Indicates whether notifications will be sent when this threshold is exceeded. - public DevTestLabCostThresholdStatus? SendNotificationWhenExceeded { get; set; } - /// Indicates the datetime when notifications were last sent for this threshold. - public string NotificationSent { get; set; } } } diff --git a/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/Models/DevTestLabCostThresholdStatus.cs b/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/Models/DevTestLabCostThresholdStatus.cs index 9e8cc5139caa..c6fa41854e5a 100644 --- a/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/Models/DevTestLabCostThresholdStatus.cs +++ b/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/Models/DevTestLabCostThresholdStatus.cs @@ -7,6 +7,7 @@ using System; using System.ComponentModel; +using Azure.ResourceManager.DevTestLabs; namespace Azure.ResourceManager.DevTestLabs.Models { @@ -14,38 +15,55 @@ namespace Azure.ResourceManager.DevTestLabs.Models public readonly partial struct DevTestLabCostThresholdStatus : IEquatable { private readonly string _value; + private const string EnabledValue = "Enabled"; + private const string DisabledValue = "Disabled"; /// Initializes a new instance of . + /// The value. /// is null. public DevTestLabCostThresholdStatus(string value) { - _value = value ?? throw new ArgumentNullException(nameof(value)); - } + Argument.AssertNotNull(value, nameof(value)); - private const string EnabledValue = "Enabled"; - private const string DisabledValue = "Disabled"; + _value = value; + } - /// Enabled. + /// Gets the Enabled. public static DevTestLabCostThresholdStatus Enabled { get; } = new DevTestLabCostThresholdStatus(EnabledValue); - /// Disabled. + + /// Gets the Disabled. public static DevTestLabCostThresholdStatus Disabled { get; } = new DevTestLabCostThresholdStatus(DisabledValue); + /// Determines if two values are the same. + /// The left value to compare. + /// The right value to compare. public static bool operator ==(DevTestLabCostThresholdStatus left, DevTestLabCostThresholdStatus 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 !=(DevTestLabCostThresholdStatus left, DevTestLabCostThresholdStatus right) => !left.Equals(right); - /// Converts a to a . + + /// Converts a string to a . + /// The value. public static implicit operator DevTestLabCostThresholdStatus(string value) => new DevTestLabCostThresholdStatus(value); - /// + /// Converts a string to a . + /// The value. + public static implicit operator DevTestLabCostThresholdStatus?(string value) => value == null ? null : new DevTestLabCostThresholdStatus(value); + + /// [EditorBrowsable(EditorBrowsableState.Never)] public override bool Equals(object obj) => obj is DevTestLabCostThresholdStatus other && Equals(other); - /// + + /// public bool Equals(DevTestLabCostThresholdStatus 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/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/Models/DevTestLabCostType.cs b/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/Models/DevTestLabCostType.cs index 6b0c009bbb27..b0bb2f2e8857 100644 --- a/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/Models/DevTestLabCostType.cs +++ b/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/Models/DevTestLabCostType.cs @@ -7,6 +7,7 @@ using System; using System.ComponentModel; +using Azure.ResourceManager.DevTestLabs; namespace Azure.ResourceManager.DevTestLabs.Models { @@ -14,41 +15,59 @@ namespace Azure.ResourceManager.DevTestLabs.Models public readonly partial struct DevTestLabCostType : IEquatable { private readonly string _value; + private const string UnavailableValue = "Unavailable"; + private const string ReportedValue = "Reported"; + private const string ProjectedValue = "Projected"; /// Initializes a new instance of . + /// The value. /// is null. public DevTestLabCostType(string value) { - _value = value ?? throw new ArgumentNullException(nameof(value)); - } + Argument.AssertNotNull(value, nameof(value)); - private const string UnavailableValue = "Unavailable"; - private const string ReportedValue = "Reported"; - private const string ProjectedValue = "Projected"; + _value = value; + } - /// Unavailable. + /// Gets the Unavailable. public static DevTestLabCostType Unavailable { get; } = new DevTestLabCostType(UnavailableValue); - /// Reported. + + /// Gets the Reported. public static DevTestLabCostType Reported { get; } = new DevTestLabCostType(ReportedValue); - /// Projected. + + /// Gets the Projected. public static DevTestLabCostType Projected { get; } = new DevTestLabCostType(ProjectedValue); + /// Determines if two values are the same. + /// The left value to compare. + /// The right value to compare. public static bool operator ==(DevTestLabCostType left, DevTestLabCostType 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 !=(DevTestLabCostType left, DevTestLabCostType right) => !left.Equals(right); - /// Converts a to a . + + /// Converts a string to a . + /// The value. public static implicit operator DevTestLabCostType(string value) => new DevTestLabCostType(value); - /// + /// Converts a string to a . + /// The value. + public static implicit operator DevTestLabCostType?(string value) => value == null ? null : new DevTestLabCostType(value); + + /// [EditorBrowsable(EditorBrowsableState.Never)] public override bool Equals(object obj) => obj is DevTestLabCostType other && Equals(other); - /// + + /// public bool Equals(DevTestLabCostType 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/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/Models/DevTestLabCustomImageOSType.cs b/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/Models/DevTestLabCustomImageOSType.cs index d97b82591537..fab66f63ed81 100644 --- a/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/Models/DevTestLabCustomImageOSType.cs +++ b/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/Models/DevTestLabCustomImageOSType.cs @@ -7,6 +7,7 @@ using System; using System.ComponentModel; +using Azure.ResourceManager.DevTestLabs; namespace Azure.ResourceManager.DevTestLabs.Models { @@ -14,41 +15,59 @@ namespace Azure.ResourceManager.DevTestLabs.Models public readonly partial struct DevTestLabCustomImageOSType : IEquatable { private readonly string _value; + private const string WindowsValue = "Windows"; + private const string LinuxValue = "Linux"; + private const string NoneValue = "None"; /// Initializes a new instance of . + /// The value. /// is null. public DevTestLabCustomImageOSType(string value) { - _value = value ?? throw new ArgumentNullException(nameof(value)); - } + Argument.AssertNotNull(value, nameof(value)); - private const string WindowsValue = "Windows"; - private const string LinuxValue = "Linux"; - private const string NoneValue = "None"; + _value = value; + } - /// Windows. + /// Gets the Windows. public static DevTestLabCustomImageOSType Windows { get; } = new DevTestLabCustomImageOSType(WindowsValue); - /// Linux. + + /// Gets the Linux. public static DevTestLabCustomImageOSType Linux { get; } = new DevTestLabCustomImageOSType(LinuxValue); - /// None. + + /// Gets the None. public static DevTestLabCustomImageOSType None { get; } = new DevTestLabCustomImageOSType(NoneValue); + /// Determines if two values are the same. + /// The left value to compare. + /// The right value to compare. public static bool operator ==(DevTestLabCustomImageOSType left, DevTestLabCustomImageOSType 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 !=(DevTestLabCustomImageOSType left, DevTestLabCustomImageOSType right) => !left.Equals(right); - /// Converts a to a . + + /// Converts a string to a . + /// The value. public static implicit operator DevTestLabCustomImageOSType(string value) => new DevTestLabCustomImageOSType(value); - /// + /// Converts a string to a . + /// The value. + public static implicit operator DevTestLabCustomImageOSType?(string value) => value == null ? null : new DevTestLabCustomImageOSType(value); + + /// [EditorBrowsable(EditorBrowsableState.Never)] public override bool Equals(object obj) => obj is DevTestLabCustomImageOSType other && Equals(other); - /// + + /// public bool Equals(DevTestLabCustomImageOSType 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/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/Models/DevTestLabCustomImagePatch.Serialization.cs b/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/Models/DevTestLabCustomImagePatch.Serialization.cs index 4208cf017241..31a9505add90 100644 --- a/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/Models/DevTestLabCustomImagePatch.Serialization.cs +++ b/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/Models/DevTestLabCustomImagePatch.Serialization.cs @@ -10,13 +10,32 @@ using System.Collections.Generic; using System.Text.Json; using Azure.Core; +using Azure.ResourceManager.DevTestLabs; namespace Azure.ResourceManager.DevTestLabs.Models { - public partial class DevTestLabCustomImagePatch : IUtf8JsonSerializable, IJsonModel + /// A custom image. + public partial class DevTestLabCustomImagePatch : DevTestLabResourcePatch, IJsonModel { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + /// The data to parse. + /// The client options for reading and writing models. + protected override DevTestLabResourcePatch 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 DeserializeDevTestLabCustomImagePatch(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(DevTestLabCustomImagePatch)} does not support reading '{options.Format}' format."); + } + } + /// The JSON writer. + /// The client options for reading and writing models. void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) { writer.WriteStartObject(); @@ -28,67 +47,79 @@ void IJsonModel.Write(Utf8JsonWriter writer, ModelRe /// 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(DevTestLabCustomImagePatch)} does not support writing '{format}' format."); } - base.JsonModelWriteCore(writer, options); } - DevTestLabCustomImagePatch IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + /// The JSON reader. + /// The client options for reading and writing models. + DevTestLabCustomImagePatch IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) => (DevTestLabCustomImagePatch)JsonModelCreateCore(ref reader, options); + + /// The JSON reader. + /// The client options for reading and writing models. + protected override DevTestLabResourcePatch 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(DevTestLabCustomImagePatch)} does not support reading '{format}' format."); } - using JsonDocument document = JsonDocument.ParseValue(ref reader); return DeserializeDevTestLabCustomImagePatch(document.RootElement, options); } - internal static DevTestLabCustomImagePatch DeserializeDevTestLabCustomImagePatch(JsonElement element, ModelReaderWriterOptions options = null) + /// The JSON element to deserialize. + /// The client options for reading and writing models. + internal static DevTestLabCustomImagePatch DeserializeDevTestLabCustomImagePatch(JsonElement element, ModelReaderWriterOptions options) { - options ??= ModelSerializationExtensions.WireOptions; - if (element.ValueKind == JsonValueKind.Null) { return null; } IDictionary tags = 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("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 (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 DevTestLabCustomImagePatch(tags ?? new ChangeTrackingDictionary(), serializedAdditionalRawData); + return new DevTestLabCustomImagePatch(tags ?? new ChangeTrackingDictionary(), 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 override BinaryData PersistableModelWriteCore(ModelReaderWriterOptions options) + { + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; switch (format) { case "J": @@ -98,22 +129,23 @@ BinaryData IPersistableModel.Write(ModelReaderWriter } } - DevTestLabCustomImagePatch 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. + DevTestLabCustomImagePatch IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) => (DevTestLabCustomImagePatch)PersistableModelCreateCore(data, options); - switch (format) + /// The client options for reading and writing models. + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + + /// The to serialize into . + internal static RequestContent ToRequestContent(DevTestLabCustomImagePatch devTestLabCustomImagePatch) + { + if (devTestLabCustomImagePatch == null) { - case "J": - { - using JsonDocument document = JsonDocument.Parse(data, ModelSerializationExtensions.JsonDocumentOptions); - return DeserializeDevTestLabCustomImagePatch(document.RootElement, options); - } - default: - throw new FormatException($"The model {nameof(DevTestLabCustomImagePatch)} does not support reading '{options.Format}' format."); + return null; } + Utf8JsonRequestContent content = new Utf8JsonRequestContent(); + content.JsonWriter.WriteObjectValue(devTestLabCustomImagePatch, ModelSerializationExtensions.WireOptions); + return content; } - - string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; } } diff --git a/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/Models/DevTestLabCustomImagePatch.cs b/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/Models/DevTestLabCustomImagePatch.cs index 5dfd60049110..93774e7bf3f3 100644 --- a/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/Models/DevTestLabCustomImagePatch.cs +++ b/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/Models/DevTestLabCustomImagePatch.cs @@ -20,8 +20,8 @@ public DevTestLabCustomImagePatch() /// Initializes a new instance of . /// The tags of the resource. - /// Keeps track of any properties unknown to the library. - internal DevTestLabCustomImagePatch(IDictionary tags, IDictionary serializedAdditionalRawData) : base(tags, serializedAdditionalRawData) + /// Keeps track of any properties unknown to the library. + internal DevTestLabCustomImagePatch(IDictionary tags, IDictionary additionalBinaryDataProperties) : base(tags, additionalBinaryDataProperties) { } } diff --git a/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/Models/DevTestLabCustomImagePlan.Serialization.cs b/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/Models/DevTestLabCustomImagePlan.Serialization.cs index f017a4cdfcf7..efad7c3a9108 100644 --- a/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/Models/DevTestLabCustomImagePlan.Serialization.cs +++ b/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/Models/DevTestLabCustomImagePlan.Serialization.cs @@ -9,14 +9,32 @@ using System.ClientModel.Primitives; using System.Collections.Generic; using System.Text.Json; -using Azure.Core; +using Azure.ResourceManager.DevTestLabs; namespace Azure.ResourceManager.DevTestLabs.Models { - public partial class DevTestLabCustomImagePlan : IUtf8JsonSerializable, IJsonModel + /// Properties for plan on a custom image. + public partial class DevTestLabCustomImagePlan : IJsonModel { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + /// The data to parse. + /// The client options for reading and writing models. + protected virtual DevTestLabCustomImagePlan 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 DeserializeDevTestLabCustomImagePlan(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(DevTestLabCustomImagePlan)} does not support reading '{options.Format}' format."); + } + } + /// The JSON writer. + /// The client options for reading and writing models. void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) { writer.WriteStartObject(); @@ -28,12 +46,11 @@ void IJsonModel.Write(Utf8JsonWriter writer, ModelRea /// 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(DevTestLabCustomImagePlan)} does not support writing '{format}' format."); } - if (Optional.IsDefined(Id)) { writer.WritePropertyName("id"u8); @@ -49,15 +66,15 @@ protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWrit writer.WritePropertyName("offer"u8); writer.WriteStringValue(Offer); } - 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,22 +83,27 @@ protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWrit } } - DevTestLabCustomImagePlan IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + /// The JSON reader. + /// The client options for reading and writing models. + DevTestLabCustomImagePlan IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) => JsonModelCreateCore(ref reader, options); + + /// The JSON reader. + /// The client options for reading and writing models. + protected virtual DevTestLabCustomImagePlan 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(DevTestLabCustomImagePlan)} does not support reading '{format}' format."); } - using JsonDocument document = JsonDocument.ParseValue(ref reader); return DeserializeDevTestLabCustomImagePlan(document.RootElement, options); } - internal static DevTestLabCustomImagePlan DeserializeDevTestLabCustomImagePlan(JsonElement element, ModelReaderWriterOptions options = null) + /// The JSON element to deserialize. + /// The client options for reading and writing models. + internal static DevTestLabCustomImagePlan DeserializeDevTestLabCustomImagePlan(JsonElement element, ModelReaderWriterOptions options) { - options ??= ModelSerializationExtensions.WireOptions; - if (element.ValueKind == JsonValueKind.Null) { return null; @@ -89,38 +111,39 @@ internal static DevTestLabCustomImagePlan DeserializeDevTestLabCustomImagePlan(J string id = default; string publisher = default; string offer = 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 = property.Value.GetString(); + id = prop.Value.GetString(); continue; } - if (property.NameEquals("publisher"u8)) + if (prop.NameEquals("publisher"u8)) { - publisher = property.Value.GetString(); + publisher = prop.Value.GetString(); continue; } - if (property.NameEquals("offer"u8)) + if (prop.NameEquals("offer"u8)) { - offer = property.Value.GetString(); + offer = 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 DevTestLabCustomImagePlan(id, publisher, offer, serializedAdditionalRawData); + return new DevTestLabCustomImagePlan(id, publisher, offer, 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,22 +153,11 @@ BinaryData IPersistableModel.Write(ModelReaderWriterO } } - DevTestLabCustomImagePlan 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 DeserializeDevTestLabCustomImagePlan(document.RootElement, options); - } - default: - throw new FormatException($"The model {nameof(DevTestLabCustomImagePlan)} does not support reading '{options.Format}' format."); - } - } + /// The data to parse. + /// The client options for reading and writing models. + DevTestLabCustomImagePlan IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) => PersistableModelCreateCore(data, options); + /// The client options for reading and writing models. string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; } } diff --git a/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/Models/DevTestLabCustomImagePlan.cs b/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/Models/DevTestLabCustomImagePlan.cs index ffb85b214f7e..dc69c81ce43b 100644 --- a/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/Models/DevTestLabCustomImagePlan.cs +++ b/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/Models/DevTestLabCustomImagePlan.cs @@ -13,37 +13,8 @@ namespace Azure.ResourceManager.DevTestLabs.Models /// Properties for plan on a custom image. public partial class DevTestLabCustomImagePlan { - /// - /// 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 DevTestLabCustomImagePlan() @@ -54,19 +25,21 @@ public DevTestLabCustomImagePlan() /// The id of the plan, equivalent to name of the plan. /// The publisher for the plan from the marketplace image the custom image is derived from. /// The offer for the plan from the marketplace image the custom image is derived from. - /// Keeps track of any properties unknown to the library. - internal DevTestLabCustomImagePlan(string id, string publisher, string offer, IDictionary serializedAdditionalRawData) + /// Keeps track of any properties unknown to the library. + internal DevTestLabCustomImagePlan(string id, string publisher, string offer, IDictionary additionalBinaryDataProperties) { Id = id; Publisher = publisher; Offer = offer; - _serializedAdditionalRawData = serializedAdditionalRawData; + _additionalBinaryDataProperties = additionalBinaryDataProperties; } /// The id of the plan, equivalent to name of the plan. public string Id { get; set; } + /// The publisher for the plan from the marketplace image the custom image is derived from. public string Publisher { get; set; } + /// The offer for the plan from the marketplace image the custom image is derived from. public string Offer { get; set; } } diff --git a/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/Models/DevTestLabCustomImageVhd.Serialization.cs b/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/Models/DevTestLabCustomImageVhd.Serialization.cs index 7d61154696ad..a6367c35283a 100644 --- a/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/Models/DevTestLabCustomImageVhd.Serialization.cs +++ b/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/Models/DevTestLabCustomImageVhd.Serialization.cs @@ -9,14 +9,37 @@ using System.ClientModel.Primitives; using System.Collections.Generic; using System.Text.Json; -using Azure.Core; +using Azure.ResourceManager.DevTestLabs; namespace Azure.ResourceManager.DevTestLabs.Models { - public partial class DevTestLabCustomImageVhd : IUtf8JsonSerializable, IJsonModel + /// Properties for creating a custom image from a VHD. + public partial class DevTestLabCustomImageVhd : IJsonModel { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + /// Initializes a new instance of for deserialization. + internal DevTestLabCustomImageVhd() + { + } + /// The data to parse. + /// The client options for reading and writing models. + protected virtual DevTestLabCustomImageVhd 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 DeserializeDevTestLabCustomImageVhd(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(DevTestLabCustomImageVhd)} does not support reading '{options.Format}' format."); + } + } + + /// The JSON writer. + /// The client options for reading and writing models. void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) { writer.WriteStartObject(); @@ -28,12 +51,11 @@ void IJsonModel.Write(Utf8JsonWriter writer, ModelRead /// 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(DevTestLabCustomImageVhd)} does not support writing '{format}' format."); } - if (Optional.IsDefined(ImageName)) { writer.WritePropertyName("imageName"u8); @@ -46,15 +68,15 @@ protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWrit } writer.WritePropertyName("osType"u8); writer.WriteStringValue(OSType.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); } @@ -63,65 +85,71 @@ protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWrit } } - DevTestLabCustomImageVhd IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + /// The JSON reader. + /// The client options for reading and writing models. + DevTestLabCustomImageVhd IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) => JsonModelCreateCore(ref reader, options); + + /// The JSON reader. + /// The client options for reading and writing models. + protected virtual DevTestLabCustomImageVhd 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(DevTestLabCustomImageVhd)} does not support reading '{format}' format."); } - using JsonDocument document = JsonDocument.ParseValue(ref reader); return DeserializeDevTestLabCustomImageVhd(document.RootElement, options); } - internal static DevTestLabCustomImageVhd DeserializeDevTestLabCustomImageVhd(JsonElement element, ModelReaderWriterOptions options = null) + /// The JSON element to deserialize. + /// The client options for reading and writing models. + internal static DevTestLabCustomImageVhd DeserializeDevTestLabCustomImageVhd(JsonElement element, ModelReaderWriterOptions options) { - options ??= ModelSerializationExtensions.WireOptions; - if (element.ValueKind == JsonValueKind.Null) { return null; } string imageName = default; - bool? sysPrep = default; + bool? isSysPrepEnabled = default; DevTestLabCustomImageOSType osType = 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("imageName"u8)) + if (prop.NameEquals("imageName"u8)) { - imageName = property.Value.GetString(); + imageName = prop.Value.GetString(); continue; } - if (property.NameEquals("sysPrep"u8)) + if (prop.NameEquals("sysPrep"u8)) { - if (property.Value.ValueKind == JsonValueKind.Null) + if (prop.Value.ValueKind == JsonValueKind.Null) { continue; } - sysPrep = property.Value.GetBoolean(); + isSysPrepEnabled = prop.Value.GetBoolean(); continue; } - if (property.NameEquals("osType"u8)) + if (prop.NameEquals("osType"u8)) { - osType = new DevTestLabCustomImageOSType(property.Value.GetString()); + osType = new DevTestLabCustomImageOSType(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 DevTestLabCustomImageVhd(imageName, sysPrep, osType, serializedAdditionalRawData); + return new DevTestLabCustomImageVhd(imageName, isSysPrepEnabled, osType, 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": @@ -131,22 +159,11 @@ BinaryData IPersistableModel.Write(ModelReaderWriterOp } } - DevTestLabCustomImageVhd 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 DeserializeDevTestLabCustomImageVhd(document.RootElement, options); - } - default: - throw new FormatException($"The model {nameof(DevTestLabCustomImageVhd)} does not support reading '{options.Format}' format."); - } - } + /// The data to parse. + /// The client options for reading and writing models. + DevTestLabCustomImageVhd IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) => PersistableModelCreateCore(data, options); + /// The client options for reading and writing models. string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; } } diff --git a/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/Models/DevTestLabCustomImageVhd.cs b/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/Models/DevTestLabCustomImageVhd.cs index ec856d86a81e..be15dc2b786f 100644 --- a/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/Models/DevTestLabCustomImageVhd.cs +++ b/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/Models/DevTestLabCustomImageVhd.cs @@ -13,37 +13,8 @@ namespace Azure.ResourceManager.DevTestLabs.Models /// Properties for creating a custom image from a VHD. public partial class DevTestLabCustomImageVhd { - /// - /// 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 OS type of the custom image (i.e. Windows, Linux). @@ -56,24 +27,21 @@ public DevTestLabCustomImageVhd(DevTestLabCustomImageOSType osType) /// The image name. /// Indicates whether sysprep has been run on the VHD. /// The OS type of the custom image (i.e. Windows, Linux). - /// Keeps track of any properties unknown to the library. - internal DevTestLabCustomImageVhd(string imageName, bool? isSysPrepEnabled, DevTestLabCustomImageOSType osType, IDictionary serializedAdditionalRawData) + /// Keeps track of any properties unknown to the library. + internal DevTestLabCustomImageVhd(string imageName, bool? isSysPrepEnabled, DevTestLabCustomImageOSType osType, IDictionary additionalBinaryDataProperties) { ImageName = imageName; IsSysPrepEnabled = isSysPrepEnabled; OSType = osType; - _serializedAdditionalRawData = serializedAdditionalRawData; - } - - /// Initializes a new instance of for deserialization. - internal DevTestLabCustomImageVhd() - { + _additionalBinaryDataProperties = additionalBinaryDataProperties; } /// The image name. public string ImageName { get; set; } + /// Indicates whether sysprep has been run on the VHD. public bool? IsSysPrepEnabled { get; set; } + /// The OS type of the custom image (i.e. Windows, Linux). public DevTestLabCustomImageOSType OSType { get; set; } } diff --git a/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/Models/DevTestLabCustomImageVm.Serialization.cs b/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/Models/DevTestLabCustomImageVm.Serialization.cs index c30e9e6e9495..d10eb59cf9d4 100644 --- a/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/Models/DevTestLabCustomImageVm.Serialization.cs +++ b/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/Models/DevTestLabCustomImageVm.Serialization.cs @@ -9,14 +9,32 @@ using System.ClientModel.Primitives; using System.Collections.Generic; using System.Text.Json; -using Azure.Core; +using Azure.ResourceManager.DevTestLabs; namespace Azure.ResourceManager.DevTestLabs.Models { - public partial class DevTestLabCustomImageVm : IUtf8JsonSerializable, IJsonModel + /// Properties for creating a custom image from a virtual machine. + public partial class DevTestLabCustomImageVm : IJsonModel { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + /// The data to parse. + /// The client options for reading and writing models. + protected virtual DevTestLabCustomImageVm 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 DeserializeDevTestLabCustomImageVm(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(DevTestLabCustomImageVm)} does not support reading '{options.Format}' format."); + } + } + /// The JSON writer. + /// The client options for reading and writing models. void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) { writer.WriteStartObject(); @@ -28,36 +46,35 @@ void IJsonModel.Write(Utf8JsonWriter writer, ModelReade /// 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(DevTestLabCustomImageVm)} does not support writing '{format}' format."); } - if (Optional.IsDefined(SourceVmId)) { writer.WritePropertyName("sourceVmId"u8); writer.WriteStringValue(SourceVmId); } - if (Optional.IsDefined(WindowsOSInfo)) + if (Optional.IsDefined(WindowsOsInfo)) { writer.WritePropertyName("windowsOsInfo"u8); - writer.WriteObjectValue(WindowsOSInfo, options); + writer.WriteObjectValue(WindowsOsInfo, options); } - if (Optional.IsDefined(LinuxOSInfo)) + if (Optional.IsDefined(LinuxOsInfo)) { writer.WritePropertyName("linuxOsInfo"u8); - writer.WriteObjectValue(LinuxOSInfo, options); + writer.WriteObjectValue(LinuxOsInfo, 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); } @@ -66,69 +83,75 @@ protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWrit } } - DevTestLabCustomImageVm IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + /// The JSON reader. + /// The client options for reading and writing models. + DevTestLabCustomImageVm IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) => JsonModelCreateCore(ref reader, options); + + /// The JSON reader. + /// The client options for reading and writing models. + protected virtual DevTestLabCustomImageVm 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(DevTestLabCustomImageVm)} does not support reading '{format}' format."); } - using JsonDocument document = JsonDocument.ParseValue(ref reader); return DeserializeDevTestLabCustomImageVm(document.RootElement, options); } - internal static DevTestLabCustomImageVm DeserializeDevTestLabCustomImageVm(JsonElement element, ModelReaderWriterOptions options = null) + /// The JSON element to deserialize. + /// The client options for reading and writing models. + internal static DevTestLabCustomImageVm DeserializeDevTestLabCustomImageVm(JsonElement element, ModelReaderWriterOptions options) { - options ??= ModelSerializationExtensions.WireOptions; - if (element.ValueKind == JsonValueKind.Null) { return null; } string sourceVmId = default; - WindowsOSInfo windowsOSInfo = default; - LinuxOSInfo linuxOSInfo = default; - IDictionary serializedAdditionalRawData = default; - Dictionary rawDataDictionary = new Dictionary(); - foreach (var property in element.EnumerateObject()) + DevTestLabWindowsOSInfo windowsOsInfo = default; + DevTestLabLinuxOSInfo linuxOsInfo = default; + IDictionary additionalBinaryDataProperties = new ChangeTrackingDictionary(); + foreach (var prop in element.EnumerateObject()) { - if (property.NameEquals("sourceVmId"u8)) + if (prop.NameEquals("sourceVmId"u8)) { - sourceVmId = property.Value.GetString(); + sourceVmId = prop.Value.GetString(); continue; } - if (property.NameEquals("windowsOsInfo"u8)) + if (prop.NameEquals("windowsOsInfo"u8)) { - if (property.Value.ValueKind == JsonValueKind.Null) + if (prop.Value.ValueKind == JsonValueKind.Null) { continue; } - windowsOSInfo = WindowsOSInfo.DeserializeWindowsOSInfo(property.Value, options); + windowsOsInfo = DevTestLabWindowsOSInfo.DeserializeDevTestLabWindowsOSInfo(prop.Value, options); continue; } - if (property.NameEquals("linuxOsInfo"u8)) + if (prop.NameEquals("linuxOsInfo"u8)) { - if (property.Value.ValueKind == JsonValueKind.Null) + if (prop.Value.ValueKind == JsonValueKind.Null) { continue; } - linuxOSInfo = LinuxOSInfo.DeserializeLinuxOSInfo(property.Value, options); + linuxOsInfo = DevTestLabLinuxOSInfo.DeserializeDevTestLabLinuxOSInfo(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 DevTestLabCustomImageVm(sourceVmId, windowsOSInfo, linuxOSInfo, serializedAdditionalRawData); + return new DevTestLabCustomImageVm(sourceVmId, windowsOsInfo, linuxOsInfo, 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,22 +161,11 @@ BinaryData IPersistableModel.Write(ModelReaderWriterOpt } } - DevTestLabCustomImageVm 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 DeserializeDevTestLabCustomImageVm(document.RootElement, options); - } - default: - throw new FormatException($"The model {nameof(DevTestLabCustomImageVm)} does not support reading '{options.Format}' format."); - } - } + /// The data to parse. + /// The client options for reading and writing models. + DevTestLabCustomImageVm IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) => PersistableModelCreateCore(data, options); + /// The client options for reading and writing models. string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; } } diff --git a/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/Models/DevTestLabCustomImageVm.cs b/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/Models/DevTestLabCustomImageVm.cs index b53ca70ef100..275f993e2209 100644 --- a/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/Models/DevTestLabCustomImageVm.cs +++ b/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/Models/DevTestLabCustomImageVm.cs @@ -13,37 +13,8 @@ namespace Azure.ResourceManager.DevTestLabs.Models /// Properties for creating a custom image from a virtual machine. public partial class DevTestLabCustomImageVm { - /// - /// 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 DevTestLabCustomImageVm() @@ -52,44 +23,57 @@ public DevTestLabCustomImageVm() /// Initializes a new instance of . /// The source vm identifier. - /// The Windows OS information of the VM. - /// The Linux OS information of the VM. - /// Keeps track of any properties unknown to the library. - internal DevTestLabCustomImageVm(string sourceVmId, WindowsOSInfo windowsOSInfo, LinuxOSInfo linuxOSInfo, IDictionary serializedAdditionalRawData) + /// The Windows OS information of the VM. + /// The Linux OS information of the VM. + /// Keeps track of any properties unknown to the library. + internal DevTestLabCustomImageVm(string sourceVmId, DevTestLabWindowsOSInfo windowsOsInfo, DevTestLabLinuxOSInfo linuxOsInfo, IDictionary additionalBinaryDataProperties) { SourceVmId = sourceVmId; - WindowsOSInfo = windowsOSInfo; - LinuxOSInfo = linuxOSInfo; - _serializedAdditionalRawData = serializedAdditionalRawData; + WindowsOsInfo = windowsOsInfo; + LinuxOsInfo = linuxOsInfo; + _additionalBinaryDataProperties = additionalBinaryDataProperties; } /// The source vm identifier. public string SourceVmId { get; set; } + /// The Windows OS information of the VM. - internal WindowsOSInfo WindowsOSInfo { get; set; } + internal DevTestLabWindowsOSInfo WindowsOsInfo { get; set; } + + /// The Linux OS information of the VM. + internal DevTestLabLinuxOSInfo LinuxOsInfo { get; set; } + /// The state of the Windows OS (i.e. NonSysprepped, SysprepRequested, SysprepApplied). public WindowsOSState? WindowsOSState { - get => WindowsOSInfo is null ? default : WindowsOSInfo.WindowsOSState; + get + { + return WindowsOsInfo is null ? default : WindowsOsInfo.WindowsOSState; + } set { - if (WindowsOSInfo is null) - WindowsOSInfo = new WindowsOSInfo(); - WindowsOSInfo.WindowsOSState = value; + if (WindowsOsInfo is null) + { + WindowsOsInfo = new DevTestLabWindowsOSInfo(); + } + WindowsOsInfo.WindowsOSState = value; } } - /// The Linux OS information of the VM. - internal LinuxOSInfo LinuxOSInfo { get; set; } /// The state of the Linux OS (i.e. NonDeprovisioned, DeprovisionRequested, DeprovisionApplied). public DevTestLabLinuxOSState? LinuxOSState { - get => LinuxOSInfo is null ? default : LinuxOSInfo.LinuxOSState; + get + { + return LinuxOsInfo is null ? default : LinuxOsInfo.LinuxOSState; + } set { - if (LinuxOSInfo is null) - LinuxOSInfo = new LinuxOSInfo(); - LinuxOSInfo.LinuxOSState = value; + if (LinuxOsInfo is null) + { + LinuxOsInfo = new DevTestLabLinuxOSInfo(); + } + LinuxOsInfo.LinuxOSState = value; } } } diff --git a/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/Models/DevTestLabDataDiskProperties.Serialization.cs b/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/Models/DevTestLabDataDiskProperties.Serialization.cs index 691d15d08b1d..35c340869428 100644 --- a/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/Models/DevTestLabDataDiskProperties.Serialization.cs +++ b/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/Models/DevTestLabDataDiskProperties.Serialization.cs @@ -10,13 +10,32 @@ using System.Collections.Generic; using System.Text.Json; using Azure.Core; +using Azure.ResourceManager.DevTestLabs; namespace Azure.ResourceManager.DevTestLabs.Models { - public partial class DevTestLabDataDiskProperties : IUtf8JsonSerializable, IJsonModel + /// Request body for adding a new or existing data disk to a virtual machine. + public partial class DevTestLabDataDiskProperties : IJsonModel { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + /// The data to parse. + /// The client options for reading and writing models. + protected virtual DevTestLabDataDiskProperties 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 DeserializeDevTestLabDataDiskProperties(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(DevTestLabDataDiskProperties)} does not support reading '{options.Format}' format."); + } + } + /// The JSON writer. + /// The client options for reading and writing models. void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) { writer.WriteStartObject(); @@ -28,12 +47,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(DevTestLabDataDiskProperties)} does not support writing '{format}' format."); } - if (Optional.IsDefined(AttachNewDataDiskOptions)) { writer.WritePropertyName("attachNewDataDiskOptions"u8); @@ -49,15 +67,15 @@ protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWrit writer.WritePropertyName("hostCaching"u8); writer.WriteStringValue(HostCaching.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); } @@ -66,22 +84,27 @@ protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWrit } } - DevTestLabDataDiskProperties IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + /// The JSON reader. + /// The client options for reading and writing models. + DevTestLabDataDiskProperties IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) => JsonModelCreateCore(ref reader, options); + + /// The JSON reader. + /// The client options for reading and writing models. + protected virtual DevTestLabDataDiskProperties 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(DevTestLabDataDiskProperties)} does not support reading '{format}' format."); } - using JsonDocument document = JsonDocument.ParseValue(ref reader); return DeserializeDevTestLabDataDiskProperties(document.RootElement, options); } - internal static DevTestLabDataDiskProperties DeserializeDevTestLabDataDiskProperties(JsonElement element, ModelReaderWriterOptions options = null) + /// The JSON element to deserialize. + /// The client options for reading and writing models. + internal static DevTestLabDataDiskProperties DeserializeDevTestLabDataDiskProperties(JsonElement element, ModelReaderWriterOptions options) { - options ??= ModelSerializationExtensions.WireOptions; - if (element.ValueKind == JsonValueKind.Null) { return null; @@ -89,50 +112,51 @@ internal static DevTestLabDataDiskProperties DeserializeDevTestLabDataDiskProper AttachNewDataDiskDetails attachNewDataDiskOptions = default; ResourceIdentifier existingLabDiskId = default; DevTestLabHostCachingOption? hostCaching = 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("attachNewDataDiskOptions"u8)) + if (prop.NameEquals("attachNewDataDiskOptions"u8)) { - if (property.Value.ValueKind == JsonValueKind.Null) + if (prop.Value.ValueKind == JsonValueKind.Null) { continue; } - attachNewDataDiskOptions = AttachNewDataDiskDetails.DeserializeAttachNewDataDiskDetails(property.Value, options); + attachNewDataDiskOptions = AttachNewDataDiskDetails.DeserializeAttachNewDataDiskDetails(prop.Value, options); continue; } - if (property.NameEquals("existingLabDiskId"u8)) + if (prop.NameEquals("existingLabDiskId"u8)) { - if (property.Value.ValueKind == JsonValueKind.Null) + if (prop.Value.ValueKind == JsonValueKind.Null) { continue; } - existingLabDiskId = new ResourceIdentifier(property.Value.GetString()); + existingLabDiskId = new ResourceIdentifier(prop.Value.GetString()); continue; } - if (property.NameEquals("hostCaching"u8)) + if (prop.NameEquals("hostCaching"u8)) { - if (property.Value.ValueKind == JsonValueKind.Null) + if (prop.Value.ValueKind == JsonValueKind.Null) { continue; } - hostCaching = new DevTestLabHostCachingOption(property.Value.GetString()); + hostCaching = new DevTestLabHostCachingOption(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 DevTestLabDataDiskProperties(attachNewDataDiskOptions, existingLabDiskId, hostCaching, serializedAdditionalRawData); + return new DevTestLabDataDiskProperties(attachNewDataDiskOptions, existingLabDiskId, hostCaching, 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": @@ -142,22 +166,23 @@ BinaryData IPersistableModel.Write(ModelReaderWrit } } - DevTestLabDataDiskProperties 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. + DevTestLabDataDiskProperties IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) => PersistableModelCreateCore(data, options); - switch (format) + /// The client options for reading and writing models. + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + + /// The to serialize into . + internal static RequestContent ToRequestContent(DevTestLabDataDiskProperties devTestLabDataDiskProperties) + { + if (devTestLabDataDiskProperties == null) { - case "J": - { - using JsonDocument document = JsonDocument.Parse(data, ModelSerializationExtensions.JsonDocumentOptions); - return DeserializeDevTestLabDataDiskProperties(document.RootElement, options); - } - default: - throw new FormatException($"The model {nameof(DevTestLabDataDiskProperties)} does not support reading '{options.Format}' format."); + return null; } + Utf8JsonRequestContent content = new Utf8JsonRequestContent(); + content.JsonWriter.WriteObjectValue(devTestLabDataDiskProperties, ModelSerializationExtensions.WireOptions); + return content; } - - string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; } } diff --git a/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/Models/DevTestLabDataDiskProperties.cs b/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/Models/DevTestLabDataDiskProperties.cs index 29547444c554..4009be8e8e81 100644 --- a/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/Models/DevTestLabDataDiskProperties.cs +++ b/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/Models/DevTestLabDataDiskProperties.cs @@ -14,37 +14,8 @@ namespace Azure.ResourceManager.DevTestLabs.Models /// Request body for adding a new or existing data disk to a virtual machine. public partial class DevTestLabDataDiskProperties { - /// - /// 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 DevTestLabDataDiskProperties() @@ -55,19 +26,21 @@ public DevTestLabDataDiskProperties() /// Specifies options to attach a new disk to the virtual machine. /// Specifies the existing lab disk id to attach to virtual machine. /// Caching option for a data disk (i.e. None, ReadOnly, ReadWrite). - /// Keeps track of any properties unknown to the library. - internal DevTestLabDataDiskProperties(AttachNewDataDiskDetails attachNewDataDiskOptions, ResourceIdentifier existingLabDiskId, DevTestLabHostCachingOption? hostCaching, IDictionary serializedAdditionalRawData) + /// Keeps track of any properties unknown to the library. + internal DevTestLabDataDiskProperties(AttachNewDataDiskDetails attachNewDataDiskOptions, ResourceIdentifier existingLabDiskId, DevTestLabHostCachingOption? hostCaching, IDictionary additionalBinaryDataProperties) { AttachNewDataDiskOptions = attachNewDataDiskOptions; ExistingLabDiskId = existingLabDiskId; HostCaching = hostCaching; - _serializedAdditionalRawData = serializedAdditionalRawData; + _additionalBinaryDataProperties = additionalBinaryDataProperties; } /// Specifies options to attach a new disk to the virtual machine. public AttachNewDataDiskDetails AttachNewDataDiskOptions { get; set; } + /// Specifies the existing lab disk id to attach to virtual machine. public ResourceIdentifier ExistingLabDiskId { get; set; } + /// Caching option for a data disk (i.e. None, ReadOnly, ReadWrite). public DevTestLabHostCachingOption? HostCaching { get; set; } } diff --git a/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/Models/DevTestLabDataDiskStorageTypeInfo.Serialization.cs b/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/Models/DevTestLabDataDiskStorageTypeInfo.Serialization.cs index 40fb56ff2032..9dc71905b786 100644 --- a/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/Models/DevTestLabDataDiskStorageTypeInfo.Serialization.cs +++ b/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/Models/DevTestLabDataDiskStorageTypeInfo.Serialization.cs @@ -9,14 +9,32 @@ using System.ClientModel.Primitives; using System.Collections.Generic; using System.Text.Json; -using Azure.Core; +using Azure.ResourceManager.DevTestLabs; namespace Azure.ResourceManager.DevTestLabs.Models { - public partial class DevTestLabDataDiskStorageTypeInfo : IUtf8JsonSerializable, IJsonModel + /// Storage information about the data disks present in the custom image. + public partial class DevTestLabDataDiskStorageTypeInfo : IJsonModel { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + /// The data to parse. + /// The client options for reading and writing models. + protected virtual DevTestLabDataDiskStorageTypeInfo 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 DeserializeDevTestLabDataDiskStorageTypeInfo(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(DevTestLabDataDiskStorageTypeInfo)} does not support reading '{options.Format}' format."); + } + } + /// The JSON writer. + /// The client options for reading and writing models. void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) { writer.WriteStartObject(); @@ -28,12 +46,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(DevTestLabDataDiskStorageTypeInfo)} does not support writing '{format}' format."); } - if (Optional.IsDefined(Lun)) { writer.WritePropertyName("lun"u8); @@ -44,15 +61,15 @@ protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWrit writer.WritePropertyName("storageType"u8); writer.WriteStringValue(StorageType.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); } @@ -61,59 +78,65 @@ protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWrit } } - DevTestLabDataDiskStorageTypeInfo IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + /// The JSON reader. + /// The client options for reading and writing models. + DevTestLabDataDiskStorageTypeInfo IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) => JsonModelCreateCore(ref reader, options); + + /// The JSON reader. + /// The client options for reading and writing models. + protected virtual DevTestLabDataDiskStorageTypeInfo 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(DevTestLabDataDiskStorageTypeInfo)} does not support reading '{format}' format."); } - using JsonDocument document = JsonDocument.ParseValue(ref reader); return DeserializeDevTestLabDataDiskStorageTypeInfo(document.RootElement, options); } - internal static DevTestLabDataDiskStorageTypeInfo DeserializeDevTestLabDataDiskStorageTypeInfo(JsonElement element, ModelReaderWriterOptions options = null) + /// The JSON element to deserialize. + /// The client options for reading and writing models. + internal static DevTestLabDataDiskStorageTypeInfo DeserializeDevTestLabDataDiskStorageTypeInfo(JsonElement element, ModelReaderWriterOptions options) { - options ??= ModelSerializationExtensions.WireOptions; - if (element.ValueKind == JsonValueKind.Null) { return null; } string lun = default; DevTestLabStorageType? storageType = 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("lun"u8)) + if (prop.NameEquals("lun"u8)) { - lun = property.Value.GetString(); + lun = prop.Value.GetString(); continue; } - if (property.NameEquals("storageType"u8)) + if (prop.NameEquals("storageType"u8)) { - if (property.Value.ValueKind == JsonValueKind.Null) + if (prop.Value.ValueKind == JsonValueKind.Null) { continue; } - storageType = new DevTestLabStorageType(property.Value.GetString()); + storageType = new DevTestLabStorageType(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 DevTestLabDataDiskStorageTypeInfo(lun, storageType, serializedAdditionalRawData); + return new DevTestLabDataDiskStorageTypeInfo(lun, storageType, 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": @@ -123,22 +146,11 @@ BinaryData IPersistableModel.Write(ModelReade } } - DevTestLabDataDiskStorageTypeInfo 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 DeserializeDevTestLabDataDiskStorageTypeInfo(document.RootElement, options); - } - default: - throw new FormatException($"The model {nameof(DevTestLabDataDiskStorageTypeInfo)} does not support reading '{options.Format}' format."); - } - } + /// The data to parse. + /// The client options for reading and writing models. + DevTestLabDataDiskStorageTypeInfo IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) => PersistableModelCreateCore(data, options); + /// The client options for reading and writing models. string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; } } diff --git a/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/Models/DevTestLabDataDiskStorageTypeInfo.cs b/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/Models/DevTestLabDataDiskStorageTypeInfo.cs index ed63f5cd341e..1f9f5dc1c5c3 100644 --- a/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/Models/DevTestLabDataDiskStorageTypeInfo.cs +++ b/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/Models/DevTestLabDataDiskStorageTypeInfo.cs @@ -13,37 +13,8 @@ namespace Azure.ResourceManager.DevTestLabs.Models /// Storage information about the data disks present in the custom image. public partial class DevTestLabDataDiskStorageTypeInfo { - /// - /// 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 DevTestLabDataDiskStorageTypeInfo() @@ -53,16 +24,17 @@ public DevTestLabDataDiskStorageTypeInfo() /// Initializes a new instance of . /// Disk Lun. /// Disk Storage Type. - /// Keeps track of any properties unknown to the library. - internal DevTestLabDataDiskStorageTypeInfo(string lun, DevTestLabStorageType? storageType, IDictionary serializedAdditionalRawData) + /// Keeps track of any properties unknown to the library. + internal DevTestLabDataDiskStorageTypeInfo(string lun, DevTestLabStorageType? storageType, IDictionary additionalBinaryDataProperties) { Lun = lun; StorageType = storageType; - _serializedAdditionalRawData = serializedAdditionalRawData; + _additionalBinaryDataProperties = additionalBinaryDataProperties; } /// Disk Lun. public string Lun { get; set; } + /// Disk Storage Type. public DevTestLabStorageType? StorageType { get; set; } } diff --git a/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/Models/DevTestLabDiskAttachContent.Serialization.cs b/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/Models/DevTestLabDiskAttachContent.Serialization.cs index da9f3e14de0b..659d0b827399 100644 --- a/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/Models/DevTestLabDiskAttachContent.Serialization.cs +++ b/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/Models/DevTestLabDiskAttachContent.Serialization.cs @@ -10,13 +10,32 @@ using System.Collections.Generic; using System.Text.Json; using Azure.Core; +using Azure.ResourceManager.DevTestLabs; namespace Azure.ResourceManager.DevTestLabs.Models { - public partial class DevTestLabDiskAttachContent : IUtf8JsonSerializable, IJsonModel + /// Properties of the disk to attach. + public partial class DevTestLabDiskAttachContent : IJsonModel { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + /// The data to parse. + /// The client options for reading and writing models. + protected virtual DevTestLabDiskAttachContent 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 DeserializeDevTestLabDiskAttachContent(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(DevTestLabDiskAttachContent)} does not support reading '{options.Format}' format."); + } + } + /// The JSON writer. + /// The client options for reading and writing models. void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) { writer.WriteStartObject(); @@ -28,26 +47,25 @@ void IJsonModel.Write(Utf8JsonWriter writer, ModelR /// 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(DevTestLabDiskAttachContent)} does not support writing '{format}' format."); } - if (Optional.IsDefined(LeasedByLabVmId)) { writer.WritePropertyName("leasedByLabVmId"u8); writer.WriteStringValue(LeasedByLabVmId); } - 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); } @@ -56,53 +74,59 @@ protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWrit } } - DevTestLabDiskAttachContent IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + /// The JSON reader. + /// The client options for reading and writing models. + DevTestLabDiskAttachContent IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) => JsonModelCreateCore(ref reader, options); + + /// The JSON reader. + /// The client options for reading and writing models. + protected virtual DevTestLabDiskAttachContent 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(DevTestLabDiskAttachContent)} does not support reading '{format}' format."); } - using JsonDocument document = JsonDocument.ParseValue(ref reader); return DeserializeDevTestLabDiskAttachContent(document.RootElement, options); } - internal static DevTestLabDiskAttachContent DeserializeDevTestLabDiskAttachContent(JsonElement element, ModelReaderWriterOptions options = null) + /// The JSON element to deserialize. + /// The client options for reading and writing models. + internal static DevTestLabDiskAttachContent DeserializeDevTestLabDiskAttachContent(JsonElement element, ModelReaderWriterOptions options) { - options ??= ModelSerializationExtensions.WireOptions; - if (element.ValueKind == JsonValueKind.Null) { return null; } ResourceIdentifier leasedByLabVmId = 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("leasedByLabVmId"u8)) + if (prop.NameEquals("leasedByLabVmId"u8)) { - if (property.Value.ValueKind == JsonValueKind.Null) + if (prop.Value.ValueKind == JsonValueKind.Null) { continue; } - leasedByLabVmId = new ResourceIdentifier(property.Value.GetString()); + leasedByLabVmId = new ResourceIdentifier(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 DevTestLabDiskAttachContent(leasedByLabVmId, serializedAdditionalRawData); + return new DevTestLabDiskAttachContent(leasedByLabVmId, 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": @@ -112,22 +136,23 @@ BinaryData IPersistableModel.Write(ModelReaderWrite } } - DevTestLabDiskAttachContent 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. + DevTestLabDiskAttachContent IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) => PersistableModelCreateCore(data, options); - switch (format) + /// The client options for reading and writing models. + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + + /// The to serialize into . + internal static RequestContent ToRequestContent(DevTestLabDiskAttachContent devTestLabDiskAttachContent) + { + if (devTestLabDiskAttachContent == null) { - case "J": - { - using JsonDocument document = JsonDocument.Parse(data, ModelSerializationExtensions.JsonDocumentOptions); - return DeserializeDevTestLabDiskAttachContent(document.RootElement, options); - } - default: - throw new FormatException($"The model {nameof(DevTestLabDiskAttachContent)} does not support reading '{options.Format}' format."); + return null; } + Utf8JsonRequestContent content = new Utf8JsonRequestContent(); + content.JsonWriter.WriteObjectValue(devTestLabDiskAttachContent, ModelSerializationExtensions.WireOptions); + return content; } - - string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; } } diff --git a/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/Models/DevTestLabDiskAttachContent.cs b/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/Models/DevTestLabDiskAttachContent.cs index d28180db1e27..cdc16932c38c 100644 --- a/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/Models/DevTestLabDiskAttachContent.cs +++ b/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/Models/DevTestLabDiskAttachContent.cs @@ -14,37 +14,8 @@ namespace Azure.ResourceManager.DevTestLabs.Models /// Properties of the disk to attach. public partial class DevTestLabDiskAttachContent { - /// - /// 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 DevTestLabDiskAttachContent() @@ -53,11 +24,11 @@ public DevTestLabDiskAttachContent() /// Initializes a new instance of . /// The resource ID of the Lab virtual machine to which the disk is attached. - /// Keeps track of any properties unknown to the library. - internal DevTestLabDiskAttachContent(ResourceIdentifier leasedByLabVmId, IDictionary serializedAdditionalRawData) + /// Keeps track of any properties unknown to the library. + internal DevTestLabDiskAttachContent(ResourceIdentifier leasedByLabVmId, IDictionary additionalBinaryDataProperties) { LeasedByLabVmId = leasedByLabVmId; - _serializedAdditionalRawData = serializedAdditionalRawData; + _additionalBinaryDataProperties = additionalBinaryDataProperties; } /// The resource ID of the Lab virtual machine to which the disk is attached. diff --git a/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/Models/DevTestLabDiskDetachContent.Serialization.cs b/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/Models/DevTestLabDiskDetachContent.Serialization.cs index 2789d516efd4..9b499c9278c0 100644 --- a/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/Models/DevTestLabDiskDetachContent.Serialization.cs +++ b/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/Models/DevTestLabDiskDetachContent.Serialization.cs @@ -10,13 +10,32 @@ using System.Collections.Generic; using System.Text.Json; using Azure.Core; +using Azure.ResourceManager.DevTestLabs; namespace Azure.ResourceManager.DevTestLabs.Models { - public partial class DevTestLabDiskDetachContent : IUtf8JsonSerializable, IJsonModel + /// Properties of the disk to detach. + public partial class DevTestLabDiskDetachContent : IJsonModel { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + /// The data to parse. + /// The client options for reading and writing models. + protected virtual DevTestLabDiskDetachContent 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 DeserializeDevTestLabDiskDetachContent(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(DevTestLabDiskDetachContent)} does not support reading '{options.Format}' format."); + } + } + /// The JSON writer. + /// The client options for reading and writing models. void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) { writer.WriteStartObject(); @@ -28,26 +47,25 @@ void IJsonModel.Write(Utf8JsonWriter writer, ModelR /// 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(DevTestLabDiskDetachContent)} does not support writing '{format}' format."); } - if (Optional.IsDefined(LeasedByLabVmId)) { writer.WritePropertyName("leasedByLabVmId"u8); writer.WriteStringValue(LeasedByLabVmId); } - 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); } @@ -56,53 +74,59 @@ protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWrit } } - DevTestLabDiskDetachContent IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + /// The JSON reader. + /// The client options for reading and writing models. + DevTestLabDiskDetachContent IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) => JsonModelCreateCore(ref reader, options); + + /// The JSON reader. + /// The client options for reading and writing models. + protected virtual DevTestLabDiskDetachContent 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(DevTestLabDiskDetachContent)} does not support reading '{format}' format."); } - using JsonDocument document = JsonDocument.ParseValue(ref reader); return DeserializeDevTestLabDiskDetachContent(document.RootElement, options); } - internal static DevTestLabDiskDetachContent DeserializeDevTestLabDiskDetachContent(JsonElement element, ModelReaderWriterOptions options = null) + /// The JSON element to deserialize. + /// The client options for reading and writing models. + internal static DevTestLabDiskDetachContent DeserializeDevTestLabDiskDetachContent(JsonElement element, ModelReaderWriterOptions options) { - options ??= ModelSerializationExtensions.WireOptions; - if (element.ValueKind == JsonValueKind.Null) { return null; } ResourceIdentifier leasedByLabVmId = 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("leasedByLabVmId"u8)) + if (prop.NameEquals("leasedByLabVmId"u8)) { - if (property.Value.ValueKind == JsonValueKind.Null) + if (prop.Value.ValueKind == JsonValueKind.Null) { continue; } - leasedByLabVmId = new ResourceIdentifier(property.Value.GetString()); + leasedByLabVmId = new ResourceIdentifier(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 DevTestLabDiskDetachContent(leasedByLabVmId, serializedAdditionalRawData); + return new DevTestLabDiskDetachContent(leasedByLabVmId, 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": @@ -112,22 +136,23 @@ BinaryData IPersistableModel.Write(ModelReaderWrite } } - DevTestLabDiskDetachContent 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. + DevTestLabDiskDetachContent IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) => PersistableModelCreateCore(data, options); - switch (format) + /// The client options for reading and writing models. + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + + /// The to serialize into . + internal static RequestContent ToRequestContent(DevTestLabDiskDetachContent devTestLabDiskDetachContent) + { + if (devTestLabDiskDetachContent == null) { - case "J": - { - using JsonDocument document = JsonDocument.Parse(data, ModelSerializationExtensions.JsonDocumentOptions); - return DeserializeDevTestLabDiskDetachContent(document.RootElement, options); - } - default: - throw new FormatException($"The model {nameof(DevTestLabDiskDetachContent)} does not support reading '{options.Format}' format."); + return null; } + Utf8JsonRequestContent content = new Utf8JsonRequestContent(); + content.JsonWriter.WriteObjectValue(devTestLabDiskDetachContent, ModelSerializationExtensions.WireOptions); + return content; } - - string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; } } diff --git a/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/Models/DevTestLabDiskDetachContent.cs b/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/Models/DevTestLabDiskDetachContent.cs index dd8e331bfe61..4bc1402860dc 100644 --- a/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/Models/DevTestLabDiskDetachContent.cs +++ b/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/Models/DevTestLabDiskDetachContent.cs @@ -14,37 +14,8 @@ namespace Azure.ResourceManager.DevTestLabs.Models /// Properties of the disk to detach. public partial class DevTestLabDiskDetachContent { - /// - /// 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 DevTestLabDiskDetachContent() @@ -53,11 +24,11 @@ public DevTestLabDiskDetachContent() /// Initializes a new instance of . /// The resource ID of the Lab VM to which the disk is attached. - /// Keeps track of any properties unknown to the library. - internal DevTestLabDiskDetachContent(ResourceIdentifier leasedByLabVmId, IDictionary serializedAdditionalRawData) + /// Keeps track of any properties unknown to the library. + internal DevTestLabDiskDetachContent(ResourceIdentifier leasedByLabVmId, IDictionary additionalBinaryDataProperties) { LeasedByLabVmId = leasedByLabVmId; - _serializedAdditionalRawData = serializedAdditionalRawData; + _additionalBinaryDataProperties = additionalBinaryDataProperties; } /// The resource ID of the Lab VM to which the disk is attached. diff --git a/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/Models/DevTestLabDiskPatch.Serialization.cs b/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/Models/DevTestLabDiskPatch.Serialization.cs index ba4f5e908373..eeaed669ea29 100644 --- a/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/Models/DevTestLabDiskPatch.Serialization.cs +++ b/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/Models/DevTestLabDiskPatch.Serialization.cs @@ -10,13 +10,32 @@ using System.Collections.Generic; using System.Text.Json; using Azure.Core; +using Azure.ResourceManager.DevTestLabs; namespace Azure.ResourceManager.DevTestLabs.Models { - public partial class DevTestLabDiskPatch : IUtf8JsonSerializable, IJsonModel + /// A Disk. + public partial class DevTestLabDiskPatch : DevTestLabResourcePatch, IJsonModel { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + /// The data to parse. + /// The client options for reading and writing models. + protected override DevTestLabResourcePatch 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 DeserializeDevTestLabDiskPatch(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(DevTestLabDiskPatch)} does not support reading '{options.Format}' format."); + } + } + /// The JSON writer. + /// The client options for reading and writing models. void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) { writer.WriteStartObject(); @@ -28,67 +47,79 @@ void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWri /// 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(DevTestLabDiskPatch)} does not support writing '{format}' format."); } - base.JsonModelWriteCore(writer, options); } - DevTestLabDiskPatch IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + /// The JSON reader. + /// The client options for reading and writing models. + DevTestLabDiskPatch IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) => (DevTestLabDiskPatch)JsonModelCreateCore(ref reader, options); + + /// The JSON reader. + /// The client options for reading and writing models. + protected override DevTestLabResourcePatch 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(DevTestLabDiskPatch)} does not support reading '{format}' format."); } - using JsonDocument document = JsonDocument.ParseValue(ref reader); return DeserializeDevTestLabDiskPatch(document.RootElement, options); } - internal static DevTestLabDiskPatch DeserializeDevTestLabDiskPatch(JsonElement element, ModelReaderWriterOptions options = null) + /// The JSON element to deserialize. + /// The client options for reading and writing models. + internal static DevTestLabDiskPatch DeserializeDevTestLabDiskPatch(JsonElement element, ModelReaderWriterOptions options) { - options ??= ModelSerializationExtensions.WireOptions; - if (element.ValueKind == JsonValueKind.Null) { return null; } IDictionary tags = 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("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 (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 DevTestLabDiskPatch(tags ?? new ChangeTrackingDictionary(), serializedAdditionalRawData); + return new DevTestLabDiskPatch(tags ?? new ChangeTrackingDictionary(), 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 override BinaryData PersistableModelWriteCore(ModelReaderWriterOptions options) + { + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; switch (format) { case "J": @@ -98,22 +129,23 @@ BinaryData IPersistableModel.Write(ModelReaderWriterOptions } } - DevTestLabDiskPatch 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. + DevTestLabDiskPatch IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) => (DevTestLabDiskPatch)PersistableModelCreateCore(data, options); - switch (format) + /// The client options for reading and writing models. + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + + /// The to serialize into . + internal static RequestContent ToRequestContent(DevTestLabDiskPatch devTestLabDiskPatch) + { + if (devTestLabDiskPatch == null) { - case "J": - { - using JsonDocument document = JsonDocument.Parse(data, ModelSerializationExtensions.JsonDocumentOptions); - return DeserializeDevTestLabDiskPatch(document.RootElement, options); - } - default: - throw new FormatException($"The model {nameof(DevTestLabDiskPatch)} does not support reading '{options.Format}' format."); + return null; } + Utf8JsonRequestContent content = new Utf8JsonRequestContent(); + content.JsonWriter.WriteObjectValue(devTestLabDiskPatch, ModelSerializationExtensions.WireOptions); + return content; } - - string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; } } diff --git a/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/Models/DevTestLabDiskPatch.cs b/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/Models/DevTestLabDiskPatch.cs index dbb2b7afa635..22985df2f54b 100644 --- a/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/Models/DevTestLabDiskPatch.cs +++ b/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/Models/DevTestLabDiskPatch.cs @@ -20,8 +20,8 @@ public DevTestLabDiskPatch() /// Initializes a new instance of . /// The tags of the resource. - /// Keeps track of any properties unknown to the library. - internal DevTestLabDiskPatch(IDictionary tags, IDictionary serializedAdditionalRawData) : base(tags, serializedAdditionalRawData) + /// Keeps track of any properties unknown to the library. + internal DevTestLabDiskPatch(IDictionary tags, IDictionary additionalBinaryDataProperties) : base(tags, additionalBinaryDataProperties) { } } diff --git a/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/Models/DevTestLabEnableStatus.cs b/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/Models/DevTestLabEnableStatus.cs index c5316acb05b1..a1ff8e9e837e 100644 --- a/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/Models/DevTestLabEnableStatus.cs +++ b/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/Models/DevTestLabEnableStatus.cs @@ -7,6 +7,7 @@ using System; using System.ComponentModel; +using Azure.ResourceManager.DevTestLabs; namespace Azure.ResourceManager.DevTestLabs.Models { @@ -14,38 +15,55 @@ namespace Azure.ResourceManager.DevTestLabs.Models public readonly partial struct DevTestLabEnableStatus : IEquatable { private readonly string _value; + private const string EnabledValue = "Enabled"; + private const string DisabledValue = "Disabled"; /// Initializes a new instance of . + /// The value. /// is null. public DevTestLabEnableStatus(string value) { - _value = value ?? throw new ArgumentNullException(nameof(value)); - } + Argument.AssertNotNull(value, nameof(value)); - private const string EnabledValue = "Enabled"; - private const string DisabledValue = "Disabled"; + _value = value; + } - /// Enabled. + /// Gets the Enabled. public static DevTestLabEnableStatus Enabled { get; } = new DevTestLabEnableStatus(EnabledValue); - /// Disabled. + + /// Gets the Disabled. public static DevTestLabEnableStatus Disabled { get; } = new DevTestLabEnableStatus(DisabledValue); + /// Determines if two values are the same. + /// The left value to compare. + /// The right value to compare. public static bool operator ==(DevTestLabEnableStatus left, DevTestLabEnableStatus 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 !=(DevTestLabEnableStatus left, DevTestLabEnableStatus right) => !left.Equals(right); - /// Converts a to a . + + /// Converts a string to a . + /// The value. public static implicit operator DevTestLabEnableStatus(string value) => new DevTestLabEnableStatus(value); - /// + /// Converts a string to a . + /// The value. + public static implicit operator DevTestLabEnableStatus?(string value) => value == null ? null : new DevTestLabEnableStatus(value); + + /// [EditorBrowsable(EditorBrowsableState.Never)] public override bool Equals(object obj) => obj is DevTestLabEnableStatus other && Equals(other); - /// + + /// public bool Equals(DevTestLabEnableStatus 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/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/Models/DevTestLabEnvironmentDeployment.Serialization.cs b/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/Models/DevTestLabEnvironmentDeployment.Serialization.cs index 8ccf5d55dee9..3c21f8f1c5d5 100644 --- a/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/Models/DevTestLabEnvironmentDeployment.Serialization.cs +++ b/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/Models/DevTestLabEnvironmentDeployment.Serialization.cs @@ -10,13 +10,32 @@ using System.Collections.Generic; using System.Text.Json; using Azure.Core; +using Azure.ResourceManager.DevTestLabs; namespace Azure.ResourceManager.DevTestLabs.Models { - public partial class DevTestLabEnvironmentDeployment : IUtf8JsonSerializable, IJsonModel + /// Properties of an environment deployment. + public partial class DevTestLabEnvironmentDeployment : IJsonModel { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + /// The data to parse. + /// The client options for reading and writing models. + protected virtual DevTestLabEnvironmentDeployment 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 DeserializeDevTestLabEnvironmentDeployment(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(DevTestLabEnvironmentDeployment)} does not support reading '{options.Format}' format."); + } + } + /// The JSON writer. + /// The client options for reading and writing models. void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) { writer.WriteStartObject(); @@ -28,12 +47,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(DevTestLabEnvironmentDeployment)} does not support writing '{format}' format."); } - if (Optional.IsDefined(ArmTemplateId)) { writer.WritePropertyName("armTemplateId"u8); @@ -43,21 +61,21 @@ protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWrit { writer.WritePropertyName("parameters"u8); writer.WriteStartArray(); - foreach (var item in Parameters) + foreach (DevTestLabArmTemplateParameter item in Parameters) { 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); } @@ -66,49 +84,53 @@ protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWrit } } - DevTestLabEnvironmentDeployment IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + /// The JSON reader. + /// The client options for reading and writing models. + DevTestLabEnvironmentDeployment IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) => JsonModelCreateCore(ref reader, options); + + /// The JSON reader. + /// The client options for reading and writing models. + protected virtual DevTestLabEnvironmentDeployment 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(DevTestLabEnvironmentDeployment)} does not support reading '{format}' format."); } - using JsonDocument document = JsonDocument.ParseValue(ref reader); return DeserializeDevTestLabEnvironmentDeployment(document.RootElement, options); } - internal static DevTestLabEnvironmentDeployment DeserializeDevTestLabEnvironmentDeployment(JsonElement element, ModelReaderWriterOptions options = null) + /// The JSON element to deserialize. + /// The client options for reading and writing models. + internal static DevTestLabEnvironmentDeployment DeserializeDevTestLabEnvironmentDeployment(JsonElement element, ModelReaderWriterOptions options) { - options ??= ModelSerializationExtensions.WireOptions; - if (element.ValueKind == JsonValueKind.Null) { return null; } ResourceIdentifier armTemplateId = default; IList parameters = 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("armTemplateId"u8)) + if (prop.NameEquals("armTemplateId"u8)) { - if (property.Value.ValueKind == JsonValueKind.Null) + if (prop.Value.ValueKind == JsonValueKind.Null) { continue; } - armTemplateId = new ResourceIdentifier(property.Value.GetString()); + armTemplateId = new ResourceIdentifier(prop.Value.GetString()); continue; } - if (property.NameEquals("parameters"u8)) + if (prop.NameEquals("parameters"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(DevTestLabArmTemplateParameter.DeserializeDevTestLabArmTemplateParameter(item, options)); } @@ -117,17 +139,19 @@ internal static DevTestLabEnvironmentDeployment DeserializeDevTestLabEnvironment } 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 DevTestLabEnvironmentDeployment(armTemplateId, parameters ?? new ChangeTrackingList(), serializedAdditionalRawData); + return new DevTestLabEnvironmentDeployment(armTemplateId, parameters ?? 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": @@ -137,22 +161,11 @@ BinaryData IPersistableModel.Write(ModelReaderW } } - DevTestLabEnvironmentDeployment 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 DeserializeDevTestLabEnvironmentDeployment(document.RootElement, options); - } - default: - throw new FormatException($"The model {nameof(DevTestLabEnvironmentDeployment)} does not support reading '{options.Format}' format."); - } - } + /// The data to parse. + /// The client options for reading and writing models. + DevTestLabEnvironmentDeployment IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) => PersistableModelCreateCore(data, options); + /// The client options for reading and writing models. string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; } } diff --git a/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/Models/DevTestLabEnvironmentDeployment.cs b/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/Models/DevTestLabEnvironmentDeployment.cs index 07d2047f2807..e1e56f178272 100644 --- a/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/Models/DevTestLabEnvironmentDeployment.cs +++ b/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/Models/DevTestLabEnvironmentDeployment.cs @@ -8,43 +8,15 @@ using System; using System.Collections.Generic; using Azure.Core; +using Azure.ResourceManager.DevTestLabs; namespace Azure.ResourceManager.DevTestLabs.Models { /// Properties of an environment deployment. public partial class DevTestLabEnvironmentDeployment { - /// - /// 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 DevTestLabEnvironmentDeployment() @@ -55,16 +27,17 @@ public DevTestLabEnvironmentDeployment() /// Initializes a new instance of . /// The Azure Resource Manager template's identifier. /// The parameters of the Azure Resource Manager template. - /// Keeps track of any properties unknown to the library. - internal DevTestLabEnvironmentDeployment(ResourceIdentifier armTemplateId, IList parameters, IDictionary serializedAdditionalRawData) + /// Keeps track of any properties unknown to the library. + internal DevTestLabEnvironmentDeployment(ResourceIdentifier armTemplateId, IList parameters, IDictionary additionalBinaryDataProperties) { ArmTemplateId = armTemplateId; Parameters = parameters; - _serializedAdditionalRawData = serializedAdditionalRawData; + _additionalBinaryDataProperties = additionalBinaryDataProperties; } /// The Azure Resource Manager template's identifier. public ResourceIdentifier ArmTemplateId { get; set; } + /// The parameters of the Azure Resource Manager template. public IList Parameters { get; } } diff --git a/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/Models/DevTestLabEnvironmentPatch.Serialization.cs b/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/Models/DevTestLabEnvironmentPatch.Serialization.cs index 836c0f614b32..b1686d6820b8 100644 --- a/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/Models/DevTestLabEnvironmentPatch.Serialization.cs +++ b/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/Models/DevTestLabEnvironmentPatch.Serialization.cs @@ -10,13 +10,32 @@ using System.Collections.Generic; using System.Text.Json; using Azure.Core; +using Azure.ResourceManager.DevTestLabs; namespace Azure.ResourceManager.DevTestLabs.Models { - public partial class DevTestLabEnvironmentPatch : IUtf8JsonSerializable, IJsonModel + /// An environment, which is essentially an ARM template deployment. + public partial class DevTestLabEnvironmentPatch : DevTestLabResourcePatch, IJsonModel { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + /// The data to parse. + /// The client options for reading and writing models. + protected override DevTestLabResourcePatch 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 DeserializeDevTestLabEnvironmentPatch(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(DevTestLabEnvironmentPatch)} does not support reading '{options.Format}' format."); + } + } + /// The JSON writer. + /// The client options for reading and writing models. void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) { writer.WriteStartObject(); @@ -28,67 +47,79 @@ void IJsonModel.Write(Utf8JsonWriter writer, ModelRe /// 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(DevTestLabEnvironmentPatch)} does not support writing '{format}' format."); } - base.JsonModelWriteCore(writer, options); } - DevTestLabEnvironmentPatch IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + /// The JSON reader. + /// The client options for reading and writing models. + DevTestLabEnvironmentPatch IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) => (DevTestLabEnvironmentPatch)JsonModelCreateCore(ref reader, options); + + /// The JSON reader. + /// The client options for reading and writing models. + protected override DevTestLabResourcePatch 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(DevTestLabEnvironmentPatch)} does not support reading '{format}' format."); } - using JsonDocument document = JsonDocument.ParseValue(ref reader); return DeserializeDevTestLabEnvironmentPatch(document.RootElement, options); } - internal static DevTestLabEnvironmentPatch DeserializeDevTestLabEnvironmentPatch(JsonElement element, ModelReaderWriterOptions options = null) + /// The JSON element to deserialize. + /// The client options for reading and writing models. + internal static DevTestLabEnvironmentPatch DeserializeDevTestLabEnvironmentPatch(JsonElement element, ModelReaderWriterOptions options) { - options ??= ModelSerializationExtensions.WireOptions; - if (element.ValueKind == JsonValueKind.Null) { return null; } IDictionary tags = 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("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 (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 DevTestLabEnvironmentPatch(tags ?? new ChangeTrackingDictionary(), serializedAdditionalRawData); + return new DevTestLabEnvironmentPatch(tags ?? new ChangeTrackingDictionary(), 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 override BinaryData PersistableModelWriteCore(ModelReaderWriterOptions options) + { + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; switch (format) { case "J": @@ -98,22 +129,23 @@ BinaryData IPersistableModel.Write(ModelReaderWriter } } - DevTestLabEnvironmentPatch 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. + DevTestLabEnvironmentPatch IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) => (DevTestLabEnvironmentPatch)PersistableModelCreateCore(data, options); - switch (format) + /// The client options for reading and writing models. + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + + /// The to serialize into . + internal static RequestContent ToRequestContent(DevTestLabEnvironmentPatch devTestLabEnvironmentPatch) + { + if (devTestLabEnvironmentPatch == null) { - case "J": - { - using JsonDocument document = JsonDocument.Parse(data, ModelSerializationExtensions.JsonDocumentOptions); - return DeserializeDevTestLabEnvironmentPatch(document.RootElement, options); - } - default: - throw new FormatException($"The model {nameof(DevTestLabEnvironmentPatch)} does not support reading '{options.Format}' format."); + return null; } + Utf8JsonRequestContent content = new Utf8JsonRequestContent(); + content.JsonWriter.WriteObjectValue(devTestLabEnvironmentPatch, ModelSerializationExtensions.WireOptions); + return content; } - - string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; } } diff --git a/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/Models/DevTestLabEnvironmentPatch.cs b/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/Models/DevTestLabEnvironmentPatch.cs index c86bc4dce0b6..ebcc017f485e 100644 --- a/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/Models/DevTestLabEnvironmentPatch.cs +++ b/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/Models/DevTestLabEnvironmentPatch.cs @@ -20,8 +20,8 @@ public DevTestLabEnvironmentPatch() /// Initializes a new instance of . /// The tags of the resource. - /// Keeps track of any properties unknown to the library. - internal DevTestLabEnvironmentPatch(IDictionary tags, IDictionary serializedAdditionalRawData) : base(tags, serializedAdditionalRawData) + /// Keeps track of any properties unknown to the library. + internal DevTestLabEnvironmentPatch(IDictionary tags, IDictionary additionalBinaryDataProperties) : base(tags, additionalBinaryDataProperties) { } } diff --git a/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/Models/DevTestLabEnvironmentPermission.cs b/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/Models/DevTestLabEnvironmentPermission.cs index fc62dcf62590..664a6b31fc94 100644 --- a/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/Models/DevTestLabEnvironmentPermission.cs +++ b/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/Models/DevTestLabEnvironmentPermission.cs @@ -7,6 +7,7 @@ using System; using System.ComponentModel; +using Azure.ResourceManager.DevTestLabs; namespace Azure.ResourceManager.DevTestLabs.Models { @@ -14,38 +15,55 @@ namespace Azure.ResourceManager.DevTestLabs.Models public readonly partial struct DevTestLabEnvironmentPermission : IEquatable { private readonly string _value; + private const string ReaderValue = "Reader"; + private const string ContributorValue = "Contributor"; /// Initializes a new instance of . + /// The value. /// is null. public DevTestLabEnvironmentPermission(string value) { - _value = value ?? throw new ArgumentNullException(nameof(value)); - } + Argument.AssertNotNull(value, nameof(value)); - private const string ReaderValue = "Reader"; - private const string ContributorValue = "Contributor"; + _value = value; + } - /// Reader. + /// Gets the Reader. public static DevTestLabEnvironmentPermission Reader { get; } = new DevTestLabEnvironmentPermission(ReaderValue); - /// Contributor. + + /// Gets the Contributor. public static DevTestLabEnvironmentPermission Contributor { get; } = new DevTestLabEnvironmentPermission(ContributorValue); + /// Determines if two values are the same. + /// The left value to compare. + /// The right value to compare. public static bool operator ==(DevTestLabEnvironmentPermission left, DevTestLabEnvironmentPermission 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 !=(DevTestLabEnvironmentPermission left, DevTestLabEnvironmentPermission right) => !left.Equals(right); - /// Converts a to a . + + /// Converts a string to a . + /// The value. public static implicit operator DevTestLabEnvironmentPermission(string value) => new DevTestLabEnvironmentPermission(value); - /// + /// Converts a string to a . + /// The value. + public static implicit operator DevTestLabEnvironmentPermission?(string value) => value == null ? null : new DevTestLabEnvironmentPermission(value); + + /// [EditorBrowsable(EditorBrowsableState.Never)] public override bool Equals(object obj) => obj is DevTestLabEnvironmentPermission other && Equals(other); - /// + + /// public bool Equals(DevTestLabEnvironmentPermission 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/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/Models/DevTestLabEvaluatePoliciesContent.Serialization.cs b/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/Models/DevTestLabEvaluatePoliciesContent.Serialization.cs index 8eb8b5006d02..a5ec7828f9c0 100644 --- a/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/Models/DevTestLabEvaluatePoliciesContent.Serialization.cs +++ b/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/Models/DevTestLabEvaluatePoliciesContent.Serialization.cs @@ -10,13 +10,32 @@ using System.Collections.Generic; using System.Text.Json; using Azure.Core; +using Azure.ResourceManager.DevTestLabs; namespace Azure.ResourceManager.DevTestLabs.Models { - public partial class DevTestLabEvaluatePoliciesContent : IUtf8JsonSerializable, IJsonModel + /// Request body for evaluating a policy set. + public partial class DevTestLabEvaluatePoliciesContent : IJsonModel { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + /// The data to parse. + /// The client options for reading and writing models. + protected virtual DevTestLabEvaluatePoliciesContent 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 DeserializeDevTestLabEvaluatePoliciesContent(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(DevTestLabEvaluatePoliciesContent)} does not support reading '{options.Format}' format."); + } + } + /// The JSON writer. + /// The client options for reading and writing models. void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) { writer.WriteStartObject(); @@ -28,31 +47,30 @@ 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(DevTestLabEvaluatePoliciesContent)} does not support writing '{format}' format."); } - if (Optional.IsCollectionDefined(Policies)) { writer.WritePropertyName("policies"u8); writer.WriteStartArray(); - foreach (var item in Policies) + foreach (DevTestLabEvaluatePolicy item in Policies) { 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); } @@ -61,39 +79,43 @@ protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWrit } } - DevTestLabEvaluatePoliciesContent IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + /// The JSON reader. + /// The client options for reading and writing models. + DevTestLabEvaluatePoliciesContent IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) => JsonModelCreateCore(ref reader, options); + + /// The JSON reader. + /// The client options for reading and writing models. + protected virtual DevTestLabEvaluatePoliciesContent 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(DevTestLabEvaluatePoliciesContent)} does not support reading '{format}' format."); } - using JsonDocument document = JsonDocument.ParseValue(ref reader); return DeserializeDevTestLabEvaluatePoliciesContent(document.RootElement, options); } - internal static DevTestLabEvaluatePoliciesContent DeserializeDevTestLabEvaluatePoliciesContent(JsonElement element, ModelReaderWriterOptions options = null) + /// The JSON element to deserialize. + /// The client options for reading and writing models. + internal static DevTestLabEvaluatePoliciesContent DeserializeDevTestLabEvaluatePoliciesContent(JsonElement element, ModelReaderWriterOptions options) { - options ??= ModelSerializationExtensions.WireOptions; - if (element.ValueKind == JsonValueKind.Null) { return null; } IList policies = 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("policies"u8)) + if (prop.NameEquals("policies"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(DevTestLabEvaluatePolicy.DeserializeDevTestLabEvaluatePolicy(item, options)); } @@ -102,17 +124,19 @@ internal static DevTestLabEvaluatePoliciesContent DeserializeDevTestLabEvaluateP } 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 DevTestLabEvaluatePoliciesContent(policies ?? new ChangeTrackingList(), serializedAdditionalRawData); + return new DevTestLabEvaluatePoliciesContent(policies ?? 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": @@ -122,22 +146,23 @@ BinaryData IPersistableModel.Write(ModelReade } } - DevTestLabEvaluatePoliciesContent 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. + DevTestLabEvaluatePoliciesContent IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) => PersistableModelCreateCore(data, options); - switch (format) + /// The client options for reading and writing models. + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + + /// The to serialize into . + internal static RequestContent ToRequestContent(DevTestLabEvaluatePoliciesContent devTestLabEvaluatePoliciesContent) + { + if (devTestLabEvaluatePoliciesContent == null) { - case "J": - { - using JsonDocument document = JsonDocument.Parse(data, ModelSerializationExtensions.JsonDocumentOptions); - return DeserializeDevTestLabEvaluatePoliciesContent(document.RootElement, options); - } - default: - throw new FormatException($"The model {nameof(DevTestLabEvaluatePoliciesContent)} does not support reading '{options.Format}' format."); + return null; } + Utf8JsonRequestContent content = new Utf8JsonRequestContent(); + content.JsonWriter.WriteObjectValue(devTestLabEvaluatePoliciesContent, ModelSerializationExtensions.WireOptions); + return content; } - - string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; } } diff --git a/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/Models/DevTestLabEvaluatePoliciesContent.cs b/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/Models/DevTestLabEvaluatePoliciesContent.cs index 23568ced9fe6..fca3482fb6a4 100644 --- a/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/Models/DevTestLabEvaluatePoliciesContent.cs +++ b/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/Models/DevTestLabEvaluatePoliciesContent.cs @@ -7,43 +7,15 @@ using System; using System.Collections.Generic; +using Azure.ResourceManager.DevTestLabs; namespace Azure.ResourceManager.DevTestLabs.Models { /// Request body for evaluating a policy set. public partial class DevTestLabEvaluatePoliciesContent { - /// - /// 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 DevTestLabEvaluatePoliciesContent() @@ -53,11 +25,11 @@ public DevTestLabEvaluatePoliciesContent() /// Initializes a new instance of . /// Policies to evaluate. - /// Keeps track of any properties unknown to the library. - internal DevTestLabEvaluatePoliciesContent(IList policies, IDictionary serializedAdditionalRawData) + /// Keeps track of any properties unknown to the library. + internal DevTestLabEvaluatePoliciesContent(IList policies, IDictionary additionalBinaryDataProperties) { Policies = policies; - _serializedAdditionalRawData = serializedAdditionalRawData; + _additionalBinaryDataProperties = additionalBinaryDataProperties; } /// Policies to evaluate. diff --git a/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/Models/DevTestLabEvaluatePoliciesResult.Serialization.cs b/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/Models/DevTestLabEvaluatePoliciesResult.Serialization.cs index 57440018fbb3..ade04ade82e7 100644 --- a/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/Models/DevTestLabEvaluatePoliciesResult.Serialization.cs +++ b/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/Models/DevTestLabEvaluatePoliciesResult.Serialization.cs @@ -9,14 +9,40 @@ using System.ClientModel.Primitives; using System.Collections.Generic; using System.Text.Json; -using Azure.Core; +using Azure; +using Azure.ResourceManager.DevTestLabs; namespace Azure.ResourceManager.DevTestLabs.Models { - public partial class DevTestLabEvaluatePoliciesResult : IUtf8JsonSerializable, IJsonModel + /// Response body for evaluating a policy set. + public partial class DevTestLabEvaluatePoliciesResult : IJsonModel { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + /// The data to parse. + /// The client options for reading and writing models. + protected virtual DevTestLabEvaluatePoliciesResult 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 DeserializeDevTestLabEvaluatePoliciesResult(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(DevTestLabEvaluatePoliciesResult)} does not support reading '{options.Format}' format."); + } + } + /// The to deserialize the from. + internal static DevTestLabEvaluatePoliciesResult FromResponse(Response response) + { + using JsonDocument document = JsonDocument.Parse(response.Content, ModelSerializationExtensions.JsonDocumentOptions); + return DeserializeDevTestLabEvaluatePoliciesResult(document.RootElement, ModelSerializationExtensions.WireOptions); + } + + /// The JSON writer. + /// The client options for reading and writing models. void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) { writer.WriteStartObject(); @@ -28,31 +54,30 @@ void IJsonModel.Write(Utf8JsonWriter writer, M /// 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(DevTestLabEvaluatePoliciesResult)} does not support writing '{format}' format."); } - if (Optional.IsCollectionDefined(Results)) { writer.WritePropertyName("results"u8); writer.WriteStartArray(); - foreach (var item in Results) + foreach (DevTestLabPolicySetResult item in Results) { 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); } @@ -61,39 +86,43 @@ protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWrit } } - DevTestLabEvaluatePoliciesResult IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + /// The JSON reader. + /// The client options for reading and writing models. + DevTestLabEvaluatePoliciesResult IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) => JsonModelCreateCore(ref reader, options); + + /// The JSON reader. + /// The client options for reading and writing models. + protected virtual DevTestLabEvaluatePoliciesResult 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(DevTestLabEvaluatePoliciesResult)} does not support reading '{format}' format."); } - using JsonDocument document = JsonDocument.ParseValue(ref reader); return DeserializeDevTestLabEvaluatePoliciesResult(document.RootElement, options); } - internal static DevTestLabEvaluatePoliciesResult DeserializeDevTestLabEvaluatePoliciesResult(JsonElement element, ModelReaderWriterOptions options = null) + /// The JSON element to deserialize. + /// The client options for reading and writing models. + internal static DevTestLabEvaluatePoliciesResult DeserializeDevTestLabEvaluatePoliciesResult(JsonElement element, ModelReaderWriterOptions options) { - options ??= ModelSerializationExtensions.WireOptions; - if (element.ValueKind == JsonValueKind.Null) { return null; } IReadOnlyList results = 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("results"u8)) + if (prop.NameEquals("results"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(DevTestLabPolicySetResult.DeserializeDevTestLabPolicySetResult(item, options)); } @@ -102,17 +131,19 @@ internal static DevTestLabEvaluatePoliciesResult DeserializeDevTestLabEvaluatePo } 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 DevTestLabEvaluatePoliciesResult(results ?? new ChangeTrackingList(), serializedAdditionalRawData); + return new DevTestLabEvaluatePoliciesResult(results ?? 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": @@ -122,22 +153,11 @@ BinaryData IPersistableModel.Write(ModelReader } } - DevTestLabEvaluatePoliciesResult 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 DeserializeDevTestLabEvaluatePoliciesResult(document.RootElement, options); - } - default: - throw new FormatException($"The model {nameof(DevTestLabEvaluatePoliciesResult)} does not support reading '{options.Format}' format."); - } - } + /// The data to parse. + /// The client options for reading and writing models. + DevTestLabEvaluatePoliciesResult IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) => PersistableModelCreateCore(data, options); + /// The client options for reading and writing models. string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; } } diff --git a/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/Models/DevTestLabEvaluatePoliciesResult.cs b/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/Models/DevTestLabEvaluatePoliciesResult.cs index c4cdd0a019d8..bccd2df42f99 100644 --- a/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/Models/DevTestLabEvaluatePoliciesResult.cs +++ b/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/Models/DevTestLabEvaluatePoliciesResult.cs @@ -7,43 +7,15 @@ using System; using System.Collections.Generic; +using Azure.ResourceManager.DevTestLabs; namespace Azure.ResourceManager.DevTestLabs.Models { /// Response body for evaluating a policy set. public partial class DevTestLabEvaluatePoliciesResult { - /// - /// 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 DevTestLabEvaluatePoliciesResult() @@ -53,11 +25,11 @@ internal DevTestLabEvaluatePoliciesResult() /// Initializes a new instance of . /// Results of evaluating a policy set. - /// Keeps track of any properties unknown to the library. - internal DevTestLabEvaluatePoliciesResult(IReadOnlyList results, IDictionary serializedAdditionalRawData) + /// Keeps track of any properties unknown to the library. + internal DevTestLabEvaluatePoliciesResult(IReadOnlyList results, IDictionary additionalBinaryDataProperties) { Results = results; - _serializedAdditionalRawData = serializedAdditionalRawData; + _additionalBinaryDataProperties = additionalBinaryDataProperties; } /// Results of evaluating a policy set. diff --git a/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/Models/DevTestLabEvaluatePolicy.Serialization.cs b/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/Models/DevTestLabEvaluatePolicy.Serialization.cs index 8f65ea570aa7..ab21d93189cf 100644 --- a/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/Models/DevTestLabEvaluatePolicy.Serialization.cs +++ b/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/Models/DevTestLabEvaluatePolicy.Serialization.cs @@ -9,14 +9,32 @@ using System.ClientModel.Primitives; using System.Collections.Generic; using System.Text.Json; -using Azure.Core; +using Azure.ResourceManager.DevTestLabs; namespace Azure.ResourceManager.DevTestLabs.Models { - public partial class DevTestLabEvaluatePolicy : IUtf8JsonSerializable, IJsonModel + /// Properties for evaluating a policy set. + public partial class DevTestLabEvaluatePolicy : IJsonModel { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + /// The data to parse. + /// The client options for reading and writing models. + protected virtual DevTestLabEvaluatePolicy 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 DeserializeDevTestLabEvaluatePolicy(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(DevTestLabEvaluatePolicy)} does not support reading '{options.Format}' format."); + } + } + /// The JSON writer. + /// The client options for reading and writing models. void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) { writer.WriteStartObject(); @@ -28,12 +46,11 @@ void IJsonModel.Write(Utf8JsonWriter writer, ModelRead /// 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(DevTestLabEvaluatePolicy)} does not support writing '{format}' format."); } - if (Optional.IsDefined(FactName)) { writer.WritePropertyName("factName"u8); @@ -54,15 +71,15 @@ protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWrit writer.WritePropertyName("userObjectId"u8); writer.WriteStringValue(UserObjectId); } - 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); } @@ -71,22 +88,27 @@ protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWrit } } - DevTestLabEvaluatePolicy IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + /// The JSON reader. + /// The client options for reading and writing models. + DevTestLabEvaluatePolicy IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) => JsonModelCreateCore(ref reader, options); + + /// The JSON reader. + /// The client options for reading and writing models. + protected virtual DevTestLabEvaluatePolicy 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(DevTestLabEvaluatePolicy)} does not support reading '{format}' format."); } - using JsonDocument document = JsonDocument.ParseValue(ref reader); return DeserializeDevTestLabEvaluatePolicy(document.RootElement, options); } - internal static DevTestLabEvaluatePolicy DeserializeDevTestLabEvaluatePolicy(JsonElement element, ModelReaderWriterOptions options = null) + /// The JSON element to deserialize. + /// The client options for reading and writing models. + internal static DevTestLabEvaluatePolicy DeserializeDevTestLabEvaluatePolicy(JsonElement element, ModelReaderWriterOptions options) { - options ??= ModelSerializationExtensions.WireOptions; - if (element.ValueKind == JsonValueKind.Null) { return null; @@ -95,43 +117,44 @@ internal static DevTestLabEvaluatePolicy DeserializeDevTestLabEvaluatePolicy(Jso string factData = default; string valueOffset = default; string userObjectId = 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("factName"u8)) + if (prop.NameEquals("factName"u8)) { - factName = property.Value.GetString(); + factName = prop.Value.GetString(); continue; } - if (property.NameEquals("factData"u8)) + if (prop.NameEquals("factData"u8)) { - factData = property.Value.GetString(); + factData = prop.Value.GetString(); continue; } - if (property.NameEquals("valueOffset"u8)) + if (prop.NameEquals("valueOffset"u8)) { - valueOffset = property.Value.GetString(); + valueOffset = prop.Value.GetString(); continue; } - if (property.NameEquals("userObjectId"u8)) + if (prop.NameEquals("userObjectId"u8)) { - userObjectId = property.Value.GetString(); + userObjectId = 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 DevTestLabEvaluatePolicy(factName, factData, valueOffset, userObjectId, serializedAdditionalRawData); + return new DevTestLabEvaluatePolicy(factName, factData, valueOffset, userObjectId, 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": @@ -141,22 +164,11 @@ BinaryData IPersistableModel.Write(ModelReaderWriterOp } } - DevTestLabEvaluatePolicy 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 DeserializeDevTestLabEvaluatePolicy(document.RootElement, options); - } - default: - throw new FormatException($"The model {nameof(DevTestLabEvaluatePolicy)} does not support reading '{options.Format}' format."); - } - } + /// The data to parse. + /// The client options for reading and writing models. + DevTestLabEvaluatePolicy IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) => PersistableModelCreateCore(data, options); + /// The client options for reading and writing models. string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; } } diff --git a/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/Models/DevTestLabEvaluatePolicy.cs b/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/Models/DevTestLabEvaluatePolicy.cs index a90b76594dc4..4d867e968f04 100644 --- a/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/Models/DevTestLabEvaluatePolicy.cs +++ b/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/Models/DevTestLabEvaluatePolicy.cs @@ -13,37 +13,8 @@ namespace Azure.ResourceManager.DevTestLabs.Models /// Properties for evaluating a policy set. public partial class DevTestLabEvaluatePolicy { - /// - /// 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 DevTestLabEvaluatePolicy() @@ -55,22 +26,25 @@ public DevTestLabEvaluatePolicy() /// The fact data. /// The value offset. /// The user for which policies will be evaluated. - /// Keeps track of any properties unknown to the library. - internal DevTestLabEvaluatePolicy(string factName, string factData, string valueOffset, string userObjectId, IDictionary serializedAdditionalRawData) + /// Keeps track of any properties unknown to the library. + internal DevTestLabEvaluatePolicy(string factName, string factData, string valueOffset, string userObjectId, IDictionary additionalBinaryDataProperties) { FactName = factName; FactData = factData; ValueOffset = valueOffset; UserObjectId = userObjectId; - _serializedAdditionalRawData = serializedAdditionalRawData; + _additionalBinaryDataProperties = additionalBinaryDataProperties; } /// The fact name. public string FactName { get; set; } + /// The fact data. public string FactData { get; set; } + /// The value offset. public string ValueOffset { get; set; } + /// The user for which policies will be evaluated. public string UserObjectId { get; set; } } diff --git a/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/Models/DevTestLabExportResourceUsageContent.Serialization.cs b/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/Models/DevTestLabExportResourceUsageContent.Serialization.cs index 1691beaa8267..e930b8e93e7f 100644 --- a/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/Models/DevTestLabExportResourceUsageContent.Serialization.cs +++ b/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/Models/DevTestLabExportResourceUsageContent.Serialization.cs @@ -10,13 +10,32 @@ using System.Collections.Generic; using System.Text.Json; using Azure.Core; +using Azure.ResourceManager.DevTestLabs; namespace Azure.ResourceManager.DevTestLabs.Models { - public partial class DevTestLabExportResourceUsageContent : IUtf8JsonSerializable, IJsonModel + /// The parameters of the export operation. + public partial class DevTestLabExportResourceUsageContent : IJsonModel { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + /// The data to parse. + /// The client options for reading and writing models. + protected virtual DevTestLabExportResourceUsageContent 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 DeserializeDevTestLabExportResourceUsageContent(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(DevTestLabExportResourceUsageContent)} does not support reading '{options.Format}' format."); + } + } + /// The JSON writer. + /// The client options for reading and writing models. void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) { writer.WriteStartObject(); @@ -28,12 +47,11 @@ void IJsonModel.Write(Utf8JsonWriter write /// 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(DevTestLabExportResourceUsageContent)} does not support writing '{format}' format."); } - if (Optional.IsDefined(BlobStorageAbsoluteSasUri)) { writer.WritePropertyName("blobStorageAbsoluteSasUri"u8); @@ -44,15 +62,15 @@ protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWrit writer.WritePropertyName("usageStartDate"u8); writer.WriteStringValue(UsageStartOn.Value, "O"); } - 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,63 +79,69 @@ protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWrit } } - DevTestLabExportResourceUsageContent IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + /// The JSON reader. + /// The client options for reading and writing models. + DevTestLabExportResourceUsageContent IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) => JsonModelCreateCore(ref reader, options); + + /// The JSON reader. + /// The client options for reading and writing models. + protected virtual DevTestLabExportResourceUsageContent 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(DevTestLabExportResourceUsageContent)} does not support reading '{format}' format."); } - using JsonDocument document = JsonDocument.ParseValue(ref reader); return DeserializeDevTestLabExportResourceUsageContent(document.RootElement, options); } - internal static DevTestLabExportResourceUsageContent DeserializeDevTestLabExportResourceUsageContent(JsonElement element, ModelReaderWriterOptions options = null) + /// The JSON element to deserialize. + /// The client options for reading and writing models. + internal static DevTestLabExportResourceUsageContent DeserializeDevTestLabExportResourceUsageContent(JsonElement element, ModelReaderWriterOptions options) { - options ??= ModelSerializationExtensions.WireOptions; - if (element.ValueKind == JsonValueKind.Null) { return null; } Uri blobStorageAbsoluteSasUri = default; - DateTimeOffset? usageStartDate = default; - IDictionary serializedAdditionalRawData = default; - Dictionary rawDataDictionary = new Dictionary(); - foreach (var property in element.EnumerateObject()) + DateTimeOffset? usageStartOn = default; + IDictionary additionalBinaryDataProperties = new ChangeTrackingDictionary(); + foreach (var prop in element.EnumerateObject()) { - if (property.NameEquals("blobStorageAbsoluteSasUri"u8)) + if (prop.NameEquals("blobStorageAbsoluteSasUri"u8)) { - if (property.Value.ValueKind == JsonValueKind.Null) + if (prop.Value.ValueKind == JsonValueKind.Null) { continue; } - blobStorageAbsoluteSasUri = new Uri(property.Value.GetString()); + blobStorageAbsoluteSasUri = string.IsNullOrEmpty(prop.Value.GetString()) ? null : new Uri(prop.Value.GetString()); continue; } - if (property.NameEquals("usageStartDate"u8)) + if (prop.NameEquals("usageStartDate"u8)) { - if (property.Value.ValueKind == JsonValueKind.Null) + if (prop.Value.ValueKind == JsonValueKind.Null) { continue; } - usageStartDate = property.Value.GetDateTimeOffset("O"); + usageStartOn = prop.Value.GetDateTimeOffset("O"); 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 DevTestLabExportResourceUsageContent(blobStorageAbsoluteSasUri, usageStartDate, serializedAdditionalRawData); + return new DevTestLabExportResourceUsageContent(blobStorageAbsoluteSasUri, usageStartOn, 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": @@ -127,22 +151,23 @@ BinaryData IPersistableModel.Write(ModelRe } } - DevTestLabExportResourceUsageContent 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. + DevTestLabExportResourceUsageContent IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) => PersistableModelCreateCore(data, options); - switch (format) + /// The client options for reading and writing models. + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + + /// The to serialize into . + internal static RequestContent ToRequestContent(DevTestLabExportResourceUsageContent devTestLabExportResourceUsageContent) + { + if (devTestLabExportResourceUsageContent == null) { - case "J": - { - using JsonDocument document = JsonDocument.Parse(data, ModelSerializationExtensions.JsonDocumentOptions); - return DeserializeDevTestLabExportResourceUsageContent(document.RootElement, options); - } - default: - throw new FormatException($"The model {nameof(DevTestLabExportResourceUsageContent)} does not support reading '{options.Format}' format."); + return null; } + Utf8JsonRequestContent content = new Utf8JsonRequestContent(); + content.JsonWriter.WriteObjectValue(devTestLabExportResourceUsageContent, ModelSerializationExtensions.WireOptions); + return content; } - - string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; } } diff --git a/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/Models/DevTestLabExportResourceUsageContent.cs b/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/Models/DevTestLabExportResourceUsageContent.cs index 0895229203f7..4a63f331076c 100644 --- a/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/Models/DevTestLabExportResourceUsageContent.cs +++ b/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/Models/DevTestLabExportResourceUsageContent.cs @@ -13,37 +13,8 @@ namespace Azure.ResourceManager.DevTestLabs.Models /// The parameters of the export operation. public partial class DevTestLabExportResourceUsageContent { - /// - /// 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 DevTestLabExportResourceUsageContent() @@ -53,16 +24,17 @@ public DevTestLabExportResourceUsageContent() /// Initializes a new instance of . /// The blob storage absolute sas uri with write permission to the container which the usage data needs to be uploaded to. /// The start time of the usage. If not provided, usage will be reported since the beginning of data collection. - /// Keeps track of any properties unknown to the library. - internal DevTestLabExportResourceUsageContent(Uri blobStorageAbsoluteSasUri, DateTimeOffset? usageStartOn, IDictionary serializedAdditionalRawData) + /// Keeps track of any properties unknown to the library. + internal DevTestLabExportResourceUsageContent(Uri blobStorageAbsoluteSasUri, DateTimeOffset? usageStartOn, IDictionary additionalBinaryDataProperties) { BlobStorageAbsoluteSasUri = blobStorageAbsoluteSasUri; UsageStartOn = usageStartOn; - _serializedAdditionalRawData = serializedAdditionalRawData; + _additionalBinaryDataProperties = additionalBinaryDataProperties; } /// The blob storage absolute sas uri with write permission to the container which the usage data needs to be uploaded to. public Uri BlobStorageAbsoluteSasUri { get; set; } + /// The start time of the usage. If not provided, usage will be reported since the beginning of data collection. public DateTimeOffset? UsageStartOn { get; set; } } diff --git a/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/Models/DevTestLabExternalSubnet.Serialization.cs b/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/Models/DevTestLabExternalSubnet.Serialization.cs index dff4ae0e2d4a..2cb6dcda1505 100644 --- a/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/Models/DevTestLabExternalSubnet.Serialization.cs +++ b/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/Models/DevTestLabExternalSubnet.Serialization.cs @@ -10,13 +10,32 @@ using System.Collections.Generic; using System.Text.Json; using Azure.Core; +using Azure.ResourceManager.DevTestLabs; namespace Azure.ResourceManager.DevTestLabs.Models { - public partial class DevTestLabExternalSubnet : IUtf8JsonSerializable, IJsonModel + /// Subnet information as returned by the Microsoft.Network API. + public partial class DevTestLabExternalSubnet : IJsonModel { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + /// The data to parse. + /// The client options for reading and writing models. + protected virtual DevTestLabExternalSubnet 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 DeserializeDevTestLabExternalSubnet(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(DevTestLabExternalSubnet)} does not support reading '{options.Format}' format."); + } + } + /// The JSON writer. + /// The client options for reading and writing models. void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) { writer.WriteStartObject(); @@ -28,12 +47,11 @@ void IJsonModel.Write(Utf8JsonWriter writer, ModelRead /// 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(DevTestLabExternalSubnet)} does not support writing '{format}' format."); } - if (Optional.IsDefined(Id)) { writer.WritePropertyName("id"u8); @@ -44,15 +62,15 @@ protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWrit writer.WritePropertyName("name"u8); writer.WriteStringValue(Name); } - 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,59 +79,65 @@ protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWrit } } - DevTestLabExternalSubnet IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + /// The JSON reader. + /// The client options for reading and writing models. + DevTestLabExternalSubnet IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) => JsonModelCreateCore(ref reader, options); + + /// The JSON reader. + /// The client options for reading and writing models. + protected virtual DevTestLabExternalSubnet 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(DevTestLabExternalSubnet)} does not support reading '{format}' format."); } - using JsonDocument document = JsonDocument.ParseValue(ref reader); return DeserializeDevTestLabExternalSubnet(document.RootElement, options); } - internal static DevTestLabExternalSubnet DeserializeDevTestLabExternalSubnet(JsonElement element, ModelReaderWriterOptions options = null) + /// The JSON element to deserialize. + /// The client options for reading and writing models. + internal static DevTestLabExternalSubnet DeserializeDevTestLabExternalSubnet(JsonElement element, ModelReaderWriterOptions options) { - options ??= ModelSerializationExtensions.WireOptions; - if (element.ValueKind == JsonValueKind.Null) { return null; } ResourceIdentifier id = default; string name = 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)) { - if (property.Value.ValueKind == JsonValueKind.Null) + if (prop.Value.ValueKind == JsonValueKind.Null) { continue; } - id = new ResourceIdentifier(property.Value.GetString()); + id = new ResourceIdentifier(prop.Value.GetString()); continue; } - if (property.NameEquals("name"u8)) + if (prop.NameEquals("name"u8)) { - name = property.Value.GetString(); + name = 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 DevTestLabExternalSubnet(id, name, serializedAdditionalRawData); + return new DevTestLabExternalSubnet(id, name, 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": @@ -123,22 +147,11 @@ BinaryData IPersistableModel.Write(ModelReaderWriterOp } } - DevTestLabExternalSubnet 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 DeserializeDevTestLabExternalSubnet(document.RootElement, options); - } - default: - throw new FormatException($"The model {nameof(DevTestLabExternalSubnet)} does not support reading '{options.Format}' format."); - } - } + /// The data to parse. + /// The client options for reading and writing models. + DevTestLabExternalSubnet IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) => PersistableModelCreateCore(data, options); + /// The client options for reading and writing models. string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; } } diff --git a/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/Models/DevTestLabExternalSubnet.cs b/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/Models/DevTestLabExternalSubnet.cs index 1a93422d92da..3375e6e9efbf 100644 --- a/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/Models/DevTestLabExternalSubnet.cs +++ b/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/Models/DevTestLabExternalSubnet.cs @@ -14,37 +14,8 @@ namespace Azure.ResourceManager.DevTestLabs.Models /// Subnet information as returned by the Microsoft.Network API. public partial class DevTestLabExternalSubnet { - /// - /// 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 DevTestLabExternalSubnet() @@ -54,16 +25,17 @@ internal DevTestLabExternalSubnet() /// Initializes a new instance of . /// Gets or sets the identifier. /// Gets or sets the name. - /// Keeps track of any properties unknown to the library. - internal DevTestLabExternalSubnet(ResourceIdentifier id, string name, IDictionary serializedAdditionalRawData) + /// Keeps track of any properties unknown to the library. + internal DevTestLabExternalSubnet(ResourceIdentifier id, string name, IDictionary additionalBinaryDataProperties) { Id = id; Name = name; - _serializedAdditionalRawData = serializedAdditionalRawData; + _additionalBinaryDataProperties = additionalBinaryDataProperties; } /// Gets or sets the identifier. public ResourceIdentifier Id { get; } + /// Gets or sets the name. public string Name { get; } } diff --git a/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/Models/DevTestLabFileUploadOption.cs b/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/Models/DevTestLabFileUploadOption.cs index 0fc80fefac96..246a10c28c54 100644 --- a/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/Models/DevTestLabFileUploadOption.cs +++ b/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/Models/DevTestLabFileUploadOption.cs @@ -7,6 +7,7 @@ using System; using System.ComponentModel; +using Azure.ResourceManager.DevTestLabs; namespace Azure.ResourceManager.DevTestLabs.Models { @@ -14,38 +15,55 @@ namespace Azure.ResourceManager.DevTestLabs.Models public readonly partial struct DevTestLabFileUploadOption : IEquatable { private readonly string _value; + private const string UploadFilesAndGenerateSasTokensValue = "UploadFilesAndGenerateSasTokens"; + private const string NoneValue = "None"; /// Initializes a new instance of . + /// The value. /// is null. public DevTestLabFileUploadOption(string value) { - _value = value ?? throw new ArgumentNullException(nameof(value)); - } + Argument.AssertNotNull(value, nameof(value)); - private const string UploadFilesAndGenerateSasTokensValue = "UploadFilesAndGenerateSasTokens"; - private const string NoneValue = "None"; + _value = value; + } - /// UploadFilesAndGenerateSasTokens. + /// Gets the UploadFilesAndGenerateSasTokens. public static DevTestLabFileUploadOption UploadFilesAndGenerateSasTokens { get; } = new DevTestLabFileUploadOption(UploadFilesAndGenerateSasTokensValue); - /// None. + + /// Gets the None. public static DevTestLabFileUploadOption None { get; } = new DevTestLabFileUploadOption(NoneValue); + /// Determines if two values are the same. + /// The left value to compare. + /// The right value to compare. public static bool operator ==(DevTestLabFileUploadOption left, DevTestLabFileUploadOption 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 !=(DevTestLabFileUploadOption left, DevTestLabFileUploadOption right) => !left.Equals(right); - /// Converts a to a . + + /// Converts a string to a . + /// The value. public static implicit operator DevTestLabFileUploadOption(string value) => new DevTestLabFileUploadOption(value); - /// + /// Converts a string to a . + /// The value. + public static implicit operator DevTestLabFileUploadOption?(string value) => value == null ? null : new DevTestLabFileUploadOption(value); + + /// [EditorBrowsable(EditorBrowsableState.Never)] public override bool Equals(object obj) => obj is DevTestLabFileUploadOption other && Equals(other); - /// + + /// public bool Equals(DevTestLabFileUploadOption 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/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/Models/DevTestLabFormulaPatch.Serialization.cs b/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/Models/DevTestLabFormulaPatch.Serialization.cs index 4a3a2c319dc4..896fa0d5da1f 100644 --- a/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/Models/DevTestLabFormulaPatch.Serialization.cs +++ b/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/Models/DevTestLabFormulaPatch.Serialization.cs @@ -10,13 +10,32 @@ using System.Collections.Generic; using System.Text.Json; using Azure.Core; +using Azure.ResourceManager.DevTestLabs; namespace Azure.ResourceManager.DevTestLabs.Models { - public partial class DevTestLabFormulaPatch : IUtf8JsonSerializable, IJsonModel + /// A formula for creating a VM, specifying an image base and other parameters. + public partial class DevTestLabFormulaPatch : DevTestLabResourcePatch, IJsonModel { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + /// The data to parse. + /// The client options for reading and writing models. + protected override DevTestLabResourcePatch 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 DeserializeDevTestLabFormulaPatch(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(DevTestLabFormulaPatch)} does not support reading '{options.Format}' format."); + } + } + /// The JSON writer. + /// The client options for reading and writing models. void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) { writer.WriteStartObject(); @@ -28,67 +47,79 @@ void IJsonModel.Write(Utf8JsonWriter writer, ModelReader /// 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(DevTestLabFormulaPatch)} does not support writing '{format}' format."); } - base.JsonModelWriteCore(writer, options); } - DevTestLabFormulaPatch IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + /// The JSON reader. + /// The client options for reading and writing models. + DevTestLabFormulaPatch IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) => (DevTestLabFormulaPatch)JsonModelCreateCore(ref reader, options); + + /// The JSON reader. + /// The client options for reading and writing models. + protected override DevTestLabResourcePatch 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(DevTestLabFormulaPatch)} does not support reading '{format}' format."); } - using JsonDocument document = JsonDocument.ParseValue(ref reader); return DeserializeDevTestLabFormulaPatch(document.RootElement, options); } - internal static DevTestLabFormulaPatch DeserializeDevTestLabFormulaPatch(JsonElement element, ModelReaderWriterOptions options = null) + /// The JSON element to deserialize. + /// The client options for reading and writing models. + internal static DevTestLabFormulaPatch DeserializeDevTestLabFormulaPatch(JsonElement element, ModelReaderWriterOptions options) { - options ??= ModelSerializationExtensions.WireOptions; - if (element.ValueKind == JsonValueKind.Null) { return null; } IDictionary tags = 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("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 (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 DevTestLabFormulaPatch(tags ?? new ChangeTrackingDictionary(), serializedAdditionalRawData); + return new DevTestLabFormulaPatch(tags ?? new ChangeTrackingDictionary(), 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 override BinaryData PersistableModelWriteCore(ModelReaderWriterOptions options) + { + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; switch (format) { case "J": @@ -98,22 +129,23 @@ BinaryData IPersistableModel.Write(ModelReaderWriterOpti } } - DevTestLabFormulaPatch 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. + DevTestLabFormulaPatch IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) => (DevTestLabFormulaPatch)PersistableModelCreateCore(data, options); - switch (format) + /// The client options for reading and writing models. + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + + /// The to serialize into . + internal static RequestContent ToRequestContent(DevTestLabFormulaPatch devTestLabFormulaPatch) + { + if (devTestLabFormulaPatch == null) { - case "J": - { - using JsonDocument document = JsonDocument.Parse(data, ModelSerializationExtensions.JsonDocumentOptions); - return DeserializeDevTestLabFormulaPatch(document.RootElement, options); - } - default: - throw new FormatException($"The model {nameof(DevTestLabFormulaPatch)} does not support reading '{options.Format}' format."); + return null; } + Utf8JsonRequestContent content = new Utf8JsonRequestContent(); + content.JsonWriter.WriteObjectValue(devTestLabFormulaPatch, ModelSerializationExtensions.WireOptions); + return content; } - - string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; } } diff --git a/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/Models/DevTestLabFormulaPatch.cs b/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/Models/DevTestLabFormulaPatch.cs index ef6c5f54e5bc..9e5fa9284bb5 100644 --- a/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/Models/DevTestLabFormulaPatch.cs +++ b/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/Models/DevTestLabFormulaPatch.cs @@ -20,8 +20,8 @@ public DevTestLabFormulaPatch() /// Initializes a new instance of . /// The tags of the resource. - /// Keeps track of any properties unknown to the library. - internal DevTestLabFormulaPatch(IDictionary tags, IDictionary serializedAdditionalRawData) : base(tags, serializedAdditionalRawData) + /// Keeps track of any properties unknown to the library. + internal DevTestLabFormulaPatch(IDictionary tags, IDictionary additionalBinaryDataProperties) : base(tags, additionalBinaryDataProperties) { } } diff --git a/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/Models/DevTestLabGalleryImage.Serialization.cs b/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/Models/DevTestLabGalleryImage.Serialization.cs index 937b54f9c736..8ee7d52016f4 100644 --- a/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/Models/DevTestLabGalleryImage.Serialization.cs +++ b/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/Models/DevTestLabGalleryImage.Serialization.cs @@ -11,14 +11,38 @@ using System.Text; using System.Text.Json; using Azure.Core; +using Azure.ResourceManager.DevTestLabs; using Azure.ResourceManager.Models; namespace Azure.ResourceManager.DevTestLabs.Models { - public partial class DevTestLabGalleryImage : IUtf8JsonSerializable, IJsonModel + /// A gallery image. + public partial class DevTestLabGalleryImage : TrackedResourceData, IJsonModel { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + /// Initializes a new instance of for deserialization. + internal DevTestLabGalleryImage() + { + } + + /// 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)) + { + return DeserializeDevTestLabGalleryImage(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(DevTestLabGalleryImage)} does not support reading '{options.Format}' format."); + } + } + /// The JSON writer. + /// The client options for reading and writing models. void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) { writer.WriteStartObject(); @@ -30,235 +54,153 @@ void IJsonModel.Write(Utf8JsonWriter writer, ModelReader /// 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(DevTestLabGalleryImage)} does not support writing '{format}' format."); } - base.JsonModelWriteCore(writer, options); writer.WritePropertyName("properties"u8); - writer.WriteStartObject(); - if (Optional.IsDefined(Author)) - { - writer.WritePropertyName("author"u8); - writer.WriteStringValue(Author); - } - if (options.Format != "W" && Optional.IsDefined(CreatedOn)) + writer.WriteObjectValue(Properties, options); + if (Optional.IsCollectionDefined(Tags)) { - writer.WritePropertyName("createdDate"u8); - writer.WriteStringValue(CreatedOn.Value, "O"); - } - if (Optional.IsDefined(Description)) - { - writer.WritePropertyName("description"u8); - writer.WriteStringValue(Description); - } - if (Optional.IsDefined(ImageReference)) - { - writer.WritePropertyName("imageReference"u8); - writer.WriteObjectValue(ImageReference, options); - } - if (Optional.IsDefined(Icon)) - { - writer.WritePropertyName("icon"u8); - writer.WriteStringValue(Icon); - } - if (Optional.IsDefined(IsEnabled)) - { - writer.WritePropertyName("enabled"u8); - writer.WriteBooleanValue(IsEnabled.Value); - } - if (Optional.IsDefined(PlanId)) - { - writer.WritePropertyName("planId"u8); - writer.WriteStringValue(PlanId); - } - if (Optional.IsDefined(IsPlanAuthorized)) - { - writer.WritePropertyName("isPlanAuthorized"u8); - writer.WriteBooleanValue(IsPlanAuthorized.Value); + writer.WritePropertyName("tags"u8); + writer.WriteStartObject(); + foreach (var item in Tags) + { + writer.WritePropertyName(item.Key); + if (item.Value == null) + { + writer.WriteNullValue(); + continue; + } + writer.WriteStringValue(item.Value); + } + writer.WriteEndObject(); } - writer.WriteEndObject(); } - DevTestLabGalleryImage IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + /// The JSON reader. + /// The client options for reading and writing models. + DevTestLabGalleryImage IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) => (DevTestLabGalleryImage)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(DevTestLabGalleryImage)} does not support reading '{format}' format."); } - using JsonDocument document = JsonDocument.ParseValue(ref reader); return DeserializeDevTestLabGalleryImage(document.RootElement, options); } - internal static DevTestLabGalleryImage DeserializeDevTestLabGalleryImage(JsonElement element, ModelReaderWriterOptions options = null) + /// The JSON element to deserialize. + /// The client options for reading and writing models. + internal static DevTestLabGalleryImage DeserializeDevTestLabGalleryImage(JsonElement element, ModelReaderWriterOptions options) { - options ??= ModelSerializationExtensions.WireOptions; - if (element.ValueKind == JsonValueKind.Null) { return null; } - IDictionary tags = default; - AzureLocation location = default; ResourceIdentifier id = default; string name = default; - ResourceType type = default; + ResourceType resourceType = default; SystemData systemData = default; - string author = default; - DateTimeOffset? createdDate = default; - string description = default; - DevTestLabGalleryImageReference imageReference = default; - string icon = default; - bool? enabled = default; - string planId = default; - bool? isPlanAuthorized = default; - IDictionary serializedAdditionalRawData = default; - Dictionary rawDataDictionary = new Dictionary(); - foreach (var property in element.EnumerateObject()) + IDictionary additionalBinaryDataProperties = new ChangeTrackingDictionary(); + AzureLocation location = default; + GalleryImageProperties properties = default; + IDictionary tags = default; + foreach (var prop in element.EnumerateObject()) { - if (property.NameEquals("tags"u8)) + if (prop.NameEquals("id"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()) - { - dictionary.Add(property0.Name, property0.Value.GetString()); - } - tags = dictionary; + id = new ResourceIdentifier(prop.Value.GetString()); continue; } - if (property.NameEquals("location"u8)) + if (prop.NameEquals("name"u8)) { - location = new AzureLocation(property.Value.GetString()); + name = prop.Value.GetString(); continue; } - if (property.NameEquals("id"u8)) + if (prop.NameEquals("type"u8)) { - id = new ResourceIdentifier(property.Value.GetString()); + if (prop.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + resourceType = new ResourceType(prop.Value.GetString()); continue; } - if (property.NameEquals("name"u8)) + if (prop.NameEquals("systemData"u8)) { - name = property.Value.GetString(); + if (prop.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + systemData = ModelReaderWriter.Read(new BinaryData(Encoding.UTF8.GetBytes(prop.Value.GetRawText())), ModelSerializationExtensions.WireOptions, AzureResourceManagerDevTestLabsContext.Default); 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) - { - continue; - } - systemData = ModelReaderWriter.Read(new BinaryData(Encoding.UTF8.GetBytes(property.Value.GetRawText())), ModelSerializationExtensions.WireOptions, AzureResourceManagerDevTestLabsContext.Default); + properties = GalleryImageProperties.DeserializeGalleryImageProperties(prop.Value, options); continue; } - if (property.NameEquals("properties"u8)) + if (prop.NameEquals("tags"u8)) { - if (property.Value.ValueKind == JsonValueKind.Null) + if (prop.Value.ValueKind == JsonValueKind.Null) { - property.ThrowNonNullablePropertyIsNull(); continue; } - foreach (var property0 in property.Value.EnumerateObject()) + Dictionary dictionary = new Dictionary(); + foreach (var prop0 in prop.Value.EnumerateObject()) { - if (property0.NameEquals("author"u8)) - { - author = property0.Value.GetString(); - continue; - } - if (property0.NameEquals("createdDate"u8)) - { - if (property0.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - createdDate = property0.Value.GetDateTimeOffset("O"); - continue; - } - if (property0.NameEquals("description"u8)) - { - description = property0.Value.GetString(); - continue; - } - if (property0.NameEquals("imageReference"u8)) - { - if (property0.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - imageReference = DevTestLabGalleryImageReference.DeserializeDevTestLabGalleryImageReference(property0.Value, options); - continue; - } - if (property0.NameEquals("icon"u8)) + if (prop0.Value.ValueKind == JsonValueKind.Null) { - icon = property0.Value.GetString(); - continue; + dictionary.Add(prop0.Name, null); } - if (property0.NameEquals("enabled"u8)) + else { - if (property0.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - enabled = property0.Value.GetBoolean(); - continue; - } - if (property0.NameEquals("planId"u8)) - { - planId = property0.Value.GetString(); - continue; - } - if (property0.NameEquals("isPlanAuthorized"u8)) - { - if (property0.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - isPlanAuthorized = property0.Value.GetBoolean(); - continue; + dictionary.Add(prop0.Name, prop0.Value.GetString()); } } + tags = dictionary; 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 DevTestLabGalleryImage( id, name, - type, + resourceType, systemData, - tags ?? new ChangeTrackingDictionary(), + additionalBinaryDataProperties, location, - author, - createdDate, - description, - imageReference, - icon, - enabled, - planId, - isPlanAuthorized, - serializedAdditionalRawData); + properties, + tags ?? new ChangeTrackingDictionary()); } - 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": @@ -268,22 +210,11 @@ BinaryData IPersistableModel.Write(ModelReaderWriterOpti } } - DevTestLabGalleryImage 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 DeserializeDevTestLabGalleryImage(document.RootElement, options); - } - default: - throw new FormatException($"The model {nameof(DevTestLabGalleryImage)} does not support reading '{options.Format}' format."); - } - } + /// The data to parse. + /// The client options for reading and writing models. + DevTestLabGalleryImage IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) => (DevTestLabGalleryImage)PersistableModelCreateCore(data, options); + /// The client options for reading and writing models. string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; } } diff --git a/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/Models/DevTestLabGalleryImage.cs b/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/Models/DevTestLabGalleryImage.cs index ee0ddc4c8277..d3a8de721f98 100644 --- a/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/Models/DevTestLabGalleryImage.cs +++ b/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/Models/DevTestLabGalleryImage.cs @@ -15,93 +15,160 @@ namespace Azure.ResourceManager.DevTestLabs.Models /// A gallery image. public partial class DevTestLabGalleryImage : 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 DevTestLabGalleryImage(AzureLocation location) : base(location) { + } /// Initializes a new instance of . - /// The id. - /// The name. - /// The resourceType. - /// The systemData. - /// The tags. - /// The location. - /// The author of the gallery image. - /// The creation date of the gallery image. - /// The description of the gallery image. - /// The image reference of the gallery image. - /// The icon of the gallery image. - /// Indicates whether this gallery image is enabled. - /// The third party plan that applies to this image. - /// Indicates if the plan has been authorized for programmatic deployment. - /// Keeps track of any properties unknown to the library. - internal DevTestLabGalleryImage(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, IDictionary tags, AzureLocation location, string author, DateTimeOffset? createdOn, string description, DevTestLabGalleryImageReference imageReference, string icon, bool? isEnabled, string planId, bool? isPlanAuthorized, IDictionary serializedAdditionalRawData) : base(id, name, resourceType, systemData, tags, 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. + /// The geo-location where the resource lives. + /// The properties of the gallery image. + /// Resource tags. + internal DevTestLabGalleryImage(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, IDictionary additionalBinaryDataProperties, AzureLocation location, GalleryImageProperties properties, IDictionary tags) : base(id, name, resourceType, systemData, tags, location) { - Author = author; - CreatedOn = createdOn; - Description = description; - ImageReference = imageReference; - Icon = icon; - IsEnabled = isEnabled; - PlanId = planId; - IsPlanAuthorized = isPlanAuthorized; - _serializedAdditionalRawData = serializedAdditionalRawData; + _additionalBinaryDataProperties = additionalBinaryDataProperties; + Properties = properties; } - /// Initializes a new instance of for deserialization. - internal DevTestLabGalleryImage() + /// The properties of the gallery image. + internal GalleryImageProperties Properties { get; set; } + + /// The author of the gallery image. + public string Author { + get + { + return Properties is null ? default : Properties.Author; + } + set + { + if (Properties is null) + { + Properties = new GalleryImageProperties(); + } + Properties.Author = value; + } } - /// The author of the gallery image. - public string Author { get; set; } /// The creation date of the gallery image. - public DateTimeOffset? CreatedOn { get; } + public DateTimeOffset? CreatedOn + { + get + { + return Properties is null ? default : Properties.CreatedOn; + } + } + /// The description of the gallery image. - public string Description { get; set; } + public string Description + { + get + { + return Properties is null ? default : Properties.Description; + } + set + { + if (Properties is null) + { + Properties = new GalleryImageProperties(); + } + Properties.Description = value; + } + } + /// The image reference of the gallery image. - public DevTestLabGalleryImageReference ImageReference { get; set; } + public DevTestLabGalleryImageReference ImageReference + { + get + { + return Properties is null ? default : Properties.ImageReference; + } + set + { + if (Properties is null) + { + Properties = new GalleryImageProperties(); + } + Properties.ImageReference = value; + } + } + /// The icon of the gallery image. - public string Icon { get; set; } + public string Icon + { + get + { + return Properties is null ? default : Properties.Icon; + } + set + { + if (Properties is null) + { + Properties = new GalleryImageProperties(); + } + Properties.Icon = value; + } + } + /// Indicates whether this gallery image is enabled. - public bool? IsEnabled { get; set; } + public bool? IsEnabled + { + get + { + return Properties is null ? default : Properties.IsEnabled; + } + set + { + if (Properties is null) + { + Properties = new GalleryImageProperties(); + } + Properties.IsEnabled = value.Value; + } + } + /// The third party plan that applies to this image. - public string PlanId { get; set; } + public string PlanId + { + get + { + return Properties is null ? default : Properties.PlanId; + } + set + { + if (Properties is null) + { + Properties = new GalleryImageProperties(); + } + Properties.PlanId = value; + } + } + /// Indicates if the plan has been authorized for programmatic deployment. - public bool? IsPlanAuthorized { get; set; } + public bool? IsPlanAuthorized + { + get + { + return Properties is null ? default : Properties.IsPlanAuthorized; + } + set + { + if (Properties is null) + { + Properties = new GalleryImageProperties(); + } + Properties.IsPlanAuthorized = value.Value; + } + } } } diff --git a/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/Models/DevTestLabGalleryImageReference.Serialization.cs b/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/Models/DevTestLabGalleryImageReference.Serialization.cs index 92a081c280b3..d514e7346685 100644 --- a/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/Models/DevTestLabGalleryImageReference.Serialization.cs +++ b/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/Models/DevTestLabGalleryImageReference.Serialization.cs @@ -9,14 +9,32 @@ using System.ClientModel.Primitives; using System.Collections.Generic; using System.Text.Json; -using Azure.Core; +using Azure.ResourceManager.DevTestLabs; namespace Azure.ResourceManager.DevTestLabs.Models { - public partial class DevTestLabGalleryImageReference : IUtf8JsonSerializable, IJsonModel + /// The reference information for an Azure Marketplace image. + public partial class DevTestLabGalleryImageReference : IJsonModel { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + /// The data to parse. + /// The client options for reading and writing models. + protected virtual DevTestLabGalleryImageReference 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 DeserializeDevTestLabGalleryImageReference(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(DevTestLabGalleryImageReference)} does not support reading '{options.Format}' format."); + } + } + /// The JSON writer. + /// The client options for reading and writing models. void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) { writer.WriteStartObject(); @@ -28,12 +46,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(DevTestLabGalleryImageReference)} does not support writing '{format}' format."); } - if (Optional.IsDefined(Offer)) { writer.WritePropertyName("offer"u8); @@ -59,15 +76,15 @@ protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWrit writer.WritePropertyName("version"u8); writer.WriteStringValue(Version); } - 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 +93,27 @@ protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWrit } } - DevTestLabGalleryImageReference IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + /// The JSON reader. + /// The client options for reading and writing models. + DevTestLabGalleryImageReference IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) => JsonModelCreateCore(ref reader, options); + + /// The JSON reader. + /// The client options for reading and writing models. + protected virtual DevTestLabGalleryImageReference 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(DevTestLabGalleryImageReference)} does not support reading '{format}' format."); } - using JsonDocument document = JsonDocument.ParseValue(ref reader); return DeserializeDevTestLabGalleryImageReference(document.RootElement, options); } - internal static DevTestLabGalleryImageReference DeserializeDevTestLabGalleryImageReference(JsonElement element, ModelReaderWriterOptions options = null) + /// The JSON element to deserialize. + /// The client options for reading and writing models. + internal static DevTestLabGalleryImageReference DeserializeDevTestLabGalleryImageReference(JsonElement element, ModelReaderWriterOptions options) { - options ??= ModelSerializationExtensions.WireOptions; - if (element.ValueKind == JsonValueKind.Null) { return null; @@ -101,54 +123,55 @@ internal static DevTestLabGalleryImageReference DeserializeDevTestLabGalleryImag string sku = default; string osType = default; string version = 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("offer"u8)) + if (prop.NameEquals("offer"u8)) { - offer = property.Value.GetString(); + offer = prop.Value.GetString(); continue; } - if (property.NameEquals("publisher"u8)) + if (prop.NameEquals("publisher"u8)) { - publisher = property.Value.GetString(); + publisher = prop.Value.GetString(); continue; } - if (property.NameEquals("sku"u8)) + if (prop.NameEquals("sku"u8)) { - sku = property.Value.GetString(); + sku = prop.Value.GetString(); continue; } - if (property.NameEquals("osType"u8)) + if (prop.NameEquals("osType"u8)) { - osType = property.Value.GetString(); + osType = prop.Value.GetString(); continue; } - if (property.NameEquals("version"u8)) + if (prop.NameEquals("version"u8)) { - version = property.Value.GetString(); + version = 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 DevTestLabGalleryImageReference( offer, publisher, sku, osType, version, - serializedAdditionalRawData); + 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": @@ -158,22 +181,11 @@ BinaryData IPersistableModel.Write(ModelReaderW } } - DevTestLabGalleryImageReference 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 DeserializeDevTestLabGalleryImageReference(document.RootElement, options); - } - default: - throw new FormatException($"The model {nameof(DevTestLabGalleryImageReference)} does not support reading '{options.Format}' format."); - } - } + /// The data to parse. + /// The client options for reading and writing models. + DevTestLabGalleryImageReference IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) => PersistableModelCreateCore(data, options); + /// The client options for reading and writing models. string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; } } diff --git a/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/Models/DevTestLabGalleryImageReference.cs b/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/Models/DevTestLabGalleryImageReference.cs index f3529ceadb0f..d3c44f45d017 100644 --- a/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/Models/DevTestLabGalleryImageReference.cs +++ b/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/Models/DevTestLabGalleryImageReference.cs @@ -13,37 +13,8 @@ namespace Azure.ResourceManager.DevTestLabs.Models /// The reference information for an Azure Marketplace image. public partial class DevTestLabGalleryImageReference { - /// - /// 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 DevTestLabGalleryImageReference() @@ -56,25 +27,29 @@ public DevTestLabGalleryImageReference() /// The SKU of the gallery image. /// The OS type of the gallery image. /// The version of the gallery image. - /// Keeps track of any properties unknown to the library. - internal DevTestLabGalleryImageReference(string offer, string publisher, string sku, string osType, string version, IDictionary serializedAdditionalRawData) + /// Keeps track of any properties unknown to the library. + internal DevTestLabGalleryImageReference(string offer, string publisher, string sku, string osType, string version, IDictionary additionalBinaryDataProperties) { Offer = offer; Publisher = publisher; Sku = sku; OSType = osType; Version = version; - _serializedAdditionalRawData = serializedAdditionalRawData; + _additionalBinaryDataProperties = additionalBinaryDataProperties; } /// The offer of the gallery image. public string Offer { get; set; } + /// The publisher of the gallery image. public string Publisher { get; set; } + /// The SKU of the gallery image. public string Sku { get; set; } + /// The OS type of the gallery image. public string OSType { get; set; } + /// The version of the gallery image. public string Version { get; set; } } diff --git a/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/Models/DevTestLabGenerateUploadUriContent.Serialization.cs b/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/Models/DevTestLabGenerateUploadUriContent.Serialization.cs index dc40cf21f74c..47f13a3fa88d 100644 --- a/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/Models/DevTestLabGenerateUploadUriContent.Serialization.cs +++ b/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/Models/DevTestLabGenerateUploadUriContent.Serialization.cs @@ -10,13 +10,32 @@ using System.Collections.Generic; using System.Text.Json; using Azure.Core; +using Azure.ResourceManager.DevTestLabs; namespace Azure.ResourceManager.DevTestLabs.Models { - public partial class DevTestLabGenerateUploadUriContent : IUtf8JsonSerializable, IJsonModel + /// Properties for generating an upload URI. + public partial class DevTestLabGenerateUploadUriContent : IJsonModel { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + /// The data to parse. + /// The client options for reading and writing models. + protected virtual DevTestLabGenerateUploadUriContent 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 DeserializeDevTestLabGenerateUploadUriContent(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(DevTestLabGenerateUploadUriContent)} does not support reading '{options.Format}' format."); + } + } + /// The JSON writer. + /// The client options for reading and writing models. void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) { writer.WriteStartObject(); @@ -28,26 +47,25 @@ 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(DevTestLabGenerateUploadUriContent)} does not support writing '{format}' format."); } - if (Optional.IsDefined(BlobName)) { writer.WritePropertyName("blobName"u8); writer.WriteStringValue(BlobName); } - 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); } @@ -56,49 +74,55 @@ protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWrit } } - DevTestLabGenerateUploadUriContent IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + /// The JSON reader. + /// The client options for reading and writing models. + DevTestLabGenerateUploadUriContent IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) => JsonModelCreateCore(ref reader, options); + + /// The JSON reader. + /// The client options for reading and writing models. + protected virtual DevTestLabGenerateUploadUriContent 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(DevTestLabGenerateUploadUriContent)} does not support reading '{format}' format."); } - using JsonDocument document = JsonDocument.ParseValue(ref reader); return DeserializeDevTestLabGenerateUploadUriContent(document.RootElement, options); } - internal static DevTestLabGenerateUploadUriContent DeserializeDevTestLabGenerateUploadUriContent(JsonElement element, ModelReaderWriterOptions options = null) + /// The JSON element to deserialize. + /// The client options for reading and writing models. + internal static DevTestLabGenerateUploadUriContent DeserializeDevTestLabGenerateUploadUriContent(JsonElement element, ModelReaderWriterOptions options) { - options ??= ModelSerializationExtensions.WireOptions; - if (element.ValueKind == JsonValueKind.Null) { return null; } string blobName = 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("blobName"u8)) + if (prop.NameEquals("blobName"u8)) { - blobName = property.Value.GetString(); + blobName = 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 DevTestLabGenerateUploadUriContent(blobName, serializedAdditionalRawData); + return new DevTestLabGenerateUploadUriContent(blobName, 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": @@ -108,22 +132,23 @@ BinaryData IPersistableModel.Write(ModelRead } } - DevTestLabGenerateUploadUriContent 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. + DevTestLabGenerateUploadUriContent IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) => PersistableModelCreateCore(data, options); - switch (format) + /// The client options for reading and writing models. + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + + /// The to serialize into . + internal static RequestContent ToRequestContent(DevTestLabGenerateUploadUriContent devTestLabGenerateUploadUriContent) + { + if (devTestLabGenerateUploadUriContent == null) { - case "J": - { - using JsonDocument document = JsonDocument.Parse(data, ModelSerializationExtensions.JsonDocumentOptions); - return DeserializeDevTestLabGenerateUploadUriContent(document.RootElement, options); - } - default: - throw new FormatException($"The model {nameof(DevTestLabGenerateUploadUriContent)} does not support reading '{options.Format}' format."); + return null; } + Utf8JsonRequestContent content = new Utf8JsonRequestContent(); + content.JsonWriter.WriteObjectValue(devTestLabGenerateUploadUriContent, ModelSerializationExtensions.WireOptions); + return content; } - - string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; } } diff --git a/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/Models/DevTestLabGenerateUploadUriContent.cs b/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/Models/DevTestLabGenerateUploadUriContent.cs index f6f620d087a9..1f7f423c6cfa 100644 --- a/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/Models/DevTestLabGenerateUploadUriContent.cs +++ b/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/Models/DevTestLabGenerateUploadUriContent.cs @@ -13,37 +13,8 @@ namespace Azure.ResourceManager.DevTestLabs.Models /// Properties for generating an upload URI. public partial class DevTestLabGenerateUploadUriContent { - /// - /// 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 DevTestLabGenerateUploadUriContent() @@ -52,11 +23,11 @@ public DevTestLabGenerateUploadUriContent() /// Initializes a new instance of . /// The blob name of the upload URI. - /// Keeps track of any properties unknown to the library. - internal DevTestLabGenerateUploadUriContent(string blobName, IDictionary serializedAdditionalRawData) + /// Keeps track of any properties unknown to the library. + internal DevTestLabGenerateUploadUriContent(string blobName, IDictionary additionalBinaryDataProperties) { BlobName = blobName; - _serializedAdditionalRawData = serializedAdditionalRawData; + _additionalBinaryDataProperties = additionalBinaryDataProperties; } /// The blob name of the upload URI. diff --git a/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/Models/DevTestLabGenerateUploadUriResult.Serialization.cs b/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/Models/DevTestLabGenerateUploadUriResult.Serialization.cs index ed195ff6a971..378b4fa8dd1d 100644 --- a/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/Models/DevTestLabGenerateUploadUriResult.Serialization.cs +++ b/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/Models/DevTestLabGenerateUploadUriResult.Serialization.cs @@ -9,14 +9,40 @@ using System.ClientModel.Primitives; using System.Collections.Generic; using System.Text.Json; -using Azure.Core; +using Azure; +using Azure.ResourceManager.DevTestLabs; namespace Azure.ResourceManager.DevTestLabs.Models { - public partial class DevTestLabGenerateUploadUriResult : IUtf8JsonSerializable, IJsonModel + /// Response body for generating an upload URI. + public partial class DevTestLabGenerateUploadUriResult : IJsonModel { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + /// The data to parse. + /// The client options for reading and writing models. + protected virtual DevTestLabGenerateUploadUriResult 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 DeserializeDevTestLabGenerateUploadUriResult(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(DevTestLabGenerateUploadUriResult)} does not support reading '{options.Format}' format."); + } + } + /// The to deserialize the from. + internal static DevTestLabGenerateUploadUriResult FromResponse(Response response) + { + using JsonDocument document = JsonDocument.Parse(response.Content, ModelSerializationExtensions.JsonDocumentOptions); + return DeserializeDevTestLabGenerateUploadUriResult(document.RootElement, ModelSerializationExtensions.WireOptions); + } + + /// The JSON writer. + /// The client options for reading and writing models. void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) { writer.WriteStartObject(); @@ -28,26 +54,25 @@ 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(DevTestLabGenerateUploadUriResult)} does not support writing '{format}' format."); } - if (Optional.IsDefined(UploadUri)) { writer.WritePropertyName("uploadUri"u8); writer.WriteStringValue(UploadUri.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); } @@ -56,53 +81,59 @@ protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWrit } } - DevTestLabGenerateUploadUriResult IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + /// The JSON reader. + /// The client options for reading and writing models. + DevTestLabGenerateUploadUriResult IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) => JsonModelCreateCore(ref reader, options); + + /// The JSON reader. + /// The client options for reading and writing models. + protected virtual DevTestLabGenerateUploadUriResult 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(DevTestLabGenerateUploadUriResult)} does not support reading '{format}' format."); } - using JsonDocument document = JsonDocument.ParseValue(ref reader); return DeserializeDevTestLabGenerateUploadUriResult(document.RootElement, options); } - internal static DevTestLabGenerateUploadUriResult DeserializeDevTestLabGenerateUploadUriResult(JsonElement element, ModelReaderWriterOptions options = null) + /// The JSON element to deserialize. + /// The client options for reading and writing models. + internal static DevTestLabGenerateUploadUriResult DeserializeDevTestLabGenerateUploadUriResult(JsonElement element, ModelReaderWriterOptions options) { - options ??= ModelSerializationExtensions.WireOptions; - if (element.ValueKind == JsonValueKind.Null) { return null; } Uri uploadUri = 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("uploadUri"u8)) + if (prop.NameEquals("uploadUri"u8)) { - if (property.Value.ValueKind == JsonValueKind.Null) + if (prop.Value.ValueKind == JsonValueKind.Null) { continue; } - uploadUri = new Uri(property.Value.GetString()); + uploadUri = string.IsNullOrEmpty(prop.Value.GetString()) ? null : 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 DevTestLabGenerateUploadUriResult(uploadUri, serializedAdditionalRawData); + return new DevTestLabGenerateUploadUriResult(uploadUri, 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": @@ -112,22 +143,11 @@ BinaryData IPersistableModel.Write(ModelReade } } - DevTestLabGenerateUploadUriResult 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 DeserializeDevTestLabGenerateUploadUriResult(document.RootElement, options); - } - default: - throw new FormatException($"The model {nameof(DevTestLabGenerateUploadUriResult)} does not support reading '{options.Format}' format."); - } - } + /// The data to parse. + /// The client options for reading and writing models. + DevTestLabGenerateUploadUriResult IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) => PersistableModelCreateCore(data, options); + /// The client options for reading and writing models. string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; } } diff --git a/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/Models/DevTestLabGenerateUploadUriResult.cs b/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/Models/DevTestLabGenerateUploadUriResult.cs index 4453459c88b5..ee5c9c2e46d4 100644 --- a/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/Models/DevTestLabGenerateUploadUriResult.cs +++ b/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/Models/DevTestLabGenerateUploadUriResult.cs @@ -13,37 +13,8 @@ namespace Azure.ResourceManager.DevTestLabs.Models /// Response body for generating an upload URI. public partial class DevTestLabGenerateUploadUriResult { - /// - /// 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 DevTestLabGenerateUploadUriResult() @@ -52,11 +23,11 @@ internal DevTestLabGenerateUploadUriResult() /// Initializes a new instance of . /// The upload URI for the VHD. - /// Keeps track of any properties unknown to the library. - internal DevTestLabGenerateUploadUriResult(Uri uploadUri, IDictionary serializedAdditionalRawData) + /// Keeps track of any properties unknown to the library. + internal DevTestLabGenerateUploadUriResult(Uri uploadUri, IDictionary additionalBinaryDataProperties) { UploadUri = uploadUri; - _serializedAdditionalRawData = serializedAdditionalRawData; + _additionalBinaryDataProperties = additionalBinaryDataProperties; } /// The upload URI for the VHD. diff --git a/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/Models/DevTestLabGlobalScheduleRetargetContent.Serialization.cs b/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/Models/DevTestLabGlobalScheduleRetargetContent.Serialization.cs index e25d6f11f47d..72be4d5c784f 100644 --- a/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/Models/DevTestLabGlobalScheduleRetargetContent.Serialization.cs +++ b/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/Models/DevTestLabGlobalScheduleRetargetContent.Serialization.cs @@ -10,13 +10,32 @@ using System.Collections.Generic; using System.Text.Json; using Azure.Core; +using Azure.ResourceManager.DevTestLabs; namespace Azure.ResourceManager.DevTestLabs.Models { - public partial class DevTestLabGlobalScheduleRetargetContent : IUtf8JsonSerializable, IJsonModel + /// Properties for retargeting a virtual machine schedule. + public partial class DevTestLabGlobalScheduleRetargetContent : IJsonModel { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + /// The data to parse. + /// The client options for reading and writing models. + protected virtual DevTestLabGlobalScheduleRetargetContent 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 DeserializeDevTestLabGlobalScheduleRetargetContent(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(DevTestLabGlobalScheduleRetargetContent)} does not support reading '{options.Format}' format."); + } + } + /// The JSON writer. + /// The client options for reading and writing models. void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) { writer.WriteStartObject(); @@ -28,12 +47,11 @@ 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(DevTestLabGlobalScheduleRetargetContent)} does not support writing '{format}' format."); } - if (Optional.IsDefined(CurrentResourceId)) { writer.WritePropertyName("currentResourceId"u8); @@ -44,15 +62,15 @@ protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWrit writer.WritePropertyName("targetResourceId"u8); writer.WriteStringValue(TargetResourceId); } - 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,63 +79,69 @@ protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWrit } } - DevTestLabGlobalScheduleRetargetContent IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + /// The JSON reader. + /// The client options for reading and writing models. + DevTestLabGlobalScheduleRetargetContent IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) => JsonModelCreateCore(ref reader, options); + + /// The JSON reader. + /// The client options for reading and writing models. + protected virtual DevTestLabGlobalScheduleRetargetContent 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(DevTestLabGlobalScheduleRetargetContent)} does not support reading '{format}' format."); } - using JsonDocument document = JsonDocument.ParseValue(ref reader); return DeserializeDevTestLabGlobalScheduleRetargetContent(document.RootElement, options); } - internal static DevTestLabGlobalScheduleRetargetContent DeserializeDevTestLabGlobalScheduleRetargetContent(JsonElement element, ModelReaderWriterOptions options = null) + /// The JSON element to deserialize. + /// The client options for reading and writing models. + internal static DevTestLabGlobalScheduleRetargetContent DeserializeDevTestLabGlobalScheduleRetargetContent(JsonElement element, ModelReaderWriterOptions options) { - options ??= ModelSerializationExtensions.WireOptions; - if (element.ValueKind == JsonValueKind.Null) { return null; } ResourceIdentifier currentResourceId = default; ResourceIdentifier targetResourceId = 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("currentResourceId"u8)) + if (prop.NameEquals("currentResourceId"u8)) { - if (property.Value.ValueKind == JsonValueKind.Null) + if (prop.Value.ValueKind == JsonValueKind.Null) { continue; } - currentResourceId = new ResourceIdentifier(property.Value.GetString()); + currentResourceId = new ResourceIdentifier(prop.Value.GetString()); continue; } - if (property.NameEquals("targetResourceId"u8)) + if (prop.NameEquals("targetResourceId"u8)) { - if (property.Value.ValueKind == JsonValueKind.Null) + if (prop.Value.ValueKind == JsonValueKind.Null) { continue; } - targetResourceId = new ResourceIdentifier(property.Value.GetString()); + targetResourceId = new ResourceIdentifier(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 DevTestLabGlobalScheduleRetargetContent(currentResourceId, targetResourceId, serializedAdditionalRawData); + return new DevTestLabGlobalScheduleRetargetContent(currentResourceId, targetResourceId, 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": @@ -127,22 +151,23 @@ BinaryData IPersistableModel.Write(Mode } } - DevTestLabGlobalScheduleRetargetContent 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. + DevTestLabGlobalScheduleRetargetContent IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) => PersistableModelCreateCore(data, options); - switch (format) + /// The client options for reading and writing models. + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + + /// The to serialize into . + internal static RequestContent ToRequestContent(DevTestLabGlobalScheduleRetargetContent devTestLabGlobalScheduleRetargetContent) + { + if (devTestLabGlobalScheduleRetargetContent == null) { - case "J": - { - using JsonDocument document = JsonDocument.Parse(data, ModelSerializationExtensions.JsonDocumentOptions); - return DeserializeDevTestLabGlobalScheduleRetargetContent(document.RootElement, options); - } - default: - throw new FormatException($"The model {nameof(DevTestLabGlobalScheduleRetargetContent)} does not support reading '{options.Format}' format."); + return null; } + Utf8JsonRequestContent content = new Utf8JsonRequestContent(); + content.JsonWriter.WriteObjectValue(devTestLabGlobalScheduleRetargetContent, ModelSerializationExtensions.WireOptions); + return content; } - - string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; } } diff --git a/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/Models/DevTestLabGlobalScheduleRetargetContent.cs b/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/Models/DevTestLabGlobalScheduleRetargetContent.cs index 3eefec6c604b..b0eee0fcf74c 100644 --- a/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/Models/DevTestLabGlobalScheduleRetargetContent.cs +++ b/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/Models/DevTestLabGlobalScheduleRetargetContent.cs @@ -14,37 +14,8 @@ namespace Azure.ResourceManager.DevTestLabs.Models /// Properties for retargeting a virtual machine schedule. public partial class DevTestLabGlobalScheduleRetargetContent { - /// - /// 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 DevTestLabGlobalScheduleRetargetContent() @@ -54,16 +25,17 @@ public DevTestLabGlobalScheduleRetargetContent() /// Initializes a new instance of . /// The resource Id of the virtual machine on which the schedule operates. /// The resource Id of the virtual machine that the schedule should be retargeted to. - /// Keeps track of any properties unknown to the library. - internal DevTestLabGlobalScheduleRetargetContent(ResourceIdentifier currentResourceId, ResourceIdentifier targetResourceId, IDictionary serializedAdditionalRawData) + /// Keeps track of any properties unknown to the library. + internal DevTestLabGlobalScheduleRetargetContent(ResourceIdentifier currentResourceId, ResourceIdentifier targetResourceId, IDictionary additionalBinaryDataProperties) { CurrentResourceId = currentResourceId; TargetResourceId = targetResourceId; - _serializedAdditionalRawData = serializedAdditionalRawData; + _additionalBinaryDataProperties = additionalBinaryDataProperties; } /// The resource Id of the virtual machine on which the schedule operates. public ResourceIdentifier CurrentResourceId { get; set; } + /// The resource Id of the virtual machine that the schedule should be retargeted to. public ResourceIdentifier TargetResourceId { get; set; } } diff --git a/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/Models/DevTestLabHostCachingOption.cs b/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/Models/DevTestLabHostCachingOption.cs index 99c36dd9ace2..e85913b965c2 100644 --- a/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/Models/DevTestLabHostCachingOption.cs +++ b/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/Models/DevTestLabHostCachingOption.cs @@ -7,6 +7,7 @@ using System; using System.ComponentModel; +using Azure.ResourceManager.DevTestLabs; namespace Azure.ResourceManager.DevTestLabs.Models { @@ -14,41 +15,59 @@ namespace Azure.ResourceManager.DevTestLabs.Models public readonly partial struct DevTestLabHostCachingOption : IEquatable { private readonly string _value; + private const string NoneValue = "None"; + private const string ReadOnlyValue = "ReadOnly"; + private const string ReadWriteValue = "ReadWrite"; /// Initializes a new instance of . + /// The value. /// is null. public DevTestLabHostCachingOption(string value) { - _value = value ?? throw new ArgumentNullException(nameof(value)); - } + Argument.AssertNotNull(value, nameof(value)); - private const string NoneValue = "None"; - private const string ReadOnlyValue = "ReadOnly"; - private const string ReadWriteValue = "ReadWrite"; + _value = value; + } - /// None. + /// Gets the None. public static DevTestLabHostCachingOption None { get; } = new DevTestLabHostCachingOption(NoneValue); - /// ReadOnly. + + /// Gets the ReadOnly. public static DevTestLabHostCachingOption ReadOnly { get; } = new DevTestLabHostCachingOption(ReadOnlyValue); - /// ReadWrite. + + /// Gets the ReadWrite. public static DevTestLabHostCachingOption ReadWrite { get; } = new DevTestLabHostCachingOption(ReadWriteValue); + /// Determines if two values are the same. + /// The left value to compare. + /// The right value to compare. public static bool operator ==(DevTestLabHostCachingOption left, DevTestLabHostCachingOption 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 !=(DevTestLabHostCachingOption left, DevTestLabHostCachingOption right) => !left.Equals(right); - /// Converts a to a . + + /// Converts a string to a . + /// The value. public static implicit operator DevTestLabHostCachingOption(string value) => new DevTestLabHostCachingOption(value); - /// + /// Converts a string to a . + /// The value. + public static implicit operator DevTestLabHostCachingOption?(string value) => value == null ? null : new DevTestLabHostCachingOption(value); + + /// [EditorBrowsable(EditorBrowsableState.Never)] public override bool Equals(object obj) => obj is DevTestLabHostCachingOption other && Equals(other); - /// + + /// public bool Equals(DevTestLabHostCachingOption 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/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/Models/DevTestLabImportVmContent.Serialization.cs b/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/Models/DevTestLabImportVmContent.Serialization.cs index 9b6a17f5a469..718719c59f07 100644 --- a/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/Models/DevTestLabImportVmContent.Serialization.cs +++ b/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/Models/DevTestLabImportVmContent.Serialization.cs @@ -10,13 +10,32 @@ using System.Collections.Generic; using System.Text.Json; using Azure.Core; +using Azure.ResourceManager.DevTestLabs; namespace Azure.ResourceManager.DevTestLabs.Models { - public partial class DevTestLabImportVmContent : IUtf8JsonSerializable, IJsonModel + /// This represents the payload required to import a virtual machine from a different lab into the current one. + public partial class DevTestLabImportVmContent : IJsonModel { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + /// The data to parse. + /// The client options for reading and writing models. + protected virtual DevTestLabImportVmContent 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 DeserializeDevTestLabImportVmContent(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(DevTestLabImportVmContent)} does not support reading '{options.Format}' format."); + } + } + /// The JSON writer. + /// The client options for reading and writing models. void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) { writer.WriteStartObject(); @@ -28,12 +47,11 @@ void IJsonModel.Write(Utf8JsonWriter writer, ModelRea /// 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(DevTestLabImportVmContent)} does not support writing '{format}' format."); } - if (Optional.IsDefined(SourceVmResourceId)) { writer.WritePropertyName("sourceVirtualMachineResourceId"u8); @@ -44,15 +62,15 @@ protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWrit writer.WritePropertyName("destinationVirtualMachineName"u8); writer.WriteStringValue(DestinationVmName); } - 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,59 +79,65 @@ protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWrit } } - DevTestLabImportVmContent IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + /// The JSON reader. + /// The client options for reading and writing models. + DevTestLabImportVmContent IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) => JsonModelCreateCore(ref reader, options); + + /// The JSON reader. + /// The client options for reading and writing models. + protected virtual DevTestLabImportVmContent 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(DevTestLabImportVmContent)} does not support reading '{format}' format."); } - using JsonDocument document = JsonDocument.ParseValue(ref reader); return DeserializeDevTestLabImportVmContent(document.RootElement, options); } - internal static DevTestLabImportVmContent DeserializeDevTestLabImportVmContent(JsonElement element, ModelReaderWriterOptions options = null) + /// The JSON element to deserialize. + /// The client options for reading and writing models. + internal static DevTestLabImportVmContent DeserializeDevTestLabImportVmContent(JsonElement element, ModelReaderWriterOptions options) { - options ??= ModelSerializationExtensions.WireOptions; - if (element.ValueKind == JsonValueKind.Null) { return null; } ResourceIdentifier sourceVmResourceId = default; string destinationVmName = 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("sourceVirtualMachineResourceId"u8)) + if (prop.NameEquals("sourceVirtualMachineResourceId"u8)) { - if (property.Value.ValueKind == JsonValueKind.Null) + if (prop.Value.ValueKind == JsonValueKind.Null) { continue; } - sourceVmResourceId = new ResourceIdentifier(property.Value.GetString()); + sourceVmResourceId = new ResourceIdentifier(prop.Value.GetString()); continue; } - if (property.NameEquals("destinationVirtualMachineName"u8)) + if (prop.NameEquals("destinationVirtualMachineName"u8)) { - destinationVmName = property.Value.GetString(); + destinationVmName = 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 DevTestLabImportVmContent(sourceVmResourceId, destinationVmName, serializedAdditionalRawData); + return new DevTestLabImportVmContent(sourceVmResourceId, destinationVmName, 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": @@ -123,22 +147,23 @@ BinaryData IPersistableModel.Write(ModelReaderWriterO } } - DevTestLabImportVmContent 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. + DevTestLabImportVmContent IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) => PersistableModelCreateCore(data, options); - switch (format) + /// The client options for reading and writing models. + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + + /// The to serialize into . + internal static RequestContent ToRequestContent(DevTestLabImportVmContent devTestLabImportVmContent) + { + if (devTestLabImportVmContent == null) { - case "J": - { - using JsonDocument document = JsonDocument.Parse(data, ModelSerializationExtensions.JsonDocumentOptions); - return DeserializeDevTestLabImportVmContent(document.RootElement, options); - } - default: - throw new FormatException($"The model {nameof(DevTestLabImportVmContent)} does not support reading '{options.Format}' format."); + return null; } + Utf8JsonRequestContent content = new Utf8JsonRequestContent(); + content.JsonWriter.WriteObjectValue(devTestLabImportVmContent, ModelSerializationExtensions.WireOptions); + return content; } - - string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; } } diff --git a/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/Models/DevTestLabImportVmContent.cs b/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/Models/DevTestLabImportVmContent.cs index 47477663dfc8..22d3dba810df 100644 --- a/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/Models/DevTestLabImportVmContent.cs +++ b/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/Models/DevTestLabImportVmContent.cs @@ -14,37 +14,8 @@ namespace Azure.ResourceManager.DevTestLabs.Models /// This represents the payload required to import a virtual machine from a different lab into the current one. public partial class DevTestLabImportVmContent { - /// - /// 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 DevTestLabImportVmContent() @@ -54,16 +25,17 @@ public DevTestLabImportVmContent() /// Initializes a new instance of . /// The full resource ID of the virtual machine to be imported. /// The name of the virtual machine in the destination lab. - /// Keeps track of any properties unknown to the library. - internal DevTestLabImportVmContent(ResourceIdentifier sourceVmResourceId, string destinationVmName, IDictionary serializedAdditionalRawData) + /// Keeps track of any properties unknown to the library. + internal DevTestLabImportVmContent(ResourceIdentifier sourceVmResourceId, string destinationVmName, IDictionary additionalBinaryDataProperties) { SourceVmResourceId = sourceVmResourceId; DestinationVmName = destinationVmName; - _serializedAdditionalRawData = serializedAdditionalRawData; + _additionalBinaryDataProperties = additionalBinaryDataProperties; } /// The full resource ID of the virtual machine to be imported. public ResourceIdentifier SourceVmResourceId { get; set; } + /// The name of the virtual machine in the destination lab. public string DestinationVmName { get; set; } } diff --git a/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/Models/DevTestLabInboundNatRule.Serialization.cs b/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/Models/DevTestLabInboundNatRule.Serialization.cs index 95287ef90ae2..f4122548e451 100644 --- a/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/Models/DevTestLabInboundNatRule.Serialization.cs +++ b/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/Models/DevTestLabInboundNatRule.Serialization.cs @@ -9,14 +9,32 @@ using System.ClientModel.Primitives; using System.Collections.Generic; using System.Text.Json; -using Azure.Core; +using Azure.ResourceManager.DevTestLabs; namespace Azure.ResourceManager.DevTestLabs.Models { - public partial class DevTestLabInboundNatRule : IUtf8JsonSerializable, IJsonModel + /// A rule for NAT - exposing a VM's port (backendPort) on the public IP address using a load balancer. + public partial class DevTestLabInboundNatRule : IJsonModel { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + /// The data to parse. + /// The client options for reading and writing models. + protected virtual DevTestLabInboundNatRule 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 DeserializeDevTestLabInboundNatRule(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(DevTestLabInboundNatRule)} does not support reading '{options.Format}' format."); + } + } + /// The JSON writer. + /// The client options for reading and writing models. void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) { writer.WriteStartObject(); @@ -28,12 +46,11 @@ void IJsonModel.Write(Utf8JsonWriter writer, ModelRead /// 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(DevTestLabInboundNatRule)} does not support writing '{format}' format."); } - if (Optional.IsDefined(TransportProtocol)) { writer.WritePropertyName("transportProtocol"u8); @@ -49,15 +66,15 @@ protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWrit writer.WritePropertyName("backendPort"u8); writer.WriteNumberValue(BackendPort.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); } @@ -66,22 +83,27 @@ protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWrit } } - DevTestLabInboundNatRule IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + /// The JSON reader. + /// The client options for reading and writing models. + DevTestLabInboundNatRule IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) => JsonModelCreateCore(ref reader, options); + + /// The JSON reader. + /// The client options for reading and writing models. + protected virtual DevTestLabInboundNatRule 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(DevTestLabInboundNatRule)} does not support reading '{format}' format."); } - using JsonDocument document = JsonDocument.ParseValue(ref reader); return DeserializeDevTestLabInboundNatRule(document.RootElement, options); } - internal static DevTestLabInboundNatRule DeserializeDevTestLabInboundNatRule(JsonElement element, ModelReaderWriterOptions options = null) + /// The JSON element to deserialize. + /// The client options for reading and writing models. + internal static DevTestLabInboundNatRule DeserializeDevTestLabInboundNatRule(JsonElement element, ModelReaderWriterOptions options) { - options ??= ModelSerializationExtensions.WireOptions; - if (element.ValueKind == JsonValueKind.Null) { return null; @@ -89,50 +111,51 @@ internal static DevTestLabInboundNatRule DeserializeDevTestLabInboundNatRule(Jso DevTestLabTransportProtocol? transportProtocol = default; int? frontendPort = default; int? backendPort = 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("transportProtocol"u8)) + if (prop.NameEquals("transportProtocol"u8)) { - if (property.Value.ValueKind == JsonValueKind.Null) + if (prop.Value.ValueKind == JsonValueKind.Null) { continue; } - transportProtocol = new DevTestLabTransportProtocol(property.Value.GetString()); + transportProtocol = new DevTestLabTransportProtocol(prop.Value.GetString()); continue; } - if (property.NameEquals("frontendPort"u8)) + if (prop.NameEquals("frontendPort"u8)) { - if (property.Value.ValueKind == JsonValueKind.Null) + if (prop.Value.ValueKind == JsonValueKind.Null) { continue; } - frontendPort = property.Value.GetInt32(); + frontendPort = prop.Value.GetInt32(); continue; } - if (property.NameEquals("backendPort"u8)) + if (prop.NameEquals("backendPort"u8)) { - if (property.Value.ValueKind == JsonValueKind.Null) + if (prop.Value.ValueKind == JsonValueKind.Null) { continue; } - backendPort = property.Value.GetInt32(); + backendPort = prop.Value.GetInt32(); 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 DevTestLabInboundNatRule(transportProtocol, frontendPort, backendPort, serializedAdditionalRawData); + return new DevTestLabInboundNatRule(transportProtocol, frontendPort, backendPort, 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": @@ -142,22 +165,11 @@ BinaryData IPersistableModel.Write(ModelReaderWriterOp } } - DevTestLabInboundNatRule 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 DeserializeDevTestLabInboundNatRule(document.RootElement, options); - } - default: - throw new FormatException($"The model {nameof(DevTestLabInboundNatRule)} does not support reading '{options.Format}' format."); - } - } + /// The data to parse. + /// The client options for reading and writing models. + DevTestLabInboundNatRule IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) => PersistableModelCreateCore(data, options); + /// The client options for reading and writing models. string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; } } diff --git a/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/Models/DevTestLabInboundNatRule.cs b/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/Models/DevTestLabInboundNatRule.cs index 7422d9465031..f1fe7ba21e8d 100644 --- a/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/Models/DevTestLabInboundNatRule.cs +++ b/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/Models/DevTestLabInboundNatRule.cs @@ -13,37 +13,8 @@ namespace Azure.ResourceManager.DevTestLabs.Models /// A rule for NAT - exposing a VM's port (backendPort) on the public IP address using a load balancer. public partial class DevTestLabInboundNatRule { - /// - /// 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 DevTestLabInboundNatRule() @@ -54,19 +25,21 @@ public DevTestLabInboundNatRule() /// The transport protocol for the endpoint. /// The external endpoint port of the inbound connection. Possible values range between 1 and 65535, inclusive. If unspecified, a value will be allocated automatically. /// The port to which the external traffic will be redirected. - /// Keeps track of any properties unknown to the library. - internal DevTestLabInboundNatRule(DevTestLabTransportProtocol? transportProtocol, int? frontendPort, int? backendPort, IDictionary serializedAdditionalRawData) + /// Keeps track of any properties unknown to the library. + internal DevTestLabInboundNatRule(DevTestLabTransportProtocol? transportProtocol, int? frontendPort, int? backendPort, IDictionary additionalBinaryDataProperties) { TransportProtocol = transportProtocol; FrontendPort = frontendPort; BackendPort = backendPort; - _serializedAdditionalRawData = serializedAdditionalRawData; + _additionalBinaryDataProperties = additionalBinaryDataProperties; } /// The transport protocol for the endpoint. public DevTestLabTransportProtocol? TransportProtocol { get; set; } + /// The external endpoint port of the inbound connection. Possible values range between 1 and 65535, inclusive. If unspecified, a value will be allocated automatically. public int? FrontendPort { get; set; } + /// The port to which the external traffic will be redirected. public int? BackendPort { get; set; } } diff --git a/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/Models/DevTestLabLinuxOSInfo.Serialization.cs b/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/Models/DevTestLabLinuxOSInfo.Serialization.cs new file mode 100644 index 000000000000..d0b86ee9320b --- /dev/null +++ b/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/Models/DevTestLabLinuxOSInfo.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.DevTestLabs; + +namespace Azure.ResourceManager.DevTestLabs.Models +{ + /// Information about a Linux OS. + internal partial class DevTestLabLinuxOSInfo : IJsonModel + { + /// The data to parse. + /// The client options for reading and writing models. + protected virtual DevTestLabLinuxOSInfo 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 DeserializeDevTestLabLinuxOSInfo(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(DevTestLabLinuxOSInfo)} does not support reading '{options.Format}' format."); + } + } + + /// 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(DevTestLabLinuxOSInfo)} does not support writing '{format}' format."); + } + if (Optional.IsDefined(LinuxOSState)) + { + writer.WritePropertyName("linuxOsState"u8); + writer.WriteStringValue(LinuxOSState.Value.ToString()); + } + 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. + DevTestLabLinuxOSInfo IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) => JsonModelCreateCore(ref reader, options); + + /// The JSON reader. + /// The client options for reading and writing models. + protected virtual DevTestLabLinuxOSInfo 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(DevTestLabLinuxOSInfo)} does not support reading '{format}' format."); + } + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeDevTestLabLinuxOSInfo(document.RootElement, options); + } + + /// The JSON element to deserialize. + /// The client options for reading and writing models. + internal static DevTestLabLinuxOSInfo DeserializeDevTestLabLinuxOSInfo(JsonElement element, ModelReaderWriterOptions options) + { + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + DevTestLabLinuxOSState? linuxOSState = default; + IDictionary additionalBinaryDataProperties = new ChangeTrackingDictionary(); + foreach (var prop in element.EnumerateObject()) + { + if (prop.NameEquals("linuxOsState"u8)) + { + if (prop.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + linuxOSState = new DevTestLabLinuxOSState(prop.Value.GetString()); + continue; + } + if (options.Format != "W") + { + additionalBinaryDataProperties.Add(prop.Name, BinaryData.FromString(prop.Value.GetRawText())); + } + } + return new DevTestLabLinuxOSInfo(linuxOSState, 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, AzureResourceManagerDevTestLabsContext.Default); + default: + throw new FormatException($"The model {nameof(DevTestLabLinuxOSInfo)} does not support writing '{options.Format}' format."); + } + } + + /// The data to parse. + /// The client options for reading and writing models. + DevTestLabLinuxOSInfo IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) => PersistableModelCreateCore(data, options); + + /// The client options for reading and writing models. + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + } +} diff --git a/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/Models/DevTestLabLinuxOSInfo.cs b/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/Models/DevTestLabLinuxOSInfo.cs new file mode 100644 index 000000000000..8a034060c739 --- /dev/null +++ b/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/Models/DevTestLabLinuxOSInfo.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.DevTestLabs.Models +{ + /// Information about a Linux OS. + internal partial class DevTestLabLinuxOSInfo + { + /// Keeps track of any properties unknown to the library. + private protected readonly IDictionary _additionalBinaryDataProperties; + + /// Initializes a new instance of . + public DevTestLabLinuxOSInfo() + { + } + + /// Initializes a new instance of . + /// The state of the Linux OS (i.e. NonDeprovisioned, DeprovisionRequested, DeprovisionApplied). + /// Keeps track of any properties unknown to the library. + internal DevTestLabLinuxOSInfo(DevTestLabLinuxOSState? linuxOSState, IDictionary additionalBinaryDataProperties) + { + LinuxOSState = linuxOSState; + _additionalBinaryDataProperties = additionalBinaryDataProperties; + } + + /// The state of the Linux OS (i.e. NonDeprovisioned, DeprovisionRequested, DeprovisionApplied). + public DevTestLabLinuxOSState? LinuxOSState { get; set; } + } +} diff --git a/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/Models/DevTestLabLinuxOSState.cs b/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/Models/DevTestLabLinuxOSState.cs index 2401fd0595a1..4933f4e7e2a8 100644 --- a/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/Models/DevTestLabLinuxOSState.cs +++ b/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/Models/DevTestLabLinuxOSState.cs @@ -7,6 +7,7 @@ using System; using System.ComponentModel; +using Azure.ResourceManager.DevTestLabs; namespace Azure.ResourceManager.DevTestLabs.Models { @@ -14,41 +15,59 @@ namespace Azure.ResourceManager.DevTestLabs.Models public readonly partial struct DevTestLabLinuxOSState : IEquatable { private readonly string _value; + private const string NonDeprovisionedValue = "NonDeprovisioned"; + private const string DeprovisionRequestedValue = "DeprovisionRequested"; + private const string DeprovisionAppliedValue = "DeprovisionApplied"; /// Initializes a new instance of . + /// The value. /// is null. public DevTestLabLinuxOSState(string value) { - _value = value ?? throw new ArgumentNullException(nameof(value)); - } + Argument.AssertNotNull(value, nameof(value)); - private const string NonDeprovisionedValue = "NonDeprovisioned"; - private const string DeprovisionRequestedValue = "DeprovisionRequested"; - private const string DeprovisionAppliedValue = "DeprovisionApplied"; + _value = value; + } - /// NonDeprovisioned. + /// Gets the NonDeprovisioned. public static DevTestLabLinuxOSState NonDeprovisioned { get; } = new DevTestLabLinuxOSState(NonDeprovisionedValue); - /// DeprovisionRequested. + + /// Gets the DeprovisionRequested. public static DevTestLabLinuxOSState DeprovisionRequested { get; } = new DevTestLabLinuxOSState(DeprovisionRequestedValue); - /// DeprovisionApplied. + + /// Gets the DeprovisionApplied. public static DevTestLabLinuxOSState DeprovisionApplied { get; } = new DevTestLabLinuxOSState(DeprovisionAppliedValue); + /// Determines if two values are the same. + /// The left value to compare. + /// The right value to compare. public static bool operator ==(DevTestLabLinuxOSState left, DevTestLabLinuxOSState 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 !=(DevTestLabLinuxOSState left, DevTestLabLinuxOSState right) => !left.Equals(right); - /// Converts a to a . + + /// Converts a string to a . + /// The value. public static implicit operator DevTestLabLinuxOSState(string value) => new DevTestLabLinuxOSState(value); - /// + /// Converts a string to a . + /// The value. + public static implicit operator DevTestLabLinuxOSState?(string value) => value == null ? null : new DevTestLabLinuxOSState(value); + + /// [EditorBrowsable(EditorBrowsableState.Never)] public override bool Equals(object obj) => obj is DevTestLabLinuxOSState other && Equals(other); - /// + + /// public bool Equals(DevTestLabLinuxOSState 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/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/Models/DevTestLabManagedIdentity.Serialization.cs b/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/Models/DevTestLabManagedIdentity.Serialization.cs new file mode 100644 index 000000000000..61708309f744 --- /dev/null +++ b/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/Models/DevTestLabManagedIdentity.Serialization.cs @@ -0,0 +1,184 @@ +// 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.DevTestLabs; +using Azure.ResourceManager.Models; + +namespace Azure.ResourceManager.DevTestLabs.Models +{ + /// Properties of a managed identity. + public partial class DevTestLabManagedIdentity : IJsonModel + { + /// The data to parse. + /// The client options for reading and writing models. + protected virtual DevTestLabManagedIdentity 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 DeserializeDevTestLabManagedIdentity(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(DevTestLabManagedIdentity)} does not support reading '{options.Format}' format."); + } + } + + /// 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(DevTestLabManagedIdentity)} does not support writing '{format}' format."); + } + writer.WritePropertyName("type"u8); + SerializeTypeValue(writer, options); + if (Optional.IsDefined(PrincipalId)) + { + writer.WritePropertyName("principalId"u8); + writer.WriteStringValue(PrincipalId.Value); + } + if (Optional.IsDefined(TenantId)) + { + writer.WritePropertyName("tenantId"u8); + writer.WriteStringValue(TenantId.Value); + } + if (Optional.IsDefined(ClientSecretUri)) + { + writer.WritePropertyName("clientSecretUrl"u8); + writer.WriteStringValue(ClientSecretUri.AbsoluteUri); + } + 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. + DevTestLabManagedIdentity IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) => JsonModelCreateCore(ref reader, options); + + /// The JSON reader. + /// The client options for reading and writing models. + protected virtual DevTestLabManagedIdentity 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(DevTestLabManagedIdentity)} does not support reading '{format}' format."); + } + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeDevTestLabManagedIdentity(document.RootElement, options); + } + + /// The JSON element to deserialize. + /// The client options for reading and writing models. + internal static DevTestLabManagedIdentity DeserializeDevTestLabManagedIdentity(JsonElement element, ModelReaderWriterOptions options) + { + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + ManagedServiceIdentityType managedIdentityType = default; + Guid? principalId = default; + Guid? tenantId = default; + Uri clientSecretUri = default; + IDictionary additionalBinaryDataProperties = new ChangeTrackingDictionary(); + foreach (var prop in element.EnumerateObject()) + { + if (prop.NameEquals("type"u8)) + { + DeserializeTypeValue(prop, ref managedIdentityType); + continue; + } + if (prop.NameEquals("principalId"u8)) + { + if (prop.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + principalId = new Guid(prop.Value.GetString()); + continue; + } + if (prop.NameEquals("tenantId"u8)) + { + if (prop.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + tenantId = new Guid(prop.Value.GetString()); + continue; + } + if (prop.NameEquals("clientSecretUrl"u8)) + { + if (prop.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + clientSecretUri = string.IsNullOrEmpty(prop.Value.GetString()) ? null : new Uri(prop.Value.GetString()); + continue; + } + if (options.Format != "W") + { + additionalBinaryDataProperties.Add(prop.Name, BinaryData.FromString(prop.Value.GetRawText())); + } + } + return new DevTestLabManagedIdentity(managedIdentityType, principalId, tenantId, clientSecretUri, 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, AzureResourceManagerDevTestLabsContext.Default); + default: + throw new FormatException($"The model {nameof(DevTestLabManagedIdentity)} does not support writing '{options.Format}' format."); + } + } + + /// The data to parse. + /// The client options for reading and writing models. + DevTestLabManagedIdentity IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) => PersistableModelCreateCore(data, options); + + /// The client options for reading and writing models. + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + } +} diff --git a/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/Models/DevTestLabManagedIdentity.cs b/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/Models/DevTestLabManagedIdentity.cs new file mode 100644 index 000000000000..e0c0755fd4ca --- /dev/null +++ b/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/Models/DevTestLabManagedIdentity.cs @@ -0,0 +1,49 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; +using Azure.ResourceManager.Models; + +namespace Azure.ResourceManager.DevTestLabs.Models +{ + /// Properties of a managed identity. + public partial class DevTestLabManagedIdentity + { + /// Keeps track of any properties unknown to the library. + private protected readonly IDictionary _additionalBinaryDataProperties; + + /// Initializes a new instance of . + public DevTestLabManagedIdentity() + { + } + + /// Initializes a new instance of . + /// Managed identity. + /// The principal id of resource identity. + /// The tenant identifier of resource. + /// The client secret URL of the identity. + /// Keeps track of any properties unknown to the library. + internal DevTestLabManagedIdentity(ManagedServiceIdentityType managedIdentityType, Guid? principalId, Guid? tenantId, Uri clientSecretUri, IDictionary additionalBinaryDataProperties) + { + ManagedIdentityType = managedIdentityType; + PrincipalId = principalId; + TenantId = tenantId; + ClientSecretUri = clientSecretUri; + _additionalBinaryDataProperties = additionalBinaryDataProperties; + } + + /// The principal id of resource identity. + public Guid? PrincipalId { get; set; } + + /// The tenant identifier of resource. + public Guid? TenantId { get; set; } + + /// The client secret URL of the identity. + public Uri ClientSecretUri { get; set; } + } +} diff --git a/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/Models/DevTestLabNetworkInterface.Serialization.cs b/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/Models/DevTestLabNetworkInterface.Serialization.cs index afc8aa8eb13f..d543d68e06c2 100644 --- a/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/Models/DevTestLabNetworkInterface.Serialization.cs +++ b/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/Models/DevTestLabNetworkInterface.Serialization.cs @@ -10,13 +10,32 @@ using System.Collections.Generic; using System.Text.Json; using Azure.Core; +using Azure.ResourceManager.DevTestLabs; namespace Azure.ResourceManager.DevTestLabs.Models { - public partial class DevTestLabNetworkInterface : IUtf8JsonSerializable, IJsonModel + /// Properties of a network interface. + public partial class DevTestLabNetworkInterface : IJsonModel { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + /// The data to parse. + /// The client options for reading and writing models. + protected virtual DevTestLabNetworkInterface 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 DeserializeDevTestLabNetworkInterface(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(DevTestLabNetworkInterface)} does not support reading '{options.Format}' format."); + } + } + /// The JSON writer. + /// The client options for reading and writing models. void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) { writer.WriteStartObject(); @@ -28,12 +47,11 @@ void IJsonModel.Write(Utf8JsonWriter writer, ModelRe /// The client options for reading and writing models. protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; if (format != "J") { throw new FormatException($"The model {nameof(DevTestLabNetworkInterface)} does not support writing '{format}' format."); } - if (Optional.IsDefined(VirtualNetworkId)) { writer.WritePropertyName("virtualNetworkId"u8); @@ -79,15 +97,15 @@ protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWrit writer.WritePropertyName("sharedPublicIpAddressConfiguration"u8); writer.WriteObjectValue(SharedPublicIPAddressConfiguration, 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); } @@ -96,22 +114,27 @@ protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWrit } } - DevTestLabNetworkInterface IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + /// The JSON reader. + /// The client options for reading and writing models. + DevTestLabNetworkInterface IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) => JsonModelCreateCore(ref reader, options); + + /// The JSON reader. + /// The client options for reading and writing models. + protected virtual DevTestLabNetworkInterface 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(DevTestLabNetworkInterface)} does not support reading '{format}' format."); } - using JsonDocument document = JsonDocument.ParseValue(ref reader); return DeserializeDevTestLabNetworkInterface(document.RootElement, options); } - internal static DevTestLabNetworkInterface DeserializeDevTestLabNetworkInterface(JsonElement element, ModelReaderWriterOptions options = null) + /// The JSON element to deserialize. + /// The client options for reading and writing models. + internal static DevTestLabNetworkInterface DeserializeDevTestLabNetworkInterface(JsonElement element, ModelReaderWriterOptions options) { - options ??= ModelSerializationExtensions.WireOptions; - if (element.ValueKind == JsonValueKind.Null) { return null; @@ -124,78 +147,76 @@ internal static DevTestLabNetworkInterface DeserializeDevTestLabNetworkInterface string dnsName = default; string rdpAuthority = default; string sshAuthority = default; - SharedPublicIPAddressConfiguration sharedPublicIPAddressConfiguration = default; - IDictionary serializedAdditionalRawData = default; - Dictionary rawDataDictionary = new Dictionary(); - foreach (var property in element.EnumerateObject()) + SharedPublicIpAddressConfiguration sharedPublicIPAddressConfiguration = default; + IDictionary additionalBinaryDataProperties = new ChangeTrackingDictionary(); + foreach (var prop in element.EnumerateObject()) { - if (property.NameEquals("virtualNetworkId"u8)) + if (prop.NameEquals("virtualNetworkId"u8)) { - if (property.Value.ValueKind == JsonValueKind.Null) + if (prop.Value.ValueKind == JsonValueKind.Null) { continue; } - virtualNetworkId = new ResourceIdentifier(property.Value.GetString()); + virtualNetworkId = new ResourceIdentifier(prop.Value.GetString()); continue; } - if (property.NameEquals("subnetId"u8)) + if (prop.NameEquals("subnetId"u8)) { - if (property.Value.ValueKind == JsonValueKind.Null) + if (prop.Value.ValueKind == JsonValueKind.Null) { continue; } - subnetId = new ResourceIdentifier(property.Value.GetString()); + subnetId = new ResourceIdentifier(prop.Value.GetString()); continue; } - if (property.NameEquals("publicIpAddressId"u8)) + if (prop.NameEquals("publicIpAddressId"u8)) { - if (property.Value.ValueKind == JsonValueKind.Null) + if (prop.Value.ValueKind == JsonValueKind.Null) { continue; } - publicIPAddressId = new ResourceIdentifier(property.Value.GetString()); + publicIPAddressId = new ResourceIdentifier(prop.Value.GetString()); continue; } - if (property.NameEquals("publicIpAddress"u8)) + if (prop.NameEquals("publicIpAddress"u8)) { - publicIPAddress = property.Value.GetString(); + publicIPAddress = prop.Value.GetString(); continue; } - if (property.NameEquals("privateIpAddress"u8)) + if (prop.NameEquals("privateIpAddress"u8)) { - privateIPAddress = property.Value.GetString(); + privateIPAddress = prop.Value.GetString(); continue; } - if (property.NameEquals("dnsName"u8)) + if (prop.NameEquals("dnsName"u8)) { - dnsName = property.Value.GetString(); + dnsName = prop.Value.GetString(); continue; } - if (property.NameEquals("rdpAuthority"u8)) + if (prop.NameEquals("rdpAuthority"u8)) { - rdpAuthority = property.Value.GetString(); + rdpAuthority = prop.Value.GetString(); continue; } - if (property.NameEquals("sshAuthority"u8)) + if (prop.NameEquals("sshAuthority"u8)) { - sshAuthority = property.Value.GetString(); + sshAuthority = prop.Value.GetString(); continue; } - if (property.NameEquals("sharedPublicIpAddressConfiguration"u8)) + if (prop.NameEquals("sharedPublicIpAddressConfiguration"u8)) { - if (property.Value.ValueKind == JsonValueKind.Null) + if (prop.Value.ValueKind == JsonValueKind.Null) { continue; } - sharedPublicIPAddressConfiguration = SharedPublicIPAddressConfiguration.DeserializeSharedPublicIPAddressConfiguration(property.Value, options); + sharedPublicIPAddressConfiguration = SharedPublicIpAddressConfiguration.DeserializeSharedPublicIpAddressConfiguration(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 DevTestLabNetworkInterface( virtualNetworkId, subnetId, @@ -206,13 +227,16 @@ internal static DevTestLabNetworkInterface DeserializeDevTestLabNetworkInterface rdpAuthority, sshAuthority, sharedPublicIPAddressConfiguration, - serializedAdditionalRawData); + 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": @@ -222,22 +246,11 @@ BinaryData IPersistableModel.Write(ModelReaderWriter } } - DevTestLabNetworkInterface 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 DeserializeDevTestLabNetworkInterface(document.RootElement, options); - } - default: - throw new FormatException($"The model {nameof(DevTestLabNetworkInterface)} does not support reading '{options.Format}' format."); - } - } + /// The data to parse. + /// The client options for reading and writing models. + DevTestLabNetworkInterface IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) => PersistableModelCreateCore(data, options); + /// The client options for reading and writing models. string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; } } diff --git a/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/Models/DevTestLabNetworkInterface.cs b/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/Models/DevTestLabNetworkInterface.cs index 737f43a5ba60..0b9c036b09a0 100644 --- a/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/Models/DevTestLabNetworkInterface.cs +++ b/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/Models/DevTestLabNetworkInterface.cs @@ -14,37 +14,8 @@ namespace Azure.ResourceManager.DevTestLabs.Models /// Properties of a network interface. public partial class DevTestLabNetworkInterface { - /// - /// 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 DevTestLabNetworkInterface() @@ -61,8 +32,8 @@ public DevTestLabNetworkInterface() /// The RdpAuthority property is a server DNS host name or IP address followed by the service port number for RDP (Remote Desktop Protocol). /// The SshAuthority property is a server DNS host name or IP address followed by the service port number for SSH. /// The configuration for sharing a public IP address across multiple virtual machines. - /// Keeps track of any properties unknown to the library. - internal DevTestLabNetworkInterface(ResourceIdentifier virtualNetworkId, ResourceIdentifier subnetId, ResourceIdentifier publicIPAddressId, string publicIPAddress, string privateIPAddress, string dnsName, string rdpAuthority, string sshAuthority, SharedPublicIPAddressConfiguration sharedPublicIPAddressConfiguration, IDictionary serializedAdditionalRawData) + /// Keeps track of any properties unknown to the library. + internal DevTestLabNetworkInterface(ResourceIdentifier virtualNetworkId, ResourceIdentifier subnetId, ResourceIdentifier publicIPAddressId, string publicIPAddress, string privateIPAddress, string dnsName, string rdpAuthority, string sshAuthority, SharedPublicIpAddressConfiguration sharedPublicIPAddressConfiguration, IDictionary additionalBinaryDataProperties) { VirtualNetworkId = virtualNetworkId; SubnetId = subnetId; @@ -73,34 +44,45 @@ internal DevTestLabNetworkInterface(ResourceIdentifier virtualNetworkId, Resourc RdpAuthority = rdpAuthority; SshAuthority = sshAuthority; SharedPublicIPAddressConfiguration = sharedPublicIPAddressConfiguration; - _serializedAdditionalRawData = serializedAdditionalRawData; + _additionalBinaryDataProperties = additionalBinaryDataProperties; } /// The resource ID of the virtual network. public ResourceIdentifier VirtualNetworkId { get; set; } + /// The resource ID of the sub net. public ResourceIdentifier SubnetId { get; set; } + /// The resource ID of the public IP address. public ResourceIdentifier PublicIPAddressId { get; set; } + /// The public IP address. public string PublicIPAddress { get; set; } + /// The private IP address. public string PrivateIPAddress { get; set; } + /// The DNS name. public string DnsName { get; set; } + /// The RdpAuthority property is a server DNS host name or IP address followed by the service port number for RDP (Remote Desktop Protocol). public string RdpAuthority { get; set; } + /// The SshAuthority property is a server DNS host name or IP address followed by the service port number for SSH. public string SshAuthority { get; set; } + /// The configuration for sharing a public IP address across multiple virtual machines. - internal SharedPublicIPAddressConfiguration SharedPublicIPAddressConfiguration { get; set; } + internal SharedPublicIpAddressConfiguration SharedPublicIPAddressConfiguration { get; set; } + /// The incoming NAT rules. public IList SharedPublicIPAddressInboundNatRules { get { if (SharedPublicIPAddressConfiguration is null) - SharedPublicIPAddressConfiguration = new SharedPublicIPAddressConfiguration(); + { + SharedPublicIPAddressConfiguration = new SharedPublicIpAddressConfiguration(); + } return SharedPublicIPAddressConfiguration.InboundNatRules; } } diff --git a/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/Models/DevTestLabNotificationChannelEvent.Serialization.cs b/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/Models/DevTestLabNotificationChannelEvent.Serialization.cs index 4a76b9cbe86a..df6113448480 100644 --- a/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/Models/DevTestLabNotificationChannelEvent.Serialization.cs +++ b/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/Models/DevTestLabNotificationChannelEvent.Serialization.cs @@ -9,14 +9,32 @@ using System.ClientModel.Primitives; using System.Collections.Generic; using System.Text.Json; -using Azure.Core; +using Azure.ResourceManager.DevTestLabs; namespace Azure.ResourceManager.DevTestLabs.Models { - public partial class DevTestLabNotificationChannelEvent : IUtf8JsonSerializable, IJsonModel + /// An event to be notified for. + public partial class DevTestLabNotificationChannelEvent : IJsonModel { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + /// The data to parse. + /// The client options for reading and writing models. + protected virtual DevTestLabNotificationChannelEvent 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 DeserializeDevTestLabNotificationChannelEvent(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(DevTestLabNotificationChannelEvent)} does not support reading '{options.Format}' format."); + } + } + /// The JSON writer. + /// The client options for reading and writing models. void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) { writer.WriteStartObject(); @@ -28,26 +46,25 @@ 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(DevTestLabNotificationChannelEvent)} does not support writing '{format}' format."); } - if (Optional.IsDefined(EventName)) { writer.WritePropertyName("eventName"u8); writer.WriteStringValue(EventName.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); } @@ -56,53 +73,59 @@ protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWrit } } - DevTestLabNotificationChannelEvent IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + /// The JSON reader. + /// The client options for reading and writing models. + DevTestLabNotificationChannelEvent IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) => JsonModelCreateCore(ref reader, options); + + /// The JSON reader. + /// The client options for reading and writing models. + protected virtual DevTestLabNotificationChannelEvent 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(DevTestLabNotificationChannelEvent)} does not support reading '{format}' format."); } - using JsonDocument document = JsonDocument.ParseValue(ref reader); return DeserializeDevTestLabNotificationChannelEvent(document.RootElement, options); } - internal static DevTestLabNotificationChannelEvent DeserializeDevTestLabNotificationChannelEvent(JsonElement element, ModelReaderWriterOptions options = null) + /// The JSON element to deserialize. + /// The client options for reading and writing models. + internal static DevTestLabNotificationChannelEvent DeserializeDevTestLabNotificationChannelEvent(JsonElement element, ModelReaderWriterOptions options) { - options ??= ModelSerializationExtensions.WireOptions; - if (element.ValueKind == JsonValueKind.Null) { return null; } DevTestLabNotificationChannelEventType? eventName = 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("eventName"u8)) + if (prop.NameEquals("eventName"u8)) { - if (property.Value.ValueKind == JsonValueKind.Null) + if (prop.Value.ValueKind == JsonValueKind.Null) { continue; } - eventName = new DevTestLabNotificationChannelEventType(property.Value.GetString()); + eventName = new DevTestLabNotificationChannelEventType(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 DevTestLabNotificationChannelEvent(eventName, serializedAdditionalRawData); + return new DevTestLabNotificationChannelEvent(eventName, 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": @@ -112,22 +135,11 @@ BinaryData IPersistableModel.Write(ModelRead } } - DevTestLabNotificationChannelEvent 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 DeserializeDevTestLabNotificationChannelEvent(document.RootElement, options); - } - default: - throw new FormatException($"The model {nameof(DevTestLabNotificationChannelEvent)} does not support reading '{options.Format}' format."); - } - } + /// The data to parse. + /// The client options for reading and writing models. + DevTestLabNotificationChannelEvent IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) => PersistableModelCreateCore(data, options); + /// The client options for reading and writing models. string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; } } diff --git a/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/Models/DevTestLabNotificationChannelEvent.cs b/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/Models/DevTestLabNotificationChannelEvent.cs index 140d7ef54f62..0390cea0540d 100644 --- a/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/Models/DevTestLabNotificationChannelEvent.cs +++ b/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/Models/DevTestLabNotificationChannelEvent.cs @@ -13,37 +13,8 @@ namespace Azure.ResourceManager.DevTestLabs.Models /// An event to be notified for. public partial class DevTestLabNotificationChannelEvent { - /// - /// 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 DevTestLabNotificationChannelEvent() @@ -52,11 +23,11 @@ public DevTestLabNotificationChannelEvent() /// Initializes a new instance of . /// The event type for which this notification is enabled (i.e. AutoShutdown, Cost). - /// Keeps track of any properties unknown to the library. - internal DevTestLabNotificationChannelEvent(DevTestLabNotificationChannelEventType? eventName, IDictionary serializedAdditionalRawData) + /// Keeps track of any properties unknown to the library. + internal DevTestLabNotificationChannelEvent(DevTestLabNotificationChannelEventType? eventName, IDictionary additionalBinaryDataProperties) { EventName = eventName; - _serializedAdditionalRawData = serializedAdditionalRawData; + _additionalBinaryDataProperties = additionalBinaryDataProperties; } /// The event type for which this notification is enabled (i.e. AutoShutdown, Cost). diff --git a/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/Models/DevTestLabNotificationChannelEventType.cs b/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/Models/DevTestLabNotificationChannelEventType.cs index 4a165b7e495c..a8acecf9bc20 100644 --- a/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/Models/DevTestLabNotificationChannelEventType.cs +++ b/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/Models/DevTestLabNotificationChannelEventType.cs @@ -7,6 +7,7 @@ using System; using System.ComponentModel; +using Azure.ResourceManager.DevTestLabs; namespace Azure.ResourceManager.DevTestLabs.Models { @@ -14,38 +15,55 @@ namespace Azure.ResourceManager.DevTestLabs.Models public readonly partial struct DevTestLabNotificationChannelEventType : IEquatable { private readonly string _value; + private const string AutoShutdownValue = "AutoShutdown"; + private const string CostValue = "Cost"; /// Initializes a new instance of . + /// The value. /// is null. public DevTestLabNotificationChannelEventType(string value) { - _value = value ?? throw new ArgumentNullException(nameof(value)); - } + Argument.AssertNotNull(value, nameof(value)); - private const string AutoShutdownValue = "AutoShutdown"; - private const string CostValue = "Cost"; + _value = value; + } - /// AutoShutdown. + /// Gets the AutoShutdown. public static DevTestLabNotificationChannelEventType AutoShutdown { get; } = new DevTestLabNotificationChannelEventType(AutoShutdownValue); - /// Cost. + + /// Gets the Cost. public static DevTestLabNotificationChannelEventType Cost { get; } = new DevTestLabNotificationChannelEventType(CostValue); + /// Determines if two values are the same. + /// The left value to compare. + /// The right value to compare. public static bool operator ==(DevTestLabNotificationChannelEventType left, DevTestLabNotificationChannelEventType 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 !=(DevTestLabNotificationChannelEventType left, DevTestLabNotificationChannelEventType right) => !left.Equals(right); - /// Converts a to a . + + /// Converts a string to a . + /// The value. public static implicit operator DevTestLabNotificationChannelEventType(string value) => new DevTestLabNotificationChannelEventType(value); - /// + /// Converts a string to a . + /// The value. + public static implicit operator DevTestLabNotificationChannelEventType?(string value) => value == null ? null : new DevTestLabNotificationChannelEventType(value); + + /// [EditorBrowsable(EditorBrowsableState.Never)] public override bool Equals(object obj) => obj is DevTestLabNotificationChannelEventType other && Equals(other); - /// + + /// public bool Equals(DevTestLabNotificationChannelEventType 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/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/Models/DevTestLabNotificationChannelNotifyContent.Serialization.cs b/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/Models/DevTestLabNotificationChannelNotifyContent.Serialization.cs index dac32311eed4..018661782db3 100644 --- a/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/Models/DevTestLabNotificationChannelNotifyContent.Serialization.cs +++ b/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/Models/DevTestLabNotificationChannelNotifyContent.Serialization.cs @@ -10,13 +10,32 @@ using System.Collections.Generic; using System.Text.Json; using Azure.Core; +using Azure.ResourceManager.DevTestLabs; namespace Azure.ResourceManager.DevTestLabs.Models { - public partial class DevTestLabNotificationChannelNotifyContent : IUtf8JsonSerializable, IJsonModel + /// Properties for generating a Notification. + public partial class DevTestLabNotificationChannelNotifyContent : IJsonModel { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + /// The data to parse. + /// The client options for reading and writing models. + protected virtual DevTestLabNotificationChannelNotifyContent 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 DeserializeDevTestLabNotificationChannelNotifyContent(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(DevTestLabNotificationChannelNotifyContent)} does not support reading '{options.Format}' format."); + } + } + /// The JSON writer. + /// The client options for reading and writing models. void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) { writer.WriteStartObject(); @@ -28,12 +47,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(DevTestLabNotificationChannelNotifyContent)} does not support writing '{format}' format."); } - if (Optional.IsDefined(EventName)) { writer.WritePropertyName("eventName"u8); @@ -44,15 +62,15 @@ protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWrit writer.WritePropertyName("jsonPayload"u8); writer.WriteStringValue(JsonPayload); } - 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,59 +79,65 @@ protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWrit } } - DevTestLabNotificationChannelNotifyContent IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + /// The JSON reader. + /// The client options for reading and writing models. + DevTestLabNotificationChannelNotifyContent IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) => JsonModelCreateCore(ref reader, options); + + /// The JSON reader. + /// The client options for reading and writing models. + protected virtual DevTestLabNotificationChannelNotifyContent 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(DevTestLabNotificationChannelNotifyContent)} does not support reading '{format}' format."); } - using JsonDocument document = JsonDocument.ParseValue(ref reader); return DeserializeDevTestLabNotificationChannelNotifyContent(document.RootElement, options); } - internal static DevTestLabNotificationChannelNotifyContent DeserializeDevTestLabNotificationChannelNotifyContent(JsonElement element, ModelReaderWriterOptions options = null) + /// The JSON element to deserialize. + /// The client options for reading and writing models. + internal static DevTestLabNotificationChannelNotifyContent DeserializeDevTestLabNotificationChannelNotifyContent(JsonElement element, ModelReaderWriterOptions options) { - options ??= ModelSerializationExtensions.WireOptions; - if (element.ValueKind == JsonValueKind.Null) { return null; } DevTestLabNotificationChannelEventType? eventName = default; string jsonPayload = 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("eventName"u8)) + if (prop.NameEquals("eventName"u8)) { - if (property.Value.ValueKind == JsonValueKind.Null) + if (prop.Value.ValueKind == JsonValueKind.Null) { continue; } - eventName = new DevTestLabNotificationChannelEventType(property.Value.GetString()); + eventName = new DevTestLabNotificationChannelEventType(prop.Value.GetString()); continue; } - if (property.NameEquals("jsonPayload"u8)) + if (prop.NameEquals("jsonPayload"u8)) { - jsonPayload = property.Value.GetString(); + jsonPayload = 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 DevTestLabNotificationChannelNotifyContent(eventName, jsonPayload, serializedAdditionalRawData); + return new DevTestLabNotificationChannelNotifyContent(eventName, jsonPayload, 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": @@ -123,22 +147,23 @@ BinaryData IPersistableModel.Write(M } } - DevTestLabNotificationChannelNotifyContent 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. + DevTestLabNotificationChannelNotifyContent IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) => PersistableModelCreateCore(data, options); - switch (format) + /// The client options for reading and writing models. + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + + /// The to serialize into . + internal static RequestContent ToRequestContent(DevTestLabNotificationChannelNotifyContent devTestLabNotificationChannelNotifyContent) + { + if (devTestLabNotificationChannelNotifyContent == null) { - case "J": - { - using JsonDocument document = JsonDocument.Parse(data, ModelSerializationExtensions.JsonDocumentOptions); - return DeserializeDevTestLabNotificationChannelNotifyContent(document.RootElement, options); - } - default: - throw new FormatException($"The model {nameof(DevTestLabNotificationChannelNotifyContent)} does not support reading '{options.Format}' format."); + return null; } + Utf8JsonRequestContent content = new Utf8JsonRequestContent(); + content.JsonWriter.WriteObjectValue(devTestLabNotificationChannelNotifyContent, ModelSerializationExtensions.WireOptions); + return content; } - - string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; } } diff --git a/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/Models/DevTestLabNotificationChannelNotifyContent.cs b/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/Models/DevTestLabNotificationChannelNotifyContent.cs index f385d9e52f8a..f1fbc593e415 100644 --- a/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/Models/DevTestLabNotificationChannelNotifyContent.cs +++ b/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/Models/DevTestLabNotificationChannelNotifyContent.cs @@ -13,37 +13,8 @@ namespace Azure.ResourceManager.DevTestLabs.Models /// Properties for generating a Notification. public partial class DevTestLabNotificationChannelNotifyContent { - /// - /// 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 DevTestLabNotificationChannelNotifyContent() @@ -53,16 +24,17 @@ public DevTestLabNotificationChannelNotifyContent() /// Initializes a new instance of . /// The type of event (i.e. AutoShutdown, Cost). /// Properties for the notification in json format. - /// Keeps track of any properties unknown to the library. - internal DevTestLabNotificationChannelNotifyContent(DevTestLabNotificationChannelEventType? eventName, string jsonPayload, IDictionary serializedAdditionalRawData) + /// Keeps track of any properties unknown to the library. + internal DevTestLabNotificationChannelNotifyContent(DevTestLabNotificationChannelEventType? eventName, string jsonPayload, IDictionary additionalBinaryDataProperties) { EventName = eventName; JsonPayload = jsonPayload; - _serializedAdditionalRawData = serializedAdditionalRawData; + _additionalBinaryDataProperties = additionalBinaryDataProperties; } /// The type of event (i.e. AutoShutdown, Cost). public DevTestLabNotificationChannelEventType? EventName { get; set; } + /// Properties for the notification in json format. public string JsonPayload { get; set; } } diff --git a/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/Models/DevTestLabNotificationChannelPatch.Serialization.cs b/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/Models/DevTestLabNotificationChannelPatch.Serialization.cs index fab9e6c09301..8d079b8b1a9b 100644 --- a/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/Models/DevTestLabNotificationChannelPatch.Serialization.cs +++ b/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/Models/DevTestLabNotificationChannelPatch.Serialization.cs @@ -10,13 +10,32 @@ using System.Collections.Generic; using System.Text.Json; using Azure.Core; +using Azure.ResourceManager.DevTestLabs; namespace Azure.ResourceManager.DevTestLabs.Models { - public partial class DevTestLabNotificationChannelPatch : IUtf8JsonSerializable, IJsonModel + /// A notification. + public partial class DevTestLabNotificationChannelPatch : DevTestLabResourcePatch, IJsonModel { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + /// The data to parse. + /// The client options for reading and writing models. + protected override DevTestLabResourcePatch 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 DeserializeDevTestLabNotificationChannelPatch(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(DevTestLabNotificationChannelPatch)} does not support reading '{options.Format}' format."); + } + } + /// The JSON writer. + /// The client options for reading and writing models. void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) { writer.WriteStartObject(); @@ -28,67 +47,79 @@ void IJsonModel.Write(Utf8JsonWriter writer, /// The client options for reading and writing models. protected override void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; if (format != "J") { throw new FormatException($"The model {nameof(DevTestLabNotificationChannelPatch)} does not support writing '{format}' format."); } - base.JsonModelWriteCore(writer, options); } - DevTestLabNotificationChannelPatch IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + /// The JSON reader. + /// The client options for reading and writing models. + DevTestLabNotificationChannelPatch IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) => (DevTestLabNotificationChannelPatch)JsonModelCreateCore(ref reader, options); + + /// The JSON reader. + /// The client options for reading and writing models. + protected override DevTestLabResourcePatch 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(DevTestLabNotificationChannelPatch)} does not support reading '{format}' format."); } - using JsonDocument document = JsonDocument.ParseValue(ref reader); return DeserializeDevTestLabNotificationChannelPatch(document.RootElement, options); } - internal static DevTestLabNotificationChannelPatch DeserializeDevTestLabNotificationChannelPatch(JsonElement element, ModelReaderWriterOptions options = null) + /// The JSON element to deserialize. + /// The client options for reading and writing models. + internal static DevTestLabNotificationChannelPatch DeserializeDevTestLabNotificationChannelPatch(JsonElement element, ModelReaderWriterOptions options) { - options ??= ModelSerializationExtensions.WireOptions; - if (element.ValueKind == JsonValueKind.Null) { return null; } IDictionary tags = 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("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 (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 DevTestLabNotificationChannelPatch(tags ?? new ChangeTrackingDictionary(), serializedAdditionalRawData); + return new DevTestLabNotificationChannelPatch(tags ?? new ChangeTrackingDictionary(), 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 override BinaryData PersistableModelWriteCore(ModelReaderWriterOptions options) + { + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; switch (format) { case "J": @@ -98,22 +129,23 @@ BinaryData IPersistableModel.Write(ModelRead } } - DevTestLabNotificationChannelPatch 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. + DevTestLabNotificationChannelPatch IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) => (DevTestLabNotificationChannelPatch)PersistableModelCreateCore(data, options); - switch (format) + /// The client options for reading and writing models. + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + + /// The to serialize into . + internal static RequestContent ToRequestContent(DevTestLabNotificationChannelPatch devTestLabNotificationChannelPatch) + { + if (devTestLabNotificationChannelPatch == null) { - case "J": - { - using JsonDocument document = JsonDocument.Parse(data, ModelSerializationExtensions.JsonDocumentOptions); - return DeserializeDevTestLabNotificationChannelPatch(document.RootElement, options); - } - default: - throw new FormatException($"The model {nameof(DevTestLabNotificationChannelPatch)} does not support reading '{options.Format}' format."); + return null; } + Utf8JsonRequestContent content = new Utf8JsonRequestContent(); + content.JsonWriter.WriteObjectValue(devTestLabNotificationChannelPatch, ModelSerializationExtensions.WireOptions); + return content; } - - string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; } } diff --git a/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/Models/DevTestLabNotificationChannelPatch.cs b/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/Models/DevTestLabNotificationChannelPatch.cs index 5853df038cc6..fac684667f92 100644 --- a/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/Models/DevTestLabNotificationChannelPatch.cs +++ b/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/Models/DevTestLabNotificationChannelPatch.cs @@ -20,8 +20,8 @@ public DevTestLabNotificationChannelPatch() /// Initializes a new instance of . /// The tags of the resource. - /// Keeps track of any properties unknown to the library. - internal DevTestLabNotificationChannelPatch(IDictionary tags, IDictionary serializedAdditionalRawData) : base(tags, serializedAdditionalRawData) + /// Keeps track of any properties unknown to the library. + internal DevTestLabNotificationChannelPatch(IDictionary tags, IDictionary additionalBinaryDataProperties) : base(tags, additionalBinaryDataProperties) { } } diff --git a/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/Models/DevTestLabNotificationSettings.Serialization.cs b/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/Models/DevTestLabNotificationSettings.Serialization.cs index e8a64ecb437e..2cb5e51b62b5 100644 --- a/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/Models/DevTestLabNotificationSettings.Serialization.cs +++ b/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/Models/DevTestLabNotificationSettings.Serialization.cs @@ -9,14 +9,32 @@ using System.ClientModel.Primitives; using System.Collections.Generic; using System.Text.Json; -using Azure.Core; +using Azure.ResourceManager.DevTestLabs; namespace Azure.ResourceManager.DevTestLabs.Models { - public partial class DevTestLabNotificationSettings : IUtf8JsonSerializable, IJsonModel + /// Notification settings for a schedule. + public partial class DevTestLabNotificationSettings : IJsonModel { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + /// The data to parse. + /// The client options for reading and writing models. + protected virtual DevTestLabNotificationSettings 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 DeserializeDevTestLabNotificationSettings(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(DevTestLabNotificationSettings)} does not support reading '{options.Format}' format."); + } + } + /// The JSON writer. + /// The client options for reading and writing models. void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) { writer.WriteStartObject(); @@ -28,12 +46,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(DevTestLabNotificationSettings)} does not support writing '{format}' format."); } - if (Optional.IsDefined(Status)) { writer.WritePropertyName("status"u8); @@ -59,15 +76,15 @@ protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWrit writer.WritePropertyName("notificationLocale"u8); writer.WriteStringValue(NotificationLocale); } - 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,91 +93,97 @@ protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWrit } } - DevTestLabNotificationSettings IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + /// The JSON reader. + /// The client options for reading and writing models. + DevTestLabNotificationSettings IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) => JsonModelCreateCore(ref reader, options); + + /// The JSON reader. + /// The client options for reading and writing models. + protected virtual DevTestLabNotificationSettings 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(DevTestLabNotificationSettings)} does not support reading '{format}' format."); } - using JsonDocument document = JsonDocument.ParseValue(ref reader); return DeserializeDevTestLabNotificationSettings(document.RootElement, options); } - internal static DevTestLabNotificationSettings DeserializeDevTestLabNotificationSettings(JsonElement element, ModelReaderWriterOptions options = null) + /// The JSON element to deserialize. + /// The client options for reading and writing models. + internal static DevTestLabNotificationSettings DeserializeDevTestLabNotificationSettings(JsonElement element, ModelReaderWriterOptions options) { - options ??= ModelSerializationExtensions.WireOptions; - if (element.ValueKind == JsonValueKind.Null) { return null; } DevTestLabEnableStatus? status = default; int? timeInMinutes = default; - Uri webhookUrl = default; + Uri webhookUri = default; string emailRecipient = default; string notificationLocale = 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("status"u8)) + if (prop.NameEquals("status"u8)) { - if (property.Value.ValueKind == JsonValueKind.Null) + if (prop.Value.ValueKind == JsonValueKind.Null) { continue; } - status = new DevTestLabEnableStatus(property.Value.GetString()); + status = new DevTestLabEnableStatus(prop.Value.GetString()); continue; } - if (property.NameEquals("timeInMinutes"u8)) + if (prop.NameEquals("timeInMinutes"u8)) { - if (property.Value.ValueKind == JsonValueKind.Null) + if (prop.Value.ValueKind == JsonValueKind.Null) { continue; } - timeInMinutes = property.Value.GetInt32(); + timeInMinutes = prop.Value.GetInt32(); continue; } - if (property.NameEquals("webhookUrl"u8)) + if (prop.NameEquals("webhookUrl"u8)) { - if (property.Value.ValueKind == JsonValueKind.Null) + if (prop.Value.ValueKind == JsonValueKind.Null) { continue; } - webhookUrl = new Uri(property.Value.GetString()); + webhookUri = string.IsNullOrEmpty(prop.Value.GetString()) ? null : new Uri(prop.Value.GetString()); continue; } - if (property.NameEquals("emailRecipient"u8)) + if (prop.NameEquals("emailRecipient"u8)) { - emailRecipient = property.Value.GetString(); + emailRecipient = prop.Value.GetString(); continue; } - if (property.NameEquals("notificationLocale"u8)) + if (prop.NameEquals("notificationLocale"u8)) { - notificationLocale = property.Value.GetString(); + notificationLocale = 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 DevTestLabNotificationSettings( status, timeInMinutes, - webhookUrl, + webhookUri, emailRecipient, notificationLocale, - serializedAdditionalRawData); + 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": @@ -170,22 +193,11 @@ BinaryData IPersistableModel.Write(ModelReaderWr } } - DevTestLabNotificationSettings 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 DeserializeDevTestLabNotificationSettings(document.RootElement, options); - } - default: - throw new FormatException($"The model {nameof(DevTestLabNotificationSettings)} does not support reading '{options.Format}' format."); - } - } + /// The data to parse. + /// The client options for reading and writing models. + DevTestLabNotificationSettings IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) => PersistableModelCreateCore(data, options); + /// The client options for reading and writing models. string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; } } diff --git a/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/Models/DevTestLabNotificationSettings.cs b/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/Models/DevTestLabNotificationSettings.cs index d269bb81e3d2..7cb411ab2edb 100644 --- a/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/Models/DevTestLabNotificationSettings.cs +++ b/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/Models/DevTestLabNotificationSettings.cs @@ -13,37 +13,8 @@ namespace Azure.ResourceManager.DevTestLabs.Models /// Notification settings for a schedule. public partial class DevTestLabNotificationSettings { - /// - /// 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 DevTestLabNotificationSettings() @@ -56,25 +27,29 @@ public DevTestLabNotificationSettings() /// The webhook URL to which the notification will be sent. /// The email recipient to send notifications to (can be a list of semi-colon separated email addresses). /// The locale to use when sending a notification (fallback for unsupported languages is EN). - /// Keeps track of any properties unknown to the library. - internal DevTestLabNotificationSettings(DevTestLabEnableStatus? status, int? timeInMinutes, Uri webhookUri, string emailRecipient, string notificationLocale, IDictionary serializedAdditionalRawData) + /// Keeps track of any properties unknown to the library. + internal DevTestLabNotificationSettings(DevTestLabEnableStatus? status, int? timeInMinutes, Uri webhookUri, string emailRecipient, string notificationLocale, IDictionary additionalBinaryDataProperties) { Status = status; TimeInMinutes = timeInMinutes; WebhookUri = webhookUri; EmailRecipient = emailRecipient; NotificationLocale = notificationLocale; - _serializedAdditionalRawData = serializedAdditionalRawData; + _additionalBinaryDataProperties = additionalBinaryDataProperties; } /// If notifications are enabled for this schedule (i.e. Enabled, Disabled). public DevTestLabEnableStatus? Status { get; set; } + /// Time in minutes before event at which notification will be sent. public int? TimeInMinutes { get; set; } + /// The webhook URL to which the notification will be sent. public Uri WebhookUri { get; set; } + /// The email recipient to send notifications to (can be a list of semi-colon separated email addresses). public string EmailRecipient { get; set; } + /// The locale to use when sending a notification (fallback for unsupported languages is EN). public string NotificationLocale { get; set; } } diff --git a/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/Models/DevTestLabParameter.Serialization.cs b/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/Models/DevTestLabParameter.Serialization.cs index b3ac8fe75c98..bfef260f4117 100644 --- a/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/Models/DevTestLabParameter.Serialization.cs +++ b/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/Models/DevTestLabParameter.Serialization.cs @@ -9,14 +9,32 @@ using System.ClientModel.Primitives; using System.Collections.Generic; using System.Text.Json; -using Azure.Core; +using Azure.ResourceManager.DevTestLabs; namespace Azure.ResourceManager.DevTestLabs.Models { - public partial class DevTestLabParameter : IUtf8JsonSerializable, IJsonModel + /// Information about an artifact's parameter. + public partial class DevTestLabParameter : IJsonModel { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + /// The data to parse. + /// The client options for reading and writing models. + protected virtual DevTestLabParameter 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 DeserializeDevTestLabParameter(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(DevTestLabParameter)} does not support reading '{options.Format}' format."); + } + } + /// The JSON writer. + /// The client options for reading and writing models. void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) { writer.WriteStartObject(); @@ -28,12 +46,11 @@ void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWri /// 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(DevTestLabParameter)} does not support writing '{format}' format."); } - if (Optional.IsDefined(Name)) { writer.WritePropertyName("name"u8); @@ -44,15 +61,15 @@ protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWrit writer.WritePropertyName("value"u8); writer.WriteStringValue(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); } @@ -61,55 +78,61 @@ protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWrit } } - DevTestLabParameter IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + /// The JSON reader. + /// The client options for reading and writing models. + DevTestLabParameter IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) => JsonModelCreateCore(ref reader, options); + + /// The JSON reader. + /// The client options for reading and writing models. + protected virtual DevTestLabParameter 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(DevTestLabParameter)} does not support reading '{format}' format."); } - using JsonDocument document = JsonDocument.ParseValue(ref reader); return DeserializeDevTestLabParameter(document.RootElement, options); } - internal static DevTestLabParameter DeserializeDevTestLabParameter(JsonElement element, ModelReaderWriterOptions options = null) + /// The JSON element to deserialize. + /// The client options for reading and writing models. + internal static DevTestLabParameter DeserializeDevTestLabParameter(JsonElement element, ModelReaderWriterOptions options) { - options ??= ModelSerializationExtensions.WireOptions; - if (element.ValueKind == JsonValueKind.Null) { return null; } string name = default; string value = 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("name"u8)) + if (prop.NameEquals("name"u8)) { - name = property.Value.GetString(); + name = prop.Value.GetString(); continue; } - if (property.NameEquals("value"u8)) + if (prop.NameEquals("value"u8)) { - value = property.Value.GetString(); + value = 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 DevTestLabParameter(name, value, serializedAdditionalRawData); + return new DevTestLabParameter(name, value, 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,22 +142,11 @@ BinaryData IPersistableModel.Write(ModelReaderWriterOptions } } - DevTestLabParameter 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 DeserializeDevTestLabParameter(document.RootElement, options); - } - default: - throw new FormatException($"The model {nameof(DevTestLabParameter)} does not support reading '{options.Format}' format."); - } - } + /// The data to parse. + /// The client options for reading and writing models. + DevTestLabParameter IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) => PersistableModelCreateCore(data, options); + /// The client options for reading and writing models. string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; } } diff --git a/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/Models/DevTestLabParameter.cs b/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/Models/DevTestLabParameter.cs index e2045fa795ac..a5a79aad3bed 100644 --- a/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/Models/DevTestLabParameter.cs +++ b/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/Models/DevTestLabParameter.cs @@ -13,37 +13,8 @@ namespace Azure.ResourceManager.DevTestLabs.Models /// Information about an artifact's parameter. public partial class DevTestLabParameter { - /// - /// 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 DevTestLabParameter() @@ -53,16 +24,17 @@ public DevTestLabParameter() /// Initializes a new instance of . /// The name of the artifact parameter. /// The value of the artifact parameter. - /// Keeps track of any properties unknown to the library. - internal DevTestLabParameter(string name, string value, IDictionary serializedAdditionalRawData) + /// Keeps track of any properties unknown to the library. + internal DevTestLabParameter(string name, string value, IDictionary additionalBinaryDataProperties) { Name = name; Value = value; - _serializedAdditionalRawData = serializedAdditionalRawData; + _additionalBinaryDataProperties = additionalBinaryDataProperties; } /// The name of the artifact parameter. public string Name { get; set; } + /// The value of the artifact parameter. public string Value { get; set; } } diff --git a/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/Models/DevTestLabParametersValueFileInfo.Serialization.cs b/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/Models/DevTestLabParametersValueFileInfo.Serialization.cs index 8ec4adc442b4..97eade7d1077 100644 --- a/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/Models/DevTestLabParametersValueFileInfo.Serialization.cs +++ b/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/Models/DevTestLabParametersValueFileInfo.Serialization.cs @@ -9,14 +9,32 @@ using System.ClientModel.Primitives; using System.Collections.Generic; using System.Text.Json; -using Azure.Core; +using Azure.ResourceManager.DevTestLabs; namespace Azure.ResourceManager.DevTestLabs.Models { - public partial class DevTestLabParametersValueFileInfo : IUtf8JsonSerializable, IJsonModel + /// A file containing a set of parameter values for an ARM template. + public partial class DevTestLabParametersValueFileInfo : IJsonModel { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + /// The data to parse. + /// The client options for reading and writing models. + protected virtual DevTestLabParametersValueFileInfo 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 DeserializeDevTestLabParametersValueFileInfo(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(DevTestLabParametersValueFileInfo)} does not support reading '{options.Format}' format."); + } + } + /// The JSON writer. + /// The client options for reading and writing models. void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) { writer.WriteStartObject(); @@ -28,12 +46,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(DevTestLabParametersValueFileInfo)} does not support writing '{format}' format."); } - if (Optional.IsDefined(FileName)) { writer.WritePropertyName("fileName"u8); @@ -43,23 +60,23 @@ protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWrit { writer.WritePropertyName("parametersValueInfo"u8); #if NET6_0_OR_GREATER - writer.WriteRawValue(ParametersValueInfo); + writer.WriteRawValue(ParametersValueInfo); #else - using (JsonDocument document = JsonDocument.Parse(ParametersValueInfo, ModelSerializationExtensions.JsonDocumentOptions)) + using (JsonDocument document = JsonDocument.Parse(ParametersValueInfo)) { JsonSerializer.Serialize(writer, document.RootElement); } #endif } - 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,59 +85,65 @@ protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWrit } } - DevTestLabParametersValueFileInfo IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + /// The JSON reader. + /// The client options for reading and writing models. + DevTestLabParametersValueFileInfo IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) => JsonModelCreateCore(ref reader, options); + + /// The JSON reader. + /// The client options for reading and writing models. + protected virtual DevTestLabParametersValueFileInfo 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(DevTestLabParametersValueFileInfo)} does not support reading '{format}' format."); } - using JsonDocument document = JsonDocument.ParseValue(ref reader); return DeserializeDevTestLabParametersValueFileInfo(document.RootElement, options); } - internal static DevTestLabParametersValueFileInfo DeserializeDevTestLabParametersValueFileInfo(JsonElement element, ModelReaderWriterOptions options = null) + /// The JSON element to deserialize. + /// The client options for reading and writing models. + internal static DevTestLabParametersValueFileInfo DeserializeDevTestLabParametersValueFileInfo(JsonElement element, ModelReaderWriterOptions options) { - options ??= ModelSerializationExtensions.WireOptions; - if (element.ValueKind == JsonValueKind.Null) { return null; } string fileName = default; BinaryData parametersValueInfo = 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("fileName"u8)) + if (prop.NameEquals("fileName"u8)) { - fileName = property.Value.GetString(); + fileName = prop.Value.GetString(); continue; } - if (property.NameEquals("parametersValueInfo"u8)) + if (prop.NameEquals("parametersValueInfo"u8)) { - if (property.Value.ValueKind == JsonValueKind.Null) + if (prop.Value.ValueKind == JsonValueKind.Null) { continue; } - parametersValueInfo = BinaryData.FromString(property.Value.GetRawText()); + parametersValueInfo = BinaryData.FromString(prop.Value.GetRawText()); 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 DevTestLabParametersValueFileInfo(fileName, parametersValueInfo, serializedAdditionalRawData); + return new DevTestLabParametersValueFileInfo(fileName, parametersValueInfo, 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,22 +153,11 @@ BinaryData IPersistableModel.Write(ModelReade } } - DevTestLabParametersValueFileInfo 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 DeserializeDevTestLabParametersValueFileInfo(document.RootElement, options); - } - default: - throw new FormatException($"The model {nameof(DevTestLabParametersValueFileInfo)} does not support reading '{options.Format}' format."); - } - } + /// The data to parse. + /// The client options for reading and writing models. + DevTestLabParametersValueFileInfo IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) => PersistableModelCreateCore(data, options); + /// The client options for reading and writing models. string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; } } diff --git a/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/Models/DevTestLabParametersValueFileInfo.cs b/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/Models/DevTestLabParametersValueFileInfo.cs index 69bf8945d869..973219293824 100644 --- a/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/Models/DevTestLabParametersValueFileInfo.cs +++ b/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/Models/DevTestLabParametersValueFileInfo.cs @@ -7,43 +7,15 @@ using System; using System.Collections.Generic; +using System.Text.Json; namespace Azure.ResourceManager.DevTestLabs.Models { /// A file containing a set of parameter values for an ARM template. public partial class DevTestLabParametersValueFileInfo { - /// - /// 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 DevTestLabParametersValueFileInfo() @@ -53,42 +25,39 @@ internal DevTestLabParametersValueFileInfo() /// Initializes a new instance of . /// File name. /// Contents of the file. - /// Keeps track of any properties unknown to the library. - internal DevTestLabParametersValueFileInfo(string fileName, BinaryData parametersValueInfo, IDictionary serializedAdditionalRawData) + /// Keeps track of any properties unknown to the library. + internal DevTestLabParametersValueFileInfo(string fileName, BinaryData parametersValueInfo, IDictionary additionalBinaryDataProperties) { FileName = fileName; ParametersValueInfo = parametersValueInfo; - _serializedAdditionalRawData = serializedAdditionalRawData; + _additionalBinaryDataProperties = additionalBinaryDataProperties; } /// File name. public string FileName { get; } + /// /// Contents of the file. - /// - /// To assign an object to this property use . - /// - /// - /// To assign an already formatted json string to this property use . - /// + /// 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.FromObjectAsJson("foo"). + /// Creates a payload of "foo". /// /// - /// BinaryData.FromString("\"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.FromObjectAsJson(new { key = "value" }). + /// Creates a payload of { "key": "value" }. /// /// - /// BinaryData.FromString("{\"key\": \"value\"}") - /// Creates a payload of { "key": "value" }. + /// BinaryData.FromString("{\"key\": \"value\"}"). + /// Creates a payload of { "key": "value" }. /// /// /// diff --git a/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/Models/DevTestLabPatch.Serialization.cs b/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/Models/DevTestLabPatch.Serialization.cs index e0117dff416a..8eb7260131de 100644 --- a/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/Models/DevTestLabPatch.Serialization.cs +++ b/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/Models/DevTestLabPatch.Serialization.cs @@ -10,13 +10,32 @@ using System.Collections.Generic; using System.Text.Json; using Azure.Core; +using Azure.ResourceManager.DevTestLabs; namespace Azure.ResourceManager.DevTestLabs.Models { - public partial class DevTestLabPatch : IUtf8JsonSerializable, IJsonModel + /// A lab. + public partial class DevTestLabPatch : DevTestLabResourcePatch, IJsonModel { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + /// The data to parse. + /// The client options for reading and writing models. + protected override DevTestLabResourcePatch 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 DeserializeDevTestLabPatch(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(DevTestLabPatch)} does not support reading '{options.Format}' format."); + } + } + /// The JSON writer. + /// The client options for reading and writing models. void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) { writer.WriteStartObject(); @@ -28,67 +47,79 @@ void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterO /// 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(DevTestLabPatch)} does not support writing '{format}' format."); } - base.JsonModelWriteCore(writer, options); } - DevTestLabPatch IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + /// The JSON reader. + /// The client options for reading and writing models. + DevTestLabPatch IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) => (DevTestLabPatch)JsonModelCreateCore(ref reader, options); + + /// The JSON reader. + /// The client options for reading and writing models. + protected override DevTestLabResourcePatch 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(DevTestLabPatch)} does not support reading '{format}' format."); } - using JsonDocument document = JsonDocument.ParseValue(ref reader); return DeserializeDevTestLabPatch(document.RootElement, options); } - internal static DevTestLabPatch DeserializeDevTestLabPatch(JsonElement element, ModelReaderWriterOptions options = null) + /// The JSON element to deserialize. + /// The client options for reading and writing models. + internal static DevTestLabPatch DeserializeDevTestLabPatch(JsonElement element, ModelReaderWriterOptions options) { - options ??= ModelSerializationExtensions.WireOptions; - if (element.ValueKind == JsonValueKind.Null) { return null; } IDictionary tags = 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("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 (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 DevTestLabPatch(tags ?? new ChangeTrackingDictionary(), serializedAdditionalRawData); + return new DevTestLabPatch(tags ?? new ChangeTrackingDictionary(), 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 override BinaryData PersistableModelWriteCore(ModelReaderWriterOptions options) + { + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; switch (format) { case "J": @@ -98,22 +129,23 @@ BinaryData IPersistableModel.Write(ModelReaderWriterOptions opt } } - DevTestLabPatch 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. + DevTestLabPatch IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) => (DevTestLabPatch)PersistableModelCreateCore(data, options); - switch (format) + /// The client options for reading and writing models. + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + + /// The to serialize into . + internal static RequestContent ToRequestContent(DevTestLabPatch devTestLabPatch) + { + if (devTestLabPatch == null) { - case "J": - { - using JsonDocument document = JsonDocument.Parse(data, ModelSerializationExtensions.JsonDocumentOptions); - return DeserializeDevTestLabPatch(document.RootElement, options); - } - default: - throw new FormatException($"The model {nameof(DevTestLabPatch)} does not support reading '{options.Format}' format."); + return null; } + Utf8JsonRequestContent content = new Utf8JsonRequestContent(); + content.JsonWriter.WriteObjectValue(devTestLabPatch, ModelSerializationExtensions.WireOptions); + return content; } - - string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; } } diff --git a/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/Models/DevTestLabPatch.cs b/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/Models/DevTestLabPatch.cs index 9246c583c483..5cfd4d9d2eaa 100644 --- a/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/Models/DevTestLabPatch.cs +++ b/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/Models/DevTestLabPatch.cs @@ -20,8 +20,8 @@ public DevTestLabPatch() /// Initializes a new instance of . /// The tags of the resource. - /// Keeps track of any properties unknown to the library. - internal DevTestLabPatch(IDictionary tags, IDictionary serializedAdditionalRawData) : base(tags, serializedAdditionalRawData) + /// Keeps track of any properties unknown to the library. + internal DevTestLabPatch(IDictionary tags, IDictionary additionalBinaryDataProperties) : base(tags, additionalBinaryDataProperties) { } } diff --git a/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/Models/DevTestLabPolicyEvaluatorType.cs b/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/Models/DevTestLabPolicyEvaluatorType.cs index f4396569c937..b65d68924940 100644 --- a/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/Models/DevTestLabPolicyEvaluatorType.cs +++ b/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/Models/DevTestLabPolicyEvaluatorType.cs @@ -7,6 +7,7 @@ using System; using System.ComponentModel; +using Azure.ResourceManager.DevTestLabs; namespace Azure.ResourceManager.DevTestLabs.Models { @@ -14,38 +15,55 @@ namespace Azure.ResourceManager.DevTestLabs.Models public readonly partial struct DevTestLabPolicyEvaluatorType : IEquatable { private readonly string _value; + private const string AllowedValuesPolicyValue = "AllowedValuesPolicy"; + private const string MaxValuePolicyValue = "MaxValuePolicy"; /// Initializes a new instance of . + /// The value. /// is null. public DevTestLabPolicyEvaluatorType(string value) { - _value = value ?? throw new ArgumentNullException(nameof(value)); - } + Argument.AssertNotNull(value, nameof(value)); - private const string AllowedValuesPolicyValue = "AllowedValuesPolicy"; - private const string MaxValuePolicyValue = "MaxValuePolicy"; + _value = value; + } - /// AllowedValuesPolicy. + /// Gets the AllowedValuesPolicy. public static DevTestLabPolicyEvaluatorType AllowedValuesPolicy { get; } = new DevTestLabPolicyEvaluatorType(AllowedValuesPolicyValue); - /// MaxValuePolicy. + + /// Gets the MaxValuePolicy. public static DevTestLabPolicyEvaluatorType MaxValuePolicy { get; } = new DevTestLabPolicyEvaluatorType(MaxValuePolicyValue); + /// Determines if two values are the same. + /// The left value to compare. + /// The right value to compare. public static bool operator ==(DevTestLabPolicyEvaluatorType left, DevTestLabPolicyEvaluatorType 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 !=(DevTestLabPolicyEvaluatorType left, DevTestLabPolicyEvaluatorType right) => !left.Equals(right); - /// Converts a to a . + + /// Converts a string to a . + /// The value. public static implicit operator DevTestLabPolicyEvaluatorType(string value) => new DevTestLabPolicyEvaluatorType(value); - /// + /// Converts a string to a . + /// The value. + public static implicit operator DevTestLabPolicyEvaluatorType?(string value) => value == null ? null : new DevTestLabPolicyEvaluatorType(value); + + /// [EditorBrowsable(EditorBrowsableState.Never)] public override bool Equals(object obj) => obj is DevTestLabPolicyEvaluatorType other && Equals(other); - /// + + /// public bool Equals(DevTestLabPolicyEvaluatorType 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/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/Models/DevTestLabPolicyFactName.cs b/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/Models/DevTestLabPolicyFactName.cs index e4560a6cdb4f..c218ed686435 100644 --- a/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/Models/DevTestLabPolicyFactName.cs +++ b/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/Models/DevTestLabPolicyFactName.cs @@ -7,6 +7,7 @@ using System; using System.ComponentModel; +using Azure.ResourceManager.DevTestLabs; namespace Azure.ResourceManager.DevTestLabs.Models { @@ -14,14 +15,6 @@ namespace Azure.ResourceManager.DevTestLabs.Models public readonly partial struct DevTestLabPolicyFactName : IEquatable { private readonly string _value; - - /// Initializes a new instance of . - /// is null. - public DevTestLabPolicyFactName(string value) - { - _value = value ?? throw new ArgumentNullException(nameof(value)); - } - private const string UserOwnedLabVmCountValue = "UserOwnedLabVmCount"; private const string UserOwnedLabPremiumVmCountValue = "UserOwnedLabPremiumVmCount"; private const string LabVmCountValue = "LabVmCount"; @@ -33,43 +26,76 @@ public DevTestLabPolicyFactName(string value) private const string EnvironmentTemplateValue = "EnvironmentTemplate"; private const string ScheduleEditPermissionValue = "ScheduleEditPermission"; - /// UserOwnedLabVmCount. + /// Initializes a new instance of . + /// The value. + /// is null. + public DevTestLabPolicyFactName(string value) + { + Argument.AssertNotNull(value, nameof(value)); + + _value = value; + } + + /// Gets the UserOwnedLabVmCount. public static DevTestLabPolicyFactName UserOwnedLabVmCount { get; } = new DevTestLabPolicyFactName(UserOwnedLabVmCountValue); - /// UserOwnedLabPremiumVmCount. + + /// Gets the UserOwnedLabPremiumVmCount. public static DevTestLabPolicyFactName UserOwnedLabPremiumVmCount { get; } = new DevTestLabPolicyFactName(UserOwnedLabPremiumVmCountValue); - /// LabVmCount. + + /// Gets the LabVmCount. public static DevTestLabPolicyFactName LabVmCount { get; } = new DevTestLabPolicyFactName(LabVmCountValue); - /// LabPremiumVmCount. + + /// Gets the LabPremiumVmCount. public static DevTestLabPolicyFactName LabPremiumVmCount { get; } = new DevTestLabPolicyFactName(LabPremiumVmCountValue); - /// LabVmSize. + + /// Gets the LabVmSize. public static DevTestLabPolicyFactName LabVmSize { get; } = new DevTestLabPolicyFactName(LabVmSizeValue); - /// GalleryImage. + + /// Gets the GalleryImage. public static DevTestLabPolicyFactName GalleryImage { get; } = new DevTestLabPolicyFactName(GalleryImageValue); - /// UserOwnedLabVmCountInSubnet. + + /// Gets the UserOwnedLabVmCountInSubnet. public static DevTestLabPolicyFactName UserOwnedLabVmCountInSubnet { get; } = new DevTestLabPolicyFactName(UserOwnedLabVmCountInSubnetValue); - /// LabTargetCost. + + /// Gets the LabTargetCost. public static DevTestLabPolicyFactName LabTargetCost { get; } = new DevTestLabPolicyFactName(LabTargetCostValue); - /// EnvironmentTemplate. + + /// Gets the EnvironmentTemplate. public static DevTestLabPolicyFactName EnvironmentTemplate { get; } = new DevTestLabPolicyFactName(EnvironmentTemplateValue); - /// ScheduleEditPermission. + + /// Gets the ScheduleEditPermission. public static DevTestLabPolicyFactName ScheduleEditPermission { get; } = new DevTestLabPolicyFactName(ScheduleEditPermissionValue); + /// Determines if two values are the same. + /// The left value to compare. + /// The right value to compare. public static bool operator ==(DevTestLabPolicyFactName left, DevTestLabPolicyFactName 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 !=(DevTestLabPolicyFactName left, DevTestLabPolicyFactName right) => !left.Equals(right); - /// Converts a to a . + + /// Converts a string to a . + /// The value. public static implicit operator DevTestLabPolicyFactName(string value) => new DevTestLabPolicyFactName(value); - /// + /// Converts a string to a . + /// The value. + public static implicit operator DevTestLabPolicyFactName?(string value) => value == null ? null : new DevTestLabPolicyFactName(value); + + /// [EditorBrowsable(EditorBrowsableState.Never)] public override bool Equals(object obj) => obj is DevTestLabPolicyFactName other && Equals(other); - /// + + /// public bool Equals(DevTestLabPolicyFactName 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/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/Models/DevTestLabPolicyPatch.Serialization.cs b/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/Models/DevTestLabPolicyPatch.Serialization.cs index 69b6d10d4db5..5c7de5eb2306 100644 --- a/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/Models/DevTestLabPolicyPatch.Serialization.cs +++ b/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/Models/DevTestLabPolicyPatch.Serialization.cs @@ -10,13 +10,32 @@ using System.Collections.Generic; using System.Text.Json; using Azure.Core; +using Azure.ResourceManager.DevTestLabs; namespace Azure.ResourceManager.DevTestLabs.Models { - public partial class DevTestLabPolicyPatch : IUtf8JsonSerializable, IJsonModel + /// A Policy. + public partial class DevTestLabPolicyPatch : DevTestLabResourcePatch, IJsonModel { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + /// The data to parse. + /// The client options for reading and writing models. + protected override DevTestLabResourcePatch 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 DeserializeDevTestLabPolicyPatch(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(DevTestLabPolicyPatch)} does not support reading '{options.Format}' format."); + } + } + /// The JSON writer. + /// The client options for reading and writing models. void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) { writer.WriteStartObject(); @@ -28,67 +47,79 @@ void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderW /// 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(DevTestLabPolicyPatch)} does not support writing '{format}' format."); } - base.JsonModelWriteCore(writer, options); } - DevTestLabPolicyPatch IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + /// The JSON reader. + /// The client options for reading and writing models. + DevTestLabPolicyPatch IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) => (DevTestLabPolicyPatch)JsonModelCreateCore(ref reader, options); + + /// The JSON reader. + /// The client options for reading and writing models. + protected override DevTestLabResourcePatch 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(DevTestLabPolicyPatch)} does not support reading '{format}' format."); } - using JsonDocument document = JsonDocument.ParseValue(ref reader); return DeserializeDevTestLabPolicyPatch(document.RootElement, options); } - internal static DevTestLabPolicyPatch DeserializeDevTestLabPolicyPatch(JsonElement element, ModelReaderWriterOptions options = null) + /// The JSON element to deserialize. + /// The client options for reading and writing models. + internal static DevTestLabPolicyPatch DeserializeDevTestLabPolicyPatch(JsonElement element, ModelReaderWriterOptions options) { - options ??= ModelSerializationExtensions.WireOptions; - if (element.ValueKind == JsonValueKind.Null) { return null; } IDictionary tags = 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("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 (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 DevTestLabPolicyPatch(tags ?? new ChangeTrackingDictionary(), serializedAdditionalRawData); + return new DevTestLabPolicyPatch(tags ?? new ChangeTrackingDictionary(), 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 override BinaryData PersistableModelWriteCore(ModelReaderWriterOptions options) + { + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; switch (format) { case "J": @@ -98,22 +129,23 @@ BinaryData IPersistableModel.Write(ModelReaderWriterOptio } } - DevTestLabPolicyPatch 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. + DevTestLabPolicyPatch IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) => (DevTestLabPolicyPatch)PersistableModelCreateCore(data, options); - switch (format) + /// The client options for reading and writing models. + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + + /// The to serialize into . + internal static RequestContent ToRequestContent(DevTestLabPolicyPatch devTestLabPolicyPatch) + { + if (devTestLabPolicyPatch == null) { - case "J": - { - using JsonDocument document = JsonDocument.Parse(data, ModelSerializationExtensions.JsonDocumentOptions); - return DeserializeDevTestLabPolicyPatch(document.RootElement, options); - } - default: - throw new FormatException($"The model {nameof(DevTestLabPolicyPatch)} does not support reading '{options.Format}' format."); + return null; } + Utf8JsonRequestContent content = new Utf8JsonRequestContent(); + content.JsonWriter.WriteObjectValue(devTestLabPolicyPatch, ModelSerializationExtensions.WireOptions); + return content; } - - string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; } } diff --git a/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/Models/DevTestLabPolicyPatch.cs b/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/Models/DevTestLabPolicyPatch.cs index 9e043165a18f..255f43dca9d6 100644 --- a/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/Models/DevTestLabPolicyPatch.cs +++ b/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/Models/DevTestLabPolicyPatch.cs @@ -20,8 +20,8 @@ public DevTestLabPolicyPatch() /// Initializes a new instance of . /// The tags of the resource. - /// Keeps track of any properties unknown to the library. - internal DevTestLabPolicyPatch(IDictionary tags, IDictionary serializedAdditionalRawData) : base(tags, serializedAdditionalRawData) + /// Keeps track of any properties unknown to the library. + internal DevTestLabPolicyPatch(IDictionary tags, IDictionary additionalBinaryDataProperties) : base(tags, additionalBinaryDataProperties) { } } diff --git a/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/Models/DevTestLabPolicySetResult.Serialization.cs b/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/Models/DevTestLabPolicySetResult.Serialization.cs index cb9212d1e0b6..d6d8922fe0c7 100644 --- a/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/Models/DevTestLabPolicySetResult.Serialization.cs +++ b/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/Models/DevTestLabPolicySetResult.Serialization.cs @@ -9,14 +9,32 @@ using System.ClientModel.Primitives; using System.Collections.Generic; using System.Text.Json; -using Azure.Core; +using Azure.ResourceManager.DevTestLabs; namespace Azure.ResourceManager.DevTestLabs.Models { - public partial class DevTestLabPolicySetResult : IUtf8JsonSerializable, IJsonModel + /// Result of a policy set evaluation. + public partial class DevTestLabPolicySetResult : IJsonModel { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + /// The data to parse. + /// The client options for reading and writing models. + protected virtual DevTestLabPolicySetResult 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 DeserializeDevTestLabPolicySetResult(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(DevTestLabPolicySetResult)} does not support reading '{options.Format}' format."); + } + } + /// The JSON writer. + /// The client options for reading and writing models. void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) { writer.WriteStartObject(); @@ -28,12 +46,11 @@ void IJsonModel.Write(Utf8JsonWriter writer, ModelRea /// 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(DevTestLabPolicySetResult)} does not support writing '{format}' format."); } - if (Optional.IsDefined(HasError)) { writer.WritePropertyName("hasError"u8); @@ -43,21 +60,21 @@ protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWrit { writer.WritePropertyName("policyViolations"u8); writer.WriteStartArray(); - foreach (var item in PolicyViolations) + foreach (DevTestLabPolicyViolation item in PolicyViolations) { 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); } @@ -66,49 +83,53 @@ protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWrit } } - DevTestLabPolicySetResult IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + /// The JSON reader. + /// The client options for reading and writing models. + DevTestLabPolicySetResult IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) => JsonModelCreateCore(ref reader, options); + + /// The JSON reader. + /// The client options for reading and writing models. + protected virtual DevTestLabPolicySetResult 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(DevTestLabPolicySetResult)} does not support reading '{format}' format."); } - using JsonDocument document = JsonDocument.ParseValue(ref reader); return DeserializeDevTestLabPolicySetResult(document.RootElement, options); } - internal static DevTestLabPolicySetResult DeserializeDevTestLabPolicySetResult(JsonElement element, ModelReaderWriterOptions options = null) + /// The JSON element to deserialize. + /// The client options for reading and writing models. + internal static DevTestLabPolicySetResult DeserializeDevTestLabPolicySetResult(JsonElement element, ModelReaderWriterOptions options) { - options ??= ModelSerializationExtensions.WireOptions; - if (element.ValueKind == JsonValueKind.Null) { return null; } bool? hasError = default; IReadOnlyList policyViolations = 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("hasError"u8)) + if (prop.NameEquals("hasError"u8)) { - if (property.Value.ValueKind == JsonValueKind.Null) + if (prop.Value.ValueKind == JsonValueKind.Null) { continue; } - hasError = property.Value.GetBoolean(); + hasError = prop.Value.GetBoolean(); continue; } - if (property.NameEquals("policyViolations"u8)) + if (prop.NameEquals("policyViolations"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(DevTestLabPolicyViolation.DeserializeDevTestLabPolicyViolation(item, options)); } @@ -117,17 +138,19 @@ internal static DevTestLabPolicySetResult DeserializeDevTestLabPolicySetResult(J } 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 DevTestLabPolicySetResult(hasError, policyViolations ?? new ChangeTrackingList(), serializedAdditionalRawData); + return new DevTestLabPolicySetResult(hasError, policyViolations ?? 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": @@ -137,22 +160,11 @@ BinaryData IPersistableModel.Write(ModelReaderWriterO } } - DevTestLabPolicySetResult 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 DeserializeDevTestLabPolicySetResult(document.RootElement, options); - } - default: - throw new FormatException($"The model {nameof(DevTestLabPolicySetResult)} does not support reading '{options.Format}' format."); - } - } + /// The data to parse. + /// The client options for reading and writing models. + DevTestLabPolicySetResult IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) => PersistableModelCreateCore(data, options); + /// The client options for reading and writing models. string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; } } diff --git a/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/Models/DevTestLabPolicySetResult.cs b/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/Models/DevTestLabPolicySetResult.cs index d120b4da6992..765c2c97990e 100644 --- a/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/Models/DevTestLabPolicySetResult.cs +++ b/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/Models/DevTestLabPolicySetResult.cs @@ -7,43 +7,15 @@ using System; using System.Collections.Generic; +using Azure.ResourceManager.DevTestLabs; namespace Azure.ResourceManager.DevTestLabs.Models { /// Result of a policy set evaluation. public partial class DevTestLabPolicySetResult { - /// - /// 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 DevTestLabPolicySetResult() @@ -54,16 +26,17 @@ internal DevTestLabPolicySetResult() /// Initializes a new instance of . /// A value indicating whether this policy set evaluation has discovered violations. /// The list of policy violations. - /// Keeps track of any properties unknown to the library. - internal DevTestLabPolicySetResult(bool? hasError, IReadOnlyList policyViolations, IDictionary serializedAdditionalRawData) + /// Keeps track of any properties unknown to the library. + internal DevTestLabPolicySetResult(bool? hasError, IReadOnlyList policyViolations, IDictionary additionalBinaryDataProperties) { HasError = hasError; PolicyViolations = policyViolations; - _serializedAdditionalRawData = serializedAdditionalRawData; + _additionalBinaryDataProperties = additionalBinaryDataProperties; } /// A value indicating whether this policy set evaluation has discovered violations. public bool? HasError { get; } + /// The list of policy violations. public IReadOnlyList PolicyViolations { get; } } diff --git a/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/Models/DevTestLabPolicyStatus.cs b/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/Models/DevTestLabPolicyStatus.cs index d423641a99ef..c30782c9780c 100644 --- a/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/Models/DevTestLabPolicyStatus.cs +++ b/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/Models/DevTestLabPolicyStatus.cs @@ -7,6 +7,7 @@ using System; using System.ComponentModel; +using Azure.ResourceManager.DevTestLabs; namespace Azure.ResourceManager.DevTestLabs.Models { @@ -14,38 +15,55 @@ namespace Azure.ResourceManager.DevTestLabs.Models public readonly partial struct DevTestLabPolicyStatus : IEquatable { private readonly string _value; + private const string EnabledValue = "Enabled"; + private const string DisabledValue = "Disabled"; /// Initializes a new instance of . + /// The value. /// is null. public DevTestLabPolicyStatus(string value) { - _value = value ?? throw new ArgumentNullException(nameof(value)); - } + Argument.AssertNotNull(value, nameof(value)); - private const string EnabledValue = "Enabled"; - private const string DisabledValue = "Disabled"; + _value = value; + } - /// Enabled. + /// Gets the Enabled. public static DevTestLabPolicyStatus Enabled { get; } = new DevTestLabPolicyStatus(EnabledValue); - /// Disabled. + + /// Gets the Disabled. public static DevTestLabPolicyStatus Disabled { get; } = new DevTestLabPolicyStatus(DisabledValue); + /// Determines if two values are the same. + /// The left value to compare. + /// The right value to compare. public static bool operator ==(DevTestLabPolicyStatus left, DevTestLabPolicyStatus 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 !=(DevTestLabPolicyStatus left, DevTestLabPolicyStatus right) => !left.Equals(right); - /// Converts a to a . + + /// Converts a string to a . + /// The value. public static implicit operator DevTestLabPolicyStatus(string value) => new DevTestLabPolicyStatus(value); - /// + /// Converts a string to a . + /// The value. + public static implicit operator DevTestLabPolicyStatus?(string value) => value == null ? null : new DevTestLabPolicyStatus(value); + + /// [EditorBrowsable(EditorBrowsableState.Never)] public override bool Equals(object obj) => obj is DevTestLabPolicyStatus other && Equals(other); - /// + + /// public bool Equals(DevTestLabPolicyStatus 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/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/Models/DevTestLabPolicyViolation.Serialization.cs b/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/Models/DevTestLabPolicyViolation.Serialization.cs index 538df7cb449a..118a7509ca3f 100644 --- a/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/Models/DevTestLabPolicyViolation.Serialization.cs +++ b/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/Models/DevTestLabPolicyViolation.Serialization.cs @@ -9,14 +9,32 @@ using System.ClientModel.Primitives; using System.Collections.Generic; using System.Text.Json; -using Azure.Core; +using Azure.ResourceManager.DevTestLabs; namespace Azure.ResourceManager.DevTestLabs.Models { - public partial class DevTestLabPolicyViolation : IUtf8JsonSerializable, IJsonModel + /// Policy violation. + public partial class DevTestLabPolicyViolation : IJsonModel { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + /// The data to parse. + /// The client options for reading and writing models. + protected virtual DevTestLabPolicyViolation 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 DeserializeDevTestLabPolicyViolation(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(DevTestLabPolicyViolation)} does not support reading '{options.Format}' format."); + } + } + /// The JSON writer. + /// The client options for reading and writing models. void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) { writer.WriteStartObject(); @@ -28,12 +46,11 @@ void IJsonModel.Write(Utf8JsonWriter writer, ModelRea /// 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(DevTestLabPolicyViolation)} does not support writing '{format}' format."); } - if (Optional.IsDefined(Code)) { writer.WritePropertyName("code"u8); @@ -44,15 +61,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 +78,61 @@ protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWrit } } - DevTestLabPolicyViolation IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + /// The JSON reader. + /// The client options for reading and writing models. + DevTestLabPolicyViolation IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) => JsonModelCreateCore(ref reader, options); + + /// The JSON reader. + /// The client options for reading and writing models. + protected virtual DevTestLabPolicyViolation 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(DevTestLabPolicyViolation)} does not support reading '{format}' format."); } - using JsonDocument document = JsonDocument.ParseValue(ref reader); return DeserializeDevTestLabPolicyViolation(document.RootElement, options); } - internal static DevTestLabPolicyViolation DeserializeDevTestLabPolicyViolation(JsonElement element, ModelReaderWriterOptions options = null) + /// The JSON element to deserialize. + /// The client options for reading and writing models. + internal static DevTestLabPolicyViolation DeserializeDevTestLabPolicyViolation(JsonElement element, ModelReaderWriterOptions options) { - options ??= ModelSerializationExtensions.WireOptions; - if (element.ValueKind == JsonValueKind.Null) { return null; } string 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 = property.Value.GetString(); + code = 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 DevTestLabPolicyViolation(code, message, serializedAdditionalRawData); + return new DevTestLabPolicyViolation(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,22 +142,11 @@ BinaryData IPersistableModel.Write(ModelReaderWriterO } } - DevTestLabPolicyViolation 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 DeserializeDevTestLabPolicyViolation(document.RootElement, options); - } - default: - throw new FormatException($"The model {nameof(DevTestLabPolicyViolation)} does not support reading '{options.Format}' format."); - } - } + /// The data to parse. + /// The client options for reading and writing models. + DevTestLabPolicyViolation IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) => PersistableModelCreateCore(data, options); + /// The client options for reading and writing models. string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; } } diff --git a/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/Models/DevTestLabPolicyViolation.cs b/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/Models/DevTestLabPolicyViolation.cs index b2e1adc92899..cfb5389b3c91 100644 --- a/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/Models/DevTestLabPolicyViolation.cs +++ b/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/Models/DevTestLabPolicyViolation.cs @@ -13,37 +13,8 @@ namespace Azure.ResourceManager.DevTestLabs.Models /// Policy violation. public partial class DevTestLabPolicyViolation { - /// - /// 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 DevTestLabPolicyViolation() @@ -53,16 +24,17 @@ internal DevTestLabPolicyViolation() /// Initializes a new instance of . /// The code of the policy violation. /// The message of the policy violation. - /// Keeps track of any properties unknown to the library. - internal DevTestLabPolicyViolation(string code, string message, IDictionary serializedAdditionalRawData) + /// Keeps track of any properties unknown to the library. + internal DevTestLabPolicyViolation(string code, string message, IDictionary additionalBinaryDataProperties) { Code = code; Message = message; - _serializedAdditionalRawData = serializedAdditionalRawData; + _additionalBinaryDataProperties = additionalBinaryDataProperties; } /// The code of the policy violation. public string Code { get; } + /// The message of the policy violation. public string Message { get; } } diff --git a/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/Models/DevTestLabPort.Serialization.cs b/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/Models/DevTestLabPort.Serialization.cs index 502288a74d69..cac6646e6358 100644 --- a/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/Models/DevTestLabPort.Serialization.cs +++ b/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/Models/DevTestLabPort.Serialization.cs @@ -9,14 +9,32 @@ using System.ClientModel.Primitives; using System.Collections.Generic; using System.Text.Json; -using Azure.Core; +using Azure.ResourceManager.DevTestLabs; namespace Azure.ResourceManager.DevTestLabs.Models { - public partial class DevTestLabPort : IUtf8JsonSerializable, IJsonModel + /// Properties of a network port. + public partial class DevTestLabPort : IJsonModel { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + /// The data to parse. + /// The client options for reading and writing models. + protected virtual DevTestLabPort 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 DeserializeDevTestLabPort(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(DevTestLabPort)} does not support reading '{options.Format}' format."); + } + } + /// The JSON writer. + /// The client options for reading and writing models. void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) { writer.WriteStartObject(); @@ -28,12 +46,11 @@ void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOp /// 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(DevTestLabPort)} does not support writing '{format}' format."); } - if (Optional.IsDefined(TransportProtocol)) { writer.WritePropertyName("transportProtocol"u8); @@ -44,15 +61,15 @@ protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWrit writer.WritePropertyName("backendPort"u8); writer.WriteNumberValue(BackendPort.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); } @@ -61,63 +78,69 @@ protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWrit } } - DevTestLabPort IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + /// The JSON reader. + /// The client options for reading and writing models. + DevTestLabPort IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) => JsonModelCreateCore(ref reader, options); + + /// The JSON reader. + /// The client options for reading and writing models. + protected virtual DevTestLabPort 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(DevTestLabPort)} does not support reading '{format}' format."); } - using JsonDocument document = JsonDocument.ParseValue(ref reader); return DeserializeDevTestLabPort(document.RootElement, options); } - internal static DevTestLabPort DeserializeDevTestLabPort(JsonElement element, ModelReaderWriterOptions options = null) + /// The JSON element to deserialize. + /// The client options for reading and writing models. + internal static DevTestLabPort DeserializeDevTestLabPort(JsonElement element, ModelReaderWriterOptions options) { - options ??= ModelSerializationExtensions.WireOptions; - if (element.ValueKind == JsonValueKind.Null) { return null; } DevTestLabTransportProtocol? transportProtocol = default; int? backendPort = 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("transportProtocol"u8)) + if (prop.NameEquals("transportProtocol"u8)) { - if (property.Value.ValueKind == JsonValueKind.Null) + if (prop.Value.ValueKind == JsonValueKind.Null) { continue; } - transportProtocol = new DevTestLabTransportProtocol(property.Value.GetString()); + transportProtocol = new DevTestLabTransportProtocol(prop.Value.GetString()); continue; } - if (property.NameEquals("backendPort"u8)) + if (prop.NameEquals("backendPort"u8)) { - if (property.Value.ValueKind == JsonValueKind.Null) + if (prop.Value.ValueKind == JsonValueKind.Null) { continue; } - backendPort = property.Value.GetInt32(); + backendPort = prop.Value.GetInt32(); 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 DevTestLabPort(transportProtocol, backendPort, serializedAdditionalRawData); + return new DevTestLabPort(transportProtocol, backendPort, 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": @@ -127,22 +150,11 @@ BinaryData IPersistableModel.Write(ModelReaderWriterOptions opti } } - DevTestLabPort 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 DeserializeDevTestLabPort(document.RootElement, options); - } - default: - throw new FormatException($"The model {nameof(DevTestLabPort)} does not support reading '{options.Format}' format."); - } - } + /// The data to parse. + /// The client options for reading and writing models. + DevTestLabPort IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) => PersistableModelCreateCore(data, options); + /// The client options for reading and writing models. string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; } } diff --git a/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/Models/DevTestLabPort.cs b/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/Models/DevTestLabPort.cs index 46a0c5d90557..9384e055ff7a 100644 --- a/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/Models/DevTestLabPort.cs +++ b/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/Models/DevTestLabPort.cs @@ -13,37 +13,8 @@ namespace Azure.ResourceManager.DevTestLabs.Models /// Properties of a network port. public partial class DevTestLabPort { - /// - /// 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 DevTestLabPort() @@ -53,16 +24,17 @@ public DevTestLabPort() /// Initializes a new instance of . /// Protocol type of the port. /// Backend port of the target virtual machine. - /// Keeps track of any properties unknown to the library. - internal DevTestLabPort(DevTestLabTransportProtocol? transportProtocol, int? backendPort, IDictionary serializedAdditionalRawData) + /// Keeps track of any properties unknown to the library. + internal DevTestLabPort(DevTestLabTransportProtocol? transportProtocol, int? backendPort, IDictionary additionalBinaryDataProperties) { TransportProtocol = transportProtocol; BackendPort = backendPort; - _serializedAdditionalRawData = serializedAdditionalRawData; + _additionalBinaryDataProperties = additionalBinaryDataProperties; } /// Protocol type of the port. public DevTestLabTransportProtocol? TransportProtocol { get; set; } + /// Backend port of the target virtual machine. public int? BackendPort { get; set; } } diff --git a/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/Models/DevTestLabPremiumDataDisk.cs b/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/Models/DevTestLabPremiumDataDisk.cs index f930f18b0dc1..e308fb41f0aa 100644 --- a/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/Models/DevTestLabPremiumDataDisk.cs +++ b/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/Models/DevTestLabPremiumDataDisk.cs @@ -7,6 +7,7 @@ using System; using System.ComponentModel; +using Azure.ResourceManager.DevTestLabs; namespace Azure.ResourceManager.DevTestLabs.Models { @@ -18,38 +19,55 @@ namespace Azure.ResourceManager.DevTestLabs.Models public readonly partial struct DevTestLabPremiumDataDisk : IEquatable { private readonly string _value; + private const string DisabledValue = "Disabled"; + private const string EnabledValue = "Enabled"; /// Initializes a new instance of . + /// The value. /// is null. public DevTestLabPremiumDataDisk(string value) { - _value = value ?? throw new ArgumentNullException(nameof(value)); - } + Argument.AssertNotNull(value, nameof(value)); - private const string DisabledValue = "Disabled"; - private const string EnabledValue = "Enabled"; + _value = value; + } - /// Disabled. + /// Gets the Disabled. public static DevTestLabPremiumDataDisk Disabled { get; } = new DevTestLabPremiumDataDisk(DisabledValue); - /// Enabled. + + /// Gets the Enabled. public static DevTestLabPremiumDataDisk Enabled { get; } = new DevTestLabPremiumDataDisk(EnabledValue); + /// Determines if two values are the same. + /// The left value to compare. + /// The right value to compare. public static bool operator ==(DevTestLabPremiumDataDisk left, DevTestLabPremiumDataDisk 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 !=(DevTestLabPremiumDataDisk left, DevTestLabPremiumDataDisk right) => !left.Equals(right); - /// Converts a to a . + + /// Converts a string to a . + /// The value. public static implicit operator DevTestLabPremiumDataDisk(string value) => new DevTestLabPremiumDataDisk(value); - /// + /// Converts a string to a . + /// The value. + public static implicit operator DevTestLabPremiumDataDisk?(string value) => value == null ? null : new DevTestLabPremiumDataDisk(value); + + /// [EditorBrowsable(EditorBrowsableState.Never)] public override bool Equals(object obj) => obj is DevTestLabPremiumDataDisk other && Equals(other); - /// + + /// public bool Equals(DevTestLabPremiumDataDisk 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/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/Models/DevTestLabRdpConnection.Serialization.cs b/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/Models/DevTestLabRdpConnection.Serialization.cs index fb5c1f619ae8..f0fb2bcd5c27 100644 --- a/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/Models/DevTestLabRdpConnection.Serialization.cs +++ b/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/Models/DevTestLabRdpConnection.Serialization.cs @@ -9,14 +9,40 @@ using System.ClientModel.Primitives; using System.Collections.Generic; using System.Text.Json; -using Azure.Core; +using Azure; +using Azure.ResourceManager.DevTestLabs; namespace Azure.ResourceManager.DevTestLabs.Models { - public partial class DevTestLabRdpConnection : IUtf8JsonSerializable, IJsonModel + /// Represents a .rdp file. + public partial class DevTestLabRdpConnection : IJsonModel { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + /// The data to parse. + /// The client options for reading and writing models. + protected virtual DevTestLabRdpConnection 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 DeserializeDevTestLabRdpConnection(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(DevTestLabRdpConnection)} does not support reading '{options.Format}' format."); + } + } + /// The to deserialize the from. + internal static DevTestLabRdpConnection FromResponse(Response response) + { + using JsonDocument document = JsonDocument.Parse(response.Content, ModelSerializationExtensions.JsonDocumentOptions); + return DeserializeDevTestLabRdpConnection(document.RootElement, ModelSerializationExtensions.WireOptions); + } + + /// The JSON writer. + /// The client options for reading and writing models. void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) { writer.WriteStartObject(); @@ -28,26 +54,25 @@ void IJsonModel.Write(Utf8JsonWriter writer, ModelReade /// 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(DevTestLabRdpConnection)} does not support writing '{format}' format."); } - if (Optional.IsDefined(Contents)) { writer.WritePropertyName("contents"u8); writer.WriteStringValue(Contents); } - 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); } @@ -56,49 +81,55 @@ protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWrit } } - DevTestLabRdpConnection IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + /// The JSON reader. + /// The client options for reading and writing models. + DevTestLabRdpConnection IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) => JsonModelCreateCore(ref reader, options); + + /// The JSON reader. + /// The client options for reading and writing models. + protected virtual DevTestLabRdpConnection 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(DevTestLabRdpConnection)} does not support reading '{format}' format."); } - using JsonDocument document = JsonDocument.ParseValue(ref reader); return DeserializeDevTestLabRdpConnection(document.RootElement, options); } - internal static DevTestLabRdpConnection DeserializeDevTestLabRdpConnection(JsonElement element, ModelReaderWriterOptions options = null) + /// The JSON element to deserialize. + /// The client options for reading and writing models. + internal static DevTestLabRdpConnection DeserializeDevTestLabRdpConnection(JsonElement element, ModelReaderWriterOptions options) { - options ??= ModelSerializationExtensions.WireOptions; - if (element.ValueKind == JsonValueKind.Null) { return null; } string contents = 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("contents"u8)) + if (prop.NameEquals("contents"u8)) { - contents = property.Value.GetString(); + contents = 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 DevTestLabRdpConnection(contents, serializedAdditionalRawData); + return new DevTestLabRdpConnection(contents, 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": @@ -108,22 +139,11 @@ BinaryData IPersistableModel.Write(ModelReaderWriterOpt } } - DevTestLabRdpConnection 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 DeserializeDevTestLabRdpConnection(document.RootElement, options); - } - default: - throw new FormatException($"The model {nameof(DevTestLabRdpConnection)} does not support reading '{options.Format}' format."); - } - } + /// The data to parse. + /// The client options for reading and writing models. + DevTestLabRdpConnection IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) => PersistableModelCreateCore(data, options); + /// The client options for reading and writing models. string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; } } diff --git a/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/Models/DevTestLabRdpConnection.cs b/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/Models/DevTestLabRdpConnection.cs index 04753aed4577..044f75f939a9 100644 --- a/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/Models/DevTestLabRdpConnection.cs +++ b/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/Models/DevTestLabRdpConnection.cs @@ -13,37 +13,8 @@ namespace Azure.ResourceManager.DevTestLabs.Models /// Represents a .rdp file. public partial class DevTestLabRdpConnection { - /// - /// 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 DevTestLabRdpConnection() @@ -52,11 +23,11 @@ internal DevTestLabRdpConnection() /// Initializes a new instance of . /// The contents of the .rdp file. - /// Keeps track of any properties unknown to the library. - internal DevTestLabRdpConnection(string contents, IDictionary serializedAdditionalRawData) + /// Keeps track of any properties unknown to the library. + internal DevTestLabRdpConnection(string contents, IDictionary additionalBinaryDataProperties) { Contents = contents; - _serializedAdditionalRawData = serializedAdditionalRawData; + _additionalBinaryDataProperties = additionalBinaryDataProperties; } /// The contents of the .rdp file. diff --git a/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/Models/DevTestLabReportingCycleType.cs b/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/Models/DevTestLabReportingCycleType.cs index c707477cf7a1..3d235ef82ca3 100644 --- a/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/Models/DevTestLabReportingCycleType.cs +++ b/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/Models/DevTestLabReportingCycleType.cs @@ -7,6 +7,7 @@ using System; using System.ComponentModel; +using Azure.ResourceManager.DevTestLabs; namespace Azure.ResourceManager.DevTestLabs.Models { @@ -14,38 +15,55 @@ namespace Azure.ResourceManager.DevTestLabs.Models public readonly partial struct DevTestLabReportingCycleType : IEquatable { private readonly string _value; + private const string CalendarMonthValue = "CalendarMonth"; + private const string CustomValue = "Custom"; /// Initializes a new instance of . + /// The value. /// is null. public DevTestLabReportingCycleType(string value) { - _value = value ?? throw new ArgumentNullException(nameof(value)); - } + Argument.AssertNotNull(value, nameof(value)); - private const string CalendarMonthValue = "CalendarMonth"; - private const string CustomValue = "Custom"; + _value = value; + } - /// CalendarMonth. + /// Gets the CalendarMonth. public static DevTestLabReportingCycleType CalendarMonth { get; } = new DevTestLabReportingCycleType(CalendarMonthValue); - /// Custom. + + /// Gets the Custom. public static DevTestLabReportingCycleType Custom { get; } = new DevTestLabReportingCycleType(CustomValue); + /// Determines if two values are the same. + /// The left value to compare. + /// The right value to compare. public static bool operator ==(DevTestLabReportingCycleType left, DevTestLabReportingCycleType 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 !=(DevTestLabReportingCycleType left, DevTestLabReportingCycleType right) => !left.Equals(right); - /// Converts a to a . + + /// Converts a string to a . + /// The value. public static implicit operator DevTestLabReportingCycleType(string value) => new DevTestLabReportingCycleType(value); - /// + /// Converts a string to a . + /// The value. + public static implicit operator DevTestLabReportingCycleType?(string value) => value == null ? null : new DevTestLabReportingCycleType(value); + + /// [EditorBrowsable(EditorBrowsableState.Never)] public override bool Equals(object obj) => obj is DevTestLabReportingCycleType other && Equals(other); - /// + + /// public bool Equals(DevTestLabReportingCycleType 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/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/Models/DevTestLabResourceCost.Serialization.cs b/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/Models/DevTestLabResourceCost.Serialization.cs index 8ee083ba706e..d2fbc1322266 100644 --- a/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/Models/DevTestLabResourceCost.Serialization.cs +++ b/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/Models/DevTestLabResourceCost.Serialization.cs @@ -9,14 +9,32 @@ using System.ClientModel.Primitives; using System.Collections.Generic; using System.Text.Json; -using Azure.Core; +using Azure.ResourceManager.DevTestLabs; namespace Azure.ResourceManager.DevTestLabs.Models { - public partial class DevTestLabResourceCost : IUtf8JsonSerializable, IJsonModel + /// The properties of a resource cost item. + public partial class DevTestLabResourceCost : IJsonModel { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + /// The data to parse. + /// The client options for reading and writing models. + protected virtual DevTestLabResourceCost 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 DeserializeDevTestLabResourceCost(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(DevTestLabResourceCost)} does not support reading '{options.Format}' format."); + } + } + /// The JSON writer. + /// The client options for reading and writing models. void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) { writer.WriteStartObject(); @@ -28,12 +46,11 @@ void IJsonModel.Write(Utf8JsonWriter writer, ModelReader /// 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(DevTestLabResourceCost)} does not support writing '{format}' format."); } - if (Optional.IsDefined(ResourceName)) { writer.WritePropertyName("resourcename"u8); @@ -79,15 +96,15 @@ protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWrit writer.WritePropertyName("externalResourceId"u8); writer.WriteStringValue(ExternalResourceId); } - 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); } @@ -96,28 +113,33 @@ protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWrit } } - DevTestLabResourceCost IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + /// The JSON reader. + /// The client options for reading and writing models. + DevTestLabResourceCost IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) => JsonModelCreateCore(ref reader, options); + + /// The JSON reader. + /// The client options for reading and writing models. + protected virtual DevTestLabResourceCost 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(DevTestLabResourceCost)} does not support reading '{format}' format."); } - using JsonDocument document = JsonDocument.ParseValue(ref reader); return DeserializeDevTestLabResourceCost(document.RootElement, options); } - internal static DevTestLabResourceCost DeserializeDevTestLabResourceCost(JsonElement element, ModelReaderWriterOptions options = null) + /// The JSON element to deserialize. + /// The client options for reading and writing models. + internal static DevTestLabResourceCost DeserializeDevTestLabResourceCost(JsonElement element, ModelReaderWriterOptions options) { - options ??= ModelSerializationExtensions.WireOptions; - if (element.ValueKind == JsonValueKind.Null) { return null; } - string resourcename = default; - string resourceUId = default; + string resourceName = default; + string resourceUniqueId = default; double? resourceCost = default; string resourceType = default; string resourceOwner = default; @@ -125,68 +147,66 @@ internal static DevTestLabResourceCost DeserializeDevTestLabResourceCost(JsonEle string resourceStatus = default; string resourceId = default; string externalResourceId = 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("resourcename"u8)) + if (prop.NameEquals("resourcename"u8)) { - resourcename = property.Value.GetString(); + resourceName = prop.Value.GetString(); continue; } - if (property.NameEquals("resourceUId"u8)) + if (prop.NameEquals("resourceUId"u8)) { - resourceUId = property.Value.GetString(); + resourceUniqueId = prop.Value.GetString(); continue; } - if (property.NameEquals("resourceCost"u8)) + if (prop.NameEquals("resourceCost"u8)) { - if (property.Value.ValueKind == JsonValueKind.Null) + if (prop.Value.ValueKind == JsonValueKind.Null) { continue; } - resourceCost = property.Value.GetDouble(); + resourceCost = prop.Value.GetDouble(); continue; } - if (property.NameEquals("resourceType"u8)) + if (prop.NameEquals("resourceType"u8)) { - resourceType = property.Value.GetString(); + resourceType = prop.Value.GetString(); continue; } - if (property.NameEquals("resourceOwner"u8)) + if (prop.NameEquals("resourceOwner"u8)) { - resourceOwner = property.Value.GetString(); + resourceOwner = prop.Value.GetString(); continue; } - if (property.NameEquals("resourcePricingTier"u8)) + if (prop.NameEquals("resourcePricingTier"u8)) { - resourcePricingTier = property.Value.GetString(); + resourcePricingTier = prop.Value.GetString(); continue; } - if (property.NameEquals("resourceStatus"u8)) + if (prop.NameEquals("resourceStatus"u8)) { - resourceStatus = property.Value.GetString(); + resourceStatus = prop.Value.GetString(); continue; } - if (property.NameEquals("resourceId"u8)) + if (prop.NameEquals("resourceId"u8)) { - resourceId = property.Value.GetString(); + resourceId = prop.Value.GetString(); continue; } - if (property.NameEquals("externalResourceId"u8)) + if (prop.NameEquals("externalResourceId"u8)) { - externalResourceId = property.Value.GetString(); + externalResourceId = 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 DevTestLabResourceCost( - resourcename, - resourceUId, + resourceName, + resourceUniqueId, resourceCost, resourceType, resourceOwner, @@ -194,13 +214,16 @@ internal static DevTestLabResourceCost DeserializeDevTestLabResourceCost(JsonEle resourceStatus, resourceId, externalResourceId, - serializedAdditionalRawData); + 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": @@ -210,22 +233,11 @@ BinaryData IPersistableModel.Write(ModelReaderWriterOpti } } - DevTestLabResourceCost 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 DeserializeDevTestLabResourceCost(document.RootElement, options); - } - default: - throw new FormatException($"The model {nameof(DevTestLabResourceCost)} does not support reading '{options.Format}' format."); - } - } + /// The data to parse. + /// The client options for reading and writing models. + DevTestLabResourceCost IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) => PersistableModelCreateCore(data, options); + /// The client options for reading and writing models. string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; } } diff --git a/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/Models/DevTestLabResourceCost.cs b/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/Models/DevTestLabResourceCost.cs index ceff71c84e77..fd005c2f0b44 100644 --- a/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/Models/DevTestLabResourceCost.cs +++ b/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/Models/DevTestLabResourceCost.cs @@ -13,37 +13,8 @@ namespace Azure.ResourceManager.DevTestLabs.Models /// The properties of a resource cost item. public partial class DevTestLabResourceCost { - /// - /// 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 DevTestLabResourceCost() @@ -60,8 +31,8 @@ internal DevTestLabResourceCost() /// The status of the resource (ex. Active). /// The ID of the resource. /// The ID of the external resource. - /// Keeps track of any properties unknown to the library. - internal DevTestLabResourceCost(string resourceName, string resourceUniqueId, double? resourceCost, string resourceType, string resourceOwner, string resourcePricingTier, string resourceStatus, string resourceId, string externalResourceId, IDictionary serializedAdditionalRawData) + /// Keeps track of any properties unknown to the library. + internal DevTestLabResourceCost(string resourceName, string resourceUniqueId, double? resourceCost, string resourceType, string resourceOwner, string resourcePricingTier, string resourceStatus, string resourceId, string externalResourceId, IDictionary additionalBinaryDataProperties) { ResourceName = resourceName; ResourceUniqueId = resourceUniqueId; @@ -72,25 +43,33 @@ internal DevTestLabResourceCost(string resourceName, string resourceUniqueId, do ResourceStatus = resourceStatus; ResourceId = resourceId; ExternalResourceId = externalResourceId; - _serializedAdditionalRawData = serializedAdditionalRawData; + _additionalBinaryDataProperties = additionalBinaryDataProperties; } /// The name of the resource. public string ResourceName { get; } + /// The unique identifier of the resource. public string ResourceUniqueId { get; } + /// The cost component of the resource cost item. public double? ResourceCost { get; } + /// The logical resource type (ex. virtualmachine, storageaccount). public string ResourceType { get; } + /// The owner of the resource (ex. janedoe@microsoft.com). public string ResourceOwner { get; } + /// The category of the resource (ex. Premium_LRS, Standard_DS1). public string ResourcePricingTier { get; } + /// The status of the resource (ex. Active). public string ResourceStatus { get; } + /// The ID of the resource. public string ResourceId { get; } + /// The ID of the external resource. public string ExternalResourceId { get; } } diff --git a/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/Models/DevTestLabResourcePatch.Serialization.cs b/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/Models/DevTestLabResourcePatch.Serialization.cs index 885ce9b3f563..f024ca115480 100644 --- a/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/Models/DevTestLabResourcePatch.Serialization.cs +++ b/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/Models/DevTestLabResourcePatch.Serialization.cs @@ -9,14 +9,32 @@ using System.ClientModel.Primitives; using System.Collections.Generic; using System.Text.Json; -using Azure.Core; +using Azure.ResourceManager.DevTestLabs; namespace Azure.ResourceManager.DevTestLabs.Models { - public partial class DevTestLabResourcePatch : IUtf8JsonSerializable, IJsonModel + /// Represents an update resource. + public partial class DevTestLabResourcePatch : IJsonModel { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + /// The data to parse. + /// The client options for reading and writing models. + protected virtual DevTestLabResourcePatch 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 DeserializeDevTestLabResourcePatch(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(DevTestLabResourcePatch)} does not support reading '{options.Format}' format."); + } + } + /// The JSON writer. + /// The client options for reading and writing models. void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) { writer.WriteStartObject(); @@ -28,12 +46,11 @@ void IJsonModel.Write(Utf8JsonWriter writer, ModelReade /// 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(DevTestLabResourcePatch)} does not support writing '{format}' format."); } - if (Optional.IsCollectionDefined(Tags)) { writer.WritePropertyName("tags"u8); @@ -41,19 +58,24 @@ 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(); } - 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); } @@ -62,58 +84,71 @@ protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWrit } } - DevTestLabResourcePatch IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + /// The JSON reader. + /// The client options for reading and writing models. + DevTestLabResourcePatch IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) => JsonModelCreateCore(ref reader, options); + + /// The JSON reader. + /// The client options for reading and writing models. + protected virtual DevTestLabResourcePatch 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(DevTestLabResourcePatch)} does not support reading '{format}' format."); } - using JsonDocument document = JsonDocument.ParseValue(ref reader); return DeserializeDevTestLabResourcePatch(document.RootElement, options); } - internal static DevTestLabResourcePatch DeserializeDevTestLabResourcePatch(JsonElement element, ModelReaderWriterOptions options = null) + /// The JSON element to deserialize. + /// The client options for reading and writing models. + internal static DevTestLabResourcePatch DeserializeDevTestLabResourcePatch(JsonElement element, ModelReaderWriterOptions options) { - options ??= ModelSerializationExtensions.WireOptions; - if (element.ValueKind == JsonValueKind.Null) { return null; } IDictionary tags = 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("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 (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 DevTestLabResourcePatch(tags ?? new ChangeTrackingDictionary(), serializedAdditionalRawData); + return new DevTestLabResourcePatch(tags ?? new ChangeTrackingDictionary(), 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": @@ -123,22 +158,11 @@ BinaryData IPersistableModel.Write(ModelReaderWriterOpt } } - DevTestLabResourcePatch 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 DeserializeDevTestLabResourcePatch(document.RootElement, options); - } - default: - throw new FormatException($"The model {nameof(DevTestLabResourcePatch)} does not support reading '{options.Format}' format."); - } - } + /// The data to parse. + /// The client options for reading and writing models. + DevTestLabResourcePatch IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) => PersistableModelCreateCore(data, options); + /// The client options for reading and writing models. string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; } } diff --git a/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/Models/DevTestLabResourcePatch.cs b/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/Models/DevTestLabResourcePatch.cs index 0c5671bed55c..4cdaa5b45ad8 100644 --- a/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/Models/DevTestLabResourcePatch.cs +++ b/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/Models/DevTestLabResourcePatch.cs @@ -7,43 +7,15 @@ using System; using System.Collections.Generic; +using Azure.ResourceManager.DevTestLabs; namespace Azure.ResourceManager.DevTestLabs.Models { /// Represents an update resource. public partial class DevTestLabResourcePatch { - /// - /// 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 protected IDictionary _serializedAdditionalRawData; + /// Keeps track of any properties unknown to the library. + private protected readonly IDictionary _additionalBinaryDataProperties; /// Initializes a new instance of . public DevTestLabResourcePatch() @@ -53,11 +25,11 @@ public DevTestLabResourcePatch() /// Initializes a new instance of . /// The tags of the resource. - /// Keeps track of any properties unknown to the library. - internal DevTestLabResourcePatch(IDictionary tags, IDictionary serializedAdditionalRawData) + /// Keeps track of any properties unknown to the library. + internal DevTestLabResourcePatch(IDictionary tags, IDictionary additionalBinaryDataProperties) { Tags = tags; - _serializedAdditionalRawData = serializedAdditionalRawData; + _additionalBinaryDataProperties = additionalBinaryDataProperties; } /// The tags of the resource. diff --git a/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/Models/DevTestLabScheduleCreationParameter.Serialization.cs b/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/Models/DevTestLabScheduleCreationParameter.Serialization.cs index e90cd9980610..2f6283af06b0 100644 --- a/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/Models/DevTestLabScheduleCreationParameter.Serialization.cs +++ b/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/Models/DevTestLabScheduleCreationParameter.Serialization.cs @@ -10,13 +10,32 @@ using System.Collections.Generic; using System.Text.Json; using Azure.Core; +using Azure.ResourceManager.DevTestLabs; namespace Azure.ResourceManager.DevTestLabs.Models { - public partial class DevTestLabScheduleCreationParameter : IUtf8JsonSerializable, IJsonModel + /// Properties for creating a schedule. + public partial class DevTestLabScheduleCreationParameter : IJsonModel { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + /// The data to parse. + /// The client options for reading and writing models. + protected virtual DevTestLabScheduleCreationParameter 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 DeserializeDevTestLabScheduleCreationParameter(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(DevTestLabScheduleCreationParameter)} does not support reading '{options.Format}' format."); + } + } + /// The JSON writer. + /// The client options for reading and writing models. void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) { writer.WriteStartObject(); @@ -28,12 +47,16 @@ 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(DevTestLabScheduleCreationParameter)} does not support writing '{format}' format."); } - + if (Optional.IsDefined(Properties)) + { + writer.WritePropertyName("properties"u8); + writer.WriteObjectValue(Properties, options); + } if (Optional.IsDefined(Name)) { writer.WritePropertyName("name"u8); @@ -51,62 +74,24 @@ 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(); } - writer.WritePropertyName("properties"u8); - writer.WriteStartObject(); - if (Optional.IsDefined(Status)) + if (options.Format != "W" && _additionalBinaryDataProperties != null) { - writer.WritePropertyName("status"u8); - writer.WriteStringValue(Status.Value.ToString()); - } - if (Optional.IsDefined(TaskType)) - { - writer.WritePropertyName("taskType"u8); - writer.WriteStringValue(TaskType); - } - if (Optional.IsDefined(WeeklyRecurrence)) - { - writer.WritePropertyName("weeklyRecurrence"u8); - writer.WriteObjectValue(WeeklyRecurrence, options); - } - if (Optional.IsDefined(DailyRecurrence)) - { - writer.WritePropertyName("dailyRecurrence"u8); - writer.WriteObjectValue(DailyRecurrence, options); - } - if (Optional.IsDefined(HourlyRecurrence)) - { - writer.WritePropertyName("hourlyRecurrence"u8); - writer.WriteObjectValue(HourlyRecurrence, options); - } - if (Optional.IsDefined(TimeZoneId)) - { - writer.WritePropertyName("timeZoneId"u8); - writer.WriteStringValue(TimeZoneId); - } - if (Optional.IsDefined(NotificationSettings)) - { - writer.WritePropertyName("notificationSettings"u8); - writer.WriteObjectValue(NotificationSettings, options); - } - if (Optional.IsDefined(TargetResourceId)) - { - writer.WritePropertyName("targetResourceId"u8); - writer.WriteStringValue(TargetResourceId); - } - writer.WriteEndObject(); - if (options.Format != "W" && _serializedAdditionalRawData != 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); } @@ -115,170 +100,97 @@ protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWrit } } - DevTestLabScheduleCreationParameter IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + /// The JSON reader. + /// The client options for reading and writing models. + DevTestLabScheduleCreationParameter IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) => JsonModelCreateCore(ref reader, options); + + /// The JSON reader. + /// The client options for reading and writing models. + protected virtual DevTestLabScheduleCreationParameter 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(DevTestLabScheduleCreationParameter)} does not support reading '{format}' format."); } - using JsonDocument document = JsonDocument.ParseValue(ref reader); return DeserializeDevTestLabScheduleCreationParameter(document.RootElement, options); } - internal static DevTestLabScheduleCreationParameter DeserializeDevTestLabScheduleCreationParameter(JsonElement element, ModelReaderWriterOptions options = null) + /// The JSON element to deserialize. + /// The client options for reading and writing models. + internal static DevTestLabScheduleCreationParameter DeserializeDevTestLabScheduleCreationParameter(JsonElement element, ModelReaderWriterOptions options) { - options ??= ModelSerializationExtensions.WireOptions; - if (element.ValueKind == JsonValueKind.Null) { return null; } + ScheduleCreationParameterProperties properties = default; string name = default; AzureLocation? location = default; IDictionary tags = default; - DevTestLabEnableStatus? status = default; - string taskType = default; - DevTestLabWeekDetails weeklyRecurrence = default; - DayDetails dailyRecurrence = default; - HourDetails hourlyRecurrence = default; - string timeZoneId = default; - DevTestLabNotificationSettings notificationSettings = default; - ResourceIdentifier targetResourceId = 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("name"u8)) - { - name = property.Value.GetString(); - continue; - } - if (property.NameEquals("location"u8)) + if (prop.NameEquals("properties"u8)) { - if (property.Value.ValueKind == JsonValueKind.Null) + if (prop.Value.ValueKind == JsonValueKind.Null) { continue; } - location = new AzureLocation(property.Value.GetString()); + properties = ScheduleCreationParameterProperties.DeserializeScheduleCreationParameterProperties(prop.Value, options); continue; } - if (property.NameEquals("tags"u8)) + if (prop.NameEquals("name"u8)) { - if (property.Value.ValueKind == JsonValueKind.Null) + name = prop.Value.GetString(); + continue; + } + if (prop.NameEquals("location"u8)) + { + if (prop.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; + location = new AzureLocation(prop.Value.GetString()); continue; } - if (property.NameEquals("properties"u8)) + if (prop.NameEquals("tags"u8)) { - if (property.Value.ValueKind == JsonValueKind.Null) + if (prop.Value.ValueKind == JsonValueKind.Null) { - property.ThrowNonNullablePropertyIsNull(); continue; } - foreach (var property0 in property.Value.EnumerateObject()) + Dictionary dictionary = new Dictionary(); + foreach (var prop0 in prop.Value.EnumerateObject()) { - if (property0.NameEquals("status"u8)) - { - if (property0.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - status = new DevTestLabEnableStatus(property0.Value.GetString()); - continue; - } - if (property0.NameEquals("taskType"u8)) - { - taskType = property0.Value.GetString(); - continue; - } - if (property0.NameEquals("weeklyRecurrence"u8)) - { - if (property0.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - weeklyRecurrence = DevTestLabWeekDetails.DeserializeDevTestLabWeekDetails(property0.Value, options); - continue; - } - if (property0.NameEquals("dailyRecurrence"u8)) - { - if (property0.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - dailyRecurrence = DayDetails.DeserializeDayDetails(property0.Value, options); - continue; - } - if (property0.NameEquals("hourlyRecurrence"u8)) - { - if (property0.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - hourlyRecurrence = HourDetails.DeserializeHourDetails(property0.Value, options); - continue; - } - if (property0.NameEquals("timeZoneId"u8)) + if (prop0.Value.ValueKind == JsonValueKind.Null) { - timeZoneId = property0.Value.GetString(); - continue; + dictionary.Add(prop0.Name, null); } - if (property0.NameEquals("notificationSettings"u8)) + else { - if (property0.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - notificationSettings = DevTestLabNotificationSettings.DeserializeDevTestLabNotificationSettings(property0.Value, options); - continue; - } - if (property0.NameEquals("targetResourceId"u8)) - { - if (property0.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - targetResourceId = new ResourceIdentifier(property0.Value.GetString()); - continue; + dictionary.Add(prop0.Name, prop0.Value.GetString()); } } + tags = dictionary; 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 DevTestLabScheduleCreationParameter( - name, - location, - tags ?? new ChangeTrackingDictionary(), - status, - taskType, - weeklyRecurrence, - dailyRecurrence, - hourlyRecurrence, - timeZoneId, - notificationSettings, - targetResourceId, - serializedAdditionalRawData); + return new DevTestLabScheduleCreationParameter(properties, name, location, tags ?? new ChangeTrackingDictionary(), 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": @@ -288,22 +200,11 @@ BinaryData IPersistableModel.Write(ModelRea } } - DevTestLabScheduleCreationParameter 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 DeserializeDevTestLabScheduleCreationParameter(document.RootElement, options); - } - default: - throw new FormatException($"The model {nameof(DevTestLabScheduleCreationParameter)} does not support reading '{options.Format}' format."); - } - } + /// The data to parse. + /// The client options for reading and writing models. + DevTestLabScheduleCreationParameter IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) => PersistableModelCreateCore(data, options); + /// The client options for reading and writing models. string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; } } diff --git a/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/Models/DevTestLabScheduleCreationParameter.cs b/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/Models/DevTestLabScheduleCreationParameter.cs index 6dda7f9ffebd..7aeeb0a4a21e 100644 --- a/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/Models/DevTestLabScheduleCreationParameter.cs +++ b/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/Models/DevTestLabScheduleCreationParameter.cs @@ -8,43 +8,15 @@ using System; using System.Collections.Generic; using Azure.Core; +using Azure.ResourceManager.DevTestLabs; namespace Azure.ResourceManager.DevTestLabs.Models { /// Properties for creating a schedule. public partial class DevTestLabScheduleCreationParameter { - /// - /// 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 DevTestLabScheduleCreationParameter() @@ -53,79 +25,166 @@ public DevTestLabScheduleCreationParameter() } /// Initializes a new instance of . + /// The properties of the schedule. /// The name of the virtual machine or environment. /// The location of the new virtual machine or environment. /// The tags of the resource. - /// The status of the schedule (i.e. Enabled, Disabled). - /// The task type of the schedule (e.g. LabVmsShutdownTask, LabVmAutoStart). - /// If the schedule will occur only some days of the week, specify the weekly recurrence. - /// If the schedule will occur once each day of the week, specify the daily recurrence. - /// If the schedule will occur multiple times a day, specify the hourly recurrence. - /// The time zone ID (e.g. Pacific Standard time). - /// Notification settings. - /// The resource ID to which the schedule belongs. - /// Keeps track of any properties unknown to the library. - internal DevTestLabScheduleCreationParameter(string name, AzureLocation? location, IDictionary tags, DevTestLabEnableStatus? status, string taskType, DevTestLabWeekDetails weeklyRecurrence, DayDetails dailyRecurrence, HourDetails hourlyRecurrence, string timeZoneId, DevTestLabNotificationSettings notificationSettings, ResourceIdentifier targetResourceId, IDictionary serializedAdditionalRawData) + /// Keeps track of any properties unknown to the library. + internal DevTestLabScheduleCreationParameter(ScheduleCreationParameterProperties properties, string name, AzureLocation? location, IDictionary tags, IDictionary additionalBinaryDataProperties) { + Properties = properties; Name = name; Location = location; Tags = tags; - Status = status; - TaskType = taskType; - WeeklyRecurrence = weeklyRecurrence; - DailyRecurrence = dailyRecurrence; - HourlyRecurrence = hourlyRecurrence; - TimeZoneId = timeZoneId; - NotificationSettings = notificationSettings; - TargetResourceId = targetResourceId; - _serializedAdditionalRawData = serializedAdditionalRawData; + _additionalBinaryDataProperties = additionalBinaryDataProperties; } + /// The properties of the schedule. + internal ScheduleCreationParameterProperties Properties { get; set; } + /// The name of the virtual machine or environment. public string Name { get; set; } + /// The location of the new virtual machine or environment. public AzureLocation? Location { get; } + /// The tags of the resource. public IDictionary Tags { get; } + /// The status of the schedule (i.e. Enabled, Disabled). - public DevTestLabEnableStatus? Status { get; set; } + public DevTestLabEnableStatus? Status + { + get + { + return Properties is null ? default : Properties.Status; + } + set + { + if (Properties is null) + { + Properties = new ScheduleCreationParameterProperties(); + } + Properties.Status = value.Value; + } + } + /// The task type of the schedule (e.g. LabVmsShutdownTask, LabVmAutoStart). - public string TaskType { get; set; } + public string TaskType + { + get + { + return Properties is null ? default : Properties.TaskType; + } + set + { + if (Properties is null) + { + Properties = new ScheduleCreationParameterProperties(); + } + Properties.TaskType = value; + } + } + /// If the schedule will occur only some days of the week, specify the weekly recurrence. - public DevTestLabWeekDetails WeeklyRecurrence { get; set; } - /// If the schedule will occur once each day of the week, specify the daily recurrence. - internal DayDetails DailyRecurrence { get; set; } + public DevTestLabWeekDetails WeeklyRecurrence + { + get + { + return Properties is null ? default : Properties.WeeklyRecurrence; + } + set + { + if (Properties is null) + { + Properties = new ScheduleCreationParameterProperties(); + } + Properties.WeeklyRecurrence = value; + } + } + + /// The time zone ID (e.g. China Standard Time, Greenland Standard Time, Pacific Standard time, etc.). The possible values for this property can be found in `IReadOnlyCollection<string> TimeZoneConverter.TZConvert.KnownWindowsTimeZoneIds` (https://github.com/mattjohnsonpint/TimeZoneConverter/blob/main/README.md). + public string TimeZoneId + { + get + { + return Properties is null ? default : Properties.TimeZoneId; + } + set + { + if (Properties is null) + { + Properties = new ScheduleCreationParameterProperties(); + } + Properties.TimeZoneId = value; + } + } + + /// Notification settings. + public DevTestLabNotificationSettings NotificationSettings + { + get + { + return Properties is null ? default : Properties.NotificationSettings; + } + set + { + if (Properties is null) + { + Properties = new ScheduleCreationParameterProperties(); + } + Properties.NotificationSettings = value; + } + } + + /// The resource ID to which the schedule belongs. + public ResourceIdentifier TargetResourceId + { + get + { + return Properties is null ? default : Properties.TargetResourceId; + } + set + { + if (Properties is null) + { + Properties = new ScheduleCreationParameterProperties(); + } + Properties.TargetResourceId = value; + } + } + /// The time of day the schedule will occur. public string DailyRecurrenceTime { - get => DailyRecurrence is null ? default : DailyRecurrence.Time; + get + { + return Properties is null ? default : Properties.DailyRecurrenceTime; + } set { - if (DailyRecurrence is null) - DailyRecurrence = new DayDetails(); - DailyRecurrence.Time = value; + if (Properties is null) + { + Properties = new ScheduleCreationParameterProperties(); + } + Properties.DailyRecurrenceTime = value; } } - /// If the schedule will occur multiple times a day, specify the hourly recurrence. - internal HourDetails HourlyRecurrence { get; set; } /// Minutes of the hour the schedule will run. public int? HourlyRecurrenceMinute { - get => HourlyRecurrence is null ? default : HourlyRecurrence.Minute; + get + { + return Properties is null ? default : Properties.HourlyRecurrenceMinute; + } set { - if (HourlyRecurrence is null) - HourlyRecurrence = new HourDetails(); - HourlyRecurrence.Minute = value; + if (Properties is null) + { + Properties = new ScheduleCreationParameterProperties(); + } + Properties.HourlyRecurrenceMinute = value.Value; } } - - /// The time zone ID (e.g. Pacific Standard time). - public string TimeZoneId { get; set; } - /// Notification settings. - public DevTestLabNotificationSettings NotificationSettings { get; set; } - /// The resource ID to which the schedule belongs. - public ResourceIdentifier TargetResourceId { get; set; } } } diff --git a/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/Models/DevTestLabSchedulePatch.Serialization.cs b/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/Models/DevTestLabSchedulePatch.Serialization.cs index 7bb26afeb674..157d61cd4513 100644 --- a/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/Models/DevTestLabSchedulePatch.Serialization.cs +++ b/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/Models/DevTestLabSchedulePatch.Serialization.cs @@ -10,13 +10,32 @@ using System.Collections.Generic; using System.Text.Json; using Azure.Core; +using Azure.ResourceManager.DevTestLabs; namespace Azure.ResourceManager.DevTestLabs.Models { - public partial class DevTestLabSchedulePatch : IUtf8JsonSerializable, IJsonModel + /// A schedule. + public partial class DevTestLabSchedulePatch : DevTestLabResourcePatch, IJsonModel { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + /// The data to parse. + /// The client options for reading and writing models. + protected override DevTestLabResourcePatch 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 DeserializeDevTestLabSchedulePatch(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(DevTestLabSchedulePatch)} does not support reading '{options.Format}' format."); + } + } + /// The JSON writer. + /// The client options for reading and writing models. void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) { writer.WriteStartObject(); @@ -28,67 +47,79 @@ void IJsonModel.Write(Utf8JsonWriter writer, ModelReade /// 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(DevTestLabSchedulePatch)} does not support writing '{format}' format."); } - base.JsonModelWriteCore(writer, options); } - DevTestLabSchedulePatch IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + /// The JSON reader. + /// The client options for reading and writing models. + DevTestLabSchedulePatch IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) => (DevTestLabSchedulePatch)JsonModelCreateCore(ref reader, options); + + /// The JSON reader. + /// The client options for reading and writing models. + protected override DevTestLabResourcePatch 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(DevTestLabSchedulePatch)} does not support reading '{format}' format."); } - using JsonDocument document = JsonDocument.ParseValue(ref reader); return DeserializeDevTestLabSchedulePatch(document.RootElement, options); } - internal static DevTestLabSchedulePatch DeserializeDevTestLabSchedulePatch(JsonElement element, ModelReaderWriterOptions options = null) + /// The JSON element to deserialize. + /// The client options for reading and writing models. + internal static DevTestLabSchedulePatch DeserializeDevTestLabSchedulePatch(JsonElement element, ModelReaderWriterOptions options) { - options ??= ModelSerializationExtensions.WireOptions; - if (element.ValueKind == JsonValueKind.Null) { return null; } IDictionary tags = 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("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 (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 DevTestLabSchedulePatch(tags ?? new ChangeTrackingDictionary(), serializedAdditionalRawData); + return new DevTestLabSchedulePatch(tags ?? new ChangeTrackingDictionary(), 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 override BinaryData PersistableModelWriteCore(ModelReaderWriterOptions options) + { + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; switch (format) { case "J": @@ -98,22 +129,23 @@ BinaryData IPersistableModel.Write(ModelReaderWriterOpt } } - DevTestLabSchedulePatch 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. + DevTestLabSchedulePatch IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) => (DevTestLabSchedulePatch)PersistableModelCreateCore(data, options); - switch (format) + /// The client options for reading and writing models. + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + + /// The to serialize into . + internal static RequestContent ToRequestContent(DevTestLabSchedulePatch devTestLabSchedulePatch) + { + if (devTestLabSchedulePatch == null) { - case "J": - { - using JsonDocument document = JsonDocument.Parse(data, ModelSerializationExtensions.JsonDocumentOptions); - return DeserializeDevTestLabSchedulePatch(document.RootElement, options); - } - default: - throw new FormatException($"The model {nameof(DevTestLabSchedulePatch)} does not support reading '{options.Format}' format."); + return null; } + Utf8JsonRequestContent content = new Utf8JsonRequestContent(); + content.JsonWriter.WriteObjectValue(devTestLabSchedulePatch, ModelSerializationExtensions.WireOptions); + return content; } - - string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; } } diff --git a/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/Models/DevTestLabSchedulePatch.cs b/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/Models/DevTestLabSchedulePatch.cs index 0514f304169f..e6b57f4e2dde 100644 --- a/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/Models/DevTestLabSchedulePatch.cs +++ b/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/Models/DevTestLabSchedulePatch.cs @@ -20,8 +20,8 @@ public DevTestLabSchedulePatch() /// Initializes a new instance of . /// The tags of the resource. - /// Keeps track of any properties unknown to the library. - internal DevTestLabSchedulePatch(IDictionary tags, IDictionary serializedAdditionalRawData) : base(tags, serializedAdditionalRawData) + /// Keeps track of any properties unknown to the library. + internal DevTestLabSchedulePatch(IDictionary tags, IDictionary additionalBinaryDataProperties) : base(tags, additionalBinaryDataProperties) { } } diff --git a/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/Models/DevTestLabSecretPatch.Serialization.cs b/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/Models/DevTestLabSecretPatch.Serialization.cs index df9c550717ff..c6d6135be897 100644 --- a/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/Models/DevTestLabSecretPatch.Serialization.cs +++ b/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/Models/DevTestLabSecretPatch.Serialization.cs @@ -10,13 +10,32 @@ using System.Collections.Generic; using System.Text.Json; using Azure.Core; +using Azure.ResourceManager.DevTestLabs; namespace Azure.ResourceManager.DevTestLabs.Models { - public partial class DevTestLabSecretPatch : IUtf8JsonSerializable, IJsonModel + /// A secret. + public partial class DevTestLabSecretPatch : DevTestLabResourcePatch, IJsonModel { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + /// The data to parse. + /// The client options for reading and writing models. + protected override DevTestLabResourcePatch 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 DeserializeDevTestLabSecretPatch(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(DevTestLabSecretPatch)} does not support reading '{options.Format}' format."); + } + } + /// The JSON writer. + /// The client options for reading and writing models. void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) { writer.WriteStartObject(); @@ -28,67 +47,79 @@ void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderW /// 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(DevTestLabSecretPatch)} does not support writing '{format}' format."); } - base.JsonModelWriteCore(writer, options); } - DevTestLabSecretPatch IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + /// The JSON reader. + /// The client options for reading and writing models. + DevTestLabSecretPatch IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) => (DevTestLabSecretPatch)JsonModelCreateCore(ref reader, options); + + /// The JSON reader. + /// The client options for reading and writing models. + protected override DevTestLabResourcePatch 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(DevTestLabSecretPatch)} does not support reading '{format}' format."); } - using JsonDocument document = JsonDocument.ParseValue(ref reader); return DeserializeDevTestLabSecretPatch(document.RootElement, options); } - internal static DevTestLabSecretPatch DeserializeDevTestLabSecretPatch(JsonElement element, ModelReaderWriterOptions options = null) + /// The JSON element to deserialize. + /// The client options for reading and writing models. + internal static DevTestLabSecretPatch DeserializeDevTestLabSecretPatch(JsonElement element, ModelReaderWriterOptions options) { - options ??= ModelSerializationExtensions.WireOptions; - if (element.ValueKind == JsonValueKind.Null) { return null; } IDictionary tags = 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("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 (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 DevTestLabSecretPatch(tags ?? new ChangeTrackingDictionary(), serializedAdditionalRawData); + return new DevTestLabSecretPatch(tags ?? new ChangeTrackingDictionary(), 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 override BinaryData PersistableModelWriteCore(ModelReaderWriterOptions options) + { + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; switch (format) { case "J": @@ -98,22 +129,23 @@ BinaryData IPersistableModel.Write(ModelReaderWriterOptio } } - DevTestLabSecretPatch 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. + DevTestLabSecretPatch IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) => (DevTestLabSecretPatch)PersistableModelCreateCore(data, options); - switch (format) + /// The client options for reading and writing models. + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + + /// The to serialize into . + internal static RequestContent ToRequestContent(DevTestLabSecretPatch devTestLabSecretPatch) + { + if (devTestLabSecretPatch == null) { - case "J": - { - using JsonDocument document = JsonDocument.Parse(data, ModelSerializationExtensions.JsonDocumentOptions); - return DeserializeDevTestLabSecretPatch(document.RootElement, options); - } - default: - throw new FormatException($"The model {nameof(DevTestLabSecretPatch)} does not support reading '{options.Format}' format."); + return null; } + Utf8JsonRequestContent content = new Utf8JsonRequestContent(); + content.JsonWriter.WriteObjectValue(devTestLabSecretPatch, ModelSerializationExtensions.WireOptions); + return content; } - - string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; } } diff --git a/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/Models/DevTestLabSecretPatch.cs b/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/Models/DevTestLabSecretPatch.cs index 3cbd04990951..39255312c64d 100644 --- a/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/Models/DevTestLabSecretPatch.cs +++ b/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/Models/DevTestLabSecretPatch.cs @@ -20,8 +20,8 @@ public DevTestLabSecretPatch() /// Initializes a new instance of . /// The tags of the resource. - /// Keeps track of any properties unknown to the library. - internal DevTestLabSecretPatch(IDictionary tags, IDictionary serializedAdditionalRawData) : base(tags, serializedAdditionalRawData) + /// Keeps track of any properties unknown to the library. + internal DevTestLabSecretPatch(IDictionary tags, IDictionary additionalBinaryDataProperties) : base(tags, additionalBinaryDataProperties) { } } diff --git a/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/Models/DevTestLabServiceFabricPatch.Serialization.cs b/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/Models/DevTestLabServiceFabricPatch.Serialization.cs index 9cdfa4273102..564c1703cf39 100644 --- a/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/Models/DevTestLabServiceFabricPatch.Serialization.cs +++ b/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/Models/DevTestLabServiceFabricPatch.Serialization.cs @@ -10,13 +10,32 @@ using System.Collections.Generic; using System.Text.Json; using Azure.Core; +using Azure.ResourceManager.DevTestLabs; namespace Azure.ResourceManager.DevTestLabs.Models { - public partial class DevTestLabServiceFabricPatch : IUtf8JsonSerializable, IJsonModel + /// A Service Fabric. + public partial class DevTestLabServiceFabricPatch : DevTestLabResourcePatch, IJsonModel { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + /// The data to parse. + /// The client options for reading and writing models. + protected override DevTestLabResourcePatch 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 DeserializeDevTestLabServiceFabricPatch(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(DevTestLabServiceFabricPatch)} does not support reading '{options.Format}' format."); + } + } + /// The JSON writer. + /// The client options for reading and writing models. void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) { writer.WriteStartObject(); @@ -28,67 +47,79 @@ void IJsonModel.Write(Utf8JsonWriter writer, Model /// 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(DevTestLabServiceFabricPatch)} does not support writing '{format}' format."); } - base.JsonModelWriteCore(writer, options); } - DevTestLabServiceFabricPatch IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + /// The JSON reader. + /// The client options for reading and writing models. + DevTestLabServiceFabricPatch IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) => (DevTestLabServiceFabricPatch)JsonModelCreateCore(ref reader, options); + + /// The JSON reader. + /// The client options for reading and writing models. + protected override DevTestLabResourcePatch 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(DevTestLabServiceFabricPatch)} does not support reading '{format}' format."); } - using JsonDocument document = JsonDocument.ParseValue(ref reader); return DeserializeDevTestLabServiceFabricPatch(document.RootElement, options); } - internal static DevTestLabServiceFabricPatch DeserializeDevTestLabServiceFabricPatch(JsonElement element, ModelReaderWriterOptions options = null) + /// The JSON element to deserialize. + /// The client options for reading and writing models. + internal static DevTestLabServiceFabricPatch DeserializeDevTestLabServiceFabricPatch(JsonElement element, ModelReaderWriterOptions options) { - options ??= ModelSerializationExtensions.WireOptions; - if (element.ValueKind == JsonValueKind.Null) { return null; } IDictionary tags = 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("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 (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 DevTestLabServiceFabricPatch(tags ?? new ChangeTrackingDictionary(), serializedAdditionalRawData); + return new DevTestLabServiceFabricPatch(tags ?? new ChangeTrackingDictionary(), 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 override BinaryData PersistableModelWriteCore(ModelReaderWriterOptions options) + { + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; switch (format) { case "J": @@ -98,22 +129,23 @@ BinaryData IPersistableModel.Write(ModelReaderWrit } } - DevTestLabServiceFabricPatch 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. + DevTestLabServiceFabricPatch IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) => (DevTestLabServiceFabricPatch)PersistableModelCreateCore(data, options); - switch (format) + /// The client options for reading and writing models. + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + + /// The to serialize into . + internal static RequestContent ToRequestContent(DevTestLabServiceFabricPatch devTestLabServiceFabricPatch) + { + if (devTestLabServiceFabricPatch == null) { - case "J": - { - using JsonDocument document = JsonDocument.Parse(data, ModelSerializationExtensions.JsonDocumentOptions); - return DeserializeDevTestLabServiceFabricPatch(document.RootElement, options); - } - default: - throw new FormatException($"The model {nameof(DevTestLabServiceFabricPatch)} does not support reading '{options.Format}' format."); + return null; } + Utf8JsonRequestContent content = new Utf8JsonRequestContent(); + content.JsonWriter.WriteObjectValue(devTestLabServiceFabricPatch, ModelSerializationExtensions.WireOptions); + return content; } - - string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; } } diff --git a/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/Models/DevTestLabServiceFabricPatch.cs b/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/Models/DevTestLabServiceFabricPatch.cs index 5eb078af39d8..7fcf23fab482 100644 --- a/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/Models/DevTestLabServiceFabricPatch.cs +++ b/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/Models/DevTestLabServiceFabricPatch.cs @@ -20,8 +20,8 @@ public DevTestLabServiceFabricPatch() /// Initializes a new instance of . /// The tags of the resource. - /// Keeps track of any properties unknown to the library. - internal DevTestLabServiceFabricPatch(IDictionary tags, IDictionary serializedAdditionalRawData) : base(tags, serializedAdditionalRawData) + /// Keeps track of any properties unknown to the library. + internal DevTestLabServiceFabricPatch(IDictionary tags, IDictionary additionalBinaryDataProperties) : base(tags, additionalBinaryDataProperties) { } } diff --git a/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/Models/DevTestLabSourceControlType.cs b/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/Models/DevTestLabSourceControlType.cs index e3d6d89de0a2..9574aed27bf7 100644 --- a/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/Models/DevTestLabSourceControlType.cs +++ b/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/Models/DevTestLabSourceControlType.cs @@ -7,6 +7,7 @@ using System; using System.ComponentModel; +using Azure.ResourceManager.DevTestLabs; namespace Azure.ResourceManager.DevTestLabs.Models { @@ -14,41 +15,59 @@ namespace Azure.ResourceManager.DevTestLabs.Models public readonly partial struct DevTestLabSourceControlType : IEquatable { private readonly string _value; + private const string VsoGitValue = "VsoGit"; + private const string GitHubValue = "GitHub"; + private const string StorageAccountValue = "StorageAccount"; /// Initializes a new instance of . + /// The value. /// is null. public DevTestLabSourceControlType(string value) { - _value = value ?? throw new ArgumentNullException(nameof(value)); - } + Argument.AssertNotNull(value, nameof(value)); - private const string VsoGitValue = "VsoGit"; - private const string GitHubValue = "GitHub"; - private const string StorageAccountValue = "StorageAccount"; + _value = value; + } - /// VsoGit. + /// Gets the VsoGit. public static DevTestLabSourceControlType VsoGit { get; } = new DevTestLabSourceControlType(VsoGitValue); - /// GitHub. + + /// Gets the GitHub. public static DevTestLabSourceControlType GitHub { get; } = new DevTestLabSourceControlType(GitHubValue); - /// StorageAccount. + + /// Gets the StorageAccount. public static DevTestLabSourceControlType StorageAccount { get; } = new DevTestLabSourceControlType(StorageAccountValue); + /// Determines if two values are the same. + /// The left value to compare. + /// The right value to compare. public static bool operator ==(DevTestLabSourceControlType left, DevTestLabSourceControlType 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 !=(DevTestLabSourceControlType left, DevTestLabSourceControlType right) => !left.Equals(right); - /// Converts a to a . + + /// Converts a string to a . + /// The value. public static implicit operator DevTestLabSourceControlType(string value) => new DevTestLabSourceControlType(value); - /// + /// Converts a string to a . + /// The value. + public static implicit operator DevTestLabSourceControlType?(string value) => value == null ? null : new DevTestLabSourceControlType(value); + + /// [EditorBrowsable(EditorBrowsableState.Never)] public override bool Equals(object obj) => obj is DevTestLabSourceControlType other && Equals(other); - /// + + /// public bool Equals(DevTestLabSourceControlType 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/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/Models/DevTestLabStorageType.cs b/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/Models/DevTestLabStorageType.cs index f2f67aded4ca..e4afdc728f11 100644 --- a/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/Models/DevTestLabStorageType.cs +++ b/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/Models/DevTestLabStorageType.cs @@ -7,6 +7,7 @@ using System; using System.ComponentModel; +using Azure.ResourceManager.DevTestLabs; namespace Azure.ResourceManager.DevTestLabs.Models { @@ -14,41 +15,59 @@ namespace Azure.ResourceManager.DevTestLabs.Models public readonly partial struct DevTestLabStorageType : IEquatable { private readonly string _value; + private const string StandardValue = "Standard"; + private const string PremiumValue = "Premium"; + private const string StandardSsdValue = "StandardSSD"; /// Initializes a new instance of . + /// The value. /// is null. public DevTestLabStorageType(string value) { - _value = value ?? throw new ArgumentNullException(nameof(value)); - } + Argument.AssertNotNull(value, nameof(value)); - private const string StandardValue = "Standard"; - private const string PremiumValue = "Premium"; - private const string StandardSsdValue = "StandardSSD"; + _value = value; + } - /// Standard. + /// Gets the Standard. public static DevTestLabStorageType Standard { get; } = new DevTestLabStorageType(StandardValue); - /// Premium. + + /// Gets the Premium. public static DevTestLabStorageType Premium { get; } = new DevTestLabStorageType(PremiumValue); - /// StandardSSD. + + /// Gets the StandardSsd. public static DevTestLabStorageType StandardSsd { get; } = new DevTestLabStorageType(StandardSsdValue); + /// Determines if two values are the same. + /// The left value to compare. + /// The right value to compare. public static bool operator ==(DevTestLabStorageType left, DevTestLabStorageType 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 !=(DevTestLabStorageType left, DevTestLabStorageType right) => !left.Equals(right); - /// Converts a to a . + + /// Converts a string to a . + /// The value. public static implicit operator DevTestLabStorageType(string value) => new DevTestLabStorageType(value); - /// + /// Converts a string to a . + /// The value. + public static implicit operator DevTestLabStorageType?(string value) => value == null ? null : new DevTestLabStorageType(value); + + /// [EditorBrowsable(EditorBrowsableState.Never)] public override bool Equals(object obj) => obj is DevTestLabStorageType other && Equals(other); - /// + + /// public bool Equals(DevTestLabStorageType 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/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/Models/DevTestLabSubnet.Serialization.cs b/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/Models/DevTestLabSubnet.Serialization.cs index 51a6a53d2e78..1077d7e12e9a 100644 --- a/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/Models/DevTestLabSubnet.Serialization.cs +++ b/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/Models/DevTestLabSubnet.Serialization.cs @@ -10,13 +10,32 @@ using System.Collections.Generic; using System.Text.Json; using Azure.Core; +using Azure.ResourceManager.DevTestLabs; namespace Azure.ResourceManager.DevTestLabs.Models { - public partial class DevTestLabSubnet : IUtf8JsonSerializable, IJsonModel + /// Subnet information. + public partial class DevTestLabSubnet : IJsonModel { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + /// The data to parse. + /// The client options for reading and writing models. + protected virtual DevTestLabSubnet 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 DeserializeDevTestLabSubnet(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(DevTestLabSubnet)} does not support reading '{options.Format}' format."); + } + } + /// The JSON writer. + /// The client options for reading and writing models. void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) { writer.WriteStartObject(); @@ -28,12 +47,11 @@ void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriter /// 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(DevTestLabSubnet)} does not support writing '{format}' format."); } - if (Optional.IsDefined(ResourceId)) { writer.WritePropertyName("resourceId"u8); @@ -49,15 +67,15 @@ protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWrit writer.WritePropertyName("allowPublicIp"u8); writer.WriteStringValue(AllowPublicIP.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); } @@ -66,22 +84,27 @@ protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWrit } } - DevTestLabSubnet IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + /// The JSON reader. + /// The client options for reading and writing models. + DevTestLabSubnet IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) => JsonModelCreateCore(ref reader, options); + + /// The JSON reader. + /// The client options for reading and writing models. + protected virtual DevTestLabSubnet 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(DevTestLabSubnet)} does not support reading '{format}' format."); } - using JsonDocument document = JsonDocument.ParseValue(ref reader); return DeserializeDevTestLabSubnet(document.RootElement, options); } - internal static DevTestLabSubnet DeserializeDevTestLabSubnet(JsonElement element, ModelReaderWriterOptions options = null) + /// The JSON element to deserialize. + /// The client options for reading and writing models. + internal static DevTestLabSubnet DeserializeDevTestLabSubnet(JsonElement element, ModelReaderWriterOptions options) { - options ??= ModelSerializationExtensions.WireOptions; - if (element.ValueKind == JsonValueKind.Null) { return null; @@ -89,46 +112,47 @@ internal static DevTestLabSubnet DeserializeDevTestLabSubnet(JsonElement element ResourceIdentifier resourceId = default; string labSubnetName = default; DevTestLabUsagePermissionType? allowPublicIP = 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("resourceId"u8)) + if (prop.NameEquals("resourceId"u8)) { - if (property.Value.ValueKind == JsonValueKind.Null) + if (prop.Value.ValueKind == JsonValueKind.Null) { continue; } - resourceId = new ResourceIdentifier(property.Value.GetString()); + resourceId = new ResourceIdentifier(prop.Value.GetString()); continue; } - if (property.NameEquals("labSubnetName"u8)) + if (prop.NameEquals("labSubnetName"u8)) { - labSubnetName = property.Value.GetString(); + labSubnetName = prop.Value.GetString(); continue; } - if (property.NameEquals("allowPublicIp"u8)) + if (prop.NameEquals("allowPublicIp"u8)) { - if (property.Value.ValueKind == JsonValueKind.Null) + if (prop.Value.ValueKind == JsonValueKind.Null) { continue; } - allowPublicIP = new DevTestLabUsagePermissionType(property.Value.GetString()); + allowPublicIP = new DevTestLabUsagePermissionType(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 DevTestLabSubnet(resourceId, labSubnetName, allowPublicIP, serializedAdditionalRawData); + return new DevTestLabSubnet(resourceId, labSubnetName, allowPublicIP, 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,22 +162,11 @@ BinaryData IPersistableModel.Write(ModelReaderWriterOptions op } } - DevTestLabSubnet 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 DeserializeDevTestLabSubnet(document.RootElement, options); - } - default: - throw new FormatException($"The model {nameof(DevTestLabSubnet)} does not support reading '{options.Format}' format."); - } - } + /// The data to parse. + /// The client options for reading and writing models. + DevTestLabSubnet IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) => PersistableModelCreateCore(data, options); + /// The client options for reading and writing models. string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; } } diff --git a/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/Models/DevTestLabSubnet.cs b/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/Models/DevTestLabSubnet.cs index efe756a74782..9b5f23bd1474 100644 --- a/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/Models/DevTestLabSubnet.cs +++ b/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/Models/DevTestLabSubnet.cs @@ -14,37 +14,8 @@ namespace Azure.ResourceManager.DevTestLabs.Models /// Subnet information. public partial class DevTestLabSubnet { - /// - /// 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 DevTestLabSubnet() @@ -55,19 +26,21 @@ public DevTestLabSubnet() /// The resource ID of the subnet. /// The name of the subnet as seen in the lab. /// The permission policy of the subnet for allowing public IP addresses (i.e. Allow, Deny)). - /// Keeps track of any properties unknown to the library. - internal DevTestLabSubnet(ResourceIdentifier resourceId, string labSubnetName, DevTestLabUsagePermissionType? allowPublicIP, IDictionary serializedAdditionalRawData) + /// Keeps track of any properties unknown to the library. + internal DevTestLabSubnet(ResourceIdentifier resourceId, string labSubnetName, DevTestLabUsagePermissionType? allowPublicIP, IDictionary additionalBinaryDataProperties) { ResourceId = resourceId; LabSubnetName = labSubnetName; AllowPublicIP = allowPublicIP; - _serializedAdditionalRawData = serializedAdditionalRawData; + _additionalBinaryDataProperties = additionalBinaryDataProperties; } /// The resource ID of the subnet. public ResourceIdentifier ResourceId { get; set; } + /// The name of the subnet as seen in the lab. public string LabSubnetName { get; set; } + /// The permission policy of the subnet for allowing public IP addresses (i.e. Allow, Deny)). public DevTestLabUsagePermissionType? AllowPublicIP { get; set; } } diff --git a/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/Models/DevTestLabSubnetOverride.Serialization.cs b/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/Models/DevTestLabSubnetOverride.Serialization.cs index 3f03ec86fad0..3b5ef08e4726 100644 --- a/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/Models/DevTestLabSubnetOverride.Serialization.cs +++ b/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/Models/DevTestLabSubnetOverride.Serialization.cs @@ -10,13 +10,32 @@ using System.Collections.Generic; using System.Text.Json; using Azure.Core; +using Azure.ResourceManager.DevTestLabs; namespace Azure.ResourceManager.DevTestLabs.Models { - public partial class DevTestLabSubnetOverride : IUtf8JsonSerializable, IJsonModel + /// Property overrides on a subnet of a virtual network. + public partial class DevTestLabSubnetOverride : IJsonModel { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + /// The data to parse. + /// The client options for reading and writing models. + protected virtual DevTestLabSubnetOverride 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 DeserializeDevTestLabSubnetOverride(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(DevTestLabSubnetOverride)} does not support reading '{options.Format}' format."); + } + } + /// The JSON writer. + /// The client options for reading and writing models. void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) { writer.WriteStartObject(); @@ -28,12 +47,11 @@ void IJsonModel.Write(Utf8JsonWriter writer, ModelRead /// 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(DevTestLabSubnetOverride)} does not support writing '{format}' format."); } - if (Optional.IsDefined(ResourceId)) { writer.WritePropertyName("resourceId"u8); @@ -64,15 +82,15 @@ protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWrit writer.WritePropertyName("virtualNetworkPoolName"u8); writer.WriteStringValue(VirtualNetworkPoolName); } - 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); } @@ -81,22 +99,27 @@ protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWrit } } - DevTestLabSubnetOverride IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + /// The JSON reader. + /// The client options for reading and writing models. + DevTestLabSubnetOverride IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) => JsonModelCreateCore(ref reader, options); + + /// The JSON reader. + /// The client options for reading and writing models. + protected virtual DevTestLabSubnetOverride 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(DevTestLabSubnetOverride)} does not support reading '{format}' format."); } - using JsonDocument document = JsonDocument.ParseValue(ref reader); return DeserializeDevTestLabSubnetOverride(document.RootElement, options); } - internal static DevTestLabSubnetOverride DeserializeDevTestLabSubnetOverride(JsonElement element, ModelReaderWriterOptions options = null) + /// The JSON element to deserialize. + /// The client options for reading and writing models. + internal static DevTestLabSubnetOverride DeserializeDevTestLabSubnetOverride(JsonElement element, ModelReaderWriterOptions options) { - options ??= ModelSerializationExtensions.WireOptions; - if (element.ValueKind == JsonValueKind.Null) { return null; @@ -107,62 +130,60 @@ internal static DevTestLabSubnetOverride DeserializeDevTestLabSubnetOverride(Jso DevTestLabUsagePermissionType? usePublicIPAddressPermission = default; SubnetSharedPublicIPAddressConfiguration sharedPublicIPAddressConfiguration = default; string virtualNetworkPoolName = 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("resourceId"u8)) + if (prop.NameEquals("resourceId"u8)) { - if (property.Value.ValueKind == JsonValueKind.Null) + if (prop.Value.ValueKind == JsonValueKind.Null) { continue; } - resourceId = new ResourceIdentifier(property.Value.GetString()); + resourceId = new ResourceIdentifier(prop.Value.GetString()); continue; } - if (property.NameEquals("labSubnetName"u8)) + if (prop.NameEquals("labSubnetName"u8)) { - labSubnetName = property.Value.GetString(); + labSubnetName = prop.Value.GetString(); continue; } - if (property.NameEquals("useInVmCreationPermission"u8)) + if (prop.NameEquals("useInVmCreationPermission"u8)) { - if (property.Value.ValueKind == JsonValueKind.Null) + if (prop.Value.ValueKind == JsonValueKind.Null) { continue; } - useInVmCreationPermission = new DevTestLabUsagePermissionType(property.Value.GetString()); + useInVmCreationPermission = new DevTestLabUsagePermissionType(prop.Value.GetString()); continue; } - if (property.NameEquals("usePublicIpAddressPermission"u8)) + if (prop.NameEquals("usePublicIpAddressPermission"u8)) { - if (property.Value.ValueKind == JsonValueKind.Null) + if (prop.Value.ValueKind == JsonValueKind.Null) { continue; } - usePublicIPAddressPermission = new DevTestLabUsagePermissionType(property.Value.GetString()); + usePublicIPAddressPermission = new DevTestLabUsagePermissionType(prop.Value.GetString()); continue; } - if (property.NameEquals("sharedPublicIpAddressConfiguration"u8)) + if (prop.NameEquals("sharedPublicIpAddressConfiguration"u8)) { - if (property.Value.ValueKind == JsonValueKind.Null) + if (prop.Value.ValueKind == JsonValueKind.Null) { continue; } - sharedPublicIPAddressConfiguration = SubnetSharedPublicIPAddressConfiguration.DeserializeSubnetSharedPublicIPAddressConfiguration(property.Value, options); + sharedPublicIPAddressConfiguration = SubnetSharedPublicIPAddressConfiguration.DeserializeSubnetSharedPublicIPAddressConfiguration(prop.Value, options); continue; } - if (property.NameEquals("virtualNetworkPoolName"u8)) + if (prop.NameEquals("virtualNetworkPoolName"u8)) { - virtualNetworkPoolName = property.Value.GetString(); + virtualNetworkPoolName = 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 DevTestLabSubnetOverride( resourceId, labSubnetName, @@ -170,13 +191,16 @@ internal static DevTestLabSubnetOverride DeserializeDevTestLabSubnetOverride(Jso usePublicIPAddressPermission, sharedPublicIPAddressConfiguration, virtualNetworkPoolName, - serializedAdditionalRawData); + 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": @@ -186,22 +210,11 @@ BinaryData IPersistableModel.Write(ModelReaderWriterOp } } - DevTestLabSubnetOverride 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 DeserializeDevTestLabSubnetOverride(document.RootElement, options); - } - default: - throw new FormatException($"The model {nameof(DevTestLabSubnetOverride)} does not support reading '{options.Format}' format."); - } - } + /// The data to parse. + /// The client options for reading and writing models. + DevTestLabSubnetOverride IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) => PersistableModelCreateCore(data, options); + /// The client options for reading and writing models. string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; } } diff --git a/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/Models/DevTestLabSubnetOverride.cs b/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/Models/DevTestLabSubnetOverride.cs index a480474ce9f0..5c678903886d 100644 --- a/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/Models/DevTestLabSubnetOverride.cs +++ b/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/Models/DevTestLabSubnetOverride.cs @@ -14,37 +14,8 @@ namespace Azure.ResourceManager.DevTestLabs.Models /// Property overrides on a subnet of a virtual network. public partial class DevTestLabSubnetOverride { - /// - /// 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 DevTestLabSubnetOverride() @@ -58,8 +29,8 @@ public DevTestLabSubnetOverride() /// Indicates whether public IP addresses can be assigned to virtual machines on this subnet (i.e. Allow, Deny). /// Properties that virtual machines on this subnet will share. /// The virtual network pool associated with this subnet. - /// Keeps track of any properties unknown to the library. - internal DevTestLabSubnetOverride(ResourceIdentifier resourceId, string labSubnetName, DevTestLabUsagePermissionType? useInVmCreationPermission, DevTestLabUsagePermissionType? usePublicIPAddressPermission, SubnetSharedPublicIPAddressConfiguration sharedPublicIPAddressConfiguration, string virtualNetworkPoolName, IDictionary serializedAdditionalRawData) + /// Keeps track of any properties unknown to the library. + internal DevTestLabSubnetOverride(ResourceIdentifier resourceId, string labSubnetName, DevTestLabUsagePermissionType? useInVmCreationPermission, DevTestLabUsagePermissionType? usePublicIPAddressPermission, SubnetSharedPublicIPAddressConfiguration sharedPublicIPAddressConfiguration, string virtualNetworkPoolName, IDictionary additionalBinaryDataProperties) { ResourceId = resourceId; LabSubnetName = labSubnetName; @@ -67,31 +38,38 @@ internal DevTestLabSubnetOverride(ResourceIdentifier resourceId, string labSubne UsePublicIPAddressPermission = usePublicIPAddressPermission; SharedPublicIPAddressConfiguration = sharedPublicIPAddressConfiguration; VirtualNetworkPoolName = virtualNetworkPoolName; - _serializedAdditionalRawData = serializedAdditionalRawData; + _additionalBinaryDataProperties = additionalBinaryDataProperties; } /// The resource ID of the subnet. public ResourceIdentifier ResourceId { get; set; } + /// The name given to the subnet within the lab. public string LabSubnetName { get; set; } + /// Indicates whether this subnet can be used during virtual machine creation (i.e. Allow, Deny). public DevTestLabUsagePermissionType? UseInVmCreationPermission { get; set; } + /// Indicates whether public IP addresses can be assigned to virtual machines on this subnet (i.e. Allow, Deny). public DevTestLabUsagePermissionType? UsePublicIPAddressPermission { get; set; } + /// Properties that virtual machines on this subnet will share. internal SubnetSharedPublicIPAddressConfiguration SharedPublicIPAddressConfiguration { get; set; } + + /// The virtual network pool associated with this subnet. + public string VirtualNetworkPoolName { get; set; } + /// Backend ports that virtual machines on this subnet are allowed to expose. public IList SharedPublicIPAddressAllowedPorts { get { if (SharedPublicIPAddressConfiguration is null) + { SharedPublicIPAddressConfiguration = new SubnetSharedPublicIPAddressConfiguration(); + } return SharedPublicIPAddressConfiguration.AllowedPorts; } } - - /// The virtual network pool associated with this subnet. - public string VirtualNetworkPoolName { get; set; } } } diff --git a/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/Models/DevTestLabSupport.Serialization.cs b/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/Models/DevTestLabSupport.Serialization.cs index 8b239b68369b..2d279e29deb5 100644 --- a/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/Models/DevTestLabSupport.Serialization.cs +++ b/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/Models/DevTestLabSupport.Serialization.cs @@ -9,14 +9,32 @@ using System.ClientModel.Primitives; using System.Collections.Generic; using System.Text.Json; -using Azure.Core; +using Azure.ResourceManager.DevTestLabs; namespace Azure.ResourceManager.DevTestLabs.Models { - public partial class DevTestLabSupport : IUtf8JsonSerializable, IJsonModel + /// Properties of a lab's support banner. + public partial class DevTestLabSupport : IJsonModel { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + /// The data to parse. + /// The client options for reading and writing models. + protected virtual DevTestLabSupport 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 DeserializeDevTestLabSupport(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(DevTestLabSupport)} does not support reading '{options.Format}' format."); + } + } + /// The JSON writer. + /// The client options for reading and writing models. void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) { writer.WriteStartObject(); @@ -28,12 +46,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(DevTestLabSupport)} does not support writing '{format}' format."); } - if (Optional.IsDefined(Enabled)) { writer.WritePropertyName("enabled"u8); @@ -44,15 +61,15 @@ protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWrit writer.WritePropertyName("markdown"u8); writer.WriteStringValue(Markdown); } - 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,59 +78,65 @@ protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWrit } } - DevTestLabSupport IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + /// The JSON reader. + /// The client options for reading and writing models. + DevTestLabSupport IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) => JsonModelCreateCore(ref reader, options); + + /// The JSON reader. + /// The client options for reading and writing models. + protected virtual DevTestLabSupport 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(DevTestLabSupport)} does not support reading '{format}' format."); } - using JsonDocument document = JsonDocument.ParseValue(ref reader); return DeserializeDevTestLabSupport(document.RootElement, options); } - internal static DevTestLabSupport DeserializeDevTestLabSupport(JsonElement element, ModelReaderWriterOptions options = null) + /// The JSON element to deserialize. + /// The client options for reading and writing models. + internal static DevTestLabSupport DeserializeDevTestLabSupport(JsonElement element, ModelReaderWriterOptions options) { - options ??= ModelSerializationExtensions.WireOptions; - if (element.ValueKind == JsonValueKind.Null) { return null; } DevTestLabEnableStatus? enabled = default; string markdown = 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("enabled"u8)) + if (prop.NameEquals("enabled"u8)) { - if (property.Value.ValueKind == JsonValueKind.Null) + if (prop.Value.ValueKind == JsonValueKind.Null) { continue; } - enabled = new DevTestLabEnableStatus(property.Value.GetString()); + enabled = new DevTestLabEnableStatus(prop.Value.GetString()); continue; } - if (property.NameEquals("markdown"u8)) + if (prop.NameEquals("markdown"u8)) { - markdown = property.Value.GetString(); + markdown = 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 DevTestLabSupport(enabled, markdown, serializedAdditionalRawData); + return new DevTestLabSupport(enabled, markdown, 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": @@ -123,22 +146,11 @@ BinaryData IPersistableModel.Write(ModelReaderWriterOptions o } } - DevTestLabSupport 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 DeserializeDevTestLabSupport(document.RootElement, options); - } - default: - throw new FormatException($"The model {nameof(DevTestLabSupport)} does not support reading '{options.Format}' format."); - } - } + /// The data to parse. + /// The client options for reading and writing models. + DevTestLabSupport IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) => PersistableModelCreateCore(data, options); + /// The client options for reading and writing models. string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; } } diff --git a/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/Models/DevTestLabSupport.cs b/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/Models/DevTestLabSupport.cs index 6f654919dd12..88738ce58d42 100644 --- a/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/Models/DevTestLabSupport.cs +++ b/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/Models/DevTestLabSupport.cs @@ -13,37 +13,8 @@ namespace Azure.ResourceManager.DevTestLabs.Models /// Properties of a lab's support banner. public partial class DevTestLabSupport { - /// - /// 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 DevTestLabSupport() @@ -53,16 +24,17 @@ public DevTestLabSupport() /// Initializes a new instance of . /// Is the lab support banner active/enabled at this time?. /// The markdown text (if any) that this lab displays in the UI. If left empty/null, nothing will be shown. - /// Keeps track of any properties unknown to the library. - internal DevTestLabSupport(DevTestLabEnableStatus? enabled, string markdown, IDictionary serializedAdditionalRawData) + /// Keeps track of any properties unknown to the library. + internal DevTestLabSupport(DevTestLabEnableStatus? enabled, string markdown, IDictionary additionalBinaryDataProperties) { Enabled = enabled; Markdown = markdown; - _serializedAdditionalRawData = serializedAdditionalRawData; + _additionalBinaryDataProperties = additionalBinaryDataProperties; } /// Is the lab support banner active/enabled at this time?. public DevTestLabEnableStatus? Enabled { get; set; } + /// The markdown text (if any) that this lab displays in the UI. If left empty/null, nothing will be shown. public string Markdown { get; set; } } diff --git a/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/Models/DevTestLabTargetCost.Serialization.cs b/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/Models/DevTestLabTargetCost.Serialization.cs index c7450260e736..86099bc55c64 100644 --- a/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/Models/DevTestLabTargetCost.Serialization.cs +++ b/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/Models/DevTestLabTargetCost.Serialization.cs @@ -9,14 +9,32 @@ using System.ClientModel.Primitives; using System.Collections.Generic; using System.Text.Json; -using Azure.Core; +using Azure.ResourceManager.DevTestLabs; namespace Azure.ResourceManager.DevTestLabs.Models { - public partial class DevTestLabTargetCost : IUtf8JsonSerializable, IJsonModel + /// Properties of a cost target. + public partial class DevTestLabTargetCost : IJsonModel { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + /// The data to parse. + /// The client options for reading and writing models. + protected virtual DevTestLabTargetCost 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 DeserializeDevTestLabTargetCost(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(DevTestLabTargetCost)} does not support reading '{options.Format}' format."); + } + } + /// The JSON writer. + /// The client options for reading and writing models. void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) { writer.WriteStartObject(); @@ -28,12 +46,11 @@ void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWr /// 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(DevTestLabTargetCost)} does not support writing '{format}' format."); } - if (Optional.IsDefined(Status)) { writer.WritePropertyName("status"u8); @@ -48,7 +65,7 @@ protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWrit { writer.WritePropertyName("costThresholds"u8); writer.WriteStartArray(); - foreach (var item in CostThresholds) + foreach (DevTestLabCostThreshold item in CostThresholds) { writer.WriteObjectValue(item, options); } @@ -69,15 +86,15 @@ protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWrit writer.WritePropertyName("cycleType"u8); writer.WriteStringValue(CycleType.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); } @@ -86,22 +103,27 @@ protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWrit } } - DevTestLabTargetCost IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + /// The JSON reader. + /// The client options for reading and writing models. + DevTestLabTargetCost IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) => JsonModelCreateCore(ref reader, options); + + /// The JSON reader. + /// The client options for reading and writing models. + protected virtual DevTestLabTargetCost 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(DevTestLabTargetCost)} does not support reading '{format}' format."); } - using JsonDocument document = JsonDocument.ParseValue(ref reader); return DeserializeDevTestLabTargetCost(document.RootElement, options); } - internal static DevTestLabTargetCost DeserializeDevTestLabTargetCost(JsonElement element, ModelReaderWriterOptions options = null) + /// The JSON element to deserialize. + /// The client options for reading and writing models. + internal static DevTestLabTargetCost DeserializeDevTestLabTargetCost(JsonElement element, ModelReaderWriterOptions options) { - options ??= ModelSerializationExtensions.WireOptions; - if (element.ValueKind == JsonValueKind.Null) { return null; @@ -109,92 +131,93 @@ internal static DevTestLabTargetCost DeserializeDevTestLabTargetCost(JsonElement DevTestLabTargetCostStatus? status = default; int? target = default; IList costThresholds = default; - DateTimeOffset? cycleStartDateTime = default; - DateTimeOffset? cycleEndDateTime = default; + DateTimeOffset? cycleStartOn = default; + DateTimeOffset? cycleEndOn = default; DevTestLabReportingCycleType? cycleType = 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("status"u8)) + if (prop.NameEquals("status"u8)) { - if (property.Value.ValueKind == JsonValueKind.Null) + if (prop.Value.ValueKind == JsonValueKind.Null) { continue; } - status = new DevTestLabTargetCostStatus(property.Value.GetString()); + status = new DevTestLabTargetCostStatus(prop.Value.GetString()); continue; } - if (property.NameEquals("target"u8)) + if (prop.NameEquals("target"u8)) { - if (property.Value.ValueKind == JsonValueKind.Null) + if (prop.Value.ValueKind == JsonValueKind.Null) { continue; } - target = property.Value.GetInt32(); + target = prop.Value.GetInt32(); continue; } - if (property.NameEquals("costThresholds"u8)) + if (prop.NameEquals("costThresholds"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(DevTestLabCostThreshold.DeserializeDevTestLabCostThreshold(item, options)); } costThresholds = array; continue; } - if (property.NameEquals("cycleStartDateTime"u8)) + if (prop.NameEquals("cycleStartDateTime"u8)) { - if (property.Value.ValueKind == JsonValueKind.Null) + if (prop.Value.ValueKind == JsonValueKind.Null) { continue; } - cycleStartDateTime = property.Value.GetDateTimeOffset("O"); + cycleStartOn = prop.Value.GetDateTimeOffset("O"); continue; } - if (property.NameEquals("cycleEndDateTime"u8)) + if (prop.NameEquals("cycleEndDateTime"u8)) { - if (property.Value.ValueKind == JsonValueKind.Null) + if (prop.Value.ValueKind == JsonValueKind.Null) { continue; } - cycleEndDateTime = property.Value.GetDateTimeOffset("O"); + cycleEndOn = prop.Value.GetDateTimeOffset("O"); continue; } - if (property.NameEquals("cycleType"u8)) + if (prop.NameEquals("cycleType"u8)) { - if (property.Value.ValueKind == JsonValueKind.Null) + if (prop.Value.ValueKind == JsonValueKind.Null) { continue; } - cycleType = new DevTestLabReportingCycleType(property.Value.GetString()); + cycleType = new DevTestLabReportingCycleType(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 DevTestLabTargetCost( status, target, costThresholds ?? new ChangeTrackingList(), - cycleStartDateTime, - cycleEndDateTime, + cycleStartOn, + cycleEndOn, cycleType, - serializedAdditionalRawData); + 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": @@ -204,22 +227,11 @@ BinaryData IPersistableModel.Write(ModelReaderWriterOption } } - DevTestLabTargetCost 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 DeserializeDevTestLabTargetCost(document.RootElement, options); - } - default: - throw new FormatException($"The model {nameof(DevTestLabTargetCost)} does not support reading '{options.Format}' format."); - } - } + /// The data to parse. + /// The client options for reading and writing models. + DevTestLabTargetCost IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) => PersistableModelCreateCore(data, options); + /// The client options for reading and writing models. string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; } } diff --git a/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/Models/DevTestLabTargetCost.cs b/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/Models/DevTestLabTargetCost.cs index b1f25f764ee1..3cf0d4aaa43c 100644 --- a/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/Models/DevTestLabTargetCost.cs +++ b/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/Models/DevTestLabTargetCost.cs @@ -7,43 +7,15 @@ using System; using System.Collections.Generic; +using Azure.ResourceManager.DevTestLabs; namespace Azure.ResourceManager.DevTestLabs.Models { /// Properties of a cost target. public partial class DevTestLabTargetCost { - /// - /// 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 DevTestLabTargetCost() @@ -58,8 +30,8 @@ public DevTestLabTargetCost() /// Reporting cycle start date. /// Reporting cycle end date. /// Reporting cycle type. - /// Keeps track of any properties unknown to the library. - internal DevTestLabTargetCost(DevTestLabTargetCostStatus? status, int? target, IList costThresholds, DateTimeOffset? cycleStartOn, DateTimeOffset? cycleEndOn, DevTestLabReportingCycleType? cycleType, IDictionary serializedAdditionalRawData) + /// Keeps track of any properties unknown to the library. + internal DevTestLabTargetCost(DevTestLabTargetCostStatus? status, int? target, IList costThresholds, DateTimeOffset? cycleStartOn, DateTimeOffset? cycleEndOn, DevTestLabReportingCycleType? cycleType, IDictionary additionalBinaryDataProperties) { Status = status; Target = target; @@ -67,19 +39,24 @@ internal DevTestLabTargetCost(DevTestLabTargetCostStatus? status, int? target, I CycleStartOn = cycleStartOn; CycleEndOn = cycleEndOn; CycleType = cycleType; - _serializedAdditionalRawData = serializedAdditionalRawData; + _additionalBinaryDataProperties = additionalBinaryDataProperties; } /// Target cost status. public DevTestLabTargetCostStatus? Status { get; set; } + /// Lab target cost. public int? Target { get; set; } + /// Cost thresholds. public IList CostThresholds { get; } + /// Reporting cycle start date. public DateTimeOffset? CycleStartOn { get; set; } + /// Reporting cycle end date. public DateTimeOffset? CycleEndOn { get; set; } + /// Reporting cycle type. public DevTestLabReportingCycleType? CycleType { get; set; } } diff --git a/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/Models/DevTestLabTargetCostStatus.cs b/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/Models/DevTestLabTargetCostStatus.cs index 74e1fc7a7213..7702ac251b0f 100644 --- a/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/Models/DevTestLabTargetCostStatus.cs +++ b/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/Models/DevTestLabTargetCostStatus.cs @@ -7,6 +7,7 @@ using System; using System.ComponentModel; +using Azure.ResourceManager.DevTestLabs; namespace Azure.ResourceManager.DevTestLabs.Models { @@ -14,38 +15,55 @@ namespace Azure.ResourceManager.DevTestLabs.Models public readonly partial struct DevTestLabTargetCostStatus : IEquatable { private readonly string _value; + private const string EnabledValue = "Enabled"; + private const string DisabledValue = "Disabled"; /// Initializes a new instance of . + /// The value. /// is null. public DevTestLabTargetCostStatus(string value) { - _value = value ?? throw new ArgumentNullException(nameof(value)); - } + Argument.AssertNotNull(value, nameof(value)); - private const string EnabledValue = "Enabled"; - private const string DisabledValue = "Disabled"; + _value = value; + } - /// Enabled. + /// Gets the Enabled. public static DevTestLabTargetCostStatus Enabled { get; } = new DevTestLabTargetCostStatus(EnabledValue); - /// Disabled. + + /// Gets the Disabled. public static DevTestLabTargetCostStatus Disabled { get; } = new DevTestLabTargetCostStatus(DisabledValue); + /// Determines if two values are the same. + /// The left value to compare. + /// The right value to compare. public static bool operator ==(DevTestLabTargetCostStatus left, DevTestLabTargetCostStatus 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 !=(DevTestLabTargetCostStatus left, DevTestLabTargetCostStatus right) => !left.Equals(right); - /// Converts a to a . + + /// Converts a string to a . + /// The value. public static implicit operator DevTestLabTargetCostStatus(string value) => new DevTestLabTargetCostStatus(value); - /// + /// Converts a string to a . + /// The value. + public static implicit operator DevTestLabTargetCostStatus?(string value) => value == null ? null : new DevTestLabTargetCostStatus(value); + + /// [EditorBrowsable(EditorBrowsableState.Never)] public override bool Equals(object obj) => obj is DevTestLabTargetCostStatus other && Equals(other); - /// + + /// public bool Equals(DevTestLabTargetCostStatus 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/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/Models/DevTestLabTransportProtocol.cs b/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/Models/DevTestLabTransportProtocol.cs index 1b624efc1b0f..d6543d0ff0d8 100644 --- a/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/Models/DevTestLabTransportProtocol.cs +++ b/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/Models/DevTestLabTransportProtocol.cs @@ -7,6 +7,7 @@ using System; using System.ComponentModel; +using Azure.ResourceManager.DevTestLabs; namespace Azure.ResourceManager.DevTestLabs.Models { @@ -14,38 +15,55 @@ namespace Azure.ResourceManager.DevTestLabs.Models public readonly partial struct DevTestLabTransportProtocol : IEquatable { private readonly string _value; + private const string TcpValue = "Tcp"; + private const string UdpValue = "Udp"; /// Initializes a new instance of . + /// The value. /// is null. public DevTestLabTransportProtocol(string value) { - _value = value ?? throw new ArgumentNullException(nameof(value)); - } + Argument.AssertNotNull(value, nameof(value)); - private const string TcpValue = "Tcp"; - private const string UdpValue = "Udp"; + _value = value; + } - /// Tcp. + /// Gets the Tcp. public static DevTestLabTransportProtocol Tcp { get; } = new DevTestLabTransportProtocol(TcpValue); - /// Udp. + + /// Gets the Udp. public static DevTestLabTransportProtocol Udp { get; } = new DevTestLabTransportProtocol(UdpValue); + /// Determines if two values are the same. + /// The left value to compare. + /// The right value to compare. public static bool operator ==(DevTestLabTransportProtocol left, DevTestLabTransportProtocol 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 !=(DevTestLabTransportProtocol left, DevTestLabTransportProtocol right) => !left.Equals(right); - /// Converts a to a . + + /// Converts a string to a . + /// The value. public static implicit operator DevTestLabTransportProtocol(string value) => new DevTestLabTransportProtocol(value); - /// + /// Converts a string to a . + /// The value. + public static implicit operator DevTestLabTransportProtocol?(string value) => value == null ? null : new DevTestLabTransportProtocol(value); + + /// [EditorBrowsable(EditorBrowsableState.Never)] public override bool Equals(object obj) => obj is DevTestLabTransportProtocol other && Equals(other); - /// + + /// public bool Equals(DevTestLabTransportProtocol 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/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/Models/DevTestLabUsagePermissionType.cs b/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/Models/DevTestLabUsagePermissionType.cs index 2ec302c45dcf..50342b65fb31 100644 --- a/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/Models/DevTestLabUsagePermissionType.cs +++ b/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/Models/DevTestLabUsagePermissionType.cs @@ -7,6 +7,7 @@ using System; using System.ComponentModel; +using Azure.ResourceManager.DevTestLabs; namespace Azure.ResourceManager.DevTestLabs.Models { @@ -14,41 +15,59 @@ namespace Azure.ResourceManager.DevTestLabs.Models public readonly partial struct DevTestLabUsagePermissionType : IEquatable { private readonly string _value; + private const string DefaultValue = "Default"; + private const string DenyValue = "Deny"; + private const string AllowValue = "Allow"; /// Initializes a new instance of . + /// The value. /// is null. public DevTestLabUsagePermissionType(string value) { - _value = value ?? throw new ArgumentNullException(nameof(value)); - } + Argument.AssertNotNull(value, nameof(value)); - private const string DefaultValue = "Default"; - private const string DenyValue = "Deny"; - private const string AllowValue = "Allow"; + _value = value; + } - /// Default. + /// Gets the Default. public static DevTestLabUsagePermissionType Default { get; } = new DevTestLabUsagePermissionType(DefaultValue); - /// Deny. + + /// Gets the Deny. public static DevTestLabUsagePermissionType Deny { get; } = new DevTestLabUsagePermissionType(DenyValue); - /// Allow. + + /// Gets the Allow. public static DevTestLabUsagePermissionType Allow { get; } = new DevTestLabUsagePermissionType(AllowValue); + /// Determines if two values are the same. + /// The left value to compare. + /// The right value to compare. public static bool operator ==(DevTestLabUsagePermissionType left, DevTestLabUsagePermissionType 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 !=(DevTestLabUsagePermissionType left, DevTestLabUsagePermissionType right) => !left.Equals(right); - /// Converts a to a . + + /// Converts a string to a . + /// The value. public static implicit operator DevTestLabUsagePermissionType(string value) => new DevTestLabUsagePermissionType(value); - /// + /// Converts a string to a . + /// The value. + public static implicit operator DevTestLabUsagePermissionType?(string value) => value == null ? null : new DevTestLabUsagePermissionType(value); + + /// [EditorBrowsable(EditorBrowsableState.Never)] public override bool Equals(object obj) => obj is DevTestLabUsagePermissionType other && Equals(other); - /// + + /// public bool Equals(DevTestLabUsagePermissionType 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/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/Models/DevTestLabUserIdentity.Serialization.cs b/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/Models/DevTestLabUserIdentity.Serialization.cs index d13d9032e4c9..9564939bf7af 100644 --- a/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/Models/DevTestLabUserIdentity.Serialization.cs +++ b/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/Models/DevTestLabUserIdentity.Serialization.cs @@ -9,14 +9,32 @@ using System.ClientModel.Primitives; using System.Collections.Generic; using System.Text.Json; -using Azure.Core; +using Azure.ResourceManager.DevTestLabs; namespace Azure.ResourceManager.DevTestLabs.Models { - public partial class DevTestLabUserIdentity : IUtf8JsonSerializable, IJsonModel + /// Identity attributes of a lab user. + public partial class DevTestLabUserIdentity : IJsonModel { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + /// The data to parse. + /// The client options for reading and writing models. + protected virtual DevTestLabUserIdentity 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 DeserializeDevTestLabUserIdentity(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(DevTestLabUserIdentity)} does not support reading '{options.Format}' format."); + } + } + /// The JSON writer. + /// The client options for reading and writing models. void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) { writer.WriteStartObject(); @@ -28,12 +46,11 @@ void IJsonModel.Write(Utf8JsonWriter writer, ModelReader /// 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(DevTestLabUserIdentity)} does not support writing '{format}' format."); } - if (Optional.IsDefined(PrincipalName)) { writer.WritePropertyName("principalName"u8); @@ -59,15 +76,15 @@ protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWrit writer.WritePropertyName("appId"u8); writer.WriteStringValue(AppId); } - 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 +93,27 @@ protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWrit } } - DevTestLabUserIdentity IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + /// The JSON reader. + /// The client options for reading and writing models. + DevTestLabUserIdentity IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) => JsonModelCreateCore(ref reader, options); + + /// The JSON reader. + /// The client options for reading and writing models. + protected virtual DevTestLabUserIdentity 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(DevTestLabUserIdentity)} does not support reading '{format}' format."); } - using JsonDocument document = JsonDocument.ParseValue(ref reader); return DeserializeDevTestLabUserIdentity(document.RootElement, options); } - internal static DevTestLabUserIdentity DeserializeDevTestLabUserIdentity(JsonElement element, ModelReaderWriterOptions options = null) + /// The JSON element to deserialize. + /// The client options for reading and writing models. + internal static DevTestLabUserIdentity DeserializeDevTestLabUserIdentity(JsonElement element, ModelReaderWriterOptions options) { - options ??= ModelSerializationExtensions.WireOptions; - if (element.ValueKind == JsonValueKind.Null) { return null; @@ -101,58 +123,59 @@ internal static DevTestLabUserIdentity DeserializeDevTestLabUserIdentity(JsonEle Guid? tenantId = default; string objectId = default; string appId = 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("principalName"u8)) + if (prop.NameEquals("principalName"u8)) { - principalName = property.Value.GetString(); + principalName = prop.Value.GetString(); continue; } - if (property.NameEquals("principalId"u8)) + if (prop.NameEquals("principalId"u8)) { - principalId = property.Value.GetString(); + principalId = prop.Value.GetString(); continue; } - if (property.NameEquals("tenantId"u8)) + if (prop.NameEquals("tenantId"u8)) { - if (property.Value.ValueKind == JsonValueKind.Null) + if (prop.Value.ValueKind == JsonValueKind.Null) { continue; } - tenantId = property.Value.GetGuid(); + tenantId = new Guid(prop.Value.GetString()); continue; } - if (property.NameEquals("objectId"u8)) + if (prop.NameEquals("objectId"u8)) { - objectId = property.Value.GetString(); + objectId = prop.Value.GetString(); continue; } - if (property.NameEquals("appId"u8)) + if (prop.NameEquals("appId"u8)) { - appId = property.Value.GetString(); + appId = 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 DevTestLabUserIdentity( principalName, principalId, tenantId, objectId, appId, - serializedAdditionalRawData); + 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": @@ -162,22 +185,11 @@ BinaryData IPersistableModel.Write(ModelReaderWriterOpti } } - DevTestLabUserIdentity 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 DeserializeDevTestLabUserIdentity(document.RootElement, options); - } - default: - throw new FormatException($"The model {nameof(DevTestLabUserIdentity)} does not support reading '{options.Format}' format."); - } - } + /// The data to parse. + /// The client options for reading and writing models. + DevTestLabUserIdentity IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) => PersistableModelCreateCore(data, options); + /// The client options for reading and writing models. string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; } } diff --git a/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/Models/DevTestLabUserIdentity.cs b/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/Models/DevTestLabUserIdentity.cs index c04fe899e163..29ecf3c297f3 100644 --- a/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/Models/DevTestLabUserIdentity.cs +++ b/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/Models/DevTestLabUserIdentity.cs @@ -13,37 +13,8 @@ namespace Azure.ResourceManager.DevTestLabs.Models /// Identity attributes of a lab user. public partial class DevTestLabUserIdentity { - /// - /// 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 DevTestLabUserIdentity() @@ -56,25 +27,29 @@ public DevTestLabUserIdentity() /// Set to the tenant ID of the client JWT making the request. /// Set to the object Id of the client JWT making the request. Not all users have object Id. For CSP (reseller) scenarios for example, object Id is not available. /// Set to the app Id of the client JWT making the request. - /// Keeps track of any properties unknown to the library. - internal DevTestLabUserIdentity(string principalName, string principalId, Guid? tenantId, string objectId, string appId, IDictionary serializedAdditionalRawData) + /// Keeps track of any properties unknown to the library. + internal DevTestLabUserIdentity(string principalName, string principalId, Guid? tenantId, string objectId, string appId, IDictionary additionalBinaryDataProperties) { PrincipalName = principalName; PrincipalId = principalId; TenantId = tenantId; ObjectId = objectId; AppId = appId; - _serializedAdditionalRawData = serializedAdditionalRawData; + _additionalBinaryDataProperties = additionalBinaryDataProperties; } /// Set to the principal name / UPN of the client JWT making the request. public string PrincipalName { get; set; } + /// Set to the principal Id of the client JWT making the request. Service principal will not have the principal Id. public string PrincipalId { get; set; } + /// Set to the tenant ID of the client JWT making the request. public Guid? TenantId { get; set; } + /// Set to the object Id of the client JWT making the request. Not all users have object Id. For CSP (reseller) scenarios for example, object Id is not available. public string ObjectId { get; set; } + /// Set to the app Id of the client JWT making the request. public string AppId { get; set; } } diff --git a/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/Models/DevTestLabUserPatch.Serialization.cs b/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/Models/DevTestLabUserPatch.Serialization.cs index d54dd952f6a4..e1087e25fca4 100644 --- a/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/Models/DevTestLabUserPatch.Serialization.cs +++ b/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/Models/DevTestLabUserPatch.Serialization.cs @@ -10,13 +10,32 @@ using System.Collections.Generic; using System.Text.Json; using Azure.Core; +using Azure.ResourceManager.DevTestLabs; namespace Azure.ResourceManager.DevTestLabs.Models { - public partial class DevTestLabUserPatch : IUtf8JsonSerializable, IJsonModel + /// Profile of a lab user. + public partial class DevTestLabUserPatch : DevTestLabResourcePatch, IJsonModel { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + /// The data to parse. + /// The client options for reading and writing models. + protected override DevTestLabResourcePatch 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 DeserializeDevTestLabUserPatch(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(DevTestLabUserPatch)} does not support reading '{options.Format}' format."); + } + } + /// The JSON writer. + /// The client options for reading and writing models. void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) { writer.WriteStartObject(); @@ -28,67 +47,79 @@ void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWri /// 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(DevTestLabUserPatch)} does not support writing '{format}' format."); } - base.JsonModelWriteCore(writer, options); } - DevTestLabUserPatch IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + /// The JSON reader. + /// The client options for reading and writing models. + DevTestLabUserPatch IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) => (DevTestLabUserPatch)JsonModelCreateCore(ref reader, options); + + /// The JSON reader. + /// The client options for reading and writing models. + protected override DevTestLabResourcePatch 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(DevTestLabUserPatch)} does not support reading '{format}' format."); } - using JsonDocument document = JsonDocument.ParseValue(ref reader); return DeserializeDevTestLabUserPatch(document.RootElement, options); } - internal static DevTestLabUserPatch DeserializeDevTestLabUserPatch(JsonElement element, ModelReaderWriterOptions options = null) + /// The JSON element to deserialize. + /// The client options for reading and writing models. + internal static DevTestLabUserPatch DeserializeDevTestLabUserPatch(JsonElement element, ModelReaderWriterOptions options) { - options ??= ModelSerializationExtensions.WireOptions; - if (element.ValueKind == JsonValueKind.Null) { return null; } IDictionary tags = 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("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 (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 DevTestLabUserPatch(tags ?? new ChangeTrackingDictionary(), serializedAdditionalRawData); + return new DevTestLabUserPatch(tags ?? new ChangeTrackingDictionary(), 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 override BinaryData PersistableModelWriteCore(ModelReaderWriterOptions options) + { + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; switch (format) { case "J": @@ -98,22 +129,23 @@ BinaryData IPersistableModel.Write(ModelReaderWriterOptions } } - DevTestLabUserPatch 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. + DevTestLabUserPatch IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) => (DevTestLabUserPatch)PersistableModelCreateCore(data, options); - switch (format) + /// The client options for reading and writing models. + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + + /// The to serialize into . + internal static RequestContent ToRequestContent(DevTestLabUserPatch devTestLabUserPatch) + { + if (devTestLabUserPatch == null) { - case "J": - { - using JsonDocument document = JsonDocument.Parse(data, ModelSerializationExtensions.JsonDocumentOptions); - return DeserializeDevTestLabUserPatch(document.RootElement, options); - } - default: - throw new FormatException($"The model {nameof(DevTestLabUserPatch)} does not support reading '{options.Format}' format."); + return null; } + Utf8JsonRequestContent content = new Utf8JsonRequestContent(); + content.JsonWriter.WriteObjectValue(devTestLabUserPatch, ModelSerializationExtensions.WireOptions); + return content; } - - string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; } } diff --git a/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/Models/DevTestLabUserPatch.cs b/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/Models/DevTestLabUserPatch.cs index 2ee9d05a488b..0a4c4211282c 100644 --- a/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/Models/DevTestLabUserPatch.cs +++ b/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/Models/DevTestLabUserPatch.cs @@ -20,8 +20,8 @@ public DevTestLabUserPatch() /// Initializes a new instance of . /// The tags of the resource. - /// Keeps track of any properties unknown to the library. - internal DevTestLabUserPatch(IDictionary tags, IDictionary serializedAdditionalRawData) : base(tags, serializedAdditionalRawData) + /// Keeps track of any properties unknown to the library. + internal DevTestLabUserPatch(IDictionary tags, IDictionary additionalBinaryDataProperties) : base(tags, additionalBinaryDataProperties) { } } diff --git a/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/Models/DevTestLabUserSecretStore.Serialization.cs b/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/Models/DevTestLabUserSecretStore.Serialization.cs index 8ba917efd5c4..13a5775f3c3f 100644 --- a/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/Models/DevTestLabUserSecretStore.Serialization.cs +++ b/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/Models/DevTestLabUserSecretStore.Serialization.cs @@ -10,13 +10,32 @@ using System.Collections.Generic; using System.Text.Json; using Azure.Core; +using Azure.ResourceManager.DevTestLabs; namespace Azure.ResourceManager.DevTestLabs.Models { - public partial class DevTestLabUserSecretStore : IUtf8JsonSerializable, IJsonModel + /// Properties of a user's secret store. + public partial class DevTestLabUserSecretStore : IJsonModel { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + /// The data to parse. + /// The client options for reading and writing models. + protected virtual DevTestLabUserSecretStore 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 DeserializeDevTestLabUserSecretStore(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(DevTestLabUserSecretStore)} does not support reading '{options.Format}' format."); + } + } + /// The JSON writer. + /// The client options for reading and writing models. void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) { writer.WriteStartObject(); @@ -28,12 +47,11 @@ void IJsonModel.Write(Utf8JsonWriter writer, ModelRea /// 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(DevTestLabUserSecretStore)} does not support writing '{format}' format."); } - if (Optional.IsDefined(KeyVaultUri)) { writer.WritePropertyName("keyVaultUri"u8); @@ -44,15 +62,15 @@ protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWrit writer.WritePropertyName("keyVaultId"u8); writer.WriteStringValue(KeyVaultId); } - 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,63 +79,69 @@ protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWrit } } - DevTestLabUserSecretStore IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + /// The JSON reader. + /// The client options for reading and writing models. + DevTestLabUserSecretStore IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) => JsonModelCreateCore(ref reader, options); + + /// The JSON reader. + /// The client options for reading and writing models. + protected virtual DevTestLabUserSecretStore 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(DevTestLabUserSecretStore)} does not support reading '{format}' format."); } - using JsonDocument document = JsonDocument.ParseValue(ref reader); return DeserializeDevTestLabUserSecretStore(document.RootElement, options); } - internal static DevTestLabUserSecretStore DeserializeDevTestLabUserSecretStore(JsonElement element, ModelReaderWriterOptions options = null) + /// The JSON element to deserialize. + /// The client options for reading and writing models. + internal static DevTestLabUserSecretStore DeserializeDevTestLabUserSecretStore(JsonElement element, ModelReaderWriterOptions options) { - options ??= ModelSerializationExtensions.WireOptions; - if (element.ValueKind == JsonValueKind.Null) { return null; } Uri keyVaultUri = default; ResourceIdentifier keyVaultId = 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("keyVaultUri"u8)) + if (prop.NameEquals("keyVaultUri"u8)) { - if (property.Value.ValueKind == JsonValueKind.Null) + if (prop.Value.ValueKind == JsonValueKind.Null) { continue; } - keyVaultUri = new Uri(property.Value.GetString()); + keyVaultUri = string.IsNullOrEmpty(prop.Value.GetString()) ? null : new Uri(prop.Value.GetString()); continue; } - if (property.NameEquals("keyVaultId"u8)) + if (prop.NameEquals("keyVaultId"u8)) { - if (property.Value.ValueKind == JsonValueKind.Null) + if (prop.Value.ValueKind == JsonValueKind.Null) { continue; } - keyVaultId = new ResourceIdentifier(property.Value.GetString()); + keyVaultId = new ResourceIdentifier(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 DevTestLabUserSecretStore(keyVaultUri, keyVaultId, serializedAdditionalRawData); + return new DevTestLabUserSecretStore(keyVaultUri, keyVaultId, 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": @@ -127,22 +151,11 @@ BinaryData IPersistableModel.Write(ModelReaderWriterO } } - DevTestLabUserSecretStore 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 DeserializeDevTestLabUserSecretStore(document.RootElement, options); - } - default: - throw new FormatException($"The model {nameof(DevTestLabUserSecretStore)} does not support reading '{options.Format}' format."); - } - } + /// The data to parse. + /// The client options for reading and writing models. + DevTestLabUserSecretStore IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) => PersistableModelCreateCore(data, options); + /// The client options for reading and writing models. string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; } } diff --git a/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/Models/DevTestLabUserSecretStore.cs b/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/Models/DevTestLabUserSecretStore.cs index a2a7691f2885..6376a954ed54 100644 --- a/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/Models/DevTestLabUserSecretStore.cs +++ b/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/Models/DevTestLabUserSecretStore.cs @@ -14,37 +14,8 @@ namespace Azure.ResourceManager.DevTestLabs.Models /// Properties of a user's secret store. public partial class DevTestLabUserSecretStore { - /// - /// 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 DevTestLabUserSecretStore() @@ -54,16 +25,17 @@ public DevTestLabUserSecretStore() /// Initializes a new instance of . /// The URI of the user's Key vault. /// The ID of the user's Key vault. - /// Keeps track of any properties unknown to the library. - internal DevTestLabUserSecretStore(Uri keyVaultUri, ResourceIdentifier keyVaultId, IDictionary serializedAdditionalRawData) + /// Keeps track of any properties unknown to the library. + internal DevTestLabUserSecretStore(Uri keyVaultUri, ResourceIdentifier keyVaultId, IDictionary additionalBinaryDataProperties) { KeyVaultUri = keyVaultUri; KeyVaultId = keyVaultId; - _serializedAdditionalRawData = serializedAdditionalRawData; + _additionalBinaryDataProperties = additionalBinaryDataProperties; } /// The URI of the user's Key vault. public Uri KeyVaultUri { get; set; } + /// The ID of the user's Key vault. public ResourceIdentifier KeyVaultId { get; set; } } diff --git a/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/Models/DevTestLabVhd.Serialization.cs b/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/Models/DevTestLabVhd.Serialization.cs new file mode 100644 index 000000000000..676fa91d3ed1 --- /dev/null +++ b/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/Models/DevTestLabVhd.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.DevTestLabs; + +namespace Azure.ResourceManager.DevTestLabs.Models +{ + /// Properties of a VHD in the lab. + public partial class DevTestLabVhd : IJsonModel + { + /// The data to parse. + /// The client options for reading and writing models. + protected virtual DevTestLabVhd 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 DeserializeDevTestLabVhd(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(DevTestLabVhd)} does not support reading '{options.Format}' format."); + } + } + + /// 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(DevTestLabVhd)} does not support writing '{format}' format."); + } + if (Optional.IsDefined(Id)) + { + writer.WritePropertyName("id"u8); + writer.WriteStringValue(Id.AbsoluteUri); + } + 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. + DevTestLabVhd IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) => JsonModelCreateCore(ref reader, options); + + /// The JSON reader. + /// The client options for reading and writing models. + protected virtual DevTestLabVhd 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(DevTestLabVhd)} does not support reading '{format}' format."); + } + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeDevTestLabVhd(document.RootElement, options); + } + + /// The JSON element to deserialize. + /// The client options for reading and writing models. + internal static DevTestLabVhd DeserializeDevTestLabVhd(JsonElement element, ModelReaderWriterOptions options) + { + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + Uri id = default; + IDictionary additionalBinaryDataProperties = new ChangeTrackingDictionary(); + foreach (var prop in element.EnumerateObject()) + { + if (prop.NameEquals("id"u8)) + { + if (prop.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + id = string.IsNullOrEmpty(prop.Value.GetString()) ? null : new Uri(prop.Value.GetString()); + continue; + } + if (options.Format != "W") + { + additionalBinaryDataProperties.Add(prop.Name, BinaryData.FromString(prop.Value.GetRawText())); + } + } + return new DevTestLabVhd(id, 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, AzureResourceManagerDevTestLabsContext.Default); + default: + throw new FormatException($"The model {nameof(DevTestLabVhd)} does not support writing '{options.Format}' format."); + } + } + + /// The data to parse. + /// The client options for reading and writing models. + DevTestLabVhd IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) => PersistableModelCreateCore(data, options); + + /// The client options for reading and writing models. + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + } +} diff --git a/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/Models/DevTestLabVhd.cs b/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/Models/DevTestLabVhd.cs new file mode 100644 index 000000000000..11da4a43a17c --- /dev/null +++ b/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/Models/DevTestLabVhd.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.DevTestLabs.Models +{ + /// Properties of a VHD in the lab. + public partial class DevTestLabVhd + { + /// Keeps track of any properties unknown to the library. + private protected readonly IDictionary _additionalBinaryDataProperties; + + /// Initializes a new instance of . + internal DevTestLabVhd() + { + } + + /// Initializes a new instance of . + /// The URI to the VHD. + /// Keeps track of any properties unknown to the library. + internal DevTestLabVhd(Uri id, IDictionary additionalBinaryDataProperties) + { + Id = id; + _additionalBinaryDataProperties = additionalBinaryDataProperties; + } + + /// The URI to the VHD. + public Uri Id { get; } + } +} diff --git a/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/Models/DevTestLabVirtualNetworkPatch.Serialization.cs b/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/Models/DevTestLabVirtualNetworkPatch.Serialization.cs index eea5b34d96f3..dd70f055d474 100644 --- a/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/Models/DevTestLabVirtualNetworkPatch.Serialization.cs +++ b/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/Models/DevTestLabVirtualNetworkPatch.Serialization.cs @@ -10,13 +10,32 @@ using System.Collections.Generic; using System.Text.Json; using Azure.Core; +using Azure.ResourceManager.DevTestLabs; namespace Azure.ResourceManager.DevTestLabs.Models { - public partial class DevTestLabVirtualNetworkPatch : IUtf8JsonSerializable, IJsonModel + /// A virtual network. + public partial class DevTestLabVirtualNetworkPatch : DevTestLabResourcePatch, IJsonModel { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + /// The data to parse. + /// The client options for reading and writing models. + protected override DevTestLabResourcePatch 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 DeserializeDevTestLabVirtualNetworkPatch(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(DevTestLabVirtualNetworkPatch)} does not support reading '{options.Format}' format."); + } + } + /// The JSON writer. + /// The client options for reading and writing models. void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) { writer.WriteStartObject(); @@ -28,67 +47,79 @@ 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(DevTestLabVirtualNetworkPatch)} does not support writing '{format}' format."); } - base.JsonModelWriteCore(writer, options); } - DevTestLabVirtualNetworkPatch IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + /// The JSON reader. + /// The client options for reading and writing models. + DevTestLabVirtualNetworkPatch IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) => (DevTestLabVirtualNetworkPatch)JsonModelCreateCore(ref reader, options); + + /// The JSON reader. + /// The client options for reading and writing models. + protected override DevTestLabResourcePatch 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(DevTestLabVirtualNetworkPatch)} does not support reading '{format}' format."); } - using JsonDocument document = JsonDocument.ParseValue(ref reader); return DeserializeDevTestLabVirtualNetworkPatch(document.RootElement, options); } - internal static DevTestLabVirtualNetworkPatch DeserializeDevTestLabVirtualNetworkPatch(JsonElement element, ModelReaderWriterOptions options = null) + /// The JSON element to deserialize. + /// The client options for reading and writing models. + internal static DevTestLabVirtualNetworkPatch DeserializeDevTestLabVirtualNetworkPatch(JsonElement element, ModelReaderWriterOptions options) { - options ??= ModelSerializationExtensions.WireOptions; - if (element.ValueKind == JsonValueKind.Null) { return null; } IDictionary tags = 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("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 (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 DevTestLabVirtualNetworkPatch(tags ?? new ChangeTrackingDictionary(), serializedAdditionalRawData); + return new DevTestLabVirtualNetworkPatch(tags ?? new ChangeTrackingDictionary(), 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 override BinaryData PersistableModelWriteCore(ModelReaderWriterOptions options) + { + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; switch (format) { case "J": @@ -98,22 +129,23 @@ BinaryData IPersistableModel.Write(ModelReaderWri } } - DevTestLabVirtualNetworkPatch 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. + DevTestLabVirtualNetworkPatch IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) => (DevTestLabVirtualNetworkPatch)PersistableModelCreateCore(data, options); - switch (format) + /// The client options for reading and writing models. + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + + /// The to serialize into . + internal static RequestContent ToRequestContent(DevTestLabVirtualNetworkPatch devTestLabVirtualNetworkPatch) + { + if (devTestLabVirtualNetworkPatch == null) { - case "J": - { - using JsonDocument document = JsonDocument.Parse(data, ModelSerializationExtensions.JsonDocumentOptions); - return DeserializeDevTestLabVirtualNetworkPatch(document.RootElement, options); - } - default: - throw new FormatException($"The model {nameof(DevTestLabVirtualNetworkPatch)} does not support reading '{options.Format}' format."); + return null; } + Utf8JsonRequestContent content = new Utf8JsonRequestContent(); + content.JsonWriter.WriteObjectValue(devTestLabVirtualNetworkPatch, ModelSerializationExtensions.WireOptions); + return content; } - - string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; } } diff --git a/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/Models/DevTestLabVirtualNetworkPatch.cs b/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/Models/DevTestLabVirtualNetworkPatch.cs index e7d2049fae2d..960839d4b38f 100644 --- a/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/Models/DevTestLabVirtualNetworkPatch.cs +++ b/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/Models/DevTestLabVirtualNetworkPatch.cs @@ -20,8 +20,8 @@ public DevTestLabVirtualNetworkPatch() /// Initializes a new instance of . /// The tags of the resource. - /// Keeps track of any properties unknown to the library. - internal DevTestLabVirtualNetworkPatch(IDictionary tags, IDictionary serializedAdditionalRawData) : base(tags, serializedAdditionalRawData) + /// Keeps track of any properties unknown to the library. + internal DevTestLabVirtualNetworkPatch(IDictionary tags, IDictionary additionalBinaryDataProperties) : base(tags, additionalBinaryDataProperties) { } } diff --git a/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/Models/DevTestLabVmApplyArtifactsContent.Serialization.cs b/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/Models/DevTestLabVmApplyArtifactsContent.Serialization.cs index 7a7665c908ba..f9754668a7f3 100644 --- a/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/Models/DevTestLabVmApplyArtifactsContent.Serialization.cs +++ b/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/Models/DevTestLabVmApplyArtifactsContent.Serialization.cs @@ -10,13 +10,32 @@ using System.Collections.Generic; using System.Text.Json; using Azure.Core; +using Azure.ResourceManager.DevTestLabs; namespace Azure.ResourceManager.DevTestLabs.Models { - public partial class DevTestLabVmApplyArtifactsContent : IUtf8JsonSerializable, IJsonModel + /// Request body for applying artifacts to a virtual machine. + public partial class DevTestLabVmApplyArtifactsContent : IJsonModel { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + /// The data to parse. + /// The client options for reading and writing models. + protected virtual DevTestLabVmApplyArtifactsContent 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 DeserializeDevTestLabVmApplyArtifactsContent(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(DevTestLabVmApplyArtifactsContent)} does not support reading '{options.Format}' format."); + } + } + /// The JSON writer. + /// The client options for reading and writing models. void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) { writer.WriteStartObject(); @@ -28,31 +47,30 @@ 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(DevTestLabVmApplyArtifactsContent)} does not support writing '{format}' format."); } - if (Optional.IsCollectionDefined(Artifacts)) { writer.WritePropertyName("artifacts"u8); writer.WriteStartArray(); - foreach (var item in Artifacts) + foreach (DevTestLabArtifactInstallInfo item in Artifacts) { 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); } @@ -61,39 +79,43 @@ protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWrit } } - DevTestLabVmApplyArtifactsContent IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + /// The JSON reader. + /// The client options for reading and writing models. + DevTestLabVmApplyArtifactsContent IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) => JsonModelCreateCore(ref reader, options); + + /// The JSON reader. + /// The client options for reading and writing models. + protected virtual DevTestLabVmApplyArtifactsContent 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(DevTestLabVmApplyArtifactsContent)} does not support reading '{format}' format."); } - using JsonDocument document = JsonDocument.ParseValue(ref reader); return DeserializeDevTestLabVmApplyArtifactsContent(document.RootElement, options); } - internal static DevTestLabVmApplyArtifactsContent DeserializeDevTestLabVmApplyArtifactsContent(JsonElement element, ModelReaderWriterOptions options = null) + /// The JSON element to deserialize. + /// The client options for reading and writing models. + internal static DevTestLabVmApplyArtifactsContent DeserializeDevTestLabVmApplyArtifactsContent(JsonElement element, ModelReaderWriterOptions options) { - options ??= ModelSerializationExtensions.WireOptions; - if (element.ValueKind == JsonValueKind.Null) { return null; } IList artifacts = 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("artifacts"u8)) + if (prop.NameEquals("artifacts"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(DevTestLabArtifactInstallInfo.DeserializeDevTestLabArtifactInstallInfo(item, options)); } @@ -102,17 +124,19 @@ internal static DevTestLabVmApplyArtifactsContent DeserializeDevTestLabVmApplyAr } 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 DevTestLabVmApplyArtifactsContent(artifacts ?? new ChangeTrackingList(), serializedAdditionalRawData); + return new DevTestLabVmApplyArtifactsContent(artifacts ?? 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": @@ -122,22 +146,23 @@ BinaryData IPersistableModel.Write(ModelReade } } - DevTestLabVmApplyArtifactsContent 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. + DevTestLabVmApplyArtifactsContent IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) => PersistableModelCreateCore(data, options); - switch (format) + /// The client options for reading and writing models. + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + + /// The to serialize into . + internal static RequestContent ToRequestContent(DevTestLabVmApplyArtifactsContent devTestLabVmApplyArtifactsContent) + { + if (devTestLabVmApplyArtifactsContent == null) { - case "J": - { - using JsonDocument document = JsonDocument.Parse(data, ModelSerializationExtensions.JsonDocumentOptions); - return DeserializeDevTestLabVmApplyArtifactsContent(document.RootElement, options); - } - default: - throw new FormatException($"The model {nameof(DevTestLabVmApplyArtifactsContent)} does not support reading '{options.Format}' format."); + return null; } + Utf8JsonRequestContent content = new Utf8JsonRequestContent(); + content.JsonWriter.WriteObjectValue(devTestLabVmApplyArtifactsContent, ModelSerializationExtensions.WireOptions); + return content; } - - string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; } } diff --git a/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/Models/DevTestLabVmApplyArtifactsContent.cs b/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/Models/DevTestLabVmApplyArtifactsContent.cs index ca9204241cee..d84253211e25 100644 --- a/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/Models/DevTestLabVmApplyArtifactsContent.cs +++ b/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/Models/DevTestLabVmApplyArtifactsContent.cs @@ -7,43 +7,15 @@ using System; using System.Collections.Generic; +using Azure.ResourceManager.DevTestLabs; namespace Azure.ResourceManager.DevTestLabs.Models { /// Request body for applying artifacts to a virtual machine. public partial class DevTestLabVmApplyArtifactsContent { - /// - /// 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 DevTestLabVmApplyArtifactsContent() @@ -53,11 +25,11 @@ public DevTestLabVmApplyArtifactsContent() /// Initializes a new instance of . /// The list of artifacts to apply. - /// Keeps track of any properties unknown to the library. - internal DevTestLabVmApplyArtifactsContent(IList artifacts, IDictionary serializedAdditionalRawData) + /// Keeps track of any properties unknown to the library. + internal DevTestLabVmApplyArtifactsContent(IList artifacts, IDictionary additionalBinaryDataProperties) { Artifacts = artifacts; - _serializedAdditionalRawData = serializedAdditionalRawData; + _additionalBinaryDataProperties = additionalBinaryDataProperties; } /// The list of artifacts to apply. diff --git a/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/Models/DevTestLabVmCreationContent.Serialization.cs b/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/Models/DevTestLabVmCreationContent.Serialization.cs index 045db870ed55..283d1eff8ea9 100644 --- a/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/Models/DevTestLabVmCreationContent.Serialization.cs +++ b/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/Models/DevTestLabVmCreationContent.Serialization.cs @@ -10,13 +10,32 @@ using System.Collections.Generic; using System.Text.Json; using Azure.Core; +using Azure.ResourceManager.DevTestLabs; namespace Azure.ResourceManager.DevTestLabs.Models { - public partial class DevTestLabVmCreationContent : IUtf8JsonSerializable, IJsonModel + /// Properties for creating a virtual machine. + public partial class DevTestLabVmCreationContent : IJsonModel { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + /// The data to parse. + /// The client options for reading and writing models. + protected virtual DevTestLabVmCreationContent 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 DeserializeDevTestLabVmCreationContent(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(DevTestLabVmCreationContent)} does not support reading '{options.Format}' format."); + } + } + /// The JSON writer. + /// The client options for reading and writing models. void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) { writer.WriteStartObject(); @@ -28,12 +47,16 @@ void IJsonModel.Write(Utf8JsonWriter writer, ModelR /// 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(DevTestLabVmCreationContent)} does not support writing '{format}' format."); } - + if (Optional.IsDefined(Properties)) + { + writer.WritePropertyName("properties"u8); + writer.WriteObjectValue(Properties, options); + } if (Optional.IsDefined(Name)) { writer.WritePropertyName("name"u8); @@ -51,157 +74,24 @@ 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(); } - writer.WritePropertyName("properties"u8); - writer.WriteStartObject(); - if (Optional.IsDefined(BulkCreationParameters)) - { - writer.WritePropertyName("bulkCreationParameters"u8); - writer.WriteObjectValue(BulkCreationParameters, options); - } - if (Optional.IsDefined(Notes)) - { - writer.WritePropertyName("notes"u8); - writer.WriteStringValue(Notes); - } - if (Optional.IsDefined(OwnerObjectId)) - { - writer.WritePropertyName("ownerObjectId"u8); - writer.WriteStringValue(OwnerObjectId); - } - if (Optional.IsDefined(OwnerUserPrincipalName)) - { - writer.WritePropertyName("ownerUserPrincipalName"u8); - writer.WriteStringValue(OwnerUserPrincipalName); - } - if (Optional.IsDefined(CreatedOn)) - { - writer.WritePropertyName("createdDate"u8); - writer.WriteStringValue(CreatedOn.Value, "O"); - } - if (Optional.IsDefined(CustomImageId)) - { - writer.WritePropertyName("customImageId"u8); - writer.WriteStringValue(CustomImageId); - } - if (Optional.IsDefined(Size)) - { - writer.WritePropertyName("size"u8); - writer.WriteStringValue(Size); - } - if (Optional.IsDefined(UserName)) + if (options.Format != "W" && _additionalBinaryDataProperties != null) { - writer.WritePropertyName("userName"u8); - writer.WriteStringValue(UserName); - } - if (Optional.IsDefined(Password)) - { - writer.WritePropertyName("password"u8); - writer.WriteStringValue(Password); - } - if (Optional.IsDefined(SshKey)) - { - writer.WritePropertyName("sshKey"u8); - writer.WriteStringValue(SshKey); - } - if (Optional.IsDefined(IsAuthenticationWithSshKey)) - { - writer.WritePropertyName("isAuthenticationWithSshKey"u8); - writer.WriteBooleanValue(IsAuthenticationWithSshKey.Value); - } - if (Optional.IsDefined(LabSubnetName)) - { - writer.WritePropertyName("labSubnetName"u8); - writer.WriteStringValue(LabSubnetName); - } - if (Optional.IsDefined(LabVirtualNetworkId)) - { - writer.WritePropertyName("labVirtualNetworkId"u8); - writer.WriteStringValue(LabVirtualNetworkId); - } - if (Optional.IsDefined(DisallowPublicIPAddress)) - { - writer.WritePropertyName("disallowPublicIpAddress"u8); - writer.WriteBooleanValue(DisallowPublicIPAddress.Value); - } - if (Optional.IsCollectionDefined(Artifacts)) - { - writer.WritePropertyName("artifacts"u8); - writer.WriteStartArray(); - foreach (var item in Artifacts) - { - writer.WriteObjectValue(item, options); - } - writer.WriteEndArray(); - } - if (Optional.IsDefined(GalleryImageReference)) - { - writer.WritePropertyName("galleryImageReference"u8); - writer.WriteObjectValue(GalleryImageReference, options); - } - if (Optional.IsDefined(PlanId)) - { - writer.WritePropertyName("planId"u8); - writer.WriteStringValue(PlanId); - } - if (Optional.IsDefined(NetworkInterface)) - { - writer.WritePropertyName("networkInterface"u8); - writer.WriteObjectValue(NetworkInterface, options); - } - if (Optional.IsDefined(ExpireOn)) - { - writer.WritePropertyName("expirationDate"u8); - writer.WriteStringValue(ExpireOn.Value, "O"); - } - if (Optional.IsDefined(AllowClaim)) - { - writer.WritePropertyName("allowClaim"u8); - writer.WriteBooleanValue(AllowClaim.Value); - } - if (Optional.IsDefined(StorageType)) - { - writer.WritePropertyName("storageType"u8); - writer.WriteStringValue(StorageType); - } - if (Optional.IsDefined(EnvironmentId)) - { - writer.WritePropertyName("environmentId"u8); - writer.WriteStringValue(EnvironmentId); - } - if (Optional.IsCollectionDefined(DataDiskParameters)) - { - writer.WritePropertyName("dataDiskParameters"u8); - writer.WriteStartArray(); - foreach (var item in DataDiskParameters) - { - writer.WriteObjectValue(item, options); - } - writer.WriteEndArray(); - } - if (Optional.IsCollectionDefined(ScheduleParameters)) - { - writer.WritePropertyName("scheduleParameters"u8); - writer.WriteStartArray(); - foreach (var item in ScheduleParameters) - { - writer.WriteObjectValue(item, options); - } - writer.WriteEndArray(); - } - writer.WriteEndObject(); - if (options.Format != "W" && _serializedAdditionalRawData != 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); } @@ -210,321 +100,97 @@ protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWrit } } - DevTestLabVmCreationContent IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + /// The JSON reader. + /// The client options for reading and writing models. + DevTestLabVmCreationContent IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) => JsonModelCreateCore(ref reader, options); + + /// The JSON reader. + /// The client options for reading and writing models. + protected virtual DevTestLabVmCreationContent 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(DevTestLabVmCreationContent)} does not support reading '{format}' format."); } - using JsonDocument document = JsonDocument.ParseValue(ref reader); return DeserializeDevTestLabVmCreationContent(document.RootElement, options); } - internal static DevTestLabVmCreationContent DeserializeDevTestLabVmCreationContent(JsonElement element, ModelReaderWriterOptions options = null) + /// The JSON element to deserialize. + /// The client options for reading and writing models. + internal static DevTestLabVmCreationContent DeserializeDevTestLabVmCreationContent(JsonElement element, ModelReaderWriterOptions options) { - options ??= ModelSerializationExtensions.WireOptions; - if (element.ValueKind == JsonValueKind.Null) { return null; } + LabVirtualMachineCreationParameterProperties properties = default; string name = default; AzureLocation? location = default; IDictionary tags = default; - BulkCreationParameters bulkCreationParameters = default; - string notes = default; - string ownerObjectId = default; - string ownerUserPrincipalName = default; - DateTimeOffset? createdDate = default; - string customImageId = default; - string size = default; - string userName = default; - string password = default; - string sshKey = default; - bool? isAuthenticationWithSshKey = default; - string labSubnetName = default; - ResourceIdentifier labVirtualNetworkId = default; - bool? disallowPublicIPAddress = default; - IList artifacts = default; - DevTestLabGalleryImageReference galleryImageReference = default; - string planId = default; - DevTestLabNetworkInterface networkInterface = default; - DateTimeOffset? expirationDate = default; - bool? allowClaim = default; - string storageType = default; - string environmentId = default; - IList dataDiskParameters = default; - IList scheduleParameters = 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("name"u8)) - { - name = property.Value.GetString(); - continue; - } - if (property.NameEquals("location"u8)) + if (prop.NameEquals("properties"u8)) { - if (property.Value.ValueKind == JsonValueKind.Null) + if (prop.Value.ValueKind == JsonValueKind.Null) { continue; } - location = new AzureLocation(property.Value.GetString()); + properties = LabVirtualMachineCreationParameterProperties.DeserializeLabVirtualMachineCreationParameterProperties(prop.Value, options); continue; } - if (property.NameEquals("tags"u8)) + if (prop.NameEquals("name"u8)) { - if (property.Value.ValueKind == JsonValueKind.Null) + name = prop.Value.GetString(); + continue; + } + if (prop.NameEquals("location"u8)) + { + if (prop.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; + location = new AzureLocation(prop.Value.GetString()); continue; } - if (property.NameEquals("properties"u8)) + if (prop.NameEquals("tags"u8)) { - if (property.Value.ValueKind == JsonValueKind.Null) + if (prop.Value.ValueKind == JsonValueKind.Null) { - property.ThrowNonNullablePropertyIsNull(); continue; } - foreach (var property0 in property.Value.EnumerateObject()) + Dictionary dictionary = new Dictionary(); + foreach (var prop0 in prop.Value.EnumerateObject()) { - if (property0.NameEquals("bulkCreationParameters"u8)) - { - if (property0.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - bulkCreationParameters = BulkCreationParameters.DeserializeBulkCreationParameters(property0.Value, options); - continue; - } - if (property0.NameEquals("notes"u8)) - { - notes = property0.Value.GetString(); - continue; - } - if (property0.NameEquals("ownerObjectId"u8)) - { - ownerObjectId = property0.Value.GetString(); - continue; - } - if (property0.NameEquals("ownerUserPrincipalName"u8)) - { - ownerUserPrincipalName = property0.Value.GetString(); - continue; - } - if (property0.NameEquals("createdDate"u8)) - { - if (property0.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - createdDate = property0.Value.GetDateTimeOffset("O"); - continue; - } - if (property0.NameEquals("customImageId"u8)) - { - customImageId = property0.Value.GetString(); - continue; - } - if (property0.NameEquals("size"u8)) - { - size = property0.Value.GetString(); - continue; - } - if (property0.NameEquals("userName"u8)) - { - userName = property0.Value.GetString(); - continue; - } - if (property0.NameEquals("password"u8)) - { - password = property0.Value.GetString(); - continue; - } - if (property0.NameEquals("sshKey"u8)) - { - sshKey = property0.Value.GetString(); - continue; - } - if (property0.NameEquals("isAuthenticationWithSshKey"u8)) - { - if (property0.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - isAuthenticationWithSshKey = property0.Value.GetBoolean(); - continue; - } - if (property0.NameEquals("labSubnetName"u8)) - { - labSubnetName = property0.Value.GetString(); - continue; - } - if (property0.NameEquals("labVirtualNetworkId"u8)) - { - if (property0.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - labVirtualNetworkId = new ResourceIdentifier(property0.Value.GetString()); - continue; - } - if (property0.NameEquals("disallowPublicIpAddress"u8)) + if (prop0.Value.ValueKind == JsonValueKind.Null) { - if (property0.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - disallowPublicIPAddress = property0.Value.GetBoolean(); - continue; + dictionary.Add(prop0.Name, null); } - if (property0.NameEquals("artifacts"u8)) + else { - if (property0.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - List array = new List(); - foreach (var item in property0.Value.EnumerateArray()) - { - array.Add(DevTestLabArtifactInstallInfo.DeserializeDevTestLabArtifactInstallInfo(item, options)); - } - artifacts = array; - continue; - } - if (property0.NameEquals("galleryImageReference"u8)) - { - if (property0.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - galleryImageReference = DevTestLabGalleryImageReference.DeserializeDevTestLabGalleryImageReference(property0.Value, options); - continue; - } - if (property0.NameEquals("planId"u8)) - { - planId = property0.Value.GetString(); - continue; - } - if (property0.NameEquals("networkInterface"u8)) - { - if (property0.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - networkInterface = DevTestLabNetworkInterface.DeserializeDevTestLabNetworkInterface(property0.Value, options); - continue; - } - if (property0.NameEquals("expirationDate"u8)) - { - if (property0.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - expirationDate = property0.Value.GetDateTimeOffset("O"); - continue; - } - if (property0.NameEquals("allowClaim"u8)) - { - if (property0.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - allowClaim = property0.Value.GetBoolean(); - continue; - } - if (property0.NameEquals("storageType"u8)) - { - storageType = property0.Value.GetString(); - continue; - } - if (property0.NameEquals("environmentId"u8)) - { - environmentId = property0.Value.GetString(); - continue; - } - if (property0.NameEquals("dataDiskParameters"u8)) - { - if (property0.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - List array = new List(); - foreach (var item in property0.Value.EnumerateArray()) - { - array.Add(DevTestLabDataDiskProperties.DeserializeDevTestLabDataDiskProperties(item, options)); - } - dataDiskParameters = array; - continue; - } - if (property0.NameEquals("scheduleParameters"u8)) - { - if (property0.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - List array = new List(); - foreach (var item in property0.Value.EnumerateArray()) - { - array.Add(DevTestLabScheduleCreationParameter.DeserializeDevTestLabScheduleCreationParameter(item, options)); - } - scheduleParameters = array; - continue; + dictionary.Add(prop0.Name, prop0.Value.GetString()); } } + tags = dictionary; 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 DevTestLabVmCreationContent( - name, - location, - tags ?? new ChangeTrackingDictionary(), - bulkCreationParameters, - notes, - ownerObjectId, - ownerUserPrincipalName, - createdDate, - customImageId, - size, - userName, - password, - sshKey, - isAuthenticationWithSshKey, - labSubnetName, - labVirtualNetworkId, - disallowPublicIPAddress, - artifacts ?? new ChangeTrackingList(), - galleryImageReference, - planId, - networkInterface, - expirationDate, - allowClaim, - storageType, - environmentId, - dataDiskParameters ?? new ChangeTrackingList(), - scheduleParameters ?? new ChangeTrackingList(), - serializedAdditionalRawData); + return new DevTestLabVmCreationContent(properties, name, location, tags ?? new ChangeTrackingDictionary(), 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": @@ -534,22 +200,23 @@ BinaryData IPersistableModel.Write(ModelReaderWrite } } - DevTestLabVmCreationContent 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. + DevTestLabVmCreationContent IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) => PersistableModelCreateCore(data, options); - switch (format) + /// The client options for reading and writing models. + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + + /// The to serialize into . + internal static RequestContent ToRequestContent(DevTestLabVmCreationContent devTestLabVmCreationContent) + { + if (devTestLabVmCreationContent == null) { - case "J": - { - using JsonDocument document = JsonDocument.Parse(data, ModelSerializationExtensions.JsonDocumentOptions); - return DeserializeDevTestLabVmCreationContent(document.RootElement, options); - } - default: - throw new FormatException($"The model {nameof(DevTestLabVmCreationContent)} does not support reading '{options.Format}' format."); + return null; } + Utf8JsonRequestContent content = new Utf8JsonRequestContent(); + content.JsonWriter.WriteObjectValue(devTestLabVmCreationContent, ModelSerializationExtensions.WireOptions); + return content; } - - string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; } } diff --git a/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/Models/DevTestLabVmCreationContent.cs b/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/Models/DevTestLabVmCreationContent.cs index c341c339f121..47e8c0fb7ca8 100644 --- a/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/Models/DevTestLabVmCreationContent.cs +++ b/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/Models/DevTestLabVmCreationContent.cs @@ -8,179 +8,443 @@ using System; using System.Collections.Generic; using Azure.Core; +using Azure.ResourceManager.DevTestLabs; namespace Azure.ResourceManager.DevTestLabs.Models { /// Properties for creating a virtual machine. public partial class DevTestLabVmCreationContent { - /// - /// 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 DevTestLabVmCreationContent() { Tags = new ChangeTrackingDictionary(); - Artifacts = new ChangeTrackingList(); - DataDiskParameters = new ChangeTrackingList(); - ScheduleParameters = new ChangeTrackingList(); } /// Initializes a new instance of . + /// The properties of the resource. /// The name of the virtual machine or environment. /// The location of the new virtual machine or environment. /// The tags of the resource. - /// The number of virtual machine instances to create. - /// The notes of the virtual machine. - /// The object identifier of the owner of the virtual machine. - /// The user principal name of the virtual machine owner. - /// The creation date of the virtual machine. - /// The custom image identifier of the virtual machine. - /// The size of the virtual machine. - /// The user name of the virtual machine. - /// The password of the virtual machine administrator. - /// The SSH key of the virtual machine administrator. - /// Indicates whether this virtual machine uses an SSH key for authentication. - /// The lab subnet name of the virtual machine. - /// The lab virtual network identifier of the virtual machine. - /// Indicates whether the virtual machine is to be created without a public IP address. - /// The artifacts to be installed on the virtual machine. - /// The Microsoft Azure Marketplace image reference of the virtual machine. - /// The id of the plan associated with the virtual machine image. - /// The network interface properties. - /// The expiration date for VM. - /// Indicates whether another user can take ownership of the virtual machine. - /// Storage type to use for virtual machine (i.e. Standard, Premium). - /// The resource ID of the environment that contains this virtual machine, if any. - /// New or existing data disks to attach to the virtual machine after creation. - /// Virtual Machine schedules to be created. - /// Keeps track of any properties unknown to the library. - internal DevTestLabVmCreationContent(string name, AzureLocation? location, IDictionary tags, BulkCreationParameters bulkCreationParameters, string notes, string ownerObjectId, string ownerUserPrincipalName, DateTimeOffset? createdOn, string customImageId, string size, string userName, string password, string sshKey, bool? isAuthenticationWithSshKey, string labSubnetName, ResourceIdentifier labVirtualNetworkId, bool? disallowPublicIPAddress, IList artifacts, DevTestLabGalleryImageReference galleryImageReference, string planId, DevTestLabNetworkInterface networkInterface, DateTimeOffset? expireOn, bool? allowClaim, string storageType, string environmentId, IList dataDiskParameters, IList scheduleParameters, IDictionary serializedAdditionalRawData) + /// Keeps track of any properties unknown to the library. + internal DevTestLabVmCreationContent(LabVirtualMachineCreationParameterProperties properties, string name, AzureLocation? location, IDictionary tags, IDictionary additionalBinaryDataProperties) { + Properties = properties; Name = name; Location = location; Tags = tags; - BulkCreationParameters = bulkCreationParameters; - Notes = notes; - OwnerObjectId = ownerObjectId; - OwnerUserPrincipalName = ownerUserPrincipalName; - CreatedOn = createdOn; - CustomImageId = customImageId; - Size = size; - UserName = userName; - Password = password; - SshKey = sshKey; - IsAuthenticationWithSshKey = isAuthenticationWithSshKey; - LabSubnetName = labSubnetName; - LabVirtualNetworkId = labVirtualNetworkId; - DisallowPublicIPAddress = disallowPublicIPAddress; - Artifacts = artifacts; - GalleryImageReference = galleryImageReference; - PlanId = planId; - NetworkInterface = networkInterface; - ExpireOn = expireOn; - AllowClaim = allowClaim; - StorageType = storageType; - EnvironmentId = environmentId; - DataDiskParameters = dataDiskParameters; - ScheduleParameters = scheduleParameters; - _serializedAdditionalRawData = serializedAdditionalRawData; + _additionalBinaryDataProperties = additionalBinaryDataProperties; } + /// The properties of the resource. + internal LabVirtualMachineCreationParameterProperties Properties { get; set; } + /// The name of the virtual machine or environment. public string Name { get; set; } + /// The location of the new virtual machine or environment. public AzureLocation? Location { get; set; } + /// The tags of the resource. public IDictionary Tags { get; } - /// The number of virtual machine instances to create. - internal BulkCreationParameters BulkCreationParameters { get; set; } - /// The number of virtual machine instances to create. - public int? BulkCreationParametersInstanceCount + + /// The notes of the virtual machine. + public string Notes { - get => BulkCreationParameters is null ? default : BulkCreationParameters.InstanceCount; + get + { + return Properties is null ? default : Properties.Notes; + } set { - if (BulkCreationParameters is null) - BulkCreationParameters = new BulkCreationParameters(); - BulkCreationParameters.InstanceCount = value; + if (Properties is null) + { + Properties = new LabVirtualMachineCreationParameterProperties(); + } + Properties.Notes = value; } } - /// The notes of the virtual machine. - public string Notes { get; set; } /// The object identifier of the owner of the virtual machine. - public string OwnerObjectId { get; set; } + public string OwnerObjectId + { + get + { + return Properties is null ? default : Properties.OwnerObjectId; + } + set + { + if (Properties is null) + { + Properties = new LabVirtualMachineCreationParameterProperties(); + } + Properties.OwnerObjectId = value; + } + } + /// The user principal name of the virtual machine owner. - public string OwnerUserPrincipalName { get; set; } + public string OwnerUserPrincipalName + { + get + { + return Properties is null ? default : Properties.OwnerUserPrincipalName; + } + set + { + if (Properties is null) + { + Properties = new LabVirtualMachineCreationParameterProperties(); + } + Properties.OwnerUserPrincipalName = value; + } + } + /// The creation date of the virtual machine. - public DateTimeOffset? CreatedOn { get; set; } + public DateTimeOffset? CreatedOn + { + get + { + return Properties is null ? default : Properties.CreatedOn; + } + set + { + if (Properties is null) + { + Properties = new LabVirtualMachineCreationParameterProperties(); + } + Properties.CreatedOn = value.Value; + } + } + /// The custom image identifier of the virtual machine. - public string CustomImageId { get; set; } + public string CustomImageId + { + get + { + return Properties is null ? default : Properties.CustomImageId; + } + set + { + if (Properties is null) + { + Properties = new LabVirtualMachineCreationParameterProperties(); + } + Properties.CustomImageId = value; + } + } + /// The size of the virtual machine. - public string Size { get; set; } + public string Size + { + get + { + return Properties is null ? default : Properties.Size; + } + set + { + if (Properties is null) + { + Properties = new LabVirtualMachineCreationParameterProperties(); + } + Properties.Size = value; + } + } + /// The user name of the virtual machine. - public string UserName { get; set; } + public string UserName + { + get + { + return Properties is null ? default : Properties.UserName; + } + set + { + if (Properties is null) + { + Properties = new LabVirtualMachineCreationParameterProperties(); + } + Properties.UserName = value; + } + } + /// The password of the virtual machine administrator. - public string Password { get; set; } + public string Password + { + get + { + return Properties is null ? default : Properties.Password; + } + set + { + if (Properties is null) + { + Properties = new LabVirtualMachineCreationParameterProperties(); + } + Properties.Password = value; + } + } + /// The SSH key of the virtual machine administrator. - public string SshKey { get; set; } + public string SshKey + { + get + { + return Properties is null ? default : Properties.SshKey; + } + set + { + if (Properties is null) + { + Properties = new LabVirtualMachineCreationParameterProperties(); + } + Properties.SshKey = value; + } + } + /// Indicates whether this virtual machine uses an SSH key for authentication. - public bool? IsAuthenticationWithSshKey { get; set; } + public bool? IsAuthenticationWithSshKey + { + get + { + return Properties is null ? default : Properties.IsAuthenticationWithSshKey; + } + set + { + if (Properties is null) + { + Properties = new LabVirtualMachineCreationParameterProperties(); + } + Properties.IsAuthenticationWithSshKey = value.Value; + } + } + /// The lab subnet name of the virtual machine. - public string LabSubnetName { get; set; } + public string LabSubnetName + { + get + { + return Properties is null ? default : Properties.LabSubnetName; + } + set + { + if (Properties is null) + { + Properties = new LabVirtualMachineCreationParameterProperties(); + } + Properties.LabSubnetName = value; + } + } + /// The lab virtual network identifier of the virtual machine. - public ResourceIdentifier LabVirtualNetworkId { get; set; } + public ResourceIdentifier LabVirtualNetworkId + { + get + { + return Properties is null ? default : Properties.LabVirtualNetworkId; + } + set + { + if (Properties is null) + { + Properties = new LabVirtualMachineCreationParameterProperties(); + } + Properties.LabVirtualNetworkId = value; + } + } + /// Indicates whether the virtual machine is to be created without a public IP address. - public bool? DisallowPublicIPAddress { get; set; } + public bool? DisallowPublicIPAddress + { + get + { + return Properties is null ? default : Properties.DisallowPublicIPAddress; + } + set + { + if (Properties is null) + { + Properties = new LabVirtualMachineCreationParameterProperties(); + } + Properties.DisallowPublicIPAddress = value.Value; + } + } + /// The artifacts to be installed on the virtual machine. - public IList Artifacts { get; } + public IList Artifacts + { + get + { + if (Properties is null) + { + Properties = new LabVirtualMachineCreationParameterProperties(); + } + return Properties.Artifacts; + } + } + /// The Microsoft Azure Marketplace image reference of the virtual machine. - public DevTestLabGalleryImageReference GalleryImageReference { get; set; } + public DevTestLabGalleryImageReference GalleryImageReference + { + get + { + return Properties is null ? default : Properties.GalleryImageReference; + } + set + { + if (Properties is null) + { + Properties = new LabVirtualMachineCreationParameterProperties(); + } + Properties.GalleryImageReference = value; + } + } + /// The id of the plan associated with the virtual machine image. - public string PlanId { get; set; } + public string PlanId + { + get + { + return Properties is null ? default : Properties.PlanId; + } + set + { + if (Properties is null) + { + Properties = new LabVirtualMachineCreationParameterProperties(); + } + Properties.PlanId = value; + } + } + /// The network interface properties. - public DevTestLabNetworkInterface NetworkInterface { get; set; } + public DevTestLabNetworkInterface NetworkInterface + { + get + { + return Properties is null ? default : Properties.NetworkInterface; + } + set + { + if (Properties is null) + { + Properties = new LabVirtualMachineCreationParameterProperties(); + } + Properties.NetworkInterface = value; + } + } + /// The expiration date for VM. - public DateTimeOffset? ExpireOn { get; set; } + public DateTimeOffset? ExpireOn + { + get + { + return Properties is null ? default : Properties.ExpireOn; + } + set + { + if (Properties is null) + { + Properties = new LabVirtualMachineCreationParameterProperties(); + } + Properties.ExpireOn = value.Value; + } + } + /// Indicates whether another user can take ownership of the virtual machine. - public bool? AllowClaim { get; set; } + public bool? AllowClaim + { + get + { + return Properties is null ? default : Properties.AllowClaim; + } + set + { + if (Properties is null) + { + Properties = new LabVirtualMachineCreationParameterProperties(); + } + Properties.AllowClaim = value.Value; + } + } + /// Storage type to use for virtual machine (i.e. Standard, Premium). - public string StorageType { get; set; } + public string StorageType + { + get + { + return Properties is null ? default : Properties.StorageType; + } + set + { + if (Properties is null) + { + Properties = new LabVirtualMachineCreationParameterProperties(); + } + Properties.StorageType = value; + } + } + /// The resource ID of the environment that contains this virtual machine, if any. - public string EnvironmentId { get; set; } + public string EnvironmentId + { + get + { + return Properties is null ? default : Properties.EnvironmentId; + } + set + { + if (Properties is null) + { + Properties = new LabVirtualMachineCreationParameterProperties(); + } + Properties.EnvironmentId = value; + } + } + /// New or existing data disks to attach to the virtual machine after creation. - public IList DataDiskParameters { get; } + public IList DataDiskParameters + { + get + { + if (Properties is null) + { + Properties = new LabVirtualMachineCreationParameterProperties(); + } + return Properties.DataDiskParameters; + } + } + /// Virtual Machine schedules to be created. - public IList ScheduleParameters { get; } + public IList ScheduleParameters + { + get + { + if (Properties is null) + { + Properties = new LabVirtualMachineCreationParameterProperties(); + } + return Properties.ScheduleParameters; + } + } + + /// The number of virtual machine instances to create. + public int? BulkCreationParametersInstanceCount + { + get + { + return Properties is null ? default : Properties.BulkCreationParametersInstanceCount; + } + set + { + if (Properties is null) + { + Properties = new LabVirtualMachineCreationParameterProperties(); + } + Properties.BulkCreationParametersInstanceCount = value.Value; + } + } } } diff --git a/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/Models/DevTestLabVmCreationSource.cs b/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/Models/DevTestLabVmCreationSource.cs index 020f2796a14c..c07d36886c5d 100644 --- a/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/Models/DevTestLabVmCreationSource.cs +++ b/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/Models/DevTestLabVmCreationSource.cs @@ -7,6 +7,7 @@ using System; using System.ComponentModel; +using Azure.ResourceManager.DevTestLabs; namespace Azure.ResourceManager.DevTestLabs.Models { @@ -14,41 +15,59 @@ namespace Azure.ResourceManager.DevTestLabs.Models public readonly partial struct DevTestLabVmCreationSource : IEquatable { private readonly string _value; + private const string FromCustomImageValue = "FromCustomImage"; + private const string FromGalleryImageValue = "FromGalleryImage"; + private const string FromSharedGalleryImageValue = "FromSharedGalleryImage"; /// Initializes a new instance of . + /// The value. /// is null. public DevTestLabVmCreationSource(string value) { - _value = value ?? throw new ArgumentNullException(nameof(value)); - } + Argument.AssertNotNull(value, nameof(value)); - private const string FromCustomImageValue = "FromCustomImage"; - private const string FromGalleryImageValue = "FromGalleryImage"; - private const string FromSharedGalleryImageValue = "FromSharedGalleryImage"; + _value = value; + } - /// FromCustomImage. + /// Gets the FromCustomImage. public static DevTestLabVmCreationSource FromCustomImage { get; } = new DevTestLabVmCreationSource(FromCustomImageValue); - /// FromGalleryImage. + + /// Gets the FromGalleryImage. public static DevTestLabVmCreationSource FromGalleryImage { get; } = new DevTestLabVmCreationSource(FromGalleryImageValue); - /// FromSharedGalleryImage. + + /// Gets the FromSharedGalleryImage. public static DevTestLabVmCreationSource FromSharedGalleryImage { get; } = new DevTestLabVmCreationSource(FromSharedGalleryImageValue); + /// Determines if two values are the same. + /// The left value to compare. + /// The right value to compare. public static bool operator ==(DevTestLabVmCreationSource left, DevTestLabVmCreationSource 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 !=(DevTestLabVmCreationSource left, DevTestLabVmCreationSource right) => !left.Equals(right); - /// Converts a to a . + + /// Converts a string to a . + /// The value. public static implicit operator DevTestLabVmCreationSource(string value) => new DevTestLabVmCreationSource(value); - /// + /// Converts a string to a . + /// The value. + public static implicit operator DevTestLabVmCreationSource?(string value) => value == null ? null : new DevTestLabVmCreationSource(value); + + /// [EditorBrowsable(EditorBrowsableState.Never)] public override bool Equals(object obj) => obj is DevTestLabVmCreationSource other && Equals(other); - /// + + /// public bool Equals(DevTestLabVmCreationSource 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/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/Models/DevTestLabVmDetachDataDiskContent.Serialization.cs b/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/Models/DevTestLabVmDetachDataDiskContent.Serialization.cs index 2c8cae69048f..e2188b4b8527 100644 --- a/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/Models/DevTestLabVmDetachDataDiskContent.Serialization.cs +++ b/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/Models/DevTestLabVmDetachDataDiskContent.Serialization.cs @@ -10,13 +10,32 @@ using System.Collections.Generic; using System.Text.Json; using Azure.Core; +using Azure.ResourceManager.DevTestLabs; namespace Azure.ResourceManager.DevTestLabs.Models { - public partial class DevTestLabVmDetachDataDiskContent : IUtf8JsonSerializable, IJsonModel + /// Request body for detaching data disk from a virtual machine. + public partial class DevTestLabVmDetachDataDiskContent : IJsonModel { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + /// The data to parse. + /// The client options for reading and writing models. + protected virtual DevTestLabVmDetachDataDiskContent 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 DeserializeDevTestLabVmDetachDataDiskContent(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(DevTestLabVmDetachDataDiskContent)} does not support reading '{options.Format}' format."); + } + } + /// The JSON writer. + /// The client options for reading and writing models. void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) { writer.WriteStartObject(); @@ -28,26 +47,25 @@ 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(DevTestLabVmDetachDataDiskContent)} does not support writing '{format}' format."); } - if (Optional.IsDefined(ExistingLabDiskId)) { writer.WritePropertyName("existingLabDiskId"u8); writer.WriteStringValue(ExistingLabDiskId); } - 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); } @@ -56,53 +74,59 @@ protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWrit } } - DevTestLabVmDetachDataDiskContent IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + /// The JSON reader. + /// The client options for reading and writing models. + DevTestLabVmDetachDataDiskContent IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) => JsonModelCreateCore(ref reader, options); + + /// The JSON reader. + /// The client options for reading and writing models. + protected virtual DevTestLabVmDetachDataDiskContent 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(DevTestLabVmDetachDataDiskContent)} does not support reading '{format}' format."); } - using JsonDocument document = JsonDocument.ParseValue(ref reader); return DeserializeDevTestLabVmDetachDataDiskContent(document.RootElement, options); } - internal static DevTestLabVmDetachDataDiskContent DeserializeDevTestLabVmDetachDataDiskContent(JsonElement element, ModelReaderWriterOptions options = null) + /// The JSON element to deserialize. + /// The client options for reading and writing models. + internal static DevTestLabVmDetachDataDiskContent DeserializeDevTestLabVmDetachDataDiskContent(JsonElement element, ModelReaderWriterOptions options) { - options ??= ModelSerializationExtensions.WireOptions; - if (element.ValueKind == JsonValueKind.Null) { return null; } ResourceIdentifier existingLabDiskId = 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("existingLabDiskId"u8)) + if (prop.NameEquals("existingLabDiskId"u8)) { - if (property.Value.ValueKind == JsonValueKind.Null) + if (prop.Value.ValueKind == JsonValueKind.Null) { continue; } - existingLabDiskId = new ResourceIdentifier(property.Value.GetString()); + existingLabDiskId = new ResourceIdentifier(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 DevTestLabVmDetachDataDiskContent(existingLabDiskId, serializedAdditionalRawData); + return new DevTestLabVmDetachDataDiskContent(existingLabDiskId, 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": @@ -112,22 +136,23 @@ BinaryData IPersistableModel.Write(ModelReade } } - DevTestLabVmDetachDataDiskContent 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. + DevTestLabVmDetachDataDiskContent IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) => PersistableModelCreateCore(data, options); - switch (format) + /// The client options for reading and writing models. + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + + /// The to serialize into . + internal static RequestContent ToRequestContent(DevTestLabVmDetachDataDiskContent devTestLabVmDetachDataDiskContent) + { + if (devTestLabVmDetachDataDiskContent == null) { - case "J": - { - using JsonDocument document = JsonDocument.Parse(data, ModelSerializationExtensions.JsonDocumentOptions); - return DeserializeDevTestLabVmDetachDataDiskContent(document.RootElement, options); - } - default: - throw new FormatException($"The model {nameof(DevTestLabVmDetachDataDiskContent)} does not support reading '{options.Format}' format."); + return null; } + Utf8JsonRequestContent content = new Utf8JsonRequestContent(); + content.JsonWriter.WriteObjectValue(devTestLabVmDetachDataDiskContent, ModelSerializationExtensions.WireOptions); + return content; } - - string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; } } diff --git a/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/Models/DevTestLabVmDetachDataDiskContent.cs b/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/Models/DevTestLabVmDetachDataDiskContent.cs index f7b404950e84..1c0ca263d67d 100644 --- a/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/Models/DevTestLabVmDetachDataDiskContent.cs +++ b/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/Models/DevTestLabVmDetachDataDiskContent.cs @@ -14,37 +14,8 @@ namespace Azure.ResourceManager.DevTestLabs.Models /// Request body for detaching data disk from a virtual machine. public partial class DevTestLabVmDetachDataDiskContent { - /// - /// 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 DevTestLabVmDetachDataDiskContent() @@ -53,11 +24,11 @@ public DevTestLabVmDetachDataDiskContent() /// Initializes a new instance of . /// Specifies the disk resource ID to detach from virtual machine. - /// Keeps track of any properties unknown to the library. - internal DevTestLabVmDetachDataDiskContent(ResourceIdentifier existingLabDiskId, IDictionary serializedAdditionalRawData) + /// Keeps track of any properties unknown to the library. + internal DevTestLabVmDetachDataDiskContent(ResourceIdentifier existingLabDiskId, IDictionary additionalBinaryDataProperties) { ExistingLabDiskId = existingLabDiskId; - _serializedAdditionalRawData = serializedAdditionalRawData; + _additionalBinaryDataProperties = additionalBinaryDataProperties; } /// Specifies the disk resource ID to detach from virtual machine. diff --git a/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/Models/DevTestLabVmPatch.Serialization.cs b/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/Models/DevTestLabVmPatch.Serialization.cs index 1e528ded1f4d..f4268d6fe4dc 100644 --- a/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/Models/DevTestLabVmPatch.Serialization.cs +++ b/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/Models/DevTestLabVmPatch.Serialization.cs @@ -10,13 +10,32 @@ using System.Collections.Generic; using System.Text.Json; using Azure.Core; +using Azure.ResourceManager.DevTestLabs; namespace Azure.ResourceManager.DevTestLabs.Models { - public partial class DevTestLabVmPatch : IUtf8JsonSerializable, IJsonModel + /// A virtual machine. + public partial class DevTestLabVmPatch : DevTestLabResourcePatch, IJsonModel { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + /// The data to parse. + /// The client options for reading and writing models. + protected override DevTestLabResourcePatch 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 DeserializeDevTestLabVmPatch(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(DevTestLabVmPatch)} does not support reading '{options.Format}' format."); + } + } + /// The JSON writer. + /// The client options for reading and writing models. void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) { writer.WriteStartObject(); @@ -28,67 +47,79 @@ void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWrite /// 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(DevTestLabVmPatch)} does not support writing '{format}' format."); } - base.JsonModelWriteCore(writer, options); } - DevTestLabVmPatch IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + /// The JSON reader. + /// The client options for reading and writing models. + DevTestLabVmPatch IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) => (DevTestLabVmPatch)JsonModelCreateCore(ref reader, options); + + /// The JSON reader. + /// The client options for reading and writing models. + protected override DevTestLabResourcePatch 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(DevTestLabVmPatch)} does not support reading '{format}' format."); } - using JsonDocument document = JsonDocument.ParseValue(ref reader); return DeserializeDevTestLabVmPatch(document.RootElement, options); } - internal static DevTestLabVmPatch DeserializeDevTestLabVmPatch(JsonElement element, ModelReaderWriterOptions options = null) + /// The JSON element to deserialize. + /// The client options for reading and writing models. + internal static DevTestLabVmPatch DeserializeDevTestLabVmPatch(JsonElement element, ModelReaderWriterOptions options) { - options ??= ModelSerializationExtensions.WireOptions; - if (element.ValueKind == JsonValueKind.Null) { return null; } IDictionary tags = 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("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 (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 DevTestLabVmPatch(tags ?? new ChangeTrackingDictionary(), serializedAdditionalRawData); + return new DevTestLabVmPatch(tags ?? new ChangeTrackingDictionary(), 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 override BinaryData PersistableModelWriteCore(ModelReaderWriterOptions options) + { + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; switch (format) { case "J": @@ -98,22 +129,23 @@ BinaryData IPersistableModel.Write(ModelReaderWriterOptions o } } - DevTestLabVmPatch 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. + DevTestLabVmPatch IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) => (DevTestLabVmPatch)PersistableModelCreateCore(data, options); - switch (format) + /// The client options for reading and writing models. + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + + /// The to serialize into . + internal static RequestContent ToRequestContent(DevTestLabVmPatch devTestLabVmPatch) + { + if (devTestLabVmPatch == null) { - case "J": - { - using JsonDocument document = JsonDocument.Parse(data, ModelSerializationExtensions.JsonDocumentOptions); - return DeserializeDevTestLabVmPatch(document.RootElement, options); - } - default: - throw new FormatException($"The model {nameof(DevTestLabVmPatch)} does not support reading '{options.Format}' format."); + return null; } + Utf8JsonRequestContent content = new Utf8JsonRequestContent(); + content.JsonWriter.WriteObjectValue(devTestLabVmPatch, ModelSerializationExtensions.WireOptions); + return content; } - - string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; } } diff --git a/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/Models/DevTestLabVmPatch.cs b/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/Models/DevTestLabVmPatch.cs index eceb8a2921fc..cccd7ab81392 100644 --- a/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/Models/DevTestLabVmPatch.cs +++ b/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/Models/DevTestLabVmPatch.cs @@ -20,8 +20,8 @@ public DevTestLabVmPatch() /// Initializes a new instance of . /// The tags of the resource. - /// Keeps track of any properties unknown to the library. - internal DevTestLabVmPatch(IDictionary tags, IDictionary serializedAdditionalRawData) : base(tags, serializedAdditionalRawData) + /// Keeps track of any properties unknown to the library. + internal DevTestLabVmPatch(IDictionary tags, IDictionary additionalBinaryDataProperties) : base(tags, additionalBinaryDataProperties) { } } diff --git a/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/Models/DevTestLabVmResizeContent.Serialization.cs b/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/Models/DevTestLabVmResizeContent.Serialization.cs index c35392ed7638..aa1b56405673 100644 --- a/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/Models/DevTestLabVmResizeContent.Serialization.cs +++ b/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/Models/DevTestLabVmResizeContent.Serialization.cs @@ -10,13 +10,32 @@ using System.Collections.Generic; using System.Text.Json; using Azure.Core; +using Azure.ResourceManager.DevTestLabs; namespace Azure.ResourceManager.DevTestLabs.Models { - public partial class DevTestLabVmResizeContent : IUtf8JsonSerializable, IJsonModel + /// Request body for resizing a virtual machine. + public partial class DevTestLabVmResizeContent : IJsonModel { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + /// The data to parse. + /// The client options for reading and writing models. + protected virtual DevTestLabVmResizeContent 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 DeserializeDevTestLabVmResizeContent(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(DevTestLabVmResizeContent)} does not support reading '{options.Format}' format."); + } + } + /// The JSON writer. + /// The client options for reading and writing models. void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) { writer.WriteStartObject(); @@ -28,26 +47,25 @@ void IJsonModel.Write(Utf8JsonWriter writer, ModelRea /// 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(DevTestLabVmResizeContent)} does not support writing '{format}' format."); } - if (Optional.IsDefined(Size)) { writer.WritePropertyName("size"u8); writer.WriteStringValue(Size); } - 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); } @@ -56,49 +74,55 @@ protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWrit } } - DevTestLabVmResizeContent IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + /// The JSON reader. + /// The client options for reading and writing models. + DevTestLabVmResizeContent IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) => JsonModelCreateCore(ref reader, options); + + /// The JSON reader. + /// The client options for reading and writing models. + protected virtual DevTestLabVmResizeContent 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(DevTestLabVmResizeContent)} does not support reading '{format}' format."); } - using JsonDocument document = JsonDocument.ParseValue(ref reader); return DeserializeDevTestLabVmResizeContent(document.RootElement, options); } - internal static DevTestLabVmResizeContent DeserializeDevTestLabVmResizeContent(JsonElement element, ModelReaderWriterOptions options = null) + /// The JSON element to deserialize. + /// The client options for reading and writing models. + internal static DevTestLabVmResizeContent DeserializeDevTestLabVmResizeContent(JsonElement element, ModelReaderWriterOptions options) { - options ??= ModelSerializationExtensions.WireOptions; - if (element.ValueKind == JsonValueKind.Null) { return null; } string size = 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("size"u8)) + if (prop.NameEquals("size"u8)) { - size = property.Value.GetString(); + size = 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 DevTestLabVmResizeContent(size, serializedAdditionalRawData); + return new DevTestLabVmResizeContent(size, 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": @@ -108,22 +132,23 @@ BinaryData IPersistableModel.Write(ModelReaderWriterO } } - DevTestLabVmResizeContent 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. + DevTestLabVmResizeContent IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) => PersistableModelCreateCore(data, options); - switch (format) + /// The client options for reading and writing models. + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + + /// The to serialize into . + internal static RequestContent ToRequestContent(DevTestLabVmResizeContent devTestLabVmResizeContent) + { + if (devTestLabVmResizeContent == null) { - case "J": - { - using JsonDocument document = JsonDocument.Parse(data, ModelSerializationExtensions.JsonDocumentOptions); - return DeserializeDevTestLabVmResizeContent(document.RootElement, options); - } - default: - throw new FormatException($"The model {nameof(DevTestLabVmResizeContent)} does not support reading '{options.Format}' format."); + return null; } + Utf8JsonRequestContent content = new Utf8JsonRequestContent(); + content.JsonWriter.WriteObjectValue(devTestLabVmResizeContent, ModelSerializationExtensions.WireOptions); + return content; } - - string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; } } diff --git a/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/Models/DevTestLabVmResizeContent.cs b/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/Models/DevTestLabVmResizeContent.cs index 6b7d5072639b..88c7f6ce3db6 100644 --- a/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/Models/DevTestLabVmResizeContent.cs +++ b/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/Models/DevTestLabVmResizeContent.cs @@ -13,37 +13,8 @@ namespace Azure.ResourceManager.DevTestLabs.Models /// Request body for resizing a virtual machine. public partial class DevTestLabVmResizeContent { - /// - /// 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 DevTestLabVmResizeContent() @@ -52,11 +23,11 @@ public DevTestLabVmResizeContent() /// Initializes a new instance of . /// Specifies the size of the virtual machine. - /// Keeps track of any properties unknown to the library. - internal DevTestLabVmResizeContent(string size, IDictionary serializedAdditionalRawData) + /// Keeps track of any properties unknown to the library. + internal DevTestLabVmResizeContent(string size, IDictionary additionalBinaryDataProperties) { Size = size; - _serializedAdditionalRawData = serializedAdditionalRawData; + _additionalBinaryDataProperties = additionalBinaryDataProperties; } /// Specifies the size of the virtual machine. diff --git a/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/Models/DevTestLabWeekDetails.Serialization.cs b/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/Models/DevTestLabWeekDetails.Serialization.cs index 69affc956f45..fca221904c97 100644 --- a/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/Models/DevTestLabWeekDetails.Serialization.cs +++ b/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/Models/DevTestLabWeekDetails.Serialization.cs @@ -9,14 +9,32 @@ using System.ClientModel.Primitives; using System.Collections.Generic; using System.Text.Json; -using Azure.Core; +using Azure.ResourceManager.DevTestLabs; namespace Azure.ResourceManager.DevTestLabs.Models { - public partial class DevTestLabWeekDetails : IUtf8JsonSerializable, IJsonModel + /// Properties of a weekly schedule. + public partial class DevTestLabWeekDetails : IJsonModel { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + /// The data to parse. + /// The client options for reading and writing models. + protected virtual DevTestLabWeekDetails 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 DeserializeDevTestLabWeekDetails(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(DevTestLabWeekDetails)} does not support reading '{options.Format}' format."); + } + } + /// The JSON writer. + /// The client options for reading and writing models. void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) { writer.WriteStartObject(); @@ -28,18 +46,22 @@ void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderW /// 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(DevTestLabWeekDetails)} does not support writing '{format}' format."); } - if (Optional.IsCollectionDefined(Weekdays)) { writer.WritePropertyName("weekdays"u8); writer.WriteStartArray(); - foreach (var item in Weekdays) + foreach (string item in Weekdays) { + if (item == null) + { + writer.WriteNullValue(); + continue; + } writer.WriteStringValue(item); } writer.WriteEndArray(); @@ -49,15 +71,15 @@ protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWrit writer.WritePropertyName("time"u8); writer.WriteStringValue(Time); } - 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,64 +88,77 @@ protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWrit } } - DevTestLabWeekDetails IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + /// The JSON reader. + /// The client options for reading and writing models. + DevTestLabWeekDetails IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) => JsonModelCreateCore(ref reader, options); + + /// The JSON reader. + /// The client options for reading and writing models. + protected virtual DevTestLabWeekDetails 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(DevTestLabWeekDetails)} does not support reading '{format}' format."); } - using JsonDocument document = JsonDocument.ParseValue(ref reader); return DeserializeDevTestLabWeekDetails(document.RootElement, options); } - internal static DevTestLabWeekDetails DeserializeDevTestLabWeekDetails(JsonElement element, ModelReaderWriterOptions options = null) + /// The JSON element to deserialize. + /// The client options for reading and writing models. + internal static DevTestLabWeekDetails DeserializeDevTestLabWeekDetails(JsonElement element, ModelReaderWriterOptions options) { - options ??= ModelSerializationExtensions.WireOptions; - if (element.ValueKind == JsonValueKind.Null) { return null; } IList weekdays = default; string time = 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("weekdays"u8)) + if (prop.NameEquals("weekdays"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()); + } } weekdays = array; continue; } - if (property.NameEquals("time"u8)) + if (prop.NameEquals("time"u8)) { - time = property.Value.GetString(); + time = 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 DevTestLabWeekDetails(weekdays ?? new ChangeTrackingList(), time, serializedAdditionalRawData); + return new DevTestLabWeekDetails(weekdays ?? new ChangeTrackingList(), time, 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": @@ -133,22 +168,11 @@ BinaryData IPersistableModel.Write(ModelReaderWriterOptio } } - DevTestLabWeekDetails 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 DeserializeDevTestLabWeekDetails(document.RootElement, options); - } - default: - throw new FormatException($"The model {nameof(DevTestLabWeekDetails)} does not support reading '{options.Format}' format."); - } - } + /// The data to parse. + /// The client options for reading and writing models. + DevTestLabWeekDetails IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) => PersistableModelCreateCore(data, options); + /// The client options for reading and writing models. string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; } } diff --git a/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/Models/DevTestLabWeekDetails.cs b/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/Models/DevTestLabWeekDetails.cs index 836d7c0687ad..44682f8b66bc 100644 --- a/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/Models/DevTestLabWeekDetails.cs +++ b/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/Models/DevTestLabWeekDetails.cs @@ -7,43 +7,15 @@ using System; using System.Collections.Generic; +using Azure.ResourceManager.DevTestLabs; namespace Azure.ResourceManager.DevTestLabs.Models { /// Properties of a weekly schedule. public partial class DevTestLabWeekDetails { - /// - /// 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 DevTestLabWeekDetails() @@ -54,16 +26,17 @@ public DevTestLabWeekDetails() /// Initializes a new instance of . /// The days of the week for which the schedule is set (e.g. Sunday, Monday, Tuesday, etc.). /// The time of the day the schedule will occur. - /// Keeps track of any properties unknown to the library. - internal DevTestLabWeekDetails(IList weekdays, string time, IDictionary serializedAdditionalRawData) + /// Keeps track of any properties unknown to the library. + internal DevTestLabWeekDetails(IList weekdays, string time, IDictionary additionalBinaryDataProperties) { Weekdays = weekdays; Time = time; - _serializedAdditionalRawData = serializedAdditionalRawData; + _additionalBinaryDataProperties = additionalBinaryDataProperties; } /// The days of the week for which the schedule is set (e.g. Sunday, Monday, Tuesday, etc.). public IList Weekdays { get; } + /// The time of the day the schedule will occur. public string Time { get; set; } } diff --git a/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/Models/DevTestLabWindowsOSInfo.Serialization.cs b/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/Models/DevTestLabWindowsOSInfo.Serialization.cs new file mode 100644 index 000000000000..137a470369f4 --- /dev/null +++ b/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/Models/DevTestLabWindowsOSInfo.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.DevTestLabs; + +namespace Azure.ResourceManager.DevTestLabs.Models +{ + /// Information about a Windows OS. + internal partial class DevTestLabWindowsOSInfo : IJsonModel + { + /// The data to parse. + /// The client options for reading and writing models. + protected virtual DevTestLabWindowsOSInfo 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 DeserializeDevTestLabWindowsOSInfo(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(DevTestLabWindowsOSInfo)} does not support reading '{options.Format}' format."); + } + } + + /// 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(DevTestLabWindowsOSInfo)} does not support writing '{format}' format."); + } + if (Optional.IsDefined(WindowsOSState)) + { + writer.WritePropertyName("windowsOsState"u8); + writer.WriteStringValue(WindowsOSState.Value.ToString()); + } + 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. + DevTestLabWindowsOSInfo IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) => JsonModelCreateCore(ref reader, options); + + /// The JSON reader. + /// The client options for reading and writing models. + protected virtual DevTestLabWindowsOSInfo 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(DevTestLabWindowsOSInfo)} does not support reading '{format}' format."); + } + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeDevTestLabWindowsOSInfo(document.RootElement, options); + } + + /// The JSON element to deserialize. + /// The client options for reading and writing models. + internal static DevTestLabWindowsOSInfo DeserializeDevTestLabWindowsOSInfo(JsonElement element, ModelReaderWriterOptions options) + { + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + WindowsOSState? windowsOSState = default; + IDictionary additionalBinaryDataProperties = new ChangeTrackingDictionary(); + foreach (var prop in element.EnumerateObject()) + { + if (prop.NameEquals("windowsOsState"u8)) + { + if (prop.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + windowsOSState = new WindowsOSState(prop.Value.GetString()); + continue; + } + if (options.Format != "W") + { + additionalBinaryDataProperties.Add(prop.Name, BinaryData.FromString(prop.Value.GetRawText())); + } + } + return new DevTestLabWindowsOSInfo(windowsOSState, 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, AzureResourceManagerDevTestLabsContext.Default); + default: + throw new FormatException($"The model {nameof(DevTestLabWindowsOSInfo)} does not support writing '{options.Format}' format."); + } + } + + /// The data to parse. + /// The client options for reading and writing models. + DevTestLabWindowsOSInfo IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) => PersistableModelCreateCore(data, options); + + /// The client options for reading and writing models. + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + } +} diff --git a/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/Models/DevTestLabWindowsOSInfo.cs b/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/Models/DevTestLabWindowsOSInfo.cs new file mode 100644 index 000000000000..e0baed88e113 --- /dev/null +++ b/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/Models/DevTestLabWindowsOSInfo.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.DevTestLabs.Models +{ + /// Information about a Windows OS. + internal partial class DevTestLabWindowsOSInfo + { + /// Keeps track of any properties unknown to the library. + private protected readonly IDictionary _additionalBinaryDataProperties; + + /// Initializes a new instance of . + public DevTestLabWindowsOSInfo() + { + } + + /// Initializes a new instance of . + /// The state of the Windows OS (i.e. NonSysprepped, SysprepRequested, SysprepApplied). + /// Keeps track of any properties unknown to the library. + internal DevTestLabWindowsOSInfo(WindowsOSState? windowsOSState, IDictionary additionalBinaryDataProperties) + { + WindowsOSState = windowsOSState; + _additionalBinaryDataProperties = additionalBinaryDataProperties; + } + + /// The state of the Windows OS (i.e. NonSysprepped, SysprepRequested, SysprepApplied). + public WindowsOSState? WindowsOSState { get; set; } + } +} diff --git a/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/Models/DiskList.Serialization.cs b/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/Models/DiskList.Serialization.cs index efaee3feedc6..cd1e46e43471 100644 --- a/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/Models/DiskList.Serialization.cs +++ b/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/Models/DiskList.Serialization.cs @@ -9,14 +9,45 @@ using System.ClientModel.Primitives; using System.Collections.Generic; using System.Text.Json; -using Azure.Core; +using Azure; +using Azure.ResourceManager.DevTestLabs; namespace Azure.ResourceManager.DevTestLabs.Models { - internal partial class DiskList : IUtf8JsonSerializable, IJsonModel + /// The response of a list operation. + internal partial class DiskList : IJsonModel { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + /// Initializes a new instance of for deserialization. + internal DiskList() + { + } + /// The data to parse. + /// The client options for reading and writing models. + protected virtual DiskList 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 DeserializeDiskList(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(DiskList)} does not support reading '{options.Format}' format."); + } + } + + /// The to deserialize the from. + internal static DiskList FromResponse(Response response) + { + using JsonDocument document = JsonDocument.Parse(response.Content, ModelSerializationExtensions.JsonDocumentOptions); + return DeserializeDiskList(document.RootElement, ModelSerializationExtensions.WireOptions); + } + + /// The JSON writer. + /// The client options for reading and writing models. void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) { writer.WriteStartObject(); @@ -28,36 +59,32 @@ void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions /// 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(DiskList)} does not support writing '{format}' format."); } - - if (Optional.IsCollectionDefined(Value)) + writer.WritePropertyName("value"u8); + writer.WriteStartArray(); + foreach (DevTestLabDiskData item in Value) { - writer.WritePropertyName("value"u8); - writer.WriteStartArray(); - foreach (var item in Value) - { - writer.WriteObjectValue(item, options); - } - writer.WriteEndArray(); + writer.WriteObjectValue(item, options); } + writer.WriteEndArray(); if (Optional.IsDefined(NextLink)) { writer.WritePropertyName("nextLink"u8); - writer.WriteStringValue(NextLink); + 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); } @@ -66,64 +93,70 @@ protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWrit } } - DiskList IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + /// The JSON reader. + /// The client options for reading and writing models. + DiskList IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) => JsonModelCreateCore(ref reader, options); + + /// The JSON reader. + /// The client options for reading and writing models. + protected virtual DiskList 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(DiskList)} does not support reading '{format}' format."); } - using JsonDocument document = JsonDocument.ParseValue(ref reader); return DeserializeDiskList(document.RootElement, options); } - internal static DiskList DeserializeDiskList(JsonElement element, ModelReaderWriterOptions options = null) + /// The JSON element to deserialize. + /// The client options for reading and writing models. + internal static DiskList DeserializeDiskList(JsonElement element, ModelReaderWriterOptions options) { - options ??= ModelSerializationExtensions.WireOptions; - if (element.ValueKind == JsonValueKind.Null) { return null; } - IReadOnlyList value = default; - string nextLink = default; - IDictionary serializedAdditionalRawData = default; - Dictionary rawDataDictionary = new Dictionary(); - foreach (var property in element.EnumerateObject()) + IList value = default; + Uri nextLink = default; + IDictionary additionalBinaryDataProperties = new ChangeTrackingDictionary(); + foreach (var prop in element.EnumerateObject()) { - if (property.NameEquals("value"u8)) + if (prop.NameEquals("value"u8)) { - if (property.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(DevTestLabDiskData.DeserializeDevTestLabDiskData(item, options)); } value = array; continue; } - if (property.NameEquals("nextLink"u8)) + if (prop.NameEquals("nextLink"u8)) { - nextLink = property.Value.GetString(); + if (prop.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + nextLink = string.IsNullOrEmpty(prop.Value.GetString()) ? null : 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 DiskList(value ?? new ChangeTrackingList(), nextLink, serializedAdditionalRawData); + return new DiskList(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": @@ -133,22 +166,11 @@ BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) } } - DiskList 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 DeserializeDiskList(document.RootElement, options); - } - default: - throw new FormatException($"The model {nameof(DiskList)} does not support reading '{options.Format}' format."); - } - } + /// The data to parse. + /// The client options for reading and writing models. + DiskList IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) => PersistableModelCreateCore(data, options); + /// The client options for reading and writing models. string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; } } diff --git a/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/Models/DiskList.cs b/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/Models/DiskList.cs index 8a76ceac4dbd..e74e15d6582f 100644 --- a/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/Models/DiskList.cs +++ b/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/Models/DiskList.cs @@ -7,64 +7,39 @@ using System; using System.Collections.Generic; +using System.Linq; +using Azure.ResourceManager.DevTestLabs; namespace Azure.ResourceManager.DevTestLabs.Models { /// The response of a list operation. internal partial class DiskList { - /// - /// 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 DiskList() + /// The Disk items on this page. + internal DiskList(IEnumerable value) { - Value = new ChangeTrackingList(); + Value = value.ToList(); } /// Initializes a new instance of . - /// Results of the list operation. - /// Link for next set of results. - /// Keeps track of any properties unknown to the library. - internal DiskList(IReadOnlyList value, string nextLink, IDictionary serializedAdditionalRawData) + /// The Disk items on this page. + /// The link to the next page of items. + /// Keeps track of any properties unknown to the library. + internal DiskList(IList value, Uri nextLink, IDictionary additionalBinaryDataProperties) { Value = value; NextLink = nextLink; - _serializedAdditionalRawData = serializedAdditionalRawData; + _additionalBinaryDataProperties = additionalBinaryDataProperties; } - /// Results of the list operation. - public IReadOnlyList Value { get; } - /// Link for next set of results. - public string NextLink { get; } + /// The Disk items on this page. + public IList Value { get; } + + /// The link to the next page of items. + public Uri NextLink { get; } } } diff --git a/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/Models/DiskProperties.Serialization.cs b/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/Models/DiskProperties.Serialization.cs new file mode 100644 index 000000000000..65bd30b07e8a --- /dev/null +++ b/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/Models/DiskProperties.Serialization.cs @@ -0,0 +1,292 @@ +// 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.DevTestLabs; + +namespace Azure.ResourceManager.DevTestLabs.Models +{ + /// Properties of a disk. + internal partial class DiskProperties : IJsonModel + { + /// The data to parse. + /// The client options for reading and writing models. + protected virtual DiskProperties 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 DeserializeDiskProperties(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(DiskProperties)} does not support reading '{options.Format}' format."); + } + } + + /// 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(DiskProperties)} does not support writing '{format}' format."); + } + if (Optional.IsDefined(DiskType)) + { + writer.WritePropertyName("diskType"u8); + writer.WriteStringValue(DiskType.Value.ToString()); + } + if (Optional.IsDefined(DiskSizeGiB)) + { + writer.WritePropertyName("diskSizeGiB"u8); + writer.WriteNumberValue(DiskSizeGiB.Value); + } + if (Optional.IsDefined(LeasedByLabVmId)) + { + writer.WritePropertyName("leasedByLabVmId"u8); + writer.WriteStringValue(LeasedByLabVmId); + } + if (Optional.IsDefined(DiskBlobName)) + { + writer.WritePropertyName("diskBlobName"u8); + writer.WriteStringValue(DiskBlobName); + } + if (Optional.IsDefined(DiskUri)) + { + writer.WritePropertyName("diskUri"u8); + writer.WriteStringValue(DiskUri.AbsoluteUri); + } + if (Optional.IsDefined(StorageAccountId)) + { + writer.WritePropertyName("storageAccountId"u8); + writer.WriteStringValue(StorageAccountId); + } + if (options.Format != "W" && Optional.IsDefined(CreatedOn)) + { + writer.WritePropertyName("createdDate"u8); + writer.WriteStringValue(CreatedOn.Value, "O"); + } + if (Optional.IsDefined(HostCaching)) + { + writer.WritePropertyName("hostCaching"u8); + writer.WriteStringValue(HostCaching); + } + if (Optional.IsDefined(ManagedDiskId)) + { + writer.WritePropertyName("managedDiskId"u8); + writer.WriteStringValue(ManagedDiskId); + } + if (options.Format != "W" && Optional.IsDefined(ProvisioningState)) + { + writer.WritePropertyName("provisioningState"u8); + writer.WriteStringValue(ProvisioningState); + } + if (options.Format != "W" && Optional.IsDefined(UniqueIdentifier)) + { + writer.WritePropertyName("uniqueIdentifier"u8); + writer.WriteStringValue(UniqueIdentifier.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. + DiskProperties IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) => JsonModelCreateCore(ref reader, options); + + /// The JSON reader. + /// The client options for reading and writing models. + protected virtual DiskProperties 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(DiskProperties)} does not support reading '{format}' format."); + } + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeDiskProperties(document.RootElement, options); + } + + /// The JSON element to deserialize. + /// The client options for reading and writing models. + internal static DiskProperties DeserializeDiskProperties(JsonElement element, ModelReaderWriterOptions options) + { + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + DevTestLabStorageType? diskType = default; + int? diskSizeGiB = default; + ResourceIdentifier leasedByLabVmId = default; + string diskBlobName = default; + Uri diskUri = default; + string storageAccountId = default; + DateTimeOffset? createdOn = default; + string hostCaching = default; + ResourceIdentifier managedDiskId = default; + string provisioningState = default; + Guid? uniqueIdentifier = default; + IDictionary additionalBinaryDataProperties = new ChangeTrackingDictionary(); + foreach (var prop in element.EnumerateObject()) + { + if (prop.NameEquals("diskType"u8)) + { + if (prop.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + diskType = new DevTestLabStorageType(prop.Value.GetString()); + continue; + } + if (prop.NameEquals("diskSizeGiB"u8)) + { + if (prop.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + diskSizeGiB = prop.Value.GetInt32(); + continue; + } + if (prop.NameEquals("leasedByLabVmId"u8)) + { + if (prop.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + leasedByLabVmId = new ResourceIdentifier(prop.Value.GetString()); + continue; + } + if (prop.NameEquals("diskBlobName"u8)) + { + diskBlobName = prop.Value.GetString(); + continue; + } + if (prop.NameEquals("diskUri"u8)) + { + if (prop.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + diskUri = string.IsNullOrEmpty(prop.Value.GetString()) ? null : new Uri(prop.Value.GetString()); + continue; + } + if (prop.NameEquals("storageAccountId"u8)) + { + storageAccountId = prop.Value.GetString(); + continue; + } + if (prop.NameEquals("createdDate"u8)) + { + if (prop.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + createdOn = prop.Value.GetDateTimeOffset("O"); + continue; + } + if (prop.NameEquals("hostCaching"u8)) + { + hostCaching = prop.Value.GetString(); + continue; + } + if (prop.NameEquals("managedDiskId"u8)) + { + if (prop.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + managedDiskId = new ResourceIdentifier(prop.Value.GetString()); + continue; + } + if (prop.NameEquals("provisioningState"u8)) + { + provisioningState = prop.Value.GetString(); + continue; + } + if (prop.NameEquals("uniqueIdentifier"u8)) + { + if (prop.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + uniqueIdentifier = new Guid(prop.Value.GetString()); + continue; + } + if (options.Format != "W") + { + additionalBinaryDataProperties.Add(prop.Name, BinaryData.FromString(prop.Value.GetRawText())); + } + } + return new DiskProperties( + diskType, + diskSizeGiB, + leasedByLabVmId, + diskBlobName, + diskUri, + storageAccountId, + createdOn, + hostCaching, + managedDiskId, + provisioningState, + uniqueIdentifier, + 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, AzureResourceManagerDevTestLabsContext.Default); + default: + throw new FormatException($"The model {nameof(DiskProperties)} does not support writing '{options.Format}' format."); + } + } + + /// The data to parse. + /// The client options for reading and writing models. + DiskProperties IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) => PersistableModelCreateCore(data, options); + + /// The client options for reading and writing models. + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + } +} diff --git a/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/Models/DiskProperties.cs b/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/Models/DiskProperties.cs new file mode 100644 index 000000000000..70f21522ab03 --- /dev/null +++ b/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/Models/DiskProperties.cs @@ -0,0 +1,87 @@ +// 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.DevTestLabs.Models +{ + /// Properties of a disk. + internal partial class DiskProperties + { + /// Keeps track of any properties unknown to the library. + private protected readonly IDictionary _additionalBinaryDataProperties; + + /// Initializes a new instance of . + public DiskProperties() + { + } + + /// Initializes a new instance of . + /// The storage type for the disk (i.e. Standard, Premium). + /// The size of the disk in Gibibytes. + /// The resource ID of the VM to which this disk is leased. + /// When backed by a blob, the name of the VHD blob without extension. + /// When backed by a blob, the URI of underlying blob. + /// When backed by a blob, the storage account where the blob is. + /// The creation date of the disk. + /// The host caching policy of the disk (i.e. None, ReadOnly, ReadWrite). + /// When backed by managed disk, this is the ID of the compute disk resource. + /// The provisioning status of the resource. + /// The unique immutable identifier of a resource (Guid). + /// Keeps track of any properties unknown to the library. + internal DiskProperties(DevTestLabStorageType? diskType, int? diskSizeGiB, ResourceIdentifier leasedByLabVmId, string diskBlobName, Uri diskUri, string storageAccountId, DateTimeOffset? createdOn, string hostCaching, ResourceIdentifier managedDiskId, string provisioningState, Guid? uniqueIdentifier, IDictionary additionalBinaryDataProperties) + { + DiskType = diskType; + DiskSizeGiB = diskSizeGiB; + LeasedByLabVmId = leasedByLabVmId; + DiskBlobName = diskBlobName; + DiskUri = diskUri; + StorageAccountId = storageAccountId; + CreatedOn = createdOn; + HostCaching = hostCaching; + ManagedDiskId = managedDiskId; + ProvisioningState = provisioningState; + UniqueIdentifier = uniqueIdentifier; + _additionalBinaryDataProperties = additionalBinaryDataProperties; + } + + /// The storage type for the disk (i.e. Standard, Premium). + public DevTestLabStorageType? DiskType { get; set; } + + /// The size of the disk in Gibibytes. + public int? DiskSizeGiB { get; set; } + + /// The resource ID of the VM to which this disk is leased. + public ResourceIdentifier LeasedByLabVmId { get; set; } + + /// When backed by a blob, the name of the VHD blob without extension. + public string DiskBlobName { get; set; } + + /// When backed by a blob, the URI of underlying blob. + public Uri DiskUri { get; set; } + + /// When backed by a blob, the storage account where the blob is. + public string StorageAccountId { get; set; } + + /// The creation date of the disk. + public DateTimeOffset? CreatedOn { get; } + + /// The host caching policy of the disk (i.e. None, ReadOnly, ReadWrite). + public string HostCaching { get; set; } + + /// When backed by managed disk, this is the ID of the compute disk resource. + public ResourceIdentifier ManagedDiskId { get; set; } + + /// The provisioning status of the resource. + public string ProvisioningState { get; } + + /// The unique immutable identifier of a resource (Guid). + public Guid? UniqueIdentifier { get; } + } +} diff --git a/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/Models/DtlEnvironmentList.Serialization.cs b/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/Models/DtlEnvironmentList.Serialization.cs index 160543fdfbb0..7075360dc273 100644 --- a/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/Models/DtlEnvironmentList.Serialization.cs +++ b/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/Models/DtlEnvironmentList.Serialization.cs @@ -9,14 +9,45 @@ using System.ClientModel.Primitives; using System.Collections.Generic; using System.Text.Json; -using Azure.Core; +using Azure; +using Azure.ResourceManager.DevTestLabs; namespace Azure.ResourceManager.DevTestLabs.Models { - internal partial class DtlEnvironmentList : IUtf8JsonSerializable, IJsonModel + /// The response of a list operation. + internal partial class DtlEnvironmentList : IJsonModel { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + /// Initializes a new instance of for deserialization. + internal DtlEnvironmentList() + { + } + /// The data to parse. + /// The client options for reading and writing models. + protected virtual DtlEnvironmentList 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 DeserializeDtlEnvironmentList(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(DtlEnvironmentList)} does not support reading '{options.Format}' format."); + } + } + + /// The to deserialize the from. + internal static DtlEnvironmentList FromResponse(Response response) + { + using JsonDocument document = JsonDocument.Parse(response.Content, ModelSerializationExtensions.JsonDocumentOptions); + return DeserializeDtlEnvironmentList(document.RootElement, ModelSerializationExtensions.WireOptions); + } + + /// The JSON writer. + /// The client options for reading and writing models. void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) { writer.WriteStartObject(); @@ -28,36 +59,32 @@ void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWrit /// 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(DtlEnvironmentList)} does not support writing '{format}' format."); } - - if (Optional.IsCollectionDefined(Value)) + writer.WritePropertyName("value"u8); + writer.WriteStartArray(); + foreach (DevTestLabEnvironmentData item in Value) { - writer.WritePropertyName("value"u8); - writer.WriteStartArray(); - foreach (var item in Value) - { - writer.WriteObjectValue(item, options); - } - writer.WriteEndArray(); + writer.WriteObjectValue(item, options); } + writer.WriteEndArray(); if (Optional.IsDefined(NextLink)) { writer.WritePropertyName("nextLink"u8); - writer.WriteStringValue(NextLink); + 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); } @@ -66,64 +93,70 @@ protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWrit } } - DtlEnvironmentList IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + /// The JSON reader. + /// The client options for reading and writing models. + DtlEnvironmentList IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) => JsonModelCreateCore(ref reader, options); + + /// The JSON reader. + /// The client options for reading and writing models. + protected virtual DtlEnvironmentList 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(DtlEnvironmentList)} does not support reading '{format}' format."); } - using JsonDocument document = JsonDocument.ParseValue(ref reader); return DeserializeDtlEnvironmentList(document.RootElement, options); } - internal static DtlEnvironmentList DeserializeDtlEnvironmentList(JsonElement element, ModelReaderWriterOptions options = null) + /// The JSON element to deserialize. + /// The client options for reading and writing models. + internal static DtlEnvironmentList DeserializeDtlEnvironmentList(JsonElement element, ModelReaderWriterOptions options) { - options ??= ModelSerializationExtensions.WireOptions; - if (element.ValueKind == JsonValueKind.Null) { return null; } - IReadOnlyList value = default; - string nextLink = default; - IDictionary serializedAdditionalRawData = default; - Dictionary rawDataDictionary = new Dictionary(); - foreach (var property in element.EnumerateObject()) + IList value = default; + Uri nextLink = default; + IDictionary additionalBinaryDataProperties = new ChangeTrackingDictionary(); + foreach (var prop in element.EnumerateObject()) { - if (property.NameEquals("value"u8)) + if (prop.NameEquals("value"u8)) { - if (property.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(DevTestLabEnvironmentData.DeserializeDevTestLabEnvironmentData(item, options)); } value = array; continue; } - if (property.NameEquals("nextLink"u8)) + if (prop.NameEquals("nextLink"u8)) { - nextLink = property.Value.GetString(); + if (prop.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + nextLink = string.IsNullOrEmpty(prop.Value.GetString()) ? null : 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 DtlEnvironmentList(value ?? new ChangeTrackingList(), nextLink, serializedAdditionalRawData); + return new DtlEnvironmentList(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": @@ -133,22 +166,11 @@ BinaryData IPersistableModel.Write(ModelReaderWriterOptions } } - DtlEnvironmentList 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 DeserializeDtlEnvironmentList(document.RootElement, options); - } - default: - throw new FormatException($"The model {nameof(DtlEnvironmentList)} does not support reading '{options.Format}' format."); - } - } + /// The data to parse. + /// The client options for reading and writing models. + DtlEnvironmentList IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) => PersistableModelCreateCore(data, options); + /// The client options for reading and writing models. string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; } } diff --git a/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/Models/DtlEnvironmentList.cs b/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/Models/DtlEnvironmentList.cs index d7d19eeac19c..a2dc48e99dd5 100644 --- a/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/Models/DtlEnvironmentList.cs +++ b/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/Models/DtlEnvironmentList.cs @@ -7,64 +7,39 @@ using System; using System.Collections.Generic; +using System.Linq; +using Azure.ResourceManager.DevTestLabs; namespace Azure.ResourceManager.DevTestLabs.Models { /// The response of a list operation. internal partial class DtlEnvironmentList { - /// - /// 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 DtlEnvironmentList() + /// The DtlEnvironment items on this page. + internal DtlEnvironmentList(IEnumerable value) { - Value = new ChangeTrackingList(); + Value = value.ToList(); } /// Initializes a new instance of . - /// Results of the list operation. - /// Link for next set of results. - /// Keeps track of any properties unknown to the library. - internal DtlEnvironmentList(IReadOnlyList value, string nextLink, IDictionary serializedAdditionalRawData) + /// The DtlEnvironment items on this page. + /// The link to the next page of items. + /// Keeps track of any properties unknown to the library. + internal DtlEnvironmentList(IList value, Uri nextLink, IDictionary additionalBinaryDataProperties) { Value = value; NextLink = nextLink; - _serializedAdditionalRawData = serializedAdditionalRawData; + _additionalBinaryDataProperties = additionalBinaryDataProperties; } - /// Results of the list operation. - public IReadOnlyList Value { get; } - /// Link for next set of results. - public string NextLink { get; } + /// The DtlEnvironment items on this page. + public IList Value { get; } + + /// The link to the next page of items. + public Uri NextLink { get; } } } diff --git a/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/Models/EnvironmentProperties.Serialization.cs b/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/Models/EnvironmentProperties.Serialization.cs new file mode 100644 index 000000000000..25a0ab628d93 --- /dev/null +++ b/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/Models/EnvironmentProperties.Serialization.cs @@ -0,0 +1,211 @@ +// 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.DevTestLabs; + +namespace Azure.ResourceManager.DevTestLabs.Models +{ + /// Properties of an environment. + internal partial class EnvironmentProperties : IJsonModel + { + /// The data to parse. + /// The client options for reading and writing models. + protected virtual EnvironmentProperties 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 DeserializeEnvironmentProperties(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(EnvironmentProperties)} does not support reading '{options.Format}' format."); + } + } + + /// 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(EnvironmentProperties)} does not support writing '{format}' format."); + } + if (Optional.IsDefined(DeploymentProperties)) + { + writer.WritePropertyName("deploymentProperties"u8); + writer.WriteObjectValue(DeploymentProperties, options); + } + if (Optional.IsDefined(ArmTemplateDisplayName)) + { + writer.WritePropertyName("armTemplateDisplayName"u8); + writer.WriteStringValue(ArmTemplateDisplayName); + } + if (options.Format != "W" && Optional.IsDefined(ResourceGroupId)) + { + writer.WritePropertyName("resourceGroupId"u8); + writer.WriteStringValue(ResourceGroupId); + } + if (options.Format != "W" && Optional.IsDefined(CreatedByUser)) + { + writer.WritePropertyName("createdByUser"u8); + writer.WriteStringValue(CreatedByUser); + } + if (options.Format != "W" && Optional.IsDefined(ProvisioningState)) + { + writer.WritePropertyName("provisioningState"u8); + writer.WriteStringValue(ProvisioningState); + } + if (options.Format != "W" && Optional.IsDefined(UniqueIdentifier)) + { + writer.WritePropertyName("uniqueIdentifier"u8); + writer.WriteStringValue(UniqueIdentifier.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. + EnvironmentProperties IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) => JsonModelCreateCore(ref reader, options); + + /// The JSON reader. + /// The client options for reading and writing models. + protected virtual EnvironmentProperties 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(EnvironmentProperties)} does not support reading '{format}' format."); + } + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeEnvironmentProperties(document.RootElement, options); + } + + /// The JSON element to deserialize. + /// The client options for reading and writing models. + internal static EnvironmentProperties DeserializeEnvironmentProperties(JsonElement element, ModelReaderWriterOptions options) + { + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + DevTestLabEnvironmentDeployment deploymentProperties = default; + string armTemplateDisplayName = default; + string resourceGroupId = default; + string createdByUser = default; + string provisioningState = default; + Guid? uniqueIdentifier = default; + IDictionary additionalBinaryDataProperties = new ChangeTrackingDictionary(); + foreach (var prop in element.EnumerateObject()) + { + if (prop.NameEquals("deploymentProperties"u8)) + { + if (prop.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + deploymentProperties = DevTestLabEnvironmentDeployment.DeserializeDevTestLabEnvironmentDeployment(prop.Value, options); + continue; + } + if (prop.NameEquals("armTemplateDisplayName"u8)) + { + armTemplateDisplayName = prop.Value.GetString(); + continue; + } + if (prop.NameEquals("resourceGroupId"u8)) + { + resourceGroupId = prop.Value.GetString(); + continue; + } + if (prop.NameEquals("createdByUser"u8)) + { + createdByUser = prop.Value.GetString(); + continue; + } + if (prop.NameEquals("provisioningState"u8)) + { + provisioningState = prop.Value.GetString(); + continue; + } + if (prop.NameEquals("uniqueIdentifier"u8)) + { + if (prop.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + uniqueIdentifier = new Guid(prop.Value.GetString()); + continue; + } + if (options.Format != "W") + { + additionalBinaryDataProperties.Add(prop.Name, BinaryData.FromString(prop.Value.GetRawText())); + } + } + return new EnvironmentProperties( + deploymentProperties, + armTemplateDisplayName, + resourceGroupId, + createdByUser, + provisioningState, + uniqueIdentifier, + 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, AzureResourceManagerDevTestLabsContext.Default); + default: + throw new FormatException($"The model {nameof(EnvironmentProperties)} does not support writing '{options.Format}' format."); + } + } + + /// The data to parse. + /// The client options for reading and writing models. + EnvironmentProperties IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) => PersistableModelCreateCore(data, options); + + /// The client options for reading and writing models. + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + } +} diff --git a/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/Models/EnvironmentProperties.cs b/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/Models/EnvironmentProperties.cs new file mode 100644 index 000000000000..dd54b2a42ecd --- /dev/null +++ b/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/Models/EnvironmentProperties.cs @@ -0,0 +1,61 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; + +namespace Azure.ResourceManager.DevTestLabs.Models +{ + /// Properties of an environment. + internal partial class EnvironmentProperties + { + /// Keeps track of any properties unknown to the library. + private protected readonly IDictionary _additionalBinaryDataProperties; + + /// Initializes a new instance of . + public EnvironmentProperties() + { + } + + /// Initializes a new instance of . + /// The deployment properties of the environment. + /// The display name of the Azure Resource Manager template that produced the environment. + /// The identifier of the resource group containing the environment's resources. + /// The creator of the environment. + /// The provisioning status of the resource. + /// The unique immutable identifier of a resource (Guid). + /// Keeps track of any properties unknown to the library. + internal EnvironmentProperties(DevTestLabEnvironmentDeployment deploymentProperties, string armTemplateDisplayName, string resourceGroupId, string createdByUser, string provisioningState, Guid? uniqueIdentifier, IDictionary additionalBinaryDataProperties) + { + DeploymentProperties = deploymentProperties; + ArmTemplateDisplayName = armTemplateDisplayName; + ResourceGroupId = resourceGroupId; + CreatedByUser = createdByUser; + ProvisioningState = provisioningState; + UniqueIdentifier = uniqueIdentifier; + _additionalBinaryDataProperties = additionalBinaryDataProperties; + } + + /// The deployment properties of the environment. + public DevTestLabEnvironmentDeployment DeploymentProperties { get; set; } + + /// The display name of the Azure Resource Manager template that produced the environment. + public string ArmTemplateDisplayName { get; set; } + + /// The identifier of the resource group containing the environment's resources. + public string ResourceGroupId { get; } + + /// The creator of the environment. + public string CreatedByUser { get; } + + /// The provisioning status of the resource. + public string ProvisioningState { get; } + + /// The unique immutable identifier of a resource (Guid). + public Guid? UniqueIdentifier { get; } + } +} diff --git a/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/Models/FormulaList.Serialization.cs b/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/Models/FormulaList.Serialization.cs index 097ef6626d6e..115f034ce023 100644 --- a/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/Models/FormulaList.Serialization.cs +++ b/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/Models/FormulaList.Serialization.cs @@ -9,14 +9,45 @@ using System.ClientModel.Primitives; using System.Collections.Generic; using System.Text.Json; -using Azure.Core; +using Azure; +using Azure.ResourceManager.DevTestLabs; namespace Azure.ResourceManager.DevTestLabs.Models { - internal partial class FormulaList : IUtf8JsonSerializable, IJsonModel + /// The response of a list operation. + internal partial class FormulaList : IJsonModel { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + /// Initializes a new instance of for deserialization. + internal FormulaList() + { + } + /// The data to parse. + /// The client options for reading and writing models. + protected virtual FormulaList 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 DeserializeFormulaList(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(FormulaList)} does not support reading '{options.Format}' format."); + } + } + + /// The to deserialize the from. + internal static FormulaList FromResponse(Response response) + { + using JsonDocument document = JsonDocument.Parse(response.Content, ModelSerializationExtensions.JsonDocumentOptions); + return DeserializeFormulaList(document.RootElement, ModelSerializationExtensions.WireOptions); + } + + /// The JSON writer. + /// The client options for reading and writing models. void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) { writer.WriteStartObject(); @@ -28,36 +59,32 @@ void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptio /// 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(FormulaList)} does not support writing '{format}' format."); } - - if (Optional.IsCollectionDefined(Value)) + writer.WritePropertyName("value"u8); + writer.WriteStartArray(); + foreach (DevTestLabFormulaData item in Value) { - writer.WritePropertyName("value"u8); - writer.WriteStartArray(); - foreach (var item in Value) - { - writer.WriteObjectValue(item, options); - } - writer.WriteEndArray(); + writer.WriteObjectValue(item, options); } + writer.WriteEndArray(); if (Optional.IsDefined(NextLink)) { writer.WritePropertyName("nextLink"u8); - writer.WriteStringValue(NextLink); + 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); } @@ -66,64 +93,70 @@ protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWrit } } - FormulaList IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + /// The JSON reader. + /// The client options for reading and writing models. + FormulaList IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) => JsonModelCreateCore(ref reader, options); + + /// The JSON reader. + /// The client options for reading and writing models. + protected virtual FormulaList 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(FormulaList)} does not support reading '{format}' format."); } - using JsonDocument document = JsonDocument.ParseValue(ref reader); return DeserializeFormulaList(document.RootElement, options); } - internal static FormulaList DeserializeFormulaList(JsonElement element, ModelReaderWriterOptions options = null) + /// The JSON element to deserialize. + /// The client options for reading and writing models. + internal static FormulaList DeserializeFormulaList(JsonElement element, ModelReaderWriterOptions options) { - options ??= ModelSerializationExtensions.WireOptions; - if (element.ValueKind == JsonValueKind.Null) { return null; } - IReadOnlyList value = default; - string nextLink = default; - IDictionary serializedAdditionalRawData = default; - Dictionary rawDataDictionary = new Dictionary(); - foreach (var property in element.EnumerateObject()) + IList value = default; + Uri nextLink = default; + IDictionary additionalBinaryDataProperties = new ChangeTrackingDictionary(); + foreach (var prop in element.EnumerateObject()) { - if (property.NameEquals("value"u8)) + if (prop.NameEquals("value"u8)) { - if (property.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(DevTestLabFormulaData.DeserializeDevTestLabFormulaData(item, options)); } value = array; continue; } - if (property.NameEquals("nextLink"u8)) + if (prop.NameEquals("nextLink"u8)) { - nextLink = property.Value.GetString(); + if (prop.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + nextLink = string.IsNullOrEmpty(prop.Value.GetString()) ? null : 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 FormulaList(value ?? new ChangeTrackingList(), nextLink, serializedAdditionalRawData); + return new FormulaList(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": @@ -133,22 +166,11 @@ BinaryData IPersistableModel.Write(ModelReaderWriterOptions options } } - FormulaList 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 DeserializeFormulaList(document.RootElement, options); - } - default: - throw new FormatException($"The model {nameof(FormulaList)} does not support reading '{options.Format}' format."); - } - } + /// The data to parse. + /// The client options for reading and writing models. + FormulaList IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) => PersistableModelCreateCore(data, options); + /// The client options for reading and writing models. string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; } } diff --git a/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/Models/FormulaList.cs b/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/Models/FormulaList.cs index 3f7e228b3cd2..f76b67a4c73b 100644 --- a/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/Models/FormulaList.cs +++ b/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/Models/FormulaList.cs @@ -7,64 +7,39 @@ using System; using System.Collections.Generic; +using System.Linq; +using Azure.ResourceManager.DevTestLabs; namespace Azure.ResourceManager.DevTestLabs.Models { /// The response of a list operation. internal partial class FormulaList { - /// - /// 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 FormulaList() + /// The Formula items on this page. + internal FormulaList(IEnumerable value) { - Value = new ChangeTrackingList(); + Value = value.ToList(); } /// Initializes a new instance of . - /// Results of the list operation. - /// Link for next set of results. - /// Keeps track of any properties unknown to the library. - internal FormulaList(IReadOnlyList value, string nextLink, IDictionary serializedAdditionalRawData) + /// The Formula items on this page. + /// The link to the next page of items. + /// Keeps track of any properties unknown to the library. + internal FormulaList(IList value, Uri nextLink, IDictionary additionalBinaryDataProperties) { Value = value; NextLink = nextLink; - _serializedAdditionalRawData = serializedAdditionalRawData; + _additionalBinaryDataProperties = additionalBinaryDataProperties; } - /// Results of the list operation. - public IReadOnlyList Value { get; } - /// Link for next set of results. - public string NextLink { get; } + /// The Formula items on this page. + public IList Value { get; } + + /// The link to the next page of items. + public Uri NextLink { get; } } } diff --git a/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/Models/FormulaProperties.Serialization.cs b/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/Models/FormulaProperties.Serialization.cs new file mode 100644 index 000000000000..0014b7442948 --- /dev/null +++ b/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/Models/FormulaProperties.Serialization.cs @@ -0,0 +1,243 @@ +// 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.DevTestLabs; + +namespace Azure.ResourceManager.DevTestLabs.Models +{ + /// Properties of a formula. + internal partial class FormulaProperties : IJsonModel + { + /// The data to parse. + /// The client options for reading and writing models. + protected virtual FormulaProperties 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 DeserializeFormulaProperties(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(FormulaProperties)} does not support reading '{options.Format}' format."); + } + } + + /// 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(FormulaProperties)} does not support writing '{format}' format."); + } + if (Optional.IsDefined(Description)) + { + writer.WritePropertyName("description"u8); + writer.WriteStringValue(Description); + } + if (options.Format != "W" && Optional.IsDefined(Author)) + { + writer.WritePropertyName("author"u8); + writer.WriteStringValue(Author); + } + if (Optional.IsDefined(OSType)) + { + writer.WritePropertyName("osType"u8); + writer.WriteStringValue(OSType); + } + if (options.Format != "W" && Optional.IsDefined(CreatedOn)) + { + writer.WritePropertyName("creationDate"u8); + writer.WriteStringValue(CreatedOn.Value, "O"); + } + if (Optional.IsDefined(FormulaContent)) + { + writer.WritePropertyName("formulaContent"u8); + writer.WriteObjectValue(FormulaContent, options); + } + if (Optional.IsDefined(Vm)) + { + writer.WritePropertyName("vm"u8); + writer.WriteObjectValue(Vm, options); + } + if (options.Format != "W" && Optional.IsDefined(ProvisioningState)) + { + writer.WritePropertyName("provisioningState"u8); + writer.WriteStringValue(ProvisioningState); + } + if (options.Format != "W" && Optional.IsDefined(UniqueIdentifier)) + { + writer.WritePropertyName("uniqueIdentifier"u8); + writer.WriteStringValue(UniqueIdentifier.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. + FormulaProperties IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) => JsonModelCreateCore(ref reader, options); + + /// The JSON reader. + /// The client options for reading and writing models. + protected virtual FormulaProperties 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(FormulaProperties)} does not support reading '{format}' format."); + } + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeFormulaProperties(document.RootElement, options); + } + + /// The JSON element to deserialize. + /// The client options for reading and writing models. + internal static FormulaProperties DeserializeFormulaProperties(JsonElement element, ModelReaderWriterOptions options) + { + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + string description = default; + string author = default; + string osType = default; + DateTimeOffset? createdOn = default; + DevTestLabVmCreationContent formulaContent = default; + FormulaPropertiesFromVm vm = default; + string provisioningState = default; + Guid? uniqueIdentifier = default; + IDictionary additionalBinaryDataProperties = new ChangeTrackingDictionary(); + foreach (var prop in element.EnumerateObject()) + { + if (prop.NameEquals("description"u8)) + { + description = prop.Value.GetString(); + continue; + } + if (prop.NameEquals("author"u8)) + { + author = prop.Value.GetString(); + continue; + } + if (prop.NameEquals("osType"u8)) + { + osType = prop.Value.GetString(); + continue; + } + if (prop.NameEquals("creationDate"u8)) + { + if (prop.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + createdOn = prop.Value.GetDateTimeOffset("O"); + continue; + } + if (prop.NameEquals("formulaContent"u8)) + { + if (prop.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + formulaContent = DevTestLabVmCreationContent.DeserializeDevTestLabVmCreationContent(prop.Value, options); + continue; + } + if (prop.NameEquals("vm"u8)) + { + if (prop.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + vm = FormulaPropertiesFromVm.DeserializeFormulaPropertiesFromVm(prop.Value, options); + continue; + } + if (prop.NameEquals("provisioningState"u8)) + { + provisioningState = prop.Value.GetString(); + continue; + } + if (prop.NameEquals("uniqueIdentifier"u8)) + { + if (prop.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + uniqueIdentifier = new Guid(prop.Value.GetString()); + continue; + } + if (options.Format != "W") + { + additionalBinaryDataProperties.Add(prop.Name, BinaryData.FromString(prop.Value.GetRawText())); + } + } + return new FormulaProperties( + description, + author, + osType, + createdOn, + formulaContent, + vm, + provisioningState, + uniqueIdentifier, + 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, AzureResourceManagerDevTestLabsContext.Default); + default: + throw new FormatException($"The model {nameof(FormulaProperties)} does not support writing '{options.Format}' format."); + } + } + + /// The data to parse. + /// The client options for reading and writing models. + FormulaProperties IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) => PersistableModelCreateCore(data, options); + + /// The client options for reading and writing models. + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + } +} diff --git a/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/Models/FormulaProperties.cs b/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/Models/FormulaProperties.cs new file mode 100644 index 000000000000..0b9c9ece573a --- /dev/null +++ b/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/Models/FormulaProperties.cs @@ -0,0 +1,88 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; + +namespace Azure.ResourceManager.DevTestLabs.Models +{ + /// Properties of a formula. + internal partial class FormulaProperties + { + /// Keeps track of any properties unknown to the library. + private protected readonly IDictionary _additionalBinaryDataProperties; + + /// Initializes a new instance of . + public FormulaProperties() + { + } + + /// Initializes a new instance of . + /// The description of the formula. + /// The author of the formula. + /// The OS type of the formula. + /// The creation date of the formula. + /// The content of the formula. + /// Information about a VM from which a formula is to be created. + /// The provisioning status of the resource. + /// The unique immutable identifier of a resource (Guid). + /// Keeps track of any properties unknown to the library. + internal FormulaProperties(string description, string author, string osType, DateTimeOffset? createdOn, DevTestLabVmCreationContent formulaContent, FormulaPropertiesFromVm vm, string provisioningState, Guid? uniqueIdentifier, IDictionary additionalBinaryDataProperties) + { + Description = description; + Author = author; + OSType = osType; + CreatedOn = createdOn; + FormulaContent = formulaContent; + Vm = vm; + ProvisioningState = provisioningState; + UniqueIdentifier = uniqueIdentifier; + _additionalBinaryDataProperties = additionalBinaryDataProperties; + } + + /// The description of the formula. + public string Description { get; set; } + + /// The author of the formula. + public string Author { get; } + + /// The OS type of the formula. + public string OSType { get; set; } + + /// The creation date of the formula. + public DateTimeOffset? CreatedOn { get; } + + /// The content of the formula. + public DevTestLabVmCreationContent FormulaContent { get; set; } + + /// Information about a VM from which a formula is to be created. + internal FormulaPropertiesFromVm Vm { get; set; } + + /// The provisioning status of the resource. + public string ProvisioningState { get; } + + /// The unique immutable identifier of a resource (Guid). + public Guid? UniqueIdentifier { get; } + + /// The identifier of the VM from which a formula is to be created. + public string LabVmId + { + get + { + return Vm is null ? default : Vm.LabVmId; + } + set + { + if (Vm is null) + { + Vm = new FormulaPropertiesFromVm(); + } + Vm.LabVmId = value; + } + } + } +} diff --git a/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/Models/FormulaPropertiesFromVm.Serialization.cs b/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/Models/FormulaPropertiesFromVm.Serialization.cs index 9723eb59c9ab..f6b5a7a8fe95 100644 --- a/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/Models/FormulaPropertiesFromVm.Serialization.cs +++ b/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/Models/FormulaPropertiesFromVm.Serialization.cs @@ -9,14 +9,32 @@ using System.ClientModel.Primitives; using System.Collections.Generic; using System.Text.Json; -using Azure.Core; +using Azure.ResourceManager.DevTestLabs; namespace Azure.ResourceManager.DevTestLabs.Models { - internal partial class FormulaPropertiesFromVm : IUtf8JsonSerializable, IJsonModel + /// Information about a VM from which a formula is to be created. + internal partial class FormulaPropertiesFromVm : IJsonModel { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + /// The data to parse. + /// The client options for reading and writing models. + protected virtual FormulaPropertiesFromVm 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 DeserializeFormulaPropertiesFromVm(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(FormulaPropertiesFromVm)} does not support reading '{options.Format}' format."); + } + } + /// The JSON writer. + /// The client options for reading and writing models. void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) { writer.WriteStartObject(); @@ -28,26 +46,25 @@ void IJsonModel.Write(Utf8JsonWriter writer, ModelReade /// 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(FormulaPropertiesFromVm)} does not support writing '{format}' format."); } - if (Optional.IsDefined(LabVmId)) { writer.WritePropertyName("labVmId"u8); writer.WriteStringValue(LabVmId); } - 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); } @@ -56,49 +73,55 @@ protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWrit } } - FormulaPropertiesFromVm IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + /// The JSON reader. + /// The client options for reading and writing models. + FormulaPropertiesFromVm IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) => JsonModelCreateCore(ref reader, options); + + /// The JSON reader. + /// The client options for reading and writing models. + protected virtual FormulaPropertiesFromVm 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(FormulaPropertiesFromVm)} does not support reading '{format}' format."); } - using JsonDocument document = JsonDocument.ParseValue(ref reader); return DeserializeFormulaPropertiesFromVm(document.RootElement, options); } - internal static FormulaPropertiesFromVm DeserializeFormulaPropertiesFromVm(JsonElement element, ModelReaderWriterOptions options = null) + /// The JSON element to deserialize. + /// The client options for reading and writing models. + internal static FormulaPropertiesFromVm DeserializeFormulaPropertiesFromVm(JsonElement element, ModelReaderWriterOptions options) { - options ??= ModelSerializationExtensions.WireOptions; - if (element.ValueKind == JsonValueKind.Null) { return null; } string labVmId = 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("labVmId"u8)) + if (prop.NameEquals("labVmId"u8)) { - labVmId = property.Value.GetString(); + labVmId = 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 FormulaPropertiesFromVm(labVmId, serializedAdditionalRawData); + return new FormulaPropertiesFromVm(labVmId, 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": @@ -108,22 +131,11 @@ BinaryData IPersistableModel.Write(ModelReaderWriterOpt } } - FormulaPropertiesFromVm 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 DeserializeFormulaPropertiesFromVm(document.RootElement, options); - } - default: - throw new FormatException($"The model {nameof(FormulaPropertiesFromVm)} does not support reading '{options.Format}' format."); - } - } + /// The data to parse. + /// The client options for reading and writing models. + FormulaPropertiesFromVm IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) => PersistableModelCreateCore(data, options); + /// The client options for reading and writing models. string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; } } diff --git a/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/Models/FormulaPropertiesFromVm.cs b/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/Models/FormulaPropertiesFromVm.cs index f4e58efdecaa..93da132358c7 100644 --- a/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/Models/FormulaPropertiesFromVm.cs +++ b/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/Models/FormulaPropertiesFromVm.cs @@ -13,37 +13,8 @@ namespace Azure.ResourceManager.DevTestLabs.Models /// Information about a VM from which a formula is to be created. internal partial class FormulaPropertiesFromVm { - /// - /// 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 FormulaPropertiesFromVm() @@ -52,11 +23,11 @@ public FormulaPropertiesFromVm() /// Initializes a new instance of . /// The identifier of the VM from which a formula is to be created. - /// Keeps track of any properties unknown to the library. - internal FormulaPropertiesFromVm(string labVmId, IDictionary serializedAdditionalRawData) + /// Keeps track of any properties unknown to the library. + internal FormulaPropertiesFromVm(string labVmId, IDictionary additionalBinaryDataProperties) { LabVmId = labVmId; - _serializedAdditionalRawData = serializedAdditionalRawData; + _additionalBinaryDataProperties = additionalBinaryDataProperties; } /// The identifier of the VM from which a formula is to be created. diff --git a/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/Models/GalleryImageList.Serialization.cs b/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/Models/GalleryImageList.Serialization.cs index a5d647e39527..8b247d17f1ba 100644 --- a/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/Models/GalleryImageList.Serialization.cs +++ b/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/Models/GalleryImageList.Serialization.cs @@ -9,14 +9,45 @@ using System.ClientModel.Primitives; using System.Collections.Generic; using System.Text.Json; -using Azure.Core; +using Azure; +using Azure.ResourceManager.DevTestLabs; namespace Azure.ResourceManager.DevTestLabs.Models { - internal partial class GalleryImageList : IUtf8JsonSerializable, IJsonModel + /// The response of a list operation. + internal partial class GalleryImageList : IJsonModel { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + /// Initializes a new instance of for deserialization. + internal GalleryImageList() + { + } + /// The data to parse. + /// The client options for reading and writing models. + protected virtual GalleryImageList 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 DeserializeGalleryImageList(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(GalleryImageList)} does not support reading '{options.Format}' format."); + } + } + + /// The to deserialize the from. + internal static GalleryImageList FromResponse(Response response) + { + using JsonDocument document = JsonDocument.Parse(response.Content, ModelSerializationExtensions.JsonDocumentOptions); + return DeserializeGalleryImageList(document.RootElement, ModelSerializationExtensions.WireOptions); + } + + /// The JSON writer. + /// The client options for reading and writing models. void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) { writer.WriteStartObject(); @@ -28,36 +59,32 @@ void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriter /// 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(GalleryImageList)} does not support writing '{format}' format."); } - - if (Optional.IsCollectionDefined(Value)) + writer.WritePropertyName("value"u8); + writer.WriteStartArray(); + foreach (DevTestLabGalleryImage item in Value) { - writer.WritePropertyName("value"u8); - writer.WriteStartArray(); - foreach (var item in Value) - { - writer.WriteObjectValue(item, options); - } - writer.WriteEndArray(); + writer.WriteObjectValue(item, options); } + writer.WriteEndArray(); if (Optional.IsDefined(NextLink)) { writer.WritePropertyName("nextLink"u8); - writer.WriteStringValue(NextLink); + 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); } @@ -66,64 +93,70 @@ protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWrit } } - GalleryImageList IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + /// The JSON reader. + /// The client options for reading and writing models. + GalleryImageList IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) => JsonModelCreateCore(ref reader, options); + + /// The JSON reader. + /// The client options for reading and writing models. + protected virtual GalleryImageList 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(GalleryImageList)} does not support reading '{format}' format."); } - using JsonDocument document = JsonDocument.ParseValue(ref reader); return DeserializeGalleryImageList(document.RootElement, options); } - internal static GalleryImageList DeserializeGalleryImageList(JsonElement element, ModelReaderWriterOptions options = null) + /// The JSON element to deserialize. + /// The client options for reading and writing models. + internal static GalleryImageList DeserializeGalleryImageList(JsonElement element, ModelReaderWriterOptions options) { - options ??= ModelSerializationExtensions.WireOptions; - if (element.ValueKind == JsonValueKind.Null) { return null; } - IReadOnlyList value = default; - string nextLink = default; - IDictionary serializedAdditionalRawData = default; - Dictionary rawDataDictionary = new Dictionary(); - foreach (var property in element.EnumerateObject()) + IList value = default; + Uri nextLink = default; + IDictionary additionalBinaryDataProperties = new ChangeTrackingDictionary(); + foreach (var prop in element.EnumerateObject()) { - if (property.NameEquals("value"u8)) + if (prop.NameEquals("value"u8)) { - if (property.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(DevTestLabGalleryImage.DeserializeDevTestLabGalleryImage(item, options)); } value = array; continue; } - if (property.NameEquals("nextLink"u8)) + if (prop.NameEquals("nextLink"u8)) { - nextLink = property.Value.GetString(); + if (prop.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + nextLink = string.IsNullOrEmpty(prop.Value.GetString()) ? null : 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 GalleryImageList(value ?? new ChangeTrackingList(), nextLink, serializedAdditionalRawData); + return new GalleryImageList(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": @@ -133,22 +166,11 @@ BinaryData IPersistableModel.Write(ModelReaderWriterOptions op } } - GalleryImageList 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 DeserializeGalleryImageList(document.RootElement, options); - } - default: - throw new FormatException($"The model {nameof(GalleryImageList)} does not support reading '{options.Format}' format."); - } - } + /// The data to parse. + /// The client options for reading and writing models. + GalleryImageList IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) => PersistableModelCreateCore(data, options); + /// The client options for reading and writing models. string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; } } diff --git a/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/Models/GalleryImageList.cs b/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/Models/GalleryImageList.cs index 64e27a5e30d4..24d66c9cd712 100644 --- a/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/Models/GalleryImageList.cs +++ b/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/Models/GalleryImageList.cs @@ -7,64 +7,38 @@ using System; using System.Collections.Generic; +using System.Linq; namespace Azure.ResourceManager.DevTestLabs.Models { /// The response of a list operation. internal partial class GalleryImageList { - /// - /// 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 GalleryImageList() + /// The GalleryImage items on this page. + internal GalleryImageList(IEnumerable value) { - Value = new ChangeTrackingList(); + Value = value.ToList(); } /// Initializes a new instance of . - /// Results of the list operation. - /// Link for next set of results. - /// Keeps track of any properties unknown to the library. - internal GalleryImageList(IReadOnlyList value, string nextLink, IDictionary serializedAdditionalRawData) + /// The GalleryImage items on this page. + /// The link to the next page of items. + /// Keeps track of any properties unknown to the library. + internal GalleryImageList(IList value, Uri nextLink, IDictionary additionalBinaryDataProperties) { Value = value; NextLink = nextLink; - _serializedAdditionalRawData = serializedAdditionalRawData; + _additionalBinaryDataProperties = additionalBinaryDataProperties; } - /// Results of the list operation. - public IReadOnlyList Value { get; } - /// Link for next set of results. - public string NextLink { get; } + /// The GalleryImage items on this page. + public IList Value { get; } + + /// The link to the next page of items. + public Uri NextLink { get; } } } diff --git a/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/Models/GalleryImageProperties.Serialization.cs b/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/Models/GalleryImageProperties.Serialization.cs new file mode 100644 index 000000000000..97c266092f9d --- /dev/null +++ b/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/Models/GalleryImageProperties.Serialization.cs @@ -0,0 +1,243 @@ +// 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.DevTestLabs; + +namespace Azure.ResourceManager.DevTestLabs.Models +{ + /// Properties of a gallery image. + internal partial class GalleryImageProperties : IJsonModel + { + /// The data to parse. + /// The client options for reading and writing models. + protected virtual GalleryImageProperties 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 DeserializeGalleryImageProperties(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(GalleryImageProperties)} does not support reading '{options.Format}' format."); + } + } + + /// 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(GalleryImageProperties)} does not support writing '{format}' format."); + } + if (Optional.IsDefined(Author)) + { + writer.WritePropertyName("author"u8); + writer.WriteStringValue(Author); + } + if (options.Format != "W" && Optional.IsDefined(CreatedOn)) + { + writer.WritePropertyName("createdDate"u8); + writer.WriteStringValue(CreatedOn.Value, "O"); + } + if (Optional.IsDefined(Description)) + { + writer.WritePropertyName("description"u8); + writer.WriteStringValue(Description); + } + if (Optional.IsDefined(ImageReference)) + { + writer.WritePropertyName("imageReference"u8); + writer.WriteObjectValue(ImageReference, options); + } + if (Optional.IsDefined(Icon)) + { + writer.WritePropertyName("icon"u8); + writer.WriteStringValue(Icon); + } + if (Optional.IsDefined(IsEnabled)) + { + writer.WritePropertyName("enabled"u8); + writer.WriteBooleanValue(IsEnabled.Value); + } + if (Optional.IsDefined(PlanId)) + { + writer.WritePropertyName("planId"u8); + writer.WriteStringValue(PlanId); + } + if (Optional.IsDefined(IsPlanAuthorized)) + { + writer.WritePropertyName("isPlanAuthorized"u8); + writer.WriteBooleanValue(IsPlanAuthorized.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. + GalleryImageProperties IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) => JsonModelCreateCore(ref reader, options); + + /// The JSON reader. + /// The client options for reading and writing models. + protected virtual GalleryImageProperties 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(GalleryImageProperties)} does not support reading '{format}' format."); + } + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeGalleryImageProperties(document.RootElement, options); + } + + /// The JSON element to deserialize. + /// The client options for reading and writing models. + internal static GalleryImageProperties DeserializeGalleryImageProperties(JsonElement element, ModelReaderWriterOptions options) + { + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + string author = default; + DateTimeOffset? createdOn = default; + string description = default; + DevTestLabGalleryImageReference imageReference = default; + string icon = default; + bool? isEnabled = default; + string planId = default; + bool? isPlanAuthorized = default; + IDictionary additionalBinaryDataProperties = new ChangeTrackingDictionary(); + foreach (var prop in element.EnumerateObject()) + { + if (prop.NameEquals("author"u8)) + { + author = prop.Value.GetString(); + continue; + } + if (prop.NameEquals("createdDate"u8)) + { + if (prop.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + createdOn = prop.Value.GetDateTimeOffset("O"); + continue; + } + if (prop.NameEquals("description"u8)) + { + description = prop.Value.GetString(); + continue; + } + if (prop.NameEquals("imageReference"u8)) + { + if (prop.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + imageReference = DevTestLabGalleryImageReference.DeserializeDevTestLabGalleryImageReference(prop.Value, options); + continue; + } + if (prop.NameEquals("icon"u8)) + { + icon = prop.Value.GetString(); + continue; + } + if (prop.NameEquals("enabled"u8)) + { + if (prop.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + isEnabled = prop.Value.GetBoolean(); + continue; + } + if (prop.NameEquals("planId"u8)) + { + planId = prop.Value.GetString(); + continue; + } + if (prop.NameEquals("isPlanAuthorized"u8)) + { + if (prop.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + isPlanAuthorized = prop.Value.GetBoolean(); + continue; + } + if (options.Format != "W") + { + additionalBinaryDataProperties.Add(prop.Name, BinaryData.FromString(prop.Value.GetRawText())); + } + } + return new GalleryImageProperties( + author, + createdOn, + description, + imageReference, + icon, + isEnabled, + planId, + isPlanAuthorized, + 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, AzureResourceManagerDevTestLabsContext.Default); + default: + throw new FormatException($"The model {nameof(GalleryImageProperties)} does not support writing '{options.Format}' format."); + } + } + + /// The data to parse. + /// The client options for reading and writing models. + GalleryImageProperties IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) => PersistableModelCreateCore(data, options); + + /// The client options for reading and writing models. + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + } +} diff --git a/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/Models/GalleryImageProperties.cs b/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/Models/GalleryImageProperties.cs new file mode 100644 index 000000000000..0eedbef8b737 --- /dev/null +++ b/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/Models/GalleryImageProperties.cs @@ -0,0 +1,71 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; + +namespace Azure.ResourceManager.DevTestLabs.Models +{ + /// Properties of a gallery image. + internal partial class GalleryImageProperties + { + /// Keeps track of any properties unknown to the library. + private protected readonly IDictionary _additionalBinaryDataProperties; + + /// Initializes a new instance of . + public GalleryImageProperties() + { + } + + /// Initializes a new instance of . + /// The author of the gallery image. + /// The creation date of the gallery image. + /// The description of the gallery image. + /// The image reference of the gallery image. + /// The icon of the gallery image. + /// Indicates whether this gallery image is enabled. + /// The third party plan that applies to this image. + /// Indicates if the plan has been authorized for programmatic deployment. + /// Keeps track of any properties unknown to the library. + internal GalleryImageProperties(string author, DateTimeOffset? createdOn, string description, DevTestLabGalleryImageReference imageReference, string icon, bool? isEnabled, string planId, bool? isPlanAuthorized, IDictionary additionalBinaryDataProperties) + { + Author = author; + CreatedOn = createdOn; + Description = description; + ImageReference = imageReference; + Icon = icon; + IsEnabled = isEnabled; + PlanId = planId; + IsPlanAuthorized = isPlanAuthorized; + _additionalBinaryDataProperties = additionalBinaryDataProperties; + } + + /// The author of the gallery image. + public string Author { get; set; } + + /// The creation date of the gallery image. + public DateTimeOffset? CreatedOn { get; } + + /// The description of the gallery image. + public string Description { get; set; } + + /// The image reference of the gallery image. + public DevTestLabGalleryImageReference ImageReference { get; set; } + + /// The icon of the gallery image. + public string Icon { get; set; } + + /// Indicates whether this gallery image is enabled. + public bool? IsEnabled { get; set; } + + /// The third party plan that applies to this image. + public string PlanId { get; set; } + + /// Indicates if the plan has been authorized for programmatic deployment. + public bool? IsPlanAuthorized { get; set; } + } +} diff --git a/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/Models/HourDetails.Serialization.cs b/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/Models/HourDetails.Serialization.cs index b19e6de4aecc..4ad74a6816f0 100644 --- a/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/Models/HourDetails.Serialization.cs +++ b/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/Models/HourDetails.Serialization.cs @@ -9,14 +9,32 @@ using System.ClientModel.Primitives; using System.Collections.Generic; using System.Text.Json; -using Azure.Core; +using Azure.ResourceManager.DevTestLabs; namespace Azure.ResourceManager.DevTestLabs.Models { - internal partial class HourDetails : IUtf8JsonSerializable, IJsonModel + /// Properties of an hourly schedule. + internal partial class HourDetails : IJsonModel { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + /// The data to parse. + /// The client options for reading and writing models. + protected virtual HourDetails 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 DeserializeHourDetails(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(HourDetails)} does not support reading '{options.Format}' format."); + } + } + /// The JSON writer. + /// The client options for reading and writing models. void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) { writer.WriteStartObject(); @@ -28,26 +46,25 @@ void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptio /// 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(HourDetails)} does not support writing '{format}' format."); } - if (Optional.IsDefined(Minute)) { writer.WritePropertyName("minute"u8); writer.WriteNumberValue(Minute.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); } @@ -56,53 +73,59 @@ protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWrit } } - HourDetails IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + /// The JSON reader. + /// The client options for reading and writing models. + HourDetails IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) => JsonModelCreateCore(ref reader, options); + + /// The JSON reader. + /// The client options for reading and writing models. + protected virtual HourDetails 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(HourDetails)} does not support reading '{format}' format."); } - using JsonDocument document = JsonDocument.ParseValue(ref reader); return DeserializeHourDetails(document.RootElement, options); } - internal static HourDetails DeserializeHourDetails(JsonElement element, ModelReaderWriterOptions options = null) + /// The JSON element to deserialize. + /// The client options for reading and writing models. + internal static HourDetails DeserializeHourDetails(JsonElement element, ModelReaderWriterOptions options) { - options ??= ModelSerializationExtensions.WireOptions; - if (element.ValueKind == JsonValueKind.Null) { return null; } int? minute = 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("minute"u8)) + if (prop.NameEquals("minute"u8)) { - if (property.Value.ValueKind == JsonValueKind.Null) + if (prop.Value.ValueKind == JsonValueKind.Null) { continue; } - minute = property.Value.GetInt32(); + minute = prop.Value.GetInt32(); 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 HourDetails(minute, serializedAdditionalRawData); + return new HourDetails(minute, 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": @@ -112,22 +135,11 @@ BinaryData IPersistableModel.Write(ModelReaderWriterOptions options } } - HourDetails 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 DeserializeHourDetails(document.RootElement, options); - } - default: - throw new FormatException($"The model {nameof(HourDetails)} does not support reading '{options.Format}' format."); - } - } + /// The data to parse. + /// The client options for reading and writing models. + HourDetails IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) => PersistableModelCreateCore(data, options); + /// The client options for reading and writing models. string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; } } diff --git a/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/Models/HourDetails.cs b/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/Models/HourDetails.cs index cc15a8c5e548..fcb66385cba4 100644 --- a/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/Models/HourDetails.cs +++ b/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/Models/HourDetails.cs @@ -13,37 +13,8 @@ namespace Azure.ResourceManager.DevTestLabs.Models /// Properties of an hourly schedule. internal partial class HourDetails { - /// - /// 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 HourDetails() @@ -52,11 +23,11 @@ public HourDetails() /// Initializes a new instance of . /// Minutes of the hour the schedule will run. - /// Keeps track of any properties unknown to the library. - internal HourDetails(int? minute, IDictionary serializedAdditionalRawData) + /// Keeps track of any properties unknown to the library. + internal HourDetails(int? minute, IDictionary additionalBinaryDataProperties) { Minute = minute; - _serializedAdditionalRawData = serializedAdditionalRawData; + _additionalBinaryDataProperties = additionalBinaryDataProperties; } /// Minutes of the hour the schedule will run. diff --git a/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/Models/LabCostProperties.Serialization.cs b/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/Models/LabCostProperties.Serialization.cs new file mode 100644 index 000000000000..d4fa900523cb --- /dev/null +++ b/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/Models/LabCostProperties.Serialization.cs @@ -0,0 +1,303 @@ +// 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.DevTestLabs; + +namespace Azure.ResourceManager.DevTestLabs.Models +{ + /// Properties of a cost item. + internal partial class LabCostProperties : IJsonModel + { + /// The data to parse. + /// The client options for reading and writing models. + protected virtual LabCostProperties 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 DeserializeLabCostProperties(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(LabCostProperties)} does not support reading '{options.Format}' format."); + } + } + + /// 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(LabCostProperties)} does not support writing '{format}' format."); + } + if (Optional.IsDefined(TargetCost)) + { + writer.WritePropertyName("targetCost"u8); + writer.WriteObjectValue(TargetCost, options); + } + if (options.Format != "W" && Optional.IsDefined(LabCostSummary)) + { + writer.WritePropertyName("labCostSummary"u8); + writer.WriteObjectValue(LabCostSummary, options); + } + if (options.Format != "W" && Optional.IsCollectionDefined(LabCostDetails)) + { + writer.WritePropertyName("labCostDetails"u8); + writer.WriteStartArray(); + foreach (DevTestLabCostDetails item in LabCostDetails) + { + writer.WriteObjectValue(item, options); + } + writer.WriteEndArray(); + } + if (options.Format != "W" && Optional.IsCollectionDefined(ResourceCosts)) + { + writer.WritePropertyName("resourceCosts"u8); + writer.WriteStartArray(); + foreach (DevTestLabResourceCost item in ResourceCosts) + { + writer.WriteObjectValue(item, options); + } + writer.WriteEndArray(); + } + if (Optional.IsDefined(CurrencyCode)) + { + writer.WritePropertyName("currencyCode"u8); + writer.WriteStringValue(CurrencyCode); + } + if (Optional.IsDefined(StartOn)) + { + writer.WritePropertyName("startDateTime"u8); + writer.WriteStringValue(StartOn.Value, "O"); + } + if (Optional.IsDefined(EndOn)) + { + writer.WritePropertyName("endDateTime"u8); + writer.WriteStringValue(EndOn.Value, "O"); + } + if (Optional.IsDefined(CreatedOn)) + { + writer.WritePropertyName("createdDate"u8); + writer.WriteStringValue(CreatedOn.Value, "O"); + } + if (options.Format != "W" && Optional.IsDefined(ProvisioningState)) + { + writer.WritePropertyName("provisioningState"u8); + writer.WriteStringValue(ProvisioningState); + } + if (options.Format != "W" && Optional.IsDefined(UniqueIdentifier)) + { + writer.WritePropertyName("uniqueIdentifier"u8); + writer.WriteStringValue(UniqueIdentifier.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. + LabCostProperties IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) => JsonModelCreateCore(ref reader, options); + + /// The JSON reader. + /// The client options for reading and writing models. + protected virtual LabCostProperties 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(LabCostProperties)} does not support reading '{format}' format."); + } + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeLabCostProperties(document.RootElement, options); + } + + /// The JSON element to deserialize. + /// The client options for reading and writing models. + internal static LabCostProperties DeserializeLabCostProperties(JsonElement element, ModelReaderWriterOptions options) + { + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + DevTestLabTargetCost targetCost = default; + LabCostSummaryProperties labCostSummary = default; + IReadOnlyList labCostDetails = default; + IReadOnlyList resourceCosts = default; + string currencyCode = default; + DateTimeOffset? startOn = default; + DateTimeOffset? endOn = default; + DateTimeOffset? createdOn = default; + string provisioningState = default; + Guid? uniqueIdentifier = default; + IDictionary additionalBinaryDataProperties = new ChangeTrackingDictionary(); + foreach (var prop in element.EnumerateObject()) + { + if (prop.NameEquals("targetCost"u8)) + { + if (prop.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + targetCost = DevTestLabTargetCost.DeserializeDevTestLabTargetCost(prop.Value, options); + continue; + } + if (prop.NameEquals("labCostSummary"u8)) + { + if (prop.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + labCostSummary = LabCostSummaryProperties.DeserializeLabCostSummaryProperties(prop.Value, options); + continue; + } + if (prop.NameEquals("labCostDetails"u8)) + { + if (prop.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + List array = new List(); + foreach (var item in prop.Value.EnumerateArray()) + { + array.Add(DevTestLabCostDetails.DeserializeDevTestLabCostDetails(item, options)); + } + labCostDetails = array; + continue; + } + if (prop.NameEquals("resourceCosts"u8)) + { + if (prop.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + List array = new List(); + foreach (var item in prop.Value.EnumerateArray()) + { + array.Add(DevTestLabResourceCost.DeserializeDevTestLabResourceCost(item, options)); + } + resourceCosts = array; + continue; + } + if (prop.NameEquals("currencyCode"u8)) + { + currencyCode = prop.Value.GetString(); + continue; + } + if (prop.NameEquals("startDateTime"u8)) + { + if (prop.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + startOn = prop.Value.GetDateTimeOffset("O"); + continue; + } + if (prop.NameEquals("endDateTime"u8)) + { + if (prop.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + endOn = prop.Value.GetDateTimeOffset("O"); + continue; + } + if (prop.NameEquals("createdDate"u8)) + { + if (prop.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + createdOn = prop.Value.GetDateTimeOffset("O"); + continue; + } + if (prop.NameEquals("provisioningState"u8)) + { + provisioningState = prop.Value.GetString(); + continue; + } + if (prop.NameEquals("uniqueIdentifier"u8)) + { + if (prop.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + uniqueIdentifier = new Guid(prop.Value.GetString()); + continue; + } + if (options.Format != "W") + { + additionalBinaryDataProperties.Add(prop.Name, BinaryData.FromString(prop.Value.GetRawText())); + } + } + return new LabCostProperties( + targetCost, + labCostSummary, + labCostDetails ?? new ChangeTrackingList(), + resourceCosts ?? new ChangeTrackingList(), + currencyCode, + startOn, + endOn, + createdOn, + provisioningState, + uniqueIdentifier, + 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, AzureResourceManagerDevTestLabsContext.Default); + default: + throw new FormatException($"The model {nameof(LabCostProperties)} does not support writing '{options.Format}' format."); + } + } + + /// The data to parse. + /// The client options for reading and writing models. + LabCostProperties IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) => PersistableModelCreateCore(data, options); + + /// The client options for reading and writing models. + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + } +} diff --git a/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/Models/LabCostProperties.cs b/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/Models/LabCostProperties.cs new file mode 100644 index 000000000000..242dc622cebd --- /dev/null +++ b/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/Models/LabCostProperties.cs @@ -0,0 +1,93 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; +using Azure.ResourceManager.DevTestLabs; + +namespace Azure.ResourceManager.DevTestLabs.Models +{ + /// Properties of a cost item. + internal partial class LabCostProperties + { + /// Keeps track of any properties unknown to the library. + private protected readonly IDictionary _additionalBinaryDataProperties; + + /// Initializes a new instance of . + public LabCostProperties() + { + LabCostDetails = new ChangeTrackingList(); + ResourceCosts = new ChangeTrackingList(); + } + + /// Initializes a new instance of . + /// The target cost properties. + /// The lab cost summary component of the cost data. + /// The lab cost details component of the cost data. + /// The resource cost component of the cost data. + /// The currency code of the cost. + /// The start time of the cost data. + /// The end time of the cost data. + /// The creation date of the cost. + /// The provisioning status of the resource. + /// The unique immutable identifier of a resource (Guid). + /// Keeps track of any properties unknown to the library. + internal LabCostProperties(DevTestLabTargetCost targetCost, LabCostSummaryProperties labCostSummary, IReadOnlyList labCostDetails, IReadOnlyList resourceCosts, string currencyCode, DateTimeOffset? startOn, DateTimeOffset? endOn, DateTimeOffset? createdOn, string provisioningState, Guid? uniqueIdentifier, IDictionary additionalBinaryDataProperties) + { + TargetCost = targetCost; + LabCostSummary = labCostSummary; + LabCostDetails = labCostDetails; + ResourceCosts = resourceCosts; + CurrencyCode = currencyCode; + StartOn = startOn; + EndOn = endOn; + CreatedOn = createdOn; + ProvisioningState = provisioningState; + UniqueIdentifier = uniqueIdentifier; + _additionalBinaryDataProperties = additionalBinaryDataProperties; + } + + /// The target cost properties. + public DevTestLabTargetCost TargetCost { get; set; } + + /// The lab cost summary component of the cost data. + internal LabCostSummaryProperties LabCostSummary { get; } + + /// The lab cost details component of the cost data. + public IReadOnlyList LabCostDetails { get; } = new ChangeTrackingList(); + + /// The resource cost component of the cost data. + public IReadOnlyList ResourceCosts { get; } = new ChangeTrackingList(); + + /// The currency code of the cost. + public string CurrencyCode { get; set; } + + /// The start time of the cost data. + public DateTimeOffset? StartOn { get; set; } + + /// The end time of the cost data. + public DateTimeOffset? EndOn { get; set; } + + /// The creation date of the cost. + public DateTimeOffset? CreatedOn { get; set; } + + /// The provisioning status of the resource. + public string ProvisioningState { get; } + + /// The unique immutable identifier of a resource (Guid). + public Guid? UniqueIdentifier { get; } + + /// The cost component of the cost item. + public double? EstimatedLabCost + { + get + { + return LabCostSummary.EstimatedLabCost; + } + } + } +} diff --git a/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/Models/LabCostSummaryProperties.Serialization.cs b/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/Models/LabCostSummaryProperties.Serialization.cs index 82d4d10d55c1..ea02a080c255 100644 --- a/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/Models/LabCostSummaryProperties.Serialization.cs +++ b/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/Models/LabCostSummaryProperties.Serialization.cs @@ -9,14 +9,32 @@ using System.ClientModel.Primitives; using System.Collections.Generic; using System.Text.Json; -using Azure.Core; +using Azure.ResourceManager.DevTestLabs; namespace Azure.ResourceManager.DevTestLabs.Models { - internal partial class LabCostSummaryProperties : IUtf8JsonSerializable, IJsonModel + /// The properties of the cost summary. + internal partial class LabCostSummaryProperties : IJsonModel { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + /// The data to parse. + /// The client options for reading and writing models. + protected virtual LabCostSummaryProperties 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 DeserializeLabCostSummaryProperties(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(LabCostSummaryProperties)} does not support reading '{options.Format}' format."); + } + } + /// The JSON writer. + /// The client options for reading and writing models. void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) { writer.WriteStartObject(); @@ -28,26 +46,25 @@ void IJsonModel.Write(Utf8JsonWriter writer, ModelRead /// 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(LabCostSummaryProperties)} does not support writing '{format}' format."); } - if (Optional.IsDefined(EstimatedLabCost)) { writer.WritePropertyName("estimatedLabCost"u8); writer.WriteNumberValue(EstimatedLabCost.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); } @@ -56,53 +73,59 @@ protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWrit } } - LabCostSummaryProperties IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + /// The JSON reader. + /// The client options for reading and writing models. + LabCostSummaryProperties IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) => JsonModelCreateCore(ref reader, options); + + /// The JSON reader. + /// The client options for reading and writing models. + protected virtual LabCostSummaryProperties 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(LabCostSummaryProperties)} does not support reading '{format}' format."); } - using JsonDocument document = JsonDocument.ParseValue(ref reader); return DeserializeLabCostSummaryProperties(document.RootElement, options); } - internal static LabCostSummaryProperties DeserializeLabCostSummaryProperties(JsonElement element, ModelReaderWriterOptions options = null) + /// The JSON element to deserialize. + /// The client options for reading and writing models. + internal static LabCostSummaryProperties DeserializeLabCostSummaryProperties(JsonElement element, ModelReaderWriterOptions options) { - options ??= ModelSerializationExtensions.WireOptions; - if (element.ValueKind == JsonValueKind.Null) { return null; } double? estimatedLabCost = 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("estimatedLabCost"u8)) + if (prop.NameEquals("estimatedLabCost"u8)) { - if (property.Value.ValueKind == JsonValueKind.Null) + if (prop.Value.ValueKind == JsonValueKind.Null) { continue; } - estimatedLabCost = property.Value.GetDouble(); + estimatedLabCost = prop.Value.GetDouble(); 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 LabCostSummaryProperties(estimatedLabCost, serializedAdditionalRawData); + return new LabCostSummaryProperties(estimatedLabCost, 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": @@ -112,22 +135,11 @@ BinaryData IPersistableModel.Write(ModelReaderWriterOp } } - LabCostSummaryProperties 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 DeserializeLabCostSummaryProperties(document.RootElement, options); - } - default: - throw new FormatException($"The model {nameof(LabCostSummaryProperties)} does not support reading '{options.Format}' format."); - } - } + /// The data to parse. + /// The client options for reading and writing models. + LabCostSummaryProperties IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) => PersistableModelCreateCore(data, options); + /// The client options for reading and writing models. string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; } } diff --git a/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/Models/LabCostSummaryProperties.cs b/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/Models/LabCostSummaryProperties.cs index c502779ff513..d4f2dfe7f415 100644 --- a/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/Models/LabCostSummaryProperties.cs +++ b/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/Models/LabCostSummaryProperties.cs @@ -13,37 +13,8 @@ namespace Azure.ResourceManager.DevTestLabs.Models /// The properties of the cost summary. internal partial class LabCostSummaryProperties { - /// - /// 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 LabCostSummaryProperties() @@ -52,11 +23,11 @@ internal LabCostSummaryProperties() /// Initializes a new instance of . /// The cost component of the cost item. - /// Keeps track of any properties unknown to the library. - internal LabCostSummaryProperties(double? estimatedLabCost, IDictionary serializedAdditionalRawData) + /// Keeps track of any properties unknown to the library. + internal LabCostSummaryProperties(double? estimatedLabCost, IDictionary additionalBinaryDataProperties) { EstimatedLabCost = estimatedLabCost; - _serializedAdditionalRawData = serializedAdditionalRawData; + _additionalBinaryDataProperties = additionalBinaryDataProperties; } /// The cost component of the cost item. diff --git a/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/Models/LabList.Serialization.cs b/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/Models/LabList.Serialization.cs index c0cf90c158f5..10a6b9e5c3cf 100644 --- a/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/Models/LabList.Serialization.cs +++ b/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/Models/LabList.Serialization.cs @@ -9,14 +9,45 @@ using System.ClientModel.Primitives; using System.Collections.Generic; using System.Text.Json; -using Azure.Core; +using Azure; +using Azure.ResourceManager.DevTestLabs; namespace Azure.ResourceManager.DevTestLabs.Models { - internal partial class LabList : IUtf8JsonSerializable, IJsonModel + /// The response of a list operation. + internal partial class LabList : IJsonModel { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + /// Initializes a new instance of for deserialization. + internal LabList() + { + } + /// The data to parse. + /// The client options for reading and writing models. + protected virtual LabList 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 DeserializeLabList(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(LabList)} does not support reading '{options.Format}' format."); + } + } + + /// The to deserialize the from. + internal static LabList FromResponse(Response response) + { + using JsonDocument document = JsonDocument.Parse(response.Content, ModelSerializationExtensions.JsonDocumentOptions); + return DeserializeLabList(document.RootElement, ModelSerializationExtensions.WireOptions); + } + + /// The JSON writer. + /// The client options for reading and writing models. void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) { writer.WriteStartObject(); @@ -28,36 +59,32 @@ void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions o /// 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(LabList)} does not support writing '{format}' format."); } - - if (Optional.IsCollectionDefined(Value)) + writer.WritePropertyName("value"u8); + writer.WriteStartArray(); + foreach (DevTestLabData item in Value) { - writer.WritePropertyName("value"u8); - writer.WriteStartArray(); - foreach (var item in Value) - { - writer.WriteObjectValue(item, options); - } - writer.WriteEndArray(); + writer.WriteObjectValue(item, options); } + writer.WriteEndArray(); if (Optional.IsDefined(NextLink)) { writer.WritePropertyName("nextLink"u8); - writer.WriteStringValue(NextLink); + 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); } @@ -66,64 +93,70 @@ protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWrit } } - LabList IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + /// The JSON reader. + /// The client options for reading and writing models. + LabList IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) => JsonModelCreateCore(ref reader, options); + + /// The JSON reader. + /// The client options for reading and writing models. + protected virtual LabList 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(LabList)} does not support reading '{format}' format."); } - using JsonDocument document = JsonDocument.ParseValue(ref reader); return DeserializeLabList(document.RootElement, options); } - internal static LabList DeserializeLabList(JsonElement element, ModelReaderWriterOptions options = null) + /// The JSON element to deserialize. + /// The client options for reading and writing models. + internal static LabList DeserializeLabList(JsonElement element, ModelReaderWriterOptions options) { - options ??= ModelSerializationExtensions.WireOptions; - if (element.ValueKind == JsonValueKind.Null) { return null; } - IReadOnlyList value = default; - string nextLink = default; - IDictionary serializedAdditionalRawData = default; - Dictionary rawDataDictionary = new Dictionary(); - foreach (var property in element.EnumerateObject()) + IList value = default; + Uri nextLink = default; + IDictionary additionalBinaryDataProperties = new ChangeTrackingDictionary(); + foreach (var prop in element.EnumerateObject()) { - if (property.NameEquals("value"u8)) + if (prop.NameEquals("value"u8)) { - if (property.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(DevTestLabData.DeserializeDevTestLabData(item, options)); } value = array; continue; } - if (property.NameEquals("nextLink"u8)) + if (prop.NameEquals("nextLink"u8)) { - nextLink = property.Value.GetString(); + if (prop.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + nextLink = string.IsNullOrEmpty(prop.Value.GetString()) ? null : 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 LabList(value ?? new ChangeTrackingList(), nextLink, serializedAdditionalRawData); + return new LabList(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": @@ -133,22 +166,11 @@ BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) } } - LabList 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 DeserializeLabList(document.RootElement, options); - } - default: - throw new FormatException($"The model {nameof(LabList)} does not support reading '{options.Format}' format."); - } - } + /// The data to parse. + /// The client options for reading and writing models. + LabList IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) => PersistableModelCreateCore(data, options); + /// The client options for reading and writing models. string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; } } diff --git a/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/Models/LabList.cs b/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/Models/LabList.cs index 16444640dd62..0e61c5e54988 100644 --- a/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/Models/LabList.cs +++ b/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/Models/LabList.cs @@ -7,64 +7,39 @@ using System; using System.Collections.Generic; +using System.Linq; +using Azure.ResourceManager.DevTestLabs; namespace Azure.ResourceManager.DevTestLabs.Models { /// The response of a list operation. internal partial class LabList { - /// - /// 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 LabList() + /// The Lab items on this page. + internal LabList(IEnumerable value) { - Value = new ChangeTrackingList(); + Value = value.ToList(); } /// Initializes a new instance of . - /// Results of the list operation. - /// Link for next set of results. - /// Keeps track of any properties unknown to the library. - internal LabList(IReadOnlyList value, string nextLink, IDictionary serializedAdditionalRawData) + /// The Lab items on this page. + /// The link to the next page of items. + /// Keeps track of any properties unknown to the library. + internal LabList(IList value, Uri nextLink, IDictionary additionalBinaryDataProperties) { Value = value; NextLink = nextLink; - _serializedAdditionalRawData = serializedAdditionalRawData; + _additionalBinaryDataProperties = additionalBinaryDataProperties; } - /// Results of the list operation. - public IReadOnlyList Value { get; } - /// Link for next set of results. - public string NextLink { get; } + /// The Lab items on this page. + public IList Value { get; } + + /// The link to the next page of items. + public Uri NextLink { get; } } } diff --git a/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/Models/LabProperties.Serialization.cs b/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/Models/LabProperties.Serialization.cs new file mode 100644 index 000000000000..1a0f23a04d92 --- /dev/null +++ b/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/Models/LabProperties.Serialization.cs @@ -0,0 +1,478 @@ +// 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.DevTestLabs; + +namespace Azure.ResourceManager.DevTestLabs.Models +{ + /// Properties of a lab. + internal partial class LabProperties : IJsonModel + { + /// The data to parse. + /// The client options for reading and writing models. + protected virtual LabProperties 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 DeserializeLabProperties(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(LabProperties)} does not support reading '{options.Format}' format."); + } + } + + /// 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(LabProperties)} does not support writing '{format}' format."); + } + if (options.Format != "W" && Optional.IsDefined(DefaultStorageAccount)) + { + writer.WritePropertyName("defaultStorageAccount"u8); + writer.WriteStringValue(DefaultStorageAccount); + } + if (options.Format != "W" && Optional.IsDefined(DefaultPremiumStorageAccount)) + { + writer.WritePropertyName("defaultPremiumStorageAccount"u8); + writer.WriteStringValue(DefaultPremiumStorageAccount); + } + if (options.Format != "W" && Optional.IsDefined(ArtifactsStorageAccount)) + { + writer.WritePropertyName("artifactsStorageAccount"u8); + writer.WriteStringValue(ArtifactsStorageAccount); + } + if (options.Format != "W" && Optional.IsDefined(PremiumDataDiskStorageAccount)) + { + writer.WritePropertyName("premiumDataDiskStorageAccount"u8); + writer.WriteStringValue(PremiumDataDiskStorageAccount); + } + if (options.Format != "W" && Optional.IsDefined(VaultName)) + { + writer.WritePropertyName("vaultName"u8); + writer.WriteStringValue(VaultName); + } + if (Optional.IsDefined(LabStorageType)) + { + writer.WritePropertyName("labStorageType"u8); + writer.WriteStringValue(LabStorageType.Value.ToString()); + } + if (Optional.IsCollectionDefined(MandatoryArtifactsResourceIdsLinux)) + { + writer.WritePropertyName("mandatoryArtifactsResourceIdsLinux"u8); + writer.WriteStartArray(); + foreach (string item in MandatoryArtifactsResourceIdsLinux) + { + if (item == null) + { + writer.WriteNullValue(); + continue; + } + writer.WriteStringValue(item); + } + writer.WriteEndArray(); + } + if (Optional.IsCollectionDefined(MandatoryArtifactsResourceIdsWindows)) + { + writer.WritePropertyName("mandatoryArtifactsResourceIdsWindows"u8); + writer.WriteStartArray(); + foreach (string item in MandatoryArtifactsResourceIdsWindows) + { + if (item == null) + { + writer.WriteNullValue(); + continue; + } + writer.WriteStringValue(item); + } + writer.WriteEndArray(); + } + if (options.Format != "W" && Optional.IsDefined(CreatedOn)) + { + writer.WritePropertyName("createdDate"u8); + writer.WriteStringValue(CreatedOn.Value, "O"); + } + if (Optional.IsDefined(PremiumDataDisks)) + { + writer.WritePropertyName("premiumDataDisks"u8); + writer.WriteStringValue(PremiumDataDisks.Value.ToString()); + } + if (Optional.IsDefined(EnvironmentPermission)) + { + writer.WritePropertyName("environmentPermission"u8); + writer.WriteStringValue(EnvironmentPermission.Value.ToString()); + } + if (Optional.IsDefined(Announcement)) + { + writer.WritePropertyName("announcement"u8); + writer.WriteObjectValue(Announcement, options); + } + if (Optional.IsDefined(Support)) + { + writer.WritePropertyName("support"u8); + writer.WriteObjectValue(Support, options); + } + if (options.Format != "W" && Optional.IsDefined(VmCreationResourceGroup)) + { + writer.WritePropertyName("vmCreationResourceGroup"u8); + writer.WriteStringValue(VmCreationResourceGroup); + } + if (options.Format != "W" && Optional.IsDefined(PublicIPId)) + { + writer.WritePropertyName("publicIpId"u8); + writer.WriteStringValue(PublicIPId); + } + if (options.Format != "W" && Optional.IsDefined(LoadBalancerId)) + { + writer.WritePropertyName("loadBalancerId"u8); + writer.WriteStringValue(LoadBalancerId); + } + if (options.Format != "W" && Optional.IsDefined(NetworkSecurityGroupId)) + { + writer.WritePropertyName("networkSecurityGroupId"u8); + writer.WriteStringValue(NetworkSecurityGroupId); + } + if (Optional.IsCollectionDefined(ExtendedProperties)) + { + writer.WritePropertyName("extendedProperties"u8); + writer.WriteStartObject(); + foreach (var item in ExtendedProperties) + { + writer.WritePropertyName(item.Key); + if (item.Value == null) + { + writer.WriteNullValue(); + continue; + } + writer.WriteStringValue(item.Value); + } + writer.WriteEndObject(); + } + if (options.Format != "W" && Optional.IsDefined(ProvisioningState)) + { + writer.WritePropertyName("provisioningState"u8); + writer.WriteStringValue(ProvisioningState); + } + if (options.Format != "W" && Optional.IsDefined(UniqueIdentifier)) + { + writer.WritePropertyName("uniqueIdentifier"u8); + writer.WriteStringValue(UniqueIdentifier.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. + LabProperties IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) => JsonModelCreateCore(ref reader, options); + + /// The JSON reader. + /// The client options for reading and writing models. + protected virtual LabProperties 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(LabProperties)} does not support reading '{format}' format."); + } + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeLabProperties(document.RootElement, options); + } + + /// The JSON element to deserialize. + /// The client options for reading and writing models. + internal static LabProperties DeserializeLabProperties(JsonElement element, ModelReaderWriterOptions options) + { + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + string defaultStorageAccount = default; + string defaultPremiumStorageAccount = default; + string artifactsStorageAccount = default; + string premiumDataDiskStorageAccount = default; + string vaultName = default; + DevTestLabStorageType? labStorageType = default; + IList mandatoryArtifactsResourceIdsLinux = default; + IList mandatoryArtifactsResourceIdsWindows = default; + DateTimeOffset? createdOn = default; + DevTestLabPremiumDataDisk? premiumDataDisks = default; + DevTestLabEnvironmentPermission? environmentPermission = default; + DevTestLabAnnouncement announcement = default; + DevTestLabSupport support = default; + string vmCreationResourceGroup = default; + string publicIPId = default; + string loadBalancerId = default; + string networkSecurityGroupId = default; + IDictionary extendedProperties = default; + string provisioningState = default; + Guid? uniqueIdentifier = default; + IDictionary additionalBinaryDataProperties = new ChangeTrackingDictionary(); + foreach (var prop in element.EnumerateObject()) + { + if (prop.NameEquals("defaultStorageAccount"u8)) + { + defaultStorageAccount = prop.Value.GetString(); + continue; + } + if (prop.NameEquals("defaultPremiumStorageAccount"u8)) + { + defaultPremiumStorageAccount = prop.Value.GetString(); + continue; + } + if (prop.NameEquals("artifactsStorageAccount"u8)) + { + artifactsStorageAccount = prop.Value.GetString(); + continue; + } + if (prop.NameEquals("premiumDataDiskStorageAccount"u8)) + { + premiumDataDiskStorageAccount = prop.Value.GetString(); + continue; + } + if (prop.NameEquals("vaultName"u8)) + { + vaultName = prop.Value.GetString(); + continue; + } + if (prop.NameEquals("labStorageType"u8)) + { + if (prop.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + labStorageType = new DevTestLabStorageType(prop.Value.GetString()); + continue; + } + if (prop.NameEquals("mandatoryArtifactsResourceIdsLinux"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()); + } + } + mandatoryArtifactsResourceIdsLinux = array; + continue; + } + if (prop.NameEquals("mandatoryArtifactsResourceIdsWindows"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()); + } + } + mandatoryArtifactsResourceIdsWindows = array; + continue; + } + if (prop.NameEquals("createdDate"u8)) + { + if (prop.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + createdOn = prop.Value.GetDateTimeOffset("O"); + continue; + } + if (prop.NameEquals("premiumDataDisks"u8)) + { + if (prop.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + premiumDataDisks = new DevTestLabPremiumDataDisk(prop.Value.GetString()); + continue; + } + if (prop.NameEquals("environmentPermission"u8)) + { + if (prop.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + environmentPermission = new DevTestLabEnvironmentPermission(prop.Value.GetString()); + continue; + } + if (prop.NameEquals("announcement"u8)) + { + if (prop.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + announcement = DevTestLabAnnouncement.DeserializeDevTestLabAnnouncement(prop.Value, options); + continue; + } + if (prop.NameEquals("support"u8)) + { + if (prop.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + support = DevTestLabSupport.DeserializeDevTestLabSupport(prop.Value, options); + continue; + } + if (prop.NameEquals("vmCreationResourceGroup"u8)) + { + vmCreationResourceGroup = prop.Value.GetString(); + continue; + } + if (prop.NameEquals("publicIpId"u8)) + { + publicIPId = prop.Value.GetString(); + continue; + } + if (prop.NameEquals("loadBalancerId"u8)) + { + loadBalancerId = prop.Value.GetString(); + continue; + } + if (prop.NameEquals("networkSecurityGroupId"u8)) + { + networkSecurityGroupId = prop.Value.GetString(); + continue; + } + if (prop.NameEquals("extendedProperties"u8)) + { + 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()); + } + } + extendedProperties = dictionary; + continue; + } + if (prop.NameEquals("provisioningState"u8)) + { + provisioningState = prop.Value.GetString(); + continue; + } + if (prop.NameEquals("uniqueIdentifier"u8)) + { + if (prop.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + uniqueIdentifier = new Guid(prop.Value.GetString()); + continue; + } + if (options.Format != "W") + { + additionalBinaryDataProperties.Add(prop.Name, BinaryData.FromString(prop.Value.GetRawText())); + } + } + return new LabProperties( + defaultStorageAccount, + defaultPremiumStorageAccount, + artifactsStorageAccount, + premiumDataDiskStorageAccount, + vaultName, + labStorageType, + mandatoryArtifactsResourceIdsLinux ?? new ChangeTrackingList(), + mandatoryArtifactsResourceIdsWindows ?? new ChangeTrackingList(), + createdOn, + premiumDataDisks, + environmentPermission, + announcement, + support, + vmCreationResourceGroup, + publicIPId, + loadBalancerId, + networkSecurityGroupId, + extendedProperties ?? new ChangeTrackingDictionary(), + provisioningState, + uniqueIdentifier, + 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, AzureResourceManagerDevTestLabsContext.Default); + default: + throw new FormatException($"The model {nameof(LabProperties)} does not support writing '{options.Format}' format."); + } + } + + /// The data to parse. + /// The client options for reading and writing models. + LabProperties IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) => PersistableModelCreateCore(data, options); + + /// The client options for reading and writing models. + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + } +} diff --git a/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/Models/LabProperties.cs b/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/Models/LabProperties.cs new file mode 100644 index 000000000000..ea35b30b02af --- /dev/null +++ b/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/Models/LabProperties.cs @@ -0,0 +1,143 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; +using Azure.ResourceManager.DevTestLabs; + +namespace Azure.ResourceManager.DevTestLabs.Models +{ + /// Properties of a lab. + internal partial class LabProperties + { + /// Keeps track of any properties unknown to the library. + private protected readonly IDictionary _additionalBinaryDataProperties; + + /// Initializes a new instance of . + public LabProperties() + { + MandatoryArtifactsResourceIdsLinux = new ChangeTrackingList(); + MandatoryArtifactsResourceIdsWindows = new ChangeTrackingList(); + ExtendedProperties = new ChangeTrackingDictionary(); + } + + /// Initializes a new instance of . + /// The lab's default storage account. + /// The lab's default premium storage account. + /// The lab's artifact storage account. + /// The lab's premium data disk storage account. + /// The lab's Key vault. + /// Type of storage used by the lab. It can be either Premium or Standard. Default is Premium. + /// The ordered list of artifact resource IDs that should be applied on all Linux VM creations by default, prior to the artifacts specified by the user. + /// The ordered list of artifact resource IDs that should be applied on all Windows VM creations by default, prior to the artifacts specified by the user. + /// The creation date of the lab. + /// + /// The setting to enable usage of premium data disks. + /// When its value is 'Enabled', creation of standard or premium data disks is allowed. + /// When its value is 'Disabled', only creation of standard data disks is allowed. + /// + /// The access rights to be granted to the user when provisioning an environment. + /// The properties of any lab announcement associated with this lab. + /// The properties of any lab support message associated with this lab. + /// The resource group in which all new lab virtual machines will be created. To let DevTest Labs manage resource group creation, set this value to null. + /// The public IP address for the lab's load balancer. + /// The load balancer used to for lab VMs that use shared IP address. + /// The Network Security Group attached to the lab VMs Network interfaces to restrict open ports. + /// Extended properties of the lab used for experimental features. + /// The provisioning status of the resource. + /// The unique immutable identifier of a resource (Guid). + /// Keeps track of any properties unknown to the library. + internal LabProperties(string defaultStorageAccount, string defaultPremiumStorageAccount, string artifactsStorageAccount, string premiumDataDiskStorageAccount, string vaultName, DevTestLabStorageType? labStorageType, IList mandatoryArtifactsResourceIdsLinux, IList mandatoryArtifactsResourceIdsWindows, DateTimeOffset? createdOn, DevTestLabPremiumDataDisk? premiumDataDisks, DevTestLabEnvironmentPermission? environmentPermission, DevTestLabAnnouncement announcement, DevTestLabSupport support, string vmCreationResourceGroup, string publicIPId, string loadBalancerId, string networkSecurityGroupId, IDictionary extendedProperties, string provisioningState, Guid? uniqueIdentifier, IDictionary additionalBinaryDataProperties) + { + DefaultStorageAccount = defaultStorageAccount; + DefaultPremiumStorageAccount = defaultPremiumStorageAccount; + ArtifactsStorageAccount = artifactsStorageAccount; + PremiumDataDiskStorageAccount = premiumDataDiskStorageAccount; + VaultName = vaultName; + LabStorageType = labStorageType; + MandatoryArtifactsResourceIdsLinux = mandatoryArtifactsResourceIdsLinux; + MandatoryArtifactsResourceIdsWindows = mandatoryArtifactsResourceIdsWindows; + CreatedOn = createdOn; + PremiumDataDisks = premiumDataDisks; + EnvironmentPermission = environmentPermission; + Announcement = announcement; + Support = support; + VmCreationResourceGroup = vmCreationResourceGroup; + PublicIPId = publicIPId; + LoadBalancerId = loadBalancerId; + NetworkSecurityGroupId = networkSecurityGroupId; + ExtendedProperties = extendedProperties; + ProvisioningState = provisioningState; + UniqueIdentifier = uniqueIdentifier; + _additionalBinaryDataProperties = additionalBinaryDataProperties; + } + + /// The lab's default storage account. + public string DefaultStorageAccount { get; } + + /// The lab's default premium storage account. + public string DefaultPremiumStorageAccount { get; } + + /// The lab's artifact storage account. + public string ArtifactsStorageAccount { get; } + + /// The lab's premium data disk storage account. + public string PremiumDataDiskStorageAccount { get; } + + /// The lab's Key vault. + public string VaultName { get; } + + /// Type of storage used by the lab. It can be either Premium or Standard. Default is Premium. + public DevTestLabStorageType? LabStorageType { get; set; } + + /// The ordered list of artifact resource IDs that should be applied on all Linux VM creations by default, prior to the artifacts specified by the user. + public IList MandatoryArtifactsResourceIdsLinux { get; } = new ChangeTrackingList(); + + /// The ordered list of artifact resource IDs that should be applied on all Windows VM creations by default, prior to the artifacts specified by the user. + public IList MandatoryArtifactsResourceIdsWindows { get; } = new ChangeTrackingList(); + + /// The creation date of the lab. + public DateTimeOffset? CreatedOn { get; } + + /// + /// The setting to enable usage of premium data disks. + /// When its value is 'Enabled', creation of standard or premium data disks is allowed. + /// When its value is 'Disabled', only creation of standard data disks is allowed. + /// + public DevTestLabPremiumDataDisk? PremiumDataDisks { get; set; } + + /// The access rights to be granted to the user when provisioning an environment. + public DevTestLabEnvironmentPermission? EnvironmentPermission { get; set; } + + /// The properties of any lab announcement associated with this lab. + public DevTestLabAnnouncement Announcement { get; set; } + + /// The properties of any lab support message associated with this lab. + public DevTestLabSupport Support { get; set; } + + /// The resource group in which all new lab virtual machines will be created. To let DevTest Labs manage resource group creation, set this value to null. + public string VmCreationResourceGroup { get; } + + /// The public IP address for the lab's load balancer. + public string PublicIPId { get; } + + /// The load balancer used to for lab VMs that use shared IP address. + public string LoadBalancerId { get; } + + /// The Network Security Group attached to the lab VMs Network interfaces to restrict open ports. + public string NetworkSecurityGroupId { get; } + + /// Extended properties of the lab used for experimental features. + public IDictionary ExtendedProperties { get; } = new ChangeTrackingDictionary(); + + /// The provisioning status of the resource. + public string ProvisioningState { get; } + + /// The unique immutable identifier of a resource (Guid). + public Guid? UniqueIdentifier { get; } + } +} diff --git a/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/Models/LabVhdList.Serialization.cs b/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/Models/LabVhdList.Serialization.cs index 0c27a5ead487..0d4d43a62542 100644 --- a/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/Models/LabVhdList.Serialization.cs +++ b/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/Models/LabVhdList.Serialization.cs @@ -8,17 +8,46 @@ 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; +using Azure.ResourceManager.DevTestLabs; namespace Azure.ResourceManager.DevTestLabs.Models { - internal partial class LabVhdList : IUtf8JsonSerializable, IJsonModel + /// The response of a list operation. + internal partial class LabVhdList : IJsonModel { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + /// Initializes a new instance of for deserialization. + internal LabVhdList() + { + } + /// The data to parse. + /// The client options for reading and writing models. + protected virtual LabVhdList 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 DeserializeLabVhdList(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(LabVhdList)} does not support reading '{options.Format}' format."); + } + } + + /// The to deserialize the from. + internal static LabVhdList FromResponse(Response response) + { + using JsonDocument document = JsonDocument.Parse(response.Content, ModelSerializationExtensions.JsonDocumentOptions); + return DeserializeLabVhdList(document.RootElement, ModelSerializationExtensions.WireOptions); + } + + /// The JSON writer. + /// The client options for reading and writing models. void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) { writer.WriteStartObject(); @@ -30,36 +59,32 @@ void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOption /// 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(LabVhdList)} does not support writing '{format}' format."); } - - if (Optional.IsCollectionDefined(Value)) + writer.WritePropertyName("value"u8); + writer.WriteStartArray(); + foreach (DevTestLabVhd item in Value) { - writer.WritePropertyName("value"u8); - writer.WriteStartArray(); - foreach (var item in Value) - { - ((IJsonModel)item).Write(writer, options); - } - writer.WriteEndArray(); + writer.WriteObjectValue(item, options); } + writer.WriteEndArray(); if (Optional.IsDefined(NextLink)) { writer.WritePropertyName("nextLink"u8); - writer.WriteStringValue(NextLink); + 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); } @@ -68,64 +93,70 @@ protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWrit } } - LabVhdList IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + /// The JSON reader. + /// The client options for reading and writing models. + LabVhdList IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) => JsonModelCreateCore(ref reader, options); + + /// The JSON reader. + /// The client options for reading and writing models. + protected virtual LabVhdList 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(LabVhdList)} does not support reading '{format}' format."); } - using JsonDocument document = JsonDocument.ParseValue(ref reader); return DeserializeLabVhdList(document.RootElement, options); } - internal static LabVhdList DeserializeLabVhdList(JsonElement element, ModelReaderWriterOptions options = null) + /// The JSON element to deserialize. + /// The client options for reading and writing models. + internal static LabVhdList DeserializeLabVhdList(JsonElement element, ModelReaderWriterOptions options) { - options ??= ModelSerializationExtensions.WireOptions; - if (element.ValueKind == JsonValueKind.Null) { return null; } - IReadOnlyList value = default; - string nextLink = default; - IDictionary serializedAdditionalRawData = default; - Dictionary rawDataDictionary = new Dictionary(); - foreach (var property in element.EnumerateObject()) + IList value = default; + Uri nextLink = default; + IDictionary additionalBinaryDataProperties = new ChangeTrackingDictionary(); + foreach (var prop in element.EnumerateObject()) { - if (property.NameEquals("value"u8)) + if (prop.NameEquals("value"u8)) { - if (property.Value.ValueKind == JsonValueKind.Null) + List array = new List(); + foreach (var item in prop.Value.EnumerateArray()) { - continue; - } - List array = new List(); - foreach (var item in property.Value.EnumerateArray()) - { - array.Add(ModelReaderWriter.Read(new BinaryData(Encoding.UTF8.GetBytes(item.GetRawText())), options, AzureResourceManagerDevTestLabsContext.Default)); + array.Add(DevTestLabVhd.DeserializeDevTestLabVhd(item, options)); } value = array; continue; } - if (property.NameEquals("nextLink"u8)) + if (prop.NameEquals("nextLink"u8)) { - nextLink = property.Value.GetString(); + if (prop.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + nextLink = string.IsNullOrEmpty(prop.Value.GetString()) ? null : 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 LabVhdList(value ?? new ChangeTrackingList(), nextLink, serializedAdditionalRawData); + return new LabVhdList(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": @@ -135,22 +166,11 @@ BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) } } - LabVhdList 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 DeserializeLabVhdList(document.RootElement, options); - } - default: - throw new FormatException($"The model {nameof(LabVhdList)} does not support reading '{options.Format}' format."); - } - } + /// The data to parse. + /// The client options for reading and writing models. + LabVhdList IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) => PersistableModelCreateCore(data, options); + /// The client options for reading and writing models. string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; } } diff --git a/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/Models/LabVhdList.cs b/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/Models/LabVhdList.cs index 06a31aab0ce6..6fae71090766 100644 --- a/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/Models/LabVhdList.cs +++ b/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/Models/LabVhdList.cs @@ -7,65 +7,38 @@ using System; using System.Collections.Generic; -using Azure.ResourceManager.Resources.Models; +using System.Linq; namespace Azure.ResourceManager.DevTestLabs.Models { /// The response of a list operation. internal partial class LabVhdList { - /// - /// 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 LabVhdList() + /// The LabVhd items on this page. + internal LabVhdList(IEnumerable value) { - Value = new ChangeTrackingList(); + Value = value.ToList(); } /// Initializes a new instance of . - /// Results of the list operation. - /// Link for next set of results. - /// Keeps track of any properties unknown to the library. - internal LabVhdList(IReadOnlyList value, string nextLink, IDictionary serializedAdditionalRawData) + /// The LabVhd items on this page. + /// The link to the next page of items. + /// Keeps track of any properties unknown to the library. + internal LabVhdList(IList value, Uri nextLink, IDictionary additionalBinaryDataProperties) { Value = value; NextLink = nextLink; - _serializedAdditionalRawData = serializedAdditionalRawData; + _additionalBinaryDataProperties = additionalBinaryDataProperties; } - /// Results of the list operation. - public IReadOnlyList Value { get; } - /// Link for next set of results. - public string NextLink { get; } + /// The LabVhd items on this page. + public IList Value { get; } + + /// The link to the next page of items. + public Uri NextLink { get; } } } diff --git a/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/Models/LabVirtualMachineCreationParameterProperties.Serialization.cs b/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/Models/LabVirtualMachineCreationParameterProperties.Serialization.cs new file mode 100644 index 000000000000..23a50107bd9e --- /dev/null +++ b/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/Models/LabVirtualMachineCreationParameterProperties.Serialization.cs @@ -0,0 +1,498 @@ +// 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.DevTestLabs; + +namespace Azure.ResourceManager.DevTestLabs.Models +{ + /// Properties for virtual machine creation. + internal partial class LabVirtualMachineCreationParameterProperties : IJsonModel + { + /// The data to parse. + /// The client options for reading and writing models. + protected virtual LabVirtualMachineCreationParameterProperties 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 DeserializeLabVirtualMachineCreationParameterProperties(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(LabVirtualMachineCreationParameterProperties)} does not support reading '{options.Format}' format."); + } + } + + /// 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(LabVirtualMachineCreationParameterProperties)} does not support writing '{format}' format."); + } + if (Optional.IsDefined(BulkCreationParameters)) + { + writer.WritePropertyName("bulkCreationParameters"u8); + writer.WriteObjectValue(BulkCreationParameters, options); + } + if (Optional.IsDefined(Notes)) + { + writer.WritePropertyName("notes"u8); + writer.WriteStringValue(Notes); + } + if (Optional.IsDefined(OwnerObjectId)) + { + writer.WritePropertyName("ownerObjectId"u8); + writer.WriteStringValue(OwnerObjectId); + } + if (Optional.IsDefined(OwnerUserPrincipalName)) + { + writer.WritePropertyName("ownerUserPrincipalName"u8); + writer.WriteStringValue(OwnerUserPrincipalName); + } + if (Optional.IsDefined(CreatedOn)) + { + writer.WritePropertyName("createdDate"u8); + writer.WriteStringValue(CreatedOn.Value, "O"); + } + if (Optional.IsDefined(CustomImageId)) + { + writer.WritePropertyName("customImageId"u8); + writer.WriteStringValue(CustomImageId); + } + if (Optional.IsDefined(Size)) + { + writer.WritePropertyName("size"u8); + writer.WriteStringValue(Size); + } + if (Optional.IsDefined(UserName)) + { + writer.WritePropertyName("userName"u8); + writer.WriteStringValue(UserName); + } + if (Optional.IsDefined(Password)) + { + writer.WritePropertyName("password"u8); + writer.WriteStringValue(Password); + } + if (Optional.IsDefined(SshKey)) + { + writer.WritePropertyName("sshKey"u8); + writer.WriteStringValue(SshKey); + } + if (Optional.IsDefined(IsAuthenticationWithSshKey)) + { + writer.WritePropertyName("isAuthenticationWithSshKey"u8); + writer.WriteBooleanValue(IsAuthenticationWithSshKey.Value); + } + if (Optional.IsDefined(LabSubnetName)) + { + writer.WritePropertyName("labSubnetName"u8); + writer.WriteStringValue(LabSubnetName); + } + if (Optional.IsDefined(LabVirtualNetworkId)) + { + writer.WritePropertyName("labVirtualNetworkId"u8); + writer.WriteStringValue(LabVirtualNetworkId); + } + if (Optional.IsDefined(DisallowPublicIPAddress)) + { + writer.WritePropertyName("disallowPublicIpAddress"u8); + writer.WriteBooleanValue(DisallowPublicIPAddress.Value); + } + if (Optional.IsCollectionDefined(Artifacts)) + { + writer.WritePropertyName("artifacts"u8); + writer.WriteStartArray(); + foreach (DevTestLabArtifactInstallInfo item in Artifacts) + { + writer.WriteObjectValue(item, options); + } + writer.WriteEndArray(); + } + if (Optional.IsDefined(GalleryImageReference)) + { + writer.WritePropertyName("galleryImageReference"u8); + writer.WriteObjectValue(GalleryImageReference, options); + } + if (Optional.IsDefined(PlanId)) + { + writer.WritePropertyName("planId"u8); + writer.WriteStringValue(PlanId); + } + if (Optional.IsDefined(NetworkInterface)) + { + writer.WritePropertyName("networkInterface"u8); + writer.WriteObjectValue(NetworkInterface, options); + } + if (Optional.IsDefined(ExpireOn)) + { + writer.WritePropertyName("expirationDate"u8); + writer.WriteStringValue(ExpireOn.Value, "O"); + } + if (Optional.IsDefined(AllowClaim)) + { + writer.WritePropertyName("allowClaim"u8); + writer.WriteBooleanValue(AllowClaim.Value); + } + if (Optional.IsDefined(StorageType)) + { + writer.WritePropertyName("storageType"u8); + writer.WriteStringValue(StorageType); + } + if (Optional.IsDefined(EnvironmentId)) + { + writer.WritePropertyName("environmentId"u8); + writer.WriteStringValue(EnvironmentId); + } + if (Optional.IsCollectionDefined(DataDiskParameters)) + { + writer.WritePropertyName("dataDiskParameters"u8); + writer.WriteStartArray(); + foreach (DevTestLabDataDiskProperties item in DataDiskParameters) + { + writer.WriteObjectValue(item, options); + } + writer.WriteEndArray(); + } + if (Optional.IsCollectionDefined(ScheduleParameters)) + { + writer.WritePropertyName("scheduleParameters"u8); + writer.WriteStartArray(); + foreach (DevTestLabScheduleCreationParameter item in ScheduleParameters) + { + 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); +#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. + LabVirtualMachineCreationParameterProperties IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) => JsonModelCreateCore(ref reader, options); + + /// The JSON reader. + /// The client options for reading and writing models. + protected virtual LabVirtualMachineCreationParameterProperties 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(LabVirtualMachineCreationParameterProperties)} does not support reading '{format}' format."); + } + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeLabVirtualMachineCreationParameterProperties(document.RootElement, options); + } + + /// The JSON element to deserialize. + /// The client options for reading and writing models. + internal static LabVirtualMachineCreationParameterProperties DeserializeLabVirtualMachineCreationParameterProperties(JsonElement element, ModelReaderWriterOptions options) + { + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + BulkCreationParameters bulkCreationParameters = default; + string notes = default; + string ownerObjectId = default; + string ownerUserPrincipalName = default; + DateTimeOffset? createdOn = default; + string customImageId = default; + string size = default; + string userName = default; + string password = default; + string sshKey = default; + bool? isAuthenticationWithSshKey = default; + string labSubnetName = default; + ResourceIdentifier labVirtualNetworkId = default; + bool? disallowPublicIPAddress = default; + IList artifacts = default; + DevTestLabGalleryImageReference galleryImageReference = default; + string planId = default; + DevTestLabNetworkInterface networkInterface = default; + DateTimeOffset? expireOn = default; + bool? allowClaim = default; + string storageType = default; + string environmentId = default; + IList dataDiskParameters = default; + IList scheduleParameters = default; + IDictionary additionalBinaryDataProperties = new ChangeTrackingDictionary(); + foreach (var prop in element.EnumerateObject()) + { + if (prop.NameEquals("bulkCreationParameters"u8)) + { + if (prop.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + bulkCreationParameters = BulkCreationParameters.DeserializeBulkCreationParameters(prop.Value, options); + continue; + } + if (prop.NameEquals("notes"u8)) + { + notes = prop.Value.GetString(); + continue; + } + if (prop.NameEquals("ownerObjectId"u8)) + { + ownerObjectId = prop.Value.GetString(); + continue; + } + if (prop.NameEquals("ownerUserPrincipalName"u8)) + { + ownerUserPrincipalName = prop.Value.GetString(); + continue; + } + if (prop.NameEquals("createdDate"u8)) + { + if (prop.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + createdOn = prop.Value.GetDateTimeOffset("O"); + continue; + } + if (prop.NameEquals("customImageId"u8)) + { + customImageId = prop.Value.GetString(); + continue; + } + if (prop.NameEquals("size"u8)) + { + size = prop.Value.GetString(); + continue; + } + if (prop.NameEquals("userName"u8)) + { + userName = prop.Value.GetString(); + continue; + } + if (prop.NameEquals("password"u8)) + { + password = prop.Value.GetString(); + continue; + } + if (prop.NameEquals("sshKey"u8)) + { + sshKey = prop.Value.GetString(); + continue; + } + if (prop.NameEquals("isAuthenticationWithSshKey"u8)) + { + if (prop.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + isAuthenticationWithSshKey = prop.Value.GetBoolean(); + continue; + } + if (prop.NameEquals("labSubnetName"u8)) + { + labSubnetName = prop.Value.GetString(); + continue; + } + if (prop.NameEquals("labVirtualNetworkId"u8)) + { + if (prop.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + labVirtualNetworkId = new ResourceIdentifier(prop.Value.GetString()); + continue; + } + if (prop.NameEquals("disallowPublicIpAddress"u8)) + { + if (prop.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + disallowPublicIPAddress = prop.Value.GetBoolean(); + continue; + } + if (prop.NameEquals("artifacts"u8)) + { + if (prop.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + List array = new List(); + foreach (var item in prop.Value.EnumerateArray()) + { + array.Add(DevTestLabArtifactInstallInfo.DeserializeDevTestLabArtifactInstallInfo(item, options)); + } + artifacts = array; + continue; + } + if (prop.NameEquals("galleryImageReference"u8)) + { + if (prop.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + galleryImageReference = DevTestLabGalleryImageReference.DeserializeDevTestLabGalleryImageReference(prop.Value, options); + continue; + } + if (prop.NameEquals("planId"u8)) + { + planId = prop.Value.GetString(); + continue; + } + if (prop.NameEquals("networkInterface"u8)) + { + if (prop.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + networkInterface = DevTestLabNetworkInterface.DeserializeDevTestLabNetworkInterface(prop.Value, options); + continue; + } + if (prop.NameEquals("expirationDate"u8)) + { + if (prop.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + expireOn = prop.Value.GetDateTimeOffset("O"); + continue; + } + if (prop.NameEquals("allowClaim"u8)) + { + if (prop.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + allowClaim = prop.Value.GetBoolean(); + continue; + } + if (prop.NameEquals("storageType"u8)) + { + storageType = prop.Value.GetString(); + continue; + } + if (prop.NameEquals("environmentId"u8)) + { + environmentId = prop.Value.GetString(); + continue; + } + if (prop.NameEquals("dataDiskParameters"u8)) + { + if (prop.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + List array = new List(); + foreach (var item in prop.Value.EnumerateArray()) + { + array.Add(DevTestLabDataDiskProperties.DeserializeDevTestLabDataDiskProperties(item, options)); + } + dataDiskParameters = array; + continue; + } + if (prop.NameEquals("scheduleParameters"u8)) + { + if (prop.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + List array = new List(); + foreach (var item in prop.Value.EnumerateArray()) + { + array.Add(DevTestLabScheduleCreationParameter.DeserializeDevTestLabScheduleCreationParameter(item, options)); + } + scheduleParameters = array; + continue; + } + if (options.Format != "W") + { + additionalBinaryDataProperties.Add(prop.Name, BinaryData.FromString(prop.Value.GetRawText())); + } + } + return new LabVirtualMachineCreationParameterProperties( + bulkCreationParameters, + notes, + ownerObjectId, + ownerUserPrincipalName, + createdOn, + customImageId, + size, + userName, + password, + sshKey, + isAuthenticationWithSshKey, + labSubnetName, + labVirtualNetworkId, + disallowPublicIPAddress, + artifacts ?? new ChangeTrackingList(), + galleryImageReference, + planId, + networkInterface, + expireOn, + allowClaim, + storageType, + environmentId, + dataDiskParameters ?? new ChangeTrackingList(), + scheduleParameters ?? 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, AzureResourceManagerDevTestLabsContext.Default); + default: + throw new FormatException($"The model {nameof(LabVirtualMachineCreationParameterProperties)} does not support writing '{options.Format}' format."); + } + } + + /// The data to parse. + /// The client options for reading and writing models. + LabVirtualMachineCreationParameterProperties IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) => PersistableModelCreateCore(data, options); + + /// The client options for reading and writing models. + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + } +} diff --git a/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/Models/LabVirtualMachineCreationParameterProperties.cs b/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/Models/LabVirtualMachineCreationParameterProperties.cs new file mode 100644 index 000000000000..e5801684ffcc --- /dev/null +++ b/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/Models/LabVirtualMachineCreationParameterProperties.cs @@ -0,0 +1,173 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; +using Azure.Core; +using Azure.ResourceManager.DevTestLabs; + +namespace Azure.ResourceManager.DevTestLabs.Models +{ + /// Properties for virtual machine creation. + internal partial class LabVirtualMachineCreationParameterProperties + { + /// Keeps track of any properties unknown to the library. + private protected readonly IDictionary _additionalBinaryDataProperties; + + /// Initializes a new instance of . + public LabVirtualMachineCreationParameterProperties() + { + Artifacts = new ChangeTrackingList(); + DataDiskParameters = new ChangeTrackingList(); + ScheduleParameters = new ChangeTrackingList(); + } + + /// Initializes a new instance of . + /// The number of virtual machine instances to create. + /// The notes of the virtual machine. + /// The object identifier of the owner of the virtual machine. + /// The user principal name of the virtual machine owner. + /// The creation date of the virtual machine. + /// The custom image identifier of the virtual machine. + /// The size of the virtual machine. + /// The user name of the virtual machine. + /// The password of the virtual machine administrator. + /// The SSH key of the virtual machine administrator. + /// Indicates whether this virtual machine uses an SSH key for authentication. + /// The lab subnet name of the virtual machine. + /// The lab virtual network identifier of the virtual machine. + /// Indicates whether the virtual machine is to be created without a public IP address. + /// The artifacts to be installed on the virtual machine. + /// The Microsoft Azure Marketplace image reference of the virtual machine. + /// The id of the plan associated with the virtual machine image. + /// The network interface properties. + /// The expiration date for VM. + /// Indicates whether another user can take ownership of the virtual machine. + /// Storage type to use for virtual machine (i.e. Standard, Premium). + /// The resource ID of the environment that contains this virtual machine, if any. + /// New or existing data disks to attach to the virtual machine after creation. + /// Virtual Machine schedules to be created. + /// Keeps track of any properties unknown to the library. + internal LabVirtualMachineCreationParameterProperties(BulkCreationParameters bulkCreationParameters, string notes, string ownerObjectId, string ownerUserPrincipalName, DateTimeOffset? createdOn, string customImageId, string size, string userName, string password, string sshKey, bool? isAuthenticationWithSshKey, string labSubnetName, ResourceIdentifier labVirtualNetworkId, bool? disallowPublicIPAddress, IList artifacts, DevTestLabGalleryImageReference galleryImageReference, string planId, DevTestLabNetworkInterface networkInterface, DateTimeOffset? expireOn, bool? allowClaim, string storageType, string environmentId, IList dataDiskParameters, IList scheduleParameters, IDictionary additionalBinaryDataProperties) + { + BulkCreationParameters = bulkCreationParameters; + Notes = notes; + OwnerObjectId = ownerObjectId; + OwnerUserPrincipalName = ownerUserPrincipalName; + CreatedOn = createdOn; + CustomImageId = customImageId; + Size = size; + UserName = userName; + Password = password; + SshKey = sshKey; + IsAuthenticationWithSshKey = isAuthenticationWithSshKey; + LabSubnetName = labSubnetName; + LabVirtualNetworkId = labVirtualNetworkId; + DisallowPublicIPAddress = disallowPublicIPAddress; + Artifacts = artifacts; + GalleryImageReference = galleryImageReference; + PlanId = planId; + NetworkInterface = networkInterface; + ExpireOn = expireOn; + AllowClaim = allowClaim; + StorageType = storageType; + EnvironmentId = environmentId; + DataDiskParameters = dataDiskParameters; + ScheduleParameters = scheduleParameters; + _additionalBinaryDataProperties = additionalBinaryDataProperties; + } + + /// The number of virtual machine instances to create. + internal BulkCreationParameters BulkCreationParameters { get; set; } + + /// The notes of the virtual machine. + public string Notes { get; set; } + + /// The object identifier of the owner of the virtual machine. + public string OwnerObjectId { get; set; } + + /// The user principal name of the virtual machine owner. + public string OwnerUserPrincipalName { get; set; } + + /// The creation date of the virtual machine. + public DateTimeOffset? CreatedOn { get; set; } + + /// The custom image identifier of the virtual machine. + public string CustomImageId { get; set; } + + /// The size of the virtual machine. + public string Size { get; set; } + + /// The user name of the virtual machine. + public string UserName { get; set; } + + /// The password of the virtual machine administrator. + public string Password { get; set; } + + /// The SSH key of the virtual machine administrator. + public string SshKey { get; set; } + + /// Indicates whether this virtual machine uses an SSH key for authentication. + public bool? IsAuthenticationWithSshKey { get; set; } + + /// The lab subnet name of the virtual machine. + public string LabSubnetName { get; set; } + + /// The lab virtual network identifier of the virtual machine. + public ResourceIdentifier LabVirtualNetworkId { get; set; } + + /// Indicates whether the virtual machine is to be created without a public IP address. + public bool? DisallowPublicIPAddress { get; set; } + + /// The artifacts to be installed on the virtual machine. + public IList Artifacts { get; } = new ChangeTrackingList(); + + /// The Microsoft Azure Marketplace image reference of the virtual machine. + public DevTestLabGalleryImageReference GalleryImageReference { get; set; } + + /// The id of the plan associated with the virtual machine image. + public string PlanId { get; set; } + + /// The network interface properties. + public DevTestLabNetworkInterface NetworkInterface { get; set; } + + /// The expiration date for VM. + public DateTimeOffset? ExpireOn { get; set; } + + /// Indicates whether another user can take ownership of the virtual machine. + public bool? AllowClaim { get; set; } + + /// Storage type to use for virtual machine (i.e. Standard, Premium). + public string StorageType { get; set; } + + /// The resource ID of the environment that contains this virtual machine, if any. + public string EnvironmentId { get; set; } + + /// New or existing data disks to attach to the virtual machine after creation. + public IList DataDiskParameters { get; } = new ChangeTrackingList(); + + /// Virtual Machine schedules to be created. + public IList ScheduleParameters { get; } = new ChangeTrackingList(); + + /// The number of virtual machine instances to create. + public int? BulkCreationParametersInstanceCount + { + get + { + return BulkCreationParameters is null ? default : BulkCreationParameters.InstanceCount; + } + set + { + if (BulkCreationParameters is null) + { + BulkCreationParameters = new BulkCreationParameters(); + } + BulkCreationParameters.InstanceCount = value; + } + } + } +} diff --git a/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/Models/LabVirtualMachineList.Serialization.cs b/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/Models/LabVirtualMachineList.Serialization.cs new file mode 100644 index 000000000000..81c2ae8bf2cf --- /dev/null +++ b/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/Models/LabVirtualMachineList.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; +using Azure.ResourceManager.DevTestLabs; + +namespace Azure.ResourceManager.DevTestLabs.Models +{ + /// The response of a list operation. + internal partial class LabVirtualMachineList : IJsonModel + { + /// Initializes a new instance of for deserialization. + internal LabVirtualMachineList() + { + } + + /// The data to parse. + /// The client options for reading and writing models. + protected virtual LabVirtualMachineList 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 DeserializeLabVirtualMachineList(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(LabVirtualMachineList)} does not support reading '{options.Format}' format."); + } + } + + /// The to deserialize the from. + internal static LabVirtualMachineList FromResponse(Response response) + { + using JsonDocument document = JsonDocument.Parse(response.Content, ModelSerializationExtensions.JsonDocumentOptions); + return DeserializeLabVirtualMachineList(document.RootElement, ModelSerializationExtensions.WireOptions); + } + + /// 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(LabVirtualMachineList)} does not support writing '{format}' format."); + } + writer.WritePropertyName("value"u8); + writer.WriteStartArray(); + foreach (DevTestLabVmData item in Value) + { + writer.WriteObjectValue(item, options); + } + writer.WriteEndArray(); + if (Optional.IsDefined(NextLink)) + { + writer.WritePropertyName("nextLink"u8); + writer.WriteStringValue(NextLink.AbsoluteUri); + } + if (options.Format != "W" && _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. + LabVirtualMachineList IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) => JsonModelCreateCore(ref reader, options); + + /// The JSON reader. + /// The client options for reading and writing models. + protected virtual LabVirtualMachineList 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(LabVirtualMachineList)} does not support reading '{format}' format."); + } + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeLabVirtualMachineList(document.RootElement, options); + } + + /// The JSON element to deserialize. + /// The client options for reading and writing models. + internal static LabVirtualMachineList DeserializeLabVirtualMachineList(JsonElement element, ModelReaderWriterOptions options) + { + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + IList value = default; + Uri nextLink = default; + IDictionary additionalBinaryDataProperties = new ChangeTrackingDictionary(); + foreach (var prop in element.EnumerateObject()) + { + if (prop.NameEquals("value"u8)) + { + List array = new List(); + foreach (var item in prop.Value.EnumerateArray()) + { + array.Add(DevTestLabVmData.DeserializeDevTestLabVmData(item, options)); + } + value = array; + continue; + } + if (prop.NameEquals("nextLink"u8)) + { + if (prop.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + nextLink = string.IsNullOrEmpty(prop.Value.GetString()) ? null : new Uri(prop.Value.GetString()); + continue; + } + if (options.Format != "W") + { + additionalBinaryDataProperties.Add(prop.Name, BinaryData.FromString(prop.Value.GetRawText())); + } + } + return new LabVirtualMachineList(value, nextLink, 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, AzureResourceManagerDevTestLabsContext.Default); + default: + throw new FormatException($"The model {nameof(LabVirtualMachineList)} does not support writing '{options.Format}' format."); + } + } + + /// The data to parse. + /// The client options for reading and writing models. + LabVirtualMachineList IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) => PersistableModelCreateCore(data, options); + + /// The client options for reading and writing models. + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + } +} diff --git a/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/Models/LabVirtualMachineList.cs b/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/Models/LabVirtualMachineList.cs new file mode 100644 index 000000000000..4d9008d4383c --- /dev/null +++ b/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/Models/LabVirtualMachineList.cs @@ -0,0 +1,45 @@ +// 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.ResourceManager.DevTestLabs; + +namespace Azure.ResourceManager.DevTestLabs.Models +{ + /// The response of a list operation. + internal partial class LabVirtualMachineList + { + /// Keeps track of any properties unknown to the library. + private protected readonly IDictionary _additionalBinaryDataProperties; + + /// Initializes a new instance of . + /// The LabVirtualMachine items on this page. + internal LabVirtualMachineList(IEnumerable value) + { + Value = value.ToList(); + } + + /// Initializes a new instance of . + /// The LabVirtualMachine items on this page. + /// The link to the next page of items. + /// Keeps track of any properties unknown to the library. + internal LabVirtualMachineList(IList value, Uri nextLink, IDictionary additionalBinaryDataProperties) + { + Value = value; + NextLink = nextLink; + _additionalBinaryDataProperties = additionalBinaryDataProperties; + } + + /// The LabVirtualMachine items on this page. + public IList Value { get; } + + /// The link to the next page of items. + public Uri NextLink { get; } + } +} diff --git a/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/Models/LabVirtualMachineProperties.Serialization.cs b/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/Models/LabVirtualMachineProperties.Serialization.cs new file mode 100644 index 000000000000..bf4ea56f5b7a --- /dev/null +++ b/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/Models/LabVirtualMachineProperties.Serialization.cs @@ -0,0 +1,654 @@ +// 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.DevTestLabs; + +namespace Azure.ResourceManager.DevTestLabs.Models +{ + /// Properties of a virtual machine. + internal partial class LabVirtualMachineProperties : IJsonModel + { + /// The data to parse. + /// The client options for reading and writing models. + protected virtual LabVirtualMachineProperties 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 DeserializeLabVirtualMachineProperties(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(LabVirtualMachineProperties)} does not support reading '{options.Format}' format."); + } + } + + /// 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(LabVirtualMachineProperties)} does not support writing '{format}' format."); + } + if (Optional.IsDefined(Notes)) + { + writer.WritePropertyName("notes"u8); + writer.WriteStringValue(Notes); + } + if (Optional.IsDefined(OwnerObjectId)) + { + writer.WritePropertyName("ownerObjectId"u8); + writer.WriteStringValue(OwnerObjectId); + } + if (Optional.IsDefined(OwnerUserPrincipalName)) + { + writer.WritePropertyName("ownerUserPrincipalName"u8); + writer.WriteStringValue(OwnerUserPrincipalName); + } + if (options.Format != "W" && Optional.IsDefined(CreatedByUserId)) + { + writer.WritePropertyName("createdByUserId"u8); + writer.WriteStringValue(CreatedByUserId); + } + if (options.Format != "W" && Optional.IsDefined(CreatedByUser)) + { + writer.WritePropertyName("createdByUser"u8); + writer.WriteStringValue(CreatedByUser); + } + if (Optional.IsDefined(CreatedOn)) + { + writer.WritePropertyName("createdDate"u8); + writer.WriteStringValue(CreatedOn.Value, "O"); + } + if (options.Format != "W" && Optional.IsDefined(ComputeId)) + { + writer.WritePropertyName("computeId"u8); + writer.WriteStringValue(ComputeId); + } + if (Optional.IsDefined(CustomImageId)) + { + writer.WritePropertyName("customImageId"u8); + writer.WriteStringValue(CustomImageId); + } + if (options.Format != "W" && Optional.IsDefined(OSType)) + { + writer.WritePropertyName("osType"u8); + writer.WriteStringValue(OSType); + } + if (Optional.IsDefined(Size)) + { + writer.WritePropertyName("size"u8); + writer.WriteStringValue(Size); + } + if (Optional.IsDefined(UserName)) + { + writer.WritePropertyName("userName"u8); + writer.WriteStringValue(UserName); + } + if (Optional.IsDefined(Password)) + { + writer.WritePropertyName("password"u8); + writer.WriteStringValue(Password); + } + if (Optional.IsDefined(SshKey)) + { + writer.WritePropertyName("sshKey"u8); + writer.WriteStringValue(SshKey); + } + if (Optional.IsDefined(IsAuthenticationWithSshKey)) + { + writer.WritePropertyName("isAuthenticationWithSshKey"u8); + writer.WriteBooleanValue(IsAuthenticationWithSshKey.Value); + } + if (options.Format != "W" && Optional.IsDefined(Fqdn)) + { + writer.WritePropertyName("fqdn"u8); + writer.WriteStringValue(Fqdn); + } + if (Optional.IsDefined(LabSubnetName)) + { + writer.WritePropertyName("labSubnetName"u8); + writer.WriteStringValue(LabSubnetName); + } + if (Optional.IsDefined(LabVirtualNetworkId)) + { + writer.WritePropertyName("labVirtualNetworkId"u8); + writer.WriteStringValue(LabVirtualNetworkId); + } + if (Optional.IsDefined(DisallowPublicIPAddress)) + { + writer.WritePropertyName("disallowPublicIpAddress"u8); + writer.WriteBooleanValue(DisallowPublicIPAddress.Value); + } + if (Optional.IsCollectionDefined(Artifacts)) + { + writer.WritePropertyName("artifacts"u8); + writer.WriteStartArray(); + foreach (DevTestLabArtifactInstallInfo item in Artifacts) + { + writer.WriteObjectValue(item, options); + } + writer.WriteEndArray(); + } + if (options.Format != "W" && Optional.IsDefined(ArtifactDeploymentStatus)) + { + writer.WritePropertyName("artifactDeploymentStatus"u8); + writer.WriteObjectValue(ArtifactDeploymentStatus, options); + } + if (Optional.IsDefined(GalleryImageReference)) + { + writer.WritePropertyName("galleryImageReference"u8); + writer.WriteObjectValue(GalleryImageReference, options); + } + if (Optional.IsDefined(PlanId)) + { + writer.WritePropertyName("planId"u8); + writer.WriteStringValue(PlanId); + } + if (options.Format != "W" && Optional.IsDefined(ComputeVm)) + { + writer.WritePropertyName("computeVm"u8); + writer.WriteObjectValue(ComputeVm, options); + } + if (Optional.IsDefined(NetworkInterface)) + { + writer.WritePropertyName("networkInterface"u8); + writer.WriteObjectValue(NetworkInterface, options); + } + if (options.Format != "W" && Optional.IsDefined(ApplicableSchedule)) + { + writer.WritePropertyName("applicableSchedule"u8); + writer.WriteObjectValue(ApplicableSchedule, options); + } + if (Optional.IsDefined(ExpireOn)) + { + writer.WritePropertyName("expirationDate"u8); + writer.WriteStringValue(ExpireOn.Value, "O"); + } + if (Optional.IsDefined(AllowClaim)) + { + writer.WritePropertyName("allowClaim"u8); + writer.WriteBooleanValue(AllowClaim.Value); + } + if (Optional.IsDefined(StorageType)) + { + writer.WritePropertyName("storageType"u8); + writer.WriteStringValue(StorageType); + } + if (options.Format != "W" && Optional.IsDefined(VmCreationSource)) + { + writer.WritePropertyName("virtualMachineCreationSource"u8); + writer.WriteStringValue(VmCreationSource.Value.ToString()); + } + if (Optional.IsDefined(EnvironmentId)) + { + writer.WritePropertyName("environmentId"u8); + writer.WriteStringValue(EnvironmentId); + } + if (Optional.IsCollectionDefined(DataDiskParameters)) + { + writer.WritePropertyName("dataDiskParameters"u8); + writer.WriteStartArray(); + foreach (DevTestLabDataDiskProperties item in DataDiskParameters) + { + writer.WriteObjectValue(item, options); + } + writer.WriteEndArray(); + } + if (Optional.IsCollectionDefined(ScheduleParameters)) + { + writer.WritePropertyName("scheduleParameters"u8); + writer.WriteStartArray(); + foreach (DevTestLabScheduleCreationParameter item in ScheduleParameters) + { + writer.WriteObjectValue(item, options); + } + writer.WriteEndArray(); + } + if (options.Format != "W" && Optional.IsDefined(LastKnownPowerState)) + { + writer.WritePropertyName("lastKnownPowerState"u8); + writer.WriteStringValue(LastKnownPowerState); + } + if (options.Format != "W" && Optional.IsDefined(ProvisioningState)) + { + writer.WritePropertyName("provisioningState"u8); + writer.WriteStringValue(ProvisioningState); + } + if (options.Format != "W" && Optional.IsDefined(UniqueIdentifier)) + { + writer.WritePropertyName("uniqueIdentifier"u8); + writer.WriteStringValue(UniqueIdentifier.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. + LabVirtualMachineProperties IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) => JsonModelCreateCore(ref reader, options); + + /// The JSON reader. + /// The client options for reading and writing models. + protected virtual LabVirtualMachineProperties 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(LabVirtualMachineProperties)} does not support reading '{format}' format."); + } + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeLabVirtualMachineProperties(document.RootElement, options); + } + + /// The JSON element to deserialize. + /// The client options for reading and writing models. + internal static LabVirtualMachineProperties DeserializeLabVirtualMachineProperties(JsonElement element, ModelReaderWriterOptions options) + { + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + string notes = default; + string ownerObjectId = default; + string ownerUserPrincipalName = default; + string createdByUserId = default; + string createdByUser = default; + DateTimeOffset? createdOn = default; + ResourceIdentifier computeId = default; + string customImageId = default; + string osType = default; + string size = default; + string userName = default; + string password = default; + string sshKey = default; + bool? isAuthenticationWithSshKey = default; + string fqdn = default; + string labSubnetName = default; + ResourceIdentifier labVirtualNetworkId = default; + bool? disallowPublicIPAddress = default; + IList artifacts = default; + DevTestLabArtifactDeploymentStatus artifactDeploymentStatus = default; + DevTestLabGalleryImageReference galleryImageReference = default; + string planId = default; + ComputeVmProperties computeVm = default; + DevTestLabNetworkInterface networkInterface = default; + DevTestLabApplicableSchedule applicableSchedule = default; + DateTimeOffset? expireOn = default; + bool? allowClaim = default; + string storageType = default; + DevTestLabVmCreationSource? vmCreationSource = default; + ResourceIdentifier environmentId = default; + IList dataDiskParameters = default; + IList scheduleParameters = default; + string lastKnownPowerState = default; + string provisioningState = default; + Guid? uniqueIdentifier = default; + IDictionary additionalBinaryDataProperties = new ChangeTrackingDictionary(); + foreach (var prop in element.EnumerateObject()) + { + if (prop.NameEquals("notes"u8)) + { + notes = prop.Value.GetString(); + continue; + } + if (prop.NameEquals("ownerObjectId"u8)) + { + ownerObjectId = prop.Value.GetString(); + continue; + } + if (prop.NameEquals("ownerUserPrincipalName"u8)) + { + ownerUserPrincipalName = prop.Value.GetString(); + continue; + } + if (prop.NameEquals("createdByUserId"u8)) + { + createdByUserId = prop.Value.GetString(); + continue; + } + if (prop.NameEquals("createdByUser"u8)) + { + createdByUser = prop.Value.GetString(); + continue; + } + if (prop.NameEquals("createdDate"u8)) + { + if (prop.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + createdOn = prop.Value.GetDateTimeOffset("O"); + continue; + } + if (prop.NameEquals("computeId"u8)) + { + if (prop.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + computeId = new ResourceIdentifier(prop.Value.GetString()); + continue; + } + if (prop.NameEquals("customImageId"u8)) + { + customImageId = prop.Value.GetString(); + continue; + } + if (prop.NameEquals("osType"u8)) + { + osType = prop.Value.GetString(); + continue; + } + if (prop.NameEquals("size"u8)) + { + size = prop.Value.GetString(); + continue; + } + if (prop.NameEquals("userName"u8)) + { + userName = prop.Value.GetString(); + continue; + } + if (prop.NameEquals("password"u8)) + { + password = prop.Value.GetString(); + continue; + } + if (prop.NameEquals("sshKey"u8)) + { + sshKey = prop.Value.GetString(); + continue; + } + if (prop.NameEquals("isAuthenticationWithSshKey"u8)) + { + if (prop.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + isAuthenticationWithSshKey = prop.Value.GetBoolean(); + continue; + } + if (prop.NameEquals("fqdn"u8)) + { + fqdn = prop.Value.GetString(); + continue; + } + if (prop.NameEquals("labSubnetName"u8)) + { + labSubnetName = prop.Value.GetString(); + continue; + } + if (prop.NameEquals("labVirtualNetworkId"u8)) + { + if (prop.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + labVirtualNetworkId = new ResourceIdentifier(prop.Value.GetString()); + continue; + } + if (prop.NameEquals("disallowPublicIpAddress"u8)) + { + if (prop.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + disallowPublicIPAddress = prop.Value.GetBoolean(); + continue; + } + if (prop.NameEquals("artifacts"u8)) + { + if (prop.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + List array = new List(); + foreach (var item in prop.Value.EnumerateArray()) + { + array.Add(DevTestLabArtifactInstallInfo.DeserializeDevTestLabArtifactInstallInfo(item, options)); + } + artifacts = array; + continue; + } + if (prop.NameEquals("artifactDeploymentStatus"u8)) + { + if (prop.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + artifactDeploymentStatus = DevTestLabArtifactDeploymentStatus.DeserializeDevTestLabArtifactDeploymentStatus(prop.Value, options); + continue; + } + if (prop.NameEquals("galleryImageReference"u8)) + { + if (prop.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + galleryImageReference = DevTestLabGalleryImageReference.DeserializeDevTestLabGalleryImageReference(prop.Value, options); + continue; + } + if (prop.NameEquals("planId"u8)) + { + planId = prop.Value.GetString(); + continue; + } + if (prop.NameEquals("computeVm"u8)) + { + if (prop.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + computeVm = ComputeVmProperties.DeserializeComputeVmProperties(prop.Value, options); + continue; + } + if (prop.NameEquals("networkInterface"u8)) + { + if (prop.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + networkInterface = DevTestLabNetworkInterface.DeserializeDevTestLabNetworkInterface(prop.Value, options); + continue; + } + if (prop.NameEquals("applicableSchedule"u8)) + { + if (prop.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + applicableSchedule = DevTestLabApplicableSchedule.DeserializeDevTestLabApplicableSchedule(prop.Value, options); + continue; + } + if (prop.NameEquals("expirationDate"u8)) + { + if (prop.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + expireOn = prop.Value.GetDateTimeOffset("O"); + continue; + } + if (prop.NameEquals("allowClaim"u8)) + { + if (prop.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + allowClaim = prop.Value.GetBoolean(); + continue; + } + if (prop.NameEquals("storageType"u8)) + { + storageType = prop.Value.GetString(); + continue; + } + if (prop.NameEquals("virtualMachineCreationSource"u8)) + { + if (prop.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + vmCreationSource = new DevTestLabVmCreationSource(prop.Value.GetString()); + continue; + } + if (prop.NameEquals("environmentId"u8)) + { + if (prop.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + environmentId = new ResourceIdentifier(prop.Value.GetString()); + continue; + } + if (prop.NameEquals("dataDiskParameters"u8)) + { + if (prop.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + List array = new List(); + foreach (var item in prop.Value.EnumerateArray()) + { + array.Add(DevTestLabDataDiskProperties.DeserializeDevTestLabDataDiskProperties(item, options)); + } + dataDiskParameters = array; + continue; + } + if (prop.NameEquals("scheduleParameters"u8)) + { + if (prop.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + List array = new List(); + foreach (var item in prop.Value.EnumerateArray()) + { + array.Add(DevTestLabScheduleCreationParameter.DeserializeDevTestLabScheduleCreationParameter(item, options)); + } + scheduleParameters = array; + continue; + } + if (prop.NameEquals("lastKnownPowerState"u8)) + { + lastKnownPowerState = prop.Value.GetString(); + continue; + } + if (prop.NameEquals("provisioningState"u8)) + { + provisioningState = prop.Value.GetString(); + continue; + } + if (prop.NameEquals("uniqueIdentifier"u8)) + { + if (prop.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + uniqueIdentifier = new Guid(prop.Value.GetString()); + continue; + } + if (options.Format != "W") + { + additionalBinaryDataProperties.Add(prop.Name, BinaryData.FromString(prop.Value.GetRawText())); + } + } + return new LabVirtualMachineProperties( + notes, + ownerObjectId, + ownerUserPrincipalName, + createdByUserId, + createdByUser, + createdOn, + computeId, + customImageId, + osType, + size, + userName, + password, + sshKey, + isAuthenticationWithSshKey, + fqdn, + labSubnetName, + labVirtualNetworkId, + disallowPublicIPAddress, + artifacts ?? new ChangeTrackingList(), + artifactDeploymentStatus, + galleryImageReference, + planId, + computeVm, + networkInterface, + applicableSchedule, + expireOn, + allowClaim, + storageType, + vmCreationSource, + environmentId, + dataDiskParameters ?? new ChangeTrackingList(), + scheduleParameters ?? new ChangeTrackingList(), + lastKnownPowerState, + provisioningState, + uniqueIdentifier, + 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, AzureResourceManagerDevTestLabsContext.Default); + default: + throw new FormatException($"The model {nameof(LabVirtualMachineProperties)} does not support writing '{options.Format}' format."); + } + } + + /// The data to parse. + /// The client options for reading and writing models. + LabVirtualMachineProperties IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) => PersistableModelCreateCore(data, options); + + /// The client options for reading and writing models. + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + } +} diff --git a/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/Models/LabVirtualMachineProperties.cs b/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/Models/LabVirtualMachineProperties.cs new file mode 100644 index 000000000000..276eacd77821 --- /dev/null +++ b/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/Models/LabVirtualMachineProperties.cs @@ -0,0 +1,211 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; +using Azure.Core; +using Azure.ResourceManager.DevTestLabs; + +namespace Azure.ResourceManager.DevTestLabs.Models +{ + /// Properties of a virtual machine. + internal partial class LabVirtualMachineProperties + { + /// Keeps track of any properties unknown to the library. + private protected readonly IDictionary _additionalBinaryDataProperties; + + /// Initializes a new instance of . + public LabVirtualMachineProperties() + { + Artifacts = new ChangeTrackingList(); + DataDiskParameters = new ChangeTrackingList(); + ScheduleParameters = new ChangeTrackingList(); + } + + /// Initializes a new instance of . + /// The notes of the virtual machine. + /// The object identifier of the owner of the virtual machine. + /// The user principal name of the virtual machine owner. + /// The object identifier of the creator of the virtual machine. + /// The email address of creator of the virtual machine. + /// The creation date of the virtual machine. + /// The resource identifier (Microsoft.Compute) of the virtual machine. + /// The custom image identifier of the virtual machine. + /// The OS type of the virtual machine. + /// The size of the virtual machine. + /// The user name of the virtual machine. + /// The password of the virtual machine administrator. + /// The SSH key of the virtual machine administrator. + /// Indicates whether this virtual machine uses an SSH key for authentication. + /// The fully-qualified domain name of the virtual machine. + /// The lab subnet name of the virtual machine. + /// The lab virtual network identifier of the virtual machine. + /// Indicates whether the virtual machine is to be created without a public IP address. + /// The artifacts to be installed on the virtual machine. + /// The artifact deployment status for the virtual machine. + /// The Microsoft Azure Marketplace image reference of the virtual machine. + /// The id of the plan associated with the virtual machine image. + /// The compute virtual machine properties. + /// The network interface properties. + /// The applicable schedule for the virtual machine. + /// The expiration date for VM. + /// Indicates whether another user can take ownership of the virtual machine. + /// Storage type to use for virtual machine (i.e. Standard, Premium). + /// Tells source of creation of lab virtual machine. Output property only. + /// The resource ID of the environment that contains this virtual machine, if any. + /// New or existing data disks to attach to the virtual machine after creation. + /// Virtual Machine schedules to be created. + /// Last known compute power state captured in DTL. + /// The provisioning status of the resource. + /// The unique immutable identifier of a resource (Guid). + /// Keeps track of any properties unknown to the library. + internal LabVirtualMachineProperties(string notes, string ownerObjectId, string ownerUserPrincipalName, string createdByUserId, string createdByUser, DateTimeOffset? createdOn, ResourceIdentifier computeId, string customImageId, string osType, string size, string userName, string password, string sshKey, bool? isAuthenticationWithSshKey, string fqdn, string labSubnetName, ResourceIdentifier labVirtualNetworkId, bool? disallowPublicIPAddress, IList artifacts, DevTestLabArtifactDeploymentStatus artifactDeploymentStatus, DevTestLabGalleryImageReference galleryImageReference, string planId, ComputeVmProperties computeVm, DevTestLabNetworkInterface networkInterface, DevTestLabApplicableSchedule applicableSchedule, DateTimeOffset? expireOn, bool? allowClaim, string storageType, DevTestLabVmCreationSource? vmCreationSource, ResourceIdentifier environmentId, IList dataDiskParameters, IList scheduleParameters, string lastKnownPowerState, string provisioningState, Guid? uniqueIdentifier, IDictionary additionalBinaryDataProperties) + { + Notes = notes; + OwnerObjectId = ownerObjectId; + OwnerUserPrincipalName = ownerUserPrincipalName; + CreatedByUserId = createdByUserId; + CreatedByUser = createdByUser; + CreatedOn = createdOn; + ComputeId = computeId; + CustomImageId = customImageId; + OSType = osType; + Size = size; + UserName = userName; + Password = password; + SshKey = sshKey; + IsAuthenticationWithSshKey = isAuthenticationWithSshKey; + Fqdn = fqdn; + LabSubnetName = labSubnetName; + LabVirtualNetworkId = labVirtualNetworkId; + DisallowPublicIPAddress = disallowPublicIPAddress; + Artifacts = artifacts; + ArtifactDeploymentStatus = artifactDeploymentStatus; + GalleryImageReference = galleryImageReference; + PlanId = planId; + ComputeVm = computeVm; + NetworkInterface = networkInterface; + ApplicableSchedule = applicableSchedule; + ExpireOn = expireOn; + AllowClaim = allowClaim; + StorageType = storageType; + VmCreationSource = vmCreationSource; + EnvironmentId = environmentId; + DataDiskParameters = dataDiskParameters; + ScheduleParameters = scheduleParameters; + LastKnownPowerState = lastKnownPowerState; + ProvisioningState = provisioningState; + UniqueIdentifier = uniqueIdentifier; + _additionalBinaryDataProperties = additionalBinaryDataProperties; + } + + /// The notes of the virtual machine. + public string Notes { get; set; } + + /// The object identifier of the owner of the virtual machine. + public string OwnerObjectId { get; set; } + + /// The user principal name of the virtual machine owner. + public string OwnerUserPrincipalName { get; set; } + + /// The object identifier of the creator of the virtual machine. + public string CreatedByUserId { get; } + + /// The email address of creator of the virtual machine. + public string CreatedByUser { get; } + + /// The creation date of the virtual machine. + public DateTimeOffset? CreatedOn { get; set; } + + /// The resource identifier (Microsoft.Compute) of the virtual machine. + public ResourceIdentifier ComputeId { get; } + + /// The custom image identifier of the virtual machine. + public string CustomImageId { get; set; } + + /// The OS type of the virtual machine. + public string OSType { get; } + + /// The size of the virtual machine. + public string Size { get; set; } + + /// The user name of the virtual machine. + public string UserName { get; set; } + + /// The password of the virtual machine administrator. + public string Password { get; set; } + + /// The SSH key of the virtual machine administrator. + public string SshKey { get; set; } + + /// Indicates whether this virtual machine uses an SSH key for authentication. + public bool? IsAuthenticationWithSshKey { get; set; } + + /// The fully-qualified domain name of the virtual machine. + public string Fqdn { get; } + + /// The lab subnet name of the virtual machine. + public string LabSubnetName { get; set; } + + /// The lab virtual network identifier of the virtual machine. + public ResourceIdentifier LabVirtualNetworkId { get; set; } + + /// Indicates whether the virtual machine is to be created without a public IP address. + public bool? DisallowPublicIPAddress { get; set; } + + /// The artifacts to be installed on the virtual machine. + public IList Artifacts { get; } = new ChangeTrackingList(); + + /// The artifact deployment status for the virtual machine. + public DevTestLabArtifactDeploymentStatus ArtifactDeploymentStatus { get; } + + /// The Microsoft Azure Marketplace image reference of the virtual machine. + public DevTestLabGalleryImageReference GalleryImageReference { get; set; } + + /// The id of the plan associated with the virtual machine image. + public string PlanId { get; set; } + + /// The compute virtual machine properties. + public ComputeVmProperties ComputeVm { get; } + + /// The network interface properties. + public DevTestLabNetworkInterface NetworkInterface { get; set; } + + /// The applicable schedule for the virtual machine. + public DevTestLabApplicableSchedule ApplicableSchedule { get; } + + /// The expiration date for VM. + public DateTimeOffset? ExpireOn { get; set; } + + /// Indicates whether another user can take ownership of the virtual machine. + public bool? AllowClaim { get; set; } + + /// Storage type to use for virtual machine (i.e. Standard, Premium). + public string StorageType { get; set; } + + /// Tells source of creation of lab virtual machine. Output property only. + public DevTestLabVmCreationSource? VmCreationSource { get; } + + /// The resource ID of the environment that contains this virtual machine, if any. + public ResourceIdentifier EnvironmentId { get; set; } + + /// New or existing data disks to attach to the virtual machine after creation. + public IList DataDiskParameters { get; } = new ChangeTrackingList(); + + /// Virtual Machine schedules to be created. + public IList ScheduleParameters { get; } = new ChangeTrackingList(); + + /// Last known compute power state captured in DTL. + public string LastKnownPowerState { get; } + + /// The provisioning status of the resource. + public string ProvisioningState { get; } + + /// The unique immutable identifier of a resource (Guid). + public Guid? UniqueIdentifier { get; } + } +} diff --git a/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/Models/LabVmList.Serialization.cs b/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/Models/LabVmList.Serialization.cs deleted file mode 100644 index f69fc190bb62..000000000000 --- a/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/Models/LabVmList.Serialization.cs +++ /dev/null @@ -1,154 +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.DevTestLabs.Models -{ - internal partial class LabVmList : 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(LabVmList)} does not support writing '{format}' format."); - } - - if (Optional.IsCollectionDefined(Value)) - { - writer.WritePropertyName("value"u8); - writer.WriteStartArray(); - foreach (var item in Value) - { - writer.WriteObjectValue(item, options); - } - writer.WriteEndArray(); - } - if (Optional.IsDefined(NextLink)) - { - writer.WritePropertyName("nextLink"u8); - writer.WriteStringValue(NextLink); - } - if (options.Format != "W" && _serializedAdditionalRawData != null) - { - foreach (var item in _serializedAdditionalRawData) - { - writer.WritePropertyName(item.Key); -#if NET6_0_OR_GREATER - writer.WriteRawValue(item.Value); -#else - using (JsonDocument document = JsonDocument.Parse(item.Value, ModelSerializationExtensions.JsonDocumentOptions)) - { - JsonSerializer.Serialize(writer, document.RootElement); - } -#endif - } - } - } - - LabVmList 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(LabVmList)} does not support reading '{format}' format."); - } - - using JsonDocument document = JsonDocument.ParseValue(ref reader); - return DeserializeLabVmList(document.RootElement, options); - } - - internal static LabVmList DeserializeLabVmList(JsonElement element, ModelReaderWriterOptions options = null) - { - options ??= ModelSerializationExtensions.WireOptions; - - if (element.ValueKind == JsonValueKind.Null) - { - return null; - } - IReadOnlyList value = default; - string nextLink = default; - IDictionary serializedAdditionalRawData = default; - Dictionary rawDataDictionary = new Dictionary(); - foreach (var property in element.EnumerateObject()) - { - if (property.NameEquals("value"u8)) - { - if (property.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - List array = new List(); - foreach (var item in property.Value.EnumerateArray()) - { - array.Add(DevTestLabVmData.DeserializeDevTestLabVmData(item, options)); - } - value = array; - continue; - } - if (property.NameEquals("nextLink"u8)) - { - nextLink = property.Value.GetString(); - continue; - } - if (options.Format != "W") - { - rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); - } - } - serializedAdditionalRawData = rawDataDictionary; - return new LabVmList(value ?? new ChangeTrackingList(), nextLink, 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, AzureResourceManagerDevTestLabsContext.Default); - default: - throw new FormatException($"The model {nameof(LabVmList)} does not support writing '{options.Format}' format."); - } - } - - LabVmList 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 DeserializeLabVmList(document.RootElement, options); - } - default: - throw new FormatException($"The model {nameof(LabVmList)} does not support reading '{options.Format}' format."); - } - } - - string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; - } -} diff --git a/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/Models/LabVmList.cs b/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/Models/LabVmList.cs deleted file mode 100644 index 3a523c69db1b..000000000000 --- a/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/Models/LabVmList.cs +++ /dev/null @@ -1,70 +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.DevTestLabs.Models -{ - /// The response of a list operation. - internal partial class LabVmList - { - /// - /// Keeps track of any properties unknown to the library. - /// - /// To assign an object to the value of this property use . - /// - /// - /// To assign an already formatted json string to this property use . - /// - /// - /// Examples: - /// - /// - /// BinaryData.FromObjectAsJson("foo") - /// Creates a payload of "foo". - /// - /// - /// BinaryData.FromString("\"foo\"") - /// Creates a payload of "foo". - /// - /// - /// BinaryData.FromObjectAsJson(new { key = "value" }) - /// Creates a payload of { "key": "value" }. - /// - /// - /// BinaryData.FromString("{\"key\": \"value\"}") - /// Creates a payload of { "key": "value" }. - /// - /// - /// - /// - private IDictionary _serializedAdditionalRawData; - - /// Initializes a new instance of . - internal LabVmList() - { - Value = new ChangeTrackingList(); - } - - /// Initializes a new instance of . - /// Results of the list operation. - /// Link for next set of results. - /// Keeps track of any properties unknown to the library. - internal LabVmList(IReadOnlyList value, string nextLink, IDictionary serializedAdditionalRawData) - { - Value = value; - NextLink = nextLink; - _serializedAdditionalRawData = serializedAdditionalRawData; - } - - /// Results of the list operation. - public IReadOnlyList Value { get; } - /// Link for next set of results. - public string NextLink { get; } - } -} diff --git a/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/Models/LinuxOSInfo.Serialization.cs b/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/Models/LinuxOSInfo.Serialization.cs deleted file mode 100644 index 04375c5868a4..000000000000 --- a/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/Models/LinuxOSInfo.Serialization.cs +++ /dev/null @@ -1,133 +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.DevTestLabs.Models -{ - internal partial class LinuxOSInfo : 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(LinuxOSInfo)} does not support writing '{format}' format."); - } - - if (Optional.IsDefined(LinuxOSState)) - { - writer.WritePropertyName("linuxOsState"u8); - writer.WriteStringValue(LinuxOSState.Value.ToString()); - } - if (options.Format != "W" && _serializedAdditionalRawData != null) - { - foreach (var item in _serializedAdditionalRawData) - { - writer.WritePropertyName(item.Key); -#if NET6_0_OR_GREATER - writer.WriteRawValue(item.Value); -#else - using (JsonDocument document = JsonDocument.Parse(item.Value, ModelSerializationExtensions.JsonDocumentOptions)) - { - JsonSerializer.Serialize(writer, document.RootElement); - } -#endif - } - } - } - - LinuxOSInfo 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(LinuxOSInfo)} does not support reading '{format}' format."); - } - - using JsonDocument document = JsonDocument.ParseValue(ref reader); - return DeserializeLinuxOSInfo(document.RootElement, options); - } - - internal static LinuxOSInfo DeserializeLinuxOSInfo(JsonElement element, ModelReaderWriterOptions options = null) - { - options ??= ModelSerializationExtensions.WireOptions; - - if (element.ValueKind == JsonValueKind.Null) - { - return null; - } - DevTestLabLinuxOSState? linuxOSState = default; - IDictionary serializedAdditionalRawData = default; - Dictionary rawDataDictionary = new Dictionary(); - foreach (var property in element.EnumerateObject()) - { - if (property.NameEquals("linuxOsState"u8)) - { - if (property.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - linuxOSState = new DevTestLabLinuxOSState(property.Value.GetString()); - continue; - } - if (options.Format != "W") - { - rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); - } - } - serializedAdditionalRawData = rawDataDictionary; - return new LinuxOSInfo(linuxOSState, 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, AzureResourceManagerDevTestLabsContext.Default); - default: - throw new FormatException($"The model {nameof(LinuxOSInfo)} does not support writing '{options.Format}' format."); - } - } - - LinuxOSInfo 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 DeserializeLinuxOSInfo(document.RootElement, options); - } - default: - throw new FormatException($"The model {nameof(LinuxOSInfo)} does not support reading '{options.Format}' format."); - } - } - - string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; - } -} diff --git a/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/Models/LinuxOSInfo.cs b/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/Models/LinuxOSInfo.cs deleted file mode 100644 index a9ab522cd623..000000000000 --- a/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/Models/LinuxOSInfo.cs +++ /dev/null @@ -1,65 +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.DevTestLabs.Models -{ - /// Information about a Linux OS. - internal partial class LinuxOSInfo - { - /// - /// 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 LinuxOSInfo() - { - } - - /// Initializes a new instance of . - /// The state of the Linux OS (i.e. NonDeprovisioned, DeprovisionRequested, DeprovisionApplied). - /// Keeps track of any properties unknown to the library. - internal LinuxOSInfo(DevTestLabLinuxOSState? linuxOSState, IDictionary serializedAdditionalRawData) - { - LinuxOSState = linuxOSState; - _serializedAdditionalRawData = serializedAdditionalRawData; - } - - /// The state of the Linux OS (i.e. NonDeprovisioned, DeprovisionRequested, DeprovisionApplied). - public DevTestLabLinuxOSState? LinuxOSState { get; set; } - } -} diff --git a/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/Models/NotificationChannelList.Serialization.cs b/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/Models/NotificationChannelList.Serialization.cs index 21e985a55037..bf57a8ce3318 100644 --- a/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/Models/NotificationChannelList.Serialization.cs +++ b/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/Models/NotificationChannelList.Serialization.cs @@ -9,14 +9,45 @@ using System.ClientModel.Primitives; using System.Collections.Generic; using System.Text.Json; -using Azure.Core; +using Azure; +using Azure.ResourceManager.DevTestLabs; namespace Azure.ResourceManager.DevTestLabs.Models { - internal partial class NotificationChannelList : IUtf8JsonSerializable, IJsonModel + /// The response of a list operation. + internal partial class NotificationChannelList : IJsonModel { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + /// Initializes a new instance of for deserialization. + internal NotificationChannelList() + { + } + /// The data to parse. + /// The client options for reading and writing models. + protected virtual NotificationChannelList 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 DeserializeNotificationChannelList(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(NotificationChannelList)} does not support reading '{options.Format}' format."); + } + } + + /// The to deserialize the from. + internal static NotificationChannelList FromResponse(Response response) + { + using JsonDocument document = JsonDocument.Parse(response.Content, ModelSerializationExtensions.JsonDocumentOptions); + return DeserializeNotificationChannelList(document.RootElement, ModelSerializationExtensions.WireOptions); + } + + /// The JSON writer. + /// The client options for reading and writing models. void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) { writer.WriteStartObject(); @@ -28,36 +59,32 @@ void IJsonModel.Write(Utf8JsonWriter writer, ModelReade /// 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(NotificationChannelList)} does not support writing '{format}' format."); } - - if (Optional.IsCollectionDefined(Value)) + writer.WritePropertyName("value"u8); + writer.WriteStartArray(); + foreach (DevTestLabNotificationChannelData item in Value) { - writer.WritePropertyName("value"u8); - writer.WriteStartArray(); - foreach (var item in Value) - { - writer.WriteObjectValue(item, options); - } - writer.WriteEndArray(); + writer.WriteObjectValue(item, options); } + writer.WriteEndArray(); if (Optional.IsDefined(NextLink)) { writer.WritePropertyName("nextLink"u8); - writer.WriteStringValue(NextLink); + 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); } @@ -66,64 +93,70 @@ protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWrit } } - NotificationChannelList IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + /// The JSON reader. + /// The client options for reading and writing models. + NotificationChannelList IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) => JsonModelCreateCore(ref reader, options); + + /// The JSON reader. + /// The client options for reading and writing models. + protected virtual NotificationChannelList 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(NotificationChannelList)} does not support reading '{format}' format."); } - using JsonDocument document = JsonDocument.ParseValue(ref reader); return DeserializeNotificationChannelList(document.RootElement, options); } - internal static NotificationChannelList DeserializeNotificationChannelList(JsonElement element, ModelReaderWriterOptions options = null) + /// The JSON element to deserialize. + /// The client options for reading and writing models. + internal static NotificationChannelList DeserializeNotificationChannelList(JsonElement element, ModelReaderWriterOptions options) { - options ??= ModelSerializationExtensions.WireOptions; - if (element.ValueKind == JsonValueKind.Null) { return null; } - IReadOnlyList value = default; - string nextLink = default; - IDictionary serializedAdditionalRawData = default; - Dictionary rawDataDictionary = new Dictionary(); - foreach (var property in element.EnumerateObject()) + IList value = default; + Uri nextLink = default; + IDictionary additionalBinaryDataProperties = new ChangeTrackingDictionary(); + foreach (var prop in element.EnumerateObject()) { - if (property.NameEquals("value"u8)) + if (prop.NameEquals("value"u8)) { - if (property.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(DevTestLabNotificationChannelData.DeserializeDevTestLabNotificationChannelData(item, options)); } value = array; continue; } - if (property.NameEquals("nextLink"u8)) + if (prop.NameEquals("nextLink"u8)) { - nextLink = property.Value.GetString(); + if (prop.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + nextLink = string.IsNullOrEmpty(prop.Value.GetString()) ? null : 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 NotificationChannelList(value ?? new ChangeTrackingList(), nextLink, serializedAdditionalRawData); + return new NotificationChannelList(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": @@ -133,22 +166,11 @@ BinaryData IPersistableModel.Write(ModelReaderWriterOpt } } - NotificationChannelList 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 DeserializeNotificationChannelList(document.RootElement, options); - } - default: - throw new FormatException($"The model {nameof(NotificationChannelList)} does not support reading '{options.Format}' format."); - } - } + /// The data to parse. + /// The client options for reading and writing models. + NotificationChannelList IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) => PersistableModelCreateCore(data, options); + /// The client options for reading and writing models. string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; } } diff --git a/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/Models/NotificationChannelList.cs b/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/Models/NotificationChannelList.cs index 1f92d5ba8543..9e56dc24decd 100644 --- a/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/Models/NotificationChannelList.cs +++ b/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/Models/NotificationChannelList.cs @@ -7,64 +7,39 @@ using System; using System.Collections.Generic; +using System.Linq; +using Azure.ResourceManager.DevTestLabs; namespace Azure.ResourceManager.DevTestLabs.Models { /// The response of a list operation. internal partial class NotificationChannelList { - /// - /// 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 NotificationChannelList() + /// The NotificationChannel items on this page. + internal NotificationChannelList(IEnumerable value) { - Value = new ChangeTrackingList(); + Value = value.ToList(); } /// Initializes a new instance of . - /// Results of the list operation. - /// Link for next set of results. - /// Keeps track of any properties unknown to the library. - internal NotificationChannelList(IReadOnlyList value, string nextLink, IDictionary serializedAdditionalRawData) + /// The NotificationChannel items on this page. + /// The link to the next page of items. + /// Keeps track of any properties unknown to the library. + internal NotificationChannelList(IList value, Uri nextLink, IDictionary additionalBinaryDataProperties) { Value = value; NextLink = nextLink; - _serializedAdditionalRawData = serializedAdditionalRawData; + _additionalBinaryDataProperties = additionalBinaryDataProperties; } - /// Results of the list operation. - public IReadOnlyList Value { get; } - /// Link for next set of results. - public string NextLink { get; } + /// The NotificationChannel items on this page. + public IList Value { get; } + + /// The link to the next page of items. + public Uri NextLink { get; } } } diff --git a/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/Models/NotificationChannelProperties.Serialization.cs b/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/Models/NotificationChannelProperties.Serialization.cs new file mode 100644 index 000000000000..cb49d53f7844 --- /dev/null +++ b/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/Models/NotificationChannelProperties.Serialization.cs @@ -0,0 +1,253 @@ +// 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.DevTestLabs; + +namespace Azure.ResourceManager.DevTestLabs.Models +{ + /// Properties of a schedule. + internal partial class NotificationChannelProperties : IJsonModel + { + /// The data to parse. + /// The client options for reading and writing models. + protected virtual NotificationChannelProperties 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 DeserializeNotificationChannelProperties(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(NotificationChannelProperties)} does not support reading '{options.Format}' format."); + } + } + + /// 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(NotificationChannelProperties)} does not support writing '{format}' format."); + } + if (Optional.IsDefined(WebHookUri)) + { + writer.WritePropertyName("webHookUrl"u8); + writer.WriteStringValue(WebHookUri.AbsoluteUri); + } + if (Optional.IsDefined(EmailRecipient)) + { + writer.WritePropertyName("emailRecipient"u8); + writer.WriteStringValue(EmailRecipient); + } + if (Optional.IsDefined(NotificationLocale)) + { + writer.WritePropertyName("notificationLocale"u8); + writer.WriteStringValue(NotificationLocale); + } + if (Optional.IsDefined(Description)) + { + writer.WritePropertyName("description"u8); + writer.WriteStringValue(Description); + } + if (Optional.IsCollectionDefined(Events)) + { + writer.WritePropertyName("events"u8); + writer.WriteStartArray(); + foreach (DevTestLabNotificationChannelEvent item in Events) + { + writer.WriteObjectValue(item, options); + } + writer.WriteEndArray(); + } + if (options.Format != "W" && Optional.IsDefined(CreatedOn)) + { + writer.WritePropertyName("createdDate"u8); + writer.WriteStringValue(CreatedOn.Value, "O"); + } + if (options.Format != "W" && Optional.IsDefined(ProvisioningState)) + { + writer.WritePropertyName("provisioningState"u8); + writer.WriteStringValue(ProvisioningState); + } + if (options.Format != "W" && Optional.IsDefined(UniqueIdentifier)) + { + writer.WritePropertyName("uniqueIdentifier"u8); + writer.WriteStringValue(UniqueIdentifier.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. + NotificationChannelProperties IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) => JsonModelCreateCore(ref reader, options); + + /// The JSON reader. + /// The client options for reading and writing models. + protected virtual NotificationChannelProperties 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(NotificationChannelProperties)} does not support reading '{format}' format."); + } + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeNotificationChannelProperties(document.RootElement, options); + } + + /// The JSON element to deserialize. + /// The client options for reading and writing models. + internal static NotificationChannelProperties DeserializeNotificationChannelProperties(JsonElement element, ModelReaderWriterOptions options) + { + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + Uri webHookUri = default; + string emailRecipient = default; + string notificationLocale = default; + string description = default; + IList events = default; + DateTimeOffset? createdOn = default; + string provisioningState = default; + Guid? uniqueIdentifier = default; + IDictionary additionalBinaryDataProperties = new ChangeTrackingDictionary(); + foreach (var prop in element.EnumerateObject()) + { + if (prop.NameEquals("webHookUrl"u8)) + { + if (prop.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + webHookUri = string.IsNullOrEmpty(prop.Value.GetString()) ? null : new Uri(prop.Value.GetString()); + continue; + } + if (prop.NameEquals("emailRecipient"u8)) + { + emailRecipient = prop.Value.GetString(); + continue; + } + if (prop.NameEquals("notificationLocale"u8)) + { + notificationLocale = prop.Value.GetString(); + continue; + } + if (prop.NameEquals("description"u8)) + { + description = prop.Value.GetString(); + continue; + } + if (prop.NameEquals("events"u8)) + { + if (prop.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + List array = new List(); + foreach (var item in prop.Value.EnumerateArray()) + { + array.Add(DevTestLabNotificationChannelEvent.DeserializeDevTestLabNotificationChannelEvent(item, options)); + } + events = array; + continue; + } + if (prop.NameEquals("createdDate"u8)) + { + if (prop.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + createdOn = prop.Value.GetDateTimeOffset("O"); + continue; + } + if (prop.NameEquals("provisioningState"u8)) + { + provisioningState = prop.Value.GetString(); + continue; + } + if (prop.NameEquals("uniqueIdentifier"u8)) + { + if (prop.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + uniqueIdentifier = new Guid(prop.Value.GetString()); + continue; + } + if (options.Format != "W") + { + additionalBinaryDataProperties.Add(prop.Name, BinaryData.FromString(prop.Value.GetRawText())); + } + } + return new NotificationChannelProperties( + webHookUri, + emailRecipient, + notificationLocale, + description, + events ?? new ChangeTrackingList(), + createdOn, + provisioningState, + uniqueIdentifier, + 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, AzureResourceManagerDevTestLabsContext.Default); + default: + throw new FormatException($"The model {nameof(NotificationChannelProperties)} does not support writing '{options.Format}' format."); + } + } + + /// The data to parse. + /// The client options for reading and writing models. + NotificationChannelProperties IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) => PersistableModelCreateCore(data, options); + + /// The client options for reading and writing models. + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + } +} diff --git a/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/Models/NotificationChannelProperties.cs b/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/Models/NotificationChannelProperties.cs new file mode 100644 index 000000000000..15202a65cead --- /dev/null +++ b/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/Models/NotificationChannelProperties.cs @@ -0,0 +1,73 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; +using Azure.ResourceManager.DevTestLabs; + +namespace Azure.ResourceManager.DevTestLabs.Models +{ + /// Properties of a schedule. + internal partial class NotificationChannelProperties + { + /// Keeps track of any properties unknown to the library. + private protected readonly IDictionary _additionalBinaryDataProperties; + + /// Initializes a new instance of . + public NotificationChannelProperties() + { + Events = new ChangeTrackingList(); + } + + /// Initializes a new instance of . + /// The webhook URL to send notifications to. + /// The email recipient to send notifications to (can be a list of semi-colon separated email addresses). + /// The locale to use when sending a notification (fallback for unsupported languages is EN). + /// Description of notification. + /// The list of event for which this notification is enabled. + /// The creation date of the notification channel. + /// The provisioning status of the resource. + /// The unique immutable identifier of a resource (Guid). + /// Keeps track of any properties unknown to the library. + internal NotificationChannelProperties(Uri webHookUri, string emailRecipient, string notificationLocale, string description, IList events, DateTimeOffset? createdOn, string provisioningState, Guid? uniqueIdentifier, IDictionary additionalBinaryDataProperties) + { + WebHookUri = webHookUri; + EmailRecipient = emailRecipient; + NotificationLocale = notificationLocale; + Description = description; + Events = events; + CreatedOn = createdOn; + ProvisioningState = provisioningState; + UniqueIdentifier = uniqueIdentifier; + _additionalBinaryDataProperties = additionalBinaryDataProperties; + } + + /// The webhook URL to send notifications to. + public Uri WebHookUri { get; set; } + + /// The email recipient to send notifications to (can be a list of semi-colon separated email addresses). + public string EmailRecipient { get; set; } + + /// The locale to use when sending a notification (fallback for unsupported languages is EN). + public string NotificationLocale { get; set; } + + /// Description of notification. + public string Description { get; set; } + + /// The list of event for which this notification is enabled. + public IList Events { get; } = new ChangeTrackingList(); + + /// The creation date of the notification channel. + public DateTimeOffset? CreatedOn { get; } + + /// The provisioning status of the resource. + public string ProvisioningState { get; } + + /// The unique immutable identifier of a resource (Guid). + public Guid? UniqueIdentifier { get; } + } +} diff --git a/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/Models/PercentageCostThresholdProperties.Serialization.cs b/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/Models/PercentageCostThresholdProperties.Serialization.cs index c86158789fc6..434bf4b853a6 100644 --- a/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/Models/PercentageCostThresholdProperties.Serialization.cs +++ b/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/Models/PercentageCostThresholdProperties.Serialization.cs @@ -9,14 +9,32 @@ using System.ClientModel.Primitives; using System.Collections.Generic; using System.Text.Json; -using Azure.Core; +using Azure.ResourceManager.DevTestLabs; namespace Azure.ResourceManager.DevTestLabs.Models { - internal partial class PercentageCostThresholdProperties : IUtf8JsonSerializable, IJsonModel + /// Properties of a percentage cost threshold. + internal partial class PercentageCostThresholdProperties : IJsonModel { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + /// The data to parse. + /// The client options for reading and writing models. + protected virtual PercentageCostThresholdProperties 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 DeserializePercentageCostThresholdProperties(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(PercentageCostThresholdProperties)} does not support reading '{options.Format}' format."); + } + } + /// The JSON writer. + /// The client options for reading and writing models. void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) { writer.WriteStartObject(); @@ -28,26 +46,25 @@ 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(PercentageCostThresholdProperties)} does not support writing '{format}' format."); } - if (Optional.IsDefined(ThresholdValue)) { writer.WritePropertyName("thresholdValue"u8); writer.WriteNumberValue(ThresholdValue.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); } @@ -56,53 +73,59 @@ protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWrit } } - PercentageCostThresholdProperties IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + /// The JSON reader. + /// The client options for reading and writing models. + PercentageCostThresholdProperties IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) => JsonModelCreateCore(ref reader, options); + + /// The JSON reader. + /// The client options for reading and writing models. + protected virtual PercentageCostThresholdProperties 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(PercentageCostThresholdProperties)} does not support reading '{format}' format."); } - using JsonDocument document = JsonDocument.ParseValue(ref reader); return DeserializePercentageCostThresholdProperties(document.RootElement, options); } - internal static PercentageCostThresholdProperties DeserializePercentageCostThresholdProperties(JsonElement element, ModelReaderWriterOptions options = null) + /// The JSON element to deserialize. + /// The client options for reading and writing models. + internal static PercentageCostThresholdProperties DeserializePercentageCostThresholdProperties(JsonElement element, ModelReaderWriterOptions options) { - options ??= ModelSerializationExtensions.WireOptions; - if (element.ValueKind == JsonValueKind.Null) { return null; } double? thresholdValue = 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("thresholdValue"u8)) + if (prop.NameEquals("thresholdValue"u8)) { - if (property.Value.ValueKind == JsonValueKind.Null) + if (prop.Value.ValueKind == JsonValueKind.Null) { continue; } - thresholdValue = property.Value.GetDouble(); + thresholdValue = prop.Value.GetDouble(); 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 PercentageCostThresholdProperties(thresholdValue, serializedAdditionalRawData); + return new PercentageCostThresholdProperties(thresholdValue, 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": @@ -112,22 +135,11 @@ BinaryData IPersistableModel.Write(ModelReade } } - PercentageCostThresholdProperties 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 DeserializePercentageCostThresholdProperties(document.RootElement, options); - } - default: - throw new FormatException($"The model {nameof(PercentageCostThresholdProperties)} does not support reading '{options.Format}' format."); - } - } + /// The data to parse. + /// The client options for reading and writing models. + PercentageCostThresholdProperties IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) => PersistableModelCreateCore(data, options); + /// The client options for reading and writing models. string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; } } diff --git a/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/Models/PercentageCostThresholdProperties.cs b/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/Models/PercentageCostThresholdProperties.cs index 258e519e2779..41b29d2fd956 100644 --- a/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/Models/PercentageCostThresholdProperties.cs +++ b/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/Models/PercentageCostThresholdProperties.cs @@ -13,37 +13,8 @@ namespace Azure.ResourceManager.DevTestLabs.Models /// Properties of a percentage cost threshold. internal partial class PercentageCostThresholdProperties { - /// - /// 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 PercentageCostThresholdProperties() @@ -52,11 +23,11 @@ public PercentageCostThresholdProperties() /// Initializes a new instance of . /// The cost threshold value. - /// Keeps track of any properties unknown to the library. - internal PercentageCostThresholdProperties(double? thresholdValue, IDictionary serializedAdditionalRawData) + /// Keeps track of any properties unknown to the library. + internal PercentageCostThresholdProperties(double? thresholdValue, IDictionary additionalBinaryDataProperties) { ThresholdValue = thresholdValue; - _serializedAdditionalRawData = serializedAdditionalRawData; + _additionalBinaryDataProperties = additionalBinaryDataProperties; } /// The cost threshold value. diff --git a/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/Models/PolicyList.Serialization.cs b/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/Models/PolicyList.Serialization.cs index 9ab950c8af12..6c3055ce1d98 100644 --- a/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/Models/PolicyList.Serialization.cs +++ b/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/Models/PolicyList.Serialization.cs @@ -9,14 +9,45 @@ using System.ClientModel.Primitives; using System.Collections.Generic; using System.Text.Json; -using Azure.Core; +using Azure; +using Azure.ResourceManager.DevTestLabs; namespace Azure.ResourceManager.DevTestLabs.Models { - internal partial class PolicyList : IUtf8JsonSerializable, IJsonModel + /// The response of a list operation. + internal partial class PolicyList : IJsonModel { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + /// Initializes a new instance of for deserialization. + internal PolicyList() + { + } + /// The data to parse. + /// The client options for reading and writing models. + protected virtual PolicyList 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 DeserializePolicyList(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(PolicyList)} does not support reading '{options.Format}' format."); + } + } + + /// The to deserialize the from. + internal static PolicyList FromResponse(Response response) + { + using JsonDocument document = JsonDocument.Parse(response.Content, ModelSerializationExtensions.JsonDocumentOptions); + return DeserializePolicyList(document.RootElement, ModelSerializationExtensions.WireOptions); + } + + /// The JSON writer. + /// The client options for reading and writing models. void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) { writer.WriteStartObject(); @@ -28,36 +59,32 @@ void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOption /// 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(PolicyList)} does not support writing '{format}' format."); } - - if (Optional.IsCollectionDefined(Value)) + writer.WritePropertyName("value"u8); + writer.WriteStartArray(); + foreach (DevTestLabPolicyData item in Value) { - writer.WritePropertyName("value"u8); - writer.WriteStartArray(); - foreach (var item in Value) - { - writer.WriteObjectValue(item, options); - } - writer.WriteEndArray(); + writer.WriteObjectValue(item, options); } + writer.WriteEndArray(); if (Optional.IsDefined(NextLink)) { writer.WritePropertyName("nextLink"u8); - writer.WriteStringValue(NextLink); + 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); } @@ -66,64 +93,70 @@ protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWrit } } - PolicyList IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + /// The JSON reader. + /// The client options for reading and writing models. + PolicyList IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) => JsonModelCreateCore(ref reader, options); + + /// The JSON reader. + /// The client options for reading and writing models. + protected virtual PolicyList 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(PolicyList)} does not support reading '{format}' format."); } - using JsonDocument document = JsonDocument.ParseValue(ref reader); return DeserializePolicyList(document.RootElement, options); } - internal static PolicyList DeserializePolicyList(JsonElement element, ModelReaderWriterOptions options = null) + /// The JSON element to deserialize. + /// The client options for reading and writing models. + internal static PolicyList DeserializePolicyList(JsonElement element, ModelReaderWriterOptions options) { - options ??= ModelSerializationExtensions.WireOptions; - if (element.ValueKind == JsonValueKind.Null) { return null; } - IReadOnlyList value = default; - string nextLink = default; - IDictionary serializedAdditionalRawData = default; - Dictionary rawDataDictionary = new Dictionary(); - foreach (var property in element.EnumerateObject()) + IList value = default; + Uri nextLink = default; + IDictionary additionalBinaryDataProperties = new ChangeTrackingDictionary(); + foreach (var prop in element.EnumerateObject()) { - if (property.NameEquals("value"u8)) + if (prop.NameEquals("value"u8)) { - if (property.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(DevTestLabPolicyData.DeserializeDevTestLabPolicyData(item, options)); } value = array; continue; } - if (property.NameEquals("nextLink"u8)) + if (prop.NameEquals("nextLink"u8)) { - nextLink = property.Value.GetString(); + if (prop.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + nextLink = string.IsNullOrEmpty(prop.Value.GetString()) ? null : 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 PolicyList(value ?? new ChangeTrackingList(), nextLink, serializedAdditionalRawData); + return new PolicyList(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": @@ -133,22 +166,11 @@ BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) } } - PolicyList 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 DeserializePolicyList(document.RootElement, options); - } - default: - throw new FormatException($"The model {nameof(PolicyList)} does not support reading '{options.Format}' format."); - } - } + /// The data to parse. + /// The client options for reading and writing models. + PolicyList IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) => PersistableModelCreateCore(data, options); + /// The client options for reading and writing models. string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; } } diff --git a/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/Models/PolicyList.cs b/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/Models/PolicyList.cs index e1436379cbb5..840db7add9a3 100644 --- a/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/Models/PolicyList.cs +++ b/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/Models/PolicyList.cs @@ -7,64 +7,39 @@ using System; using System.Collections.Generic; +using System.Linq; +using Azure.ResourceManager.DevTestLabs; namespace Azure.ResourceManager.DevTestLabs.Models { /// The response of a list operation. internal partial class PolicyList { - /// - /// 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 PolicyList() + /// The Policy items on this page. + internal PolicyList(IEnumerable value) { - Value = new ChangeTrackingList(); + Value = value.ToList(); } /// Initializes a new instance of . - /// Results of the list operation. - /// Link for next set of results. - /// Keeps track of any properties unknown to the library. - internal PolicyList(IReadOnlyList value, string nextLink, IDictionary serializedAdditionalRawData) + /// The Policy items on this page. + /// The link to the next page of items. + /// Keeps track of any properties unknown to the library. + internal PolicyList(IList value, Uri nextLink, IDictionary additionalBinaryDataProperties) { Value = value; NextLink = nextLink; - _serializedAdditionalRawData = serializedAdditionalRawData; + _additionalBinaryDataProperties = additionalBinaryDataProperties; } - /// Results of the list operation. - public IReadOnlyList Value { get; } - /// Link for next set of results. - public string NextLink { get; } + /// The Policy items on this page. + public IList Value { get; } + + /// The link to the next page of items. + public Uri NextLink { get; } } } diff --git a/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/Models/PolicyProperties.Serialization.cs b/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/Models/PolicyProperties.Serialization.cs new file mode 100644 index 000000000000..7ebfd3ac6aaa --- /dev/null +++ b/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/Models/PolicyProperties.Serialization.cs @@ -0,0 +1,259 @@ +// 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.DevTestLabs; + +namespace Azure.ResourceManager.DevTestLabs.Models +{ + /// Properties of a Policy. + internal partial class PolicyProperties : IJsonModel + { + /// The data to parse. + /// The client options for reading and writing models. + protected virtual PolicyProperties 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 DeserializePolicyProperties(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(PolicyProperties)} does not support reading '{options.Format}' format."); + } + } + + /// 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(PolicyProperties)} does not support writing '{format}' format."); + } + if (Optional.IsDefined(Description)) + { + writer.WritePropertyName("description"u8); + writer.WriteStringValue(Description); + } + if (Optional.IsDefined(Status)) + { + writer.WritePropertyName("status"u8); + writer.WriteStringValue(Status.Value.ToString()); + } + if (Optional.IsDefined(FactName)) + { + writer.WritePropertyName("factName"u8); + writer.WriteStringValue(FactName.Value.ToString()); + } + if (Optional.IsDefined(FactData)) + { + writer.WritePropertyName("factData"u8); + writer.WriteStringValue(FactData); + } + if (Optional.IsDefined(Threshold)) + { + writer.WritePropertyName("threshold"u8); + writer.WriteStringValue(Threshold); + } + if (Optional.IsDefined(EvaluatorType)) + { + writer.WritePropertyName("evaluatorType"u8); + writer.WriteStringValue(EvaluatorType.Value.ToString()); + } + if (options.Format != "W" && Optional.IsDefined(CreatedOn)) + { + writer.WritePropertyName("createdDate"u8); + writer.WriteStringValue(CreatedOn.Value, "O"); + } + if (options.Format != "W" && Optional.IsDefined(ProvisioningState)) + { + writer.WritePropertyName("provisioningState"u8); + writer.WriteStringValue(ProvisioningState); + } + if (options.Format != "W" && Optional.IsDefined(UniqueIdentifier)) + { + writer.WritePropertyName("uniqueIdentifier"u8); + writer.WriteStringValue(UniqueIdentifier.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. + PolicyProperties IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) => JsonModelCreateCore(ref reader, options); + + /// The JSON reader. + /// The client options for reading and writing models. + protected virtual PolicyProperties 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(PolicyProperties)} does not support reading '{format}' format."); + } + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializePolicyProperties(document.RootElement, options); + } + + /// The JSON element to deserialize. + /// The client options for reading and writing models. + internal static PolicyProperties DeserializePolicyProperties(JsonElement element, ModelReaderWriterOptions options) + { + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + string description = default; + DevTestLabPolicyStatus? status = default; + DevTestLabPolicyFactName? factName = default; + string factData = default; + string threshold = default; + DevTestLabPolicyEvaluatorType? evaluatorType = default; + DateTimeOffset? createdOn = default; + string provisioningState = default; + Guid? uniqueIdentifier = default; + IDictionary additionalBinaryDataProperties = new ChangeTrackingDictionary(); + foreach (var prop in element.EnumerateObject()) + { + if (prop.NameEquals("description"u8)) + { + description = prop.Value.GetString(); + continue; + } + if (prop.NameEquals("status"u8)) + { + if (prop.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + status = new DevTestLabPolicyStatus(prop.Value.GetString()); + continue; + } + if (prop.NameEquals("factName"u8)) + { + if (prop.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + factName = new DevTestLabPolicyFactName(prop.Value.GetString()); + continue; + } + if (prop.NameEquals("factData"u8)) + { + factData = prop.Value.GetString(); + continue; + } + if (prop.NameEquals("threshold"u8)) + { + threshold = prop.Value.GetString(); + continue; + } + if (prop.NameEquals("evaluatorType"u8)) + { + if (prop.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + evaluatorType = new DevTestLabPolicyEvaluatorType(prop.Value.GetString()); + continue; + } + if (prop.NameEquals("createdDate"u8)) + { + if (prop.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + createdOn = prop.Value.GetDateTimeOffset("O"); + continue; + } + if (prop.NameEquals("provisioningState"u8)) + { + provisioningState = prop.Value.GetString(); + continue; + } + if (prop.NameEquals("uniqueIdentifier"u8)) + { + if (prop.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + uniqueIdentifier = new Guid(prop.Value.GetString()); + continue; + } + if (options.Format != "W") + { + additionalBinaryDataProperties.Add(prop.Name, BinaryData.FromString(prop.Value.GetRawText())); + } + } + return new PolicyProperties( + description, + status, + factName, + factData, + threshold, + evaluatorType, + createdOn, + provisioningState, + uniqueIdentifier, + 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, AzureResourceManagerDevTestLabsContext.Default); + default: + throw new FormatException($"The model {nameof(PolicyProperties)} does not support writing '{options.Format}' format."); + } + } + + /// The data to parse. + /// The client options for reading and writing models. + PolicyProperties IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) => PersistableModelCreateCore(data, options); + + /// The client options for reading and writing models. + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + } +} diff --git a/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/Models/PolicyProperties.cs b/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/Models/PolicyProperties.cs new file mode 100644 index 000000000000..4ca035b54aa0 --- /dev/null +++ b/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/Models/PolicyProperties.cs @@ -0,0 +1,76 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; + +namespace Azure.ResourceManager.DevTestLabs.Models +{ + /// Properties of a Policy. + internal partial class PolicyProperties + { + /// Keeps track of any properties unknown to the library. + private protected readonly IDictionary _additionalBinaryDataProperties; + + /// Initializes a new instance of . + public PolicyProperties() + { + } + + /// Initializes a new instance of . + /// The description of the policy. + /// The status of the policy. + /// The fact name of the policy (e.g. LabVmCount, LabVmSize, MaxVmsAllowedPerLab, etc. + /// The fact data of the policy. + /// The threshold of the policy (i.e. a number for MaxValuePolicy, and a JSON array of values for AllowedValuesPolicy). + /// The evaluator type of the policy (i.e. AllowedValuesPolicy, MaxValuePolicy). + /// The creation date of the policy. + /// The provisioning status of the resource. + /// The unique immutable identifier of a resource (Guid). + /// Keeps track of any properties unknown to the library. + internal PolicyProperties(string description, DevTestLabPolicyStatus? status, DevTestLabPolicyFactName? factName, string factData, string threshold, DevTestLabPolicyEvaluatorType? evaluatorType, DateTimeOffset? createdOn, string provisioningState, Guid? uniqueIdentifier, IDictionary additionalBinaryDataProperties) + { + Description = description; + Status = status; + FactName = factName; + FactData = factData; + Threshold = threshold; + EvaluatorType = evaluatorType; + CreatedOn = createdOn; + ProvisioningState = provisioningState; + UniqueIdentifier = uniqueIdentifier; + _additionalBinaryDataProperties = additionalBinaryDataProperties; + } + + /// The description of the policy. + public string Description { get; set; } + + /// The status of the policy. + public DevTestLabPolicyStatus? Status { get; set; } + + /// The fact name of the policy (e.g. LabVmCount, LabVmSize, MaxVmsAllowedPerLab, etc. + public DevTestLabPolicyFactName? FactName { get; set; } + + /// The fact data of the policy. + public string FactData { get; set; } + + /// The threshold of the policy (i.e. a number for MaxValuePolicy, and a JSON array of values for AllowedValuesPolicy). + public string Threshold { get; set; } + + /// The evaluator type of the policy (i.e. AllowedValuesPolicy, MaxValuePolicy). + public DevTestLabPolicyEvaluatorType? EvaluatorType { get; set; } + + /// The creation date of the policy. + public DateTimeOffset? CreatedOn { get; } + + /// The provisioning status of the resource. + public string ProvisioningState { get; } + + /// The unique immutable identifier of a resource (Guid). + public Guid? UniqueIdentifier { get; } + } +} diff --git a/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/Models/ScheduleCreationParameterProperties.Serialization.cs b/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/Models/ScheduleCreationParameterProperties.Serialization.cs new file mode 100644 index 000000000000..b9976b21e287 --- /dev/null +++ b/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/Models/ScheduleCreationParameterProperties.Serialization.cs @@ -0,0 +1,252 @@ +// 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.DevTestLabs; + +namespace Azure.ResourceManager.DevTestLabs.Models +{ + /// Properties for schedule creation. + internal partial class ScheduleCreationParameterProperties : IJsonModel + { + /// The data to parse. + /// The client options for reading and writing models. + protected virtual ScheduleCreationParameterProperties 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 DeserializeScheduleCreationParameterProperties(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(ScheduleCreationParameterProperties)} does not support reading '{options.Format}' format."); + } + } + + /// 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(ScheduleCreationParameterProperties)} does not support writing '{format}' format."); + } + if (Optional.IsDefined(Status)) + { + writer.WritePropertyName("status"u8); + writer.WriteStringValue(Status.Value.ToString()); + } + if (Optional.IsDefined(TaskType)) + { + writer.WritePropertyName("taskType"u8); + writer.WriteStringValue(TaskType); + } + if (Optional.IsDefined(WeeklyRecurrence)) + { + writer.WritePropertyName("weeklyRecurrence"u8); + writer.WriteObjectValue(WeeklyRecurrence, options); + } + if (Optional.IsDefined(DailyRecurrence)) + { + writer.WritePropertyName("dailyRecurrence"u8); + writer.WriteObjectValue(DailyRecurrence, options); + } + if (Optional.IsDefined(HourlyRecurrence)) + { + writer.WritePropertyName("hourlyRecurrence"u8); + writer.WriteObjectValue(HourlyRecurrence, options); + } + if (Optional.IsDefined(TimeZoneId)) + { + writer.WritePropertyName("timeZoneId"u8); + writer.WriteStringValue(TimeZoneId); + } + if (Optional.IsDefined(NotificationSettings)) + { + writer.WritePropertyName("notificationSettings"u8); + writer.WriteObjectValue(NotificationSettings, options); + } + if (Optional.IsDefined(TargetResourceId)) + { + writer.WritePropertyName("targetResourceId"u8); + writer.WriteStringValue(TargetResourceId); + } + 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. + ScheduleCreationParameterProperties IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) => JsonModelCreateCore(ref reader, options); + + /// The JSON reader. + /// The client options for reading and writing models. + protected virtual ScheduleCreationParameterProperties 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(ScheduleCreationParameterProperties)} does not support reading '{format}' format."); + } + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeScheduleCreationParameterProperties(document.RootElement, options); + } + + /// The JSON element to deserialize. + /// The client options for reading and writing models. + internal static ScheduleCreationParameterProperties DeserializeScheduleCreationParameterProperties(JsonElement element, ModelReaderWriterOptions options) + { + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + DevTestLabEnableStatus? status = default; + string taskType = default; + DevTestLabWeekDetails weeklyRecurrence = default; + DayDetails dailyRecurrence = default; + HourDetails hourlyRecurrence = default; + string timeZoneId = default; + DevTestLabNotificationSettings notificationSettings = default; + ResourceIdentifier targetResourceId = default; + IDictionary additionalBinaryDataProperties = new ChangeTrackingDictionary(); + foreach (var prop in element.EnumerateObject()) + { + if (prop.NameEquals("status"u8)) + { + if (prop.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + status = new DevTestLabEnableStatus(prop.Value.GetString()); + continue; + } + if (prop.NameEquals("taskType"u8)) + { + taskType = prop.Value.GetString(); + continue; + } + if (prop.NameEquals("weeklyRecurrence"u8)) + { + if (prop.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + weeklyRecurrence = DevTestLabWeekDetails.DeserializeDevTestLabWeekDetails(prop.Value, options); + continue; + } + if (prop.NameEquals("dailyRecurrence"u8)) + { + if (prop.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + dailyRecurrence = DayDetails.DeserializeDayDetails(prop.Value, options); + continue; + } + if (prop.NameEquals("hourlyRecurrence"u8)) + { + if (prop.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + hourlyRecurrence = HourDetails.DeserializeHourDetails(prop.Value, options); + continue; + } + if (prop.NameEquals("timeZoneId"u8)) + { + timeZoneId = prop.Value.GetString(); + continue; + } + if (prop.NameEquals("notificationSettings"u8)) + { + if (prop.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + notificationSettings = DevTestLabNotificationSettings.DeserializeDevTestLabNotificationSettings(prop.Value, options); + continue; + } + if (prop.NameEquals("targetResourceId"u8)) + { + if (prop.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + targetResourceId = new ResourceIdentifier(prop.Value.GetString()); + continue; + } + if (options.Format != "W") + { + additionalBinaryDataProperties.Add(prop.Name, BinaryData.FromString(prop.Value.GetRawText())); + } + } + return new ScheduleCreationParameterProperties( + status, + taskType, + weeklyRecurrence, + dailyRecurrence, + hourlyRecurrence, + timeZoneId, + notificationSettings, + targetResourceId, + 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, AzureResourceManagerDevTestLabsContext.Default); + default: + throw new FormatException($"The model {nameof(ScheduleCreationParameterProperties)} does not support writing '{options.Format}' format."); + } + } + + /// The data to parse. + /// The client options for reading and writing models. + ScheduleCreationParameterProperties IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) => PersistableModelCreateCore(data, options); + + /// The client options for reading and writing models. + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + } +} diff --git a/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/Models/ScheduleCreationParameterProperties.cs b/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/Models/ScheduleCreationParameterProperties.cs new file mode 100644 index 000000000000..abc1a3a54aac --- /dev/null +++ b/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/Models/ScheduleCreationParameterProperties.cs @@ -0,0 +1,106 @@ +// 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.DevTestLabs.Models +{ + /// Properties for schedule creation. + internal partial class ScheduleCreationParameterProperties + { + /// Keeps track of any properties unknown to the library. + private protected readonly IDictionary _additionalBinaryDataProperties; + + /// Initializes a new instance of . + public ScheduleCreationParameterProperties() + { + } + + /// Initializes a new instance of . + /// The status of the schedule (i.e. Enabled, Disabled). + /// The task type of the schedule (e.g. LabVmsShutdownTask, LabVmAutoStart). + /// If the schedule will occur only some days of the week, specify the weekly recurrence. + /// If the schedule will occur once each day of the week, specify the daily recurrence. + /// If the schedule will occur multiple times a day, specify the hourly recurrence. + /// The time zone ID (e.g. China Standard Time, Greenland Standard Time, Pacific Standard time, etc.). The possible values for this property can be found in `IReadOnlyCollection<string> TimeZoneConverter.TZConvert.KnownWindowsTimeZoneIds` (https://github.com/mattjohnsonpint/TimeZoneConverter/blob/main/README.md). + /// Notification settings. + /// The resource ID to which the schedule belongs. + /// Keeps track of any properties unknown to the library. + internal ScheduleCreationParameterProperties(DevTestLabEnableStatus? status, string taskType, DevTestLabWeekDetails weeklyRecurrence, DayDetails dailyRecurrence, HourDetails hourlyRecurrence, string timeZoneId, DevTestLabNotificationSettings notificationSettings, ResourceIdentifier targetResourceId, IDictionary additionalBinaryDataProperties) + { + Status = status; + TaskType = taskType; + WeeklyRecurrence = weeklyRecurrence; + DailyRecurrence = dailyRecurrence; + HourlyRecurrence = hourlyRecurrence; + TimeZoneId = timeZoneId; + NotificationSettings = notificationSettings; + TargetResourceId = targetResourceId; + _additionalBinaryDataProperties = additionalBinaryDataProperties; + } + + /// The status of the schedule (i.e. Enabled, Disabled). + public DevTestLabEnableStatus? Status { get; set; } + + /// The task type of the schedule (e.g. LabVmsShutdownTask, LabVmAutoStart). + public string TaskType { get; set; } + + /// If the schedule will occur only some days of the week, specify the weekly recurrence. + public DevTestLabWeekDetails WeeklyRecurrence { get; set; } + + /// If the schedule will occur once each day of the week, specify the daily recurrence. + internal DayDetails DailyRecurrence { get; set; } + + /// If the schedule will occur multiple times a day, specify the hourly recurrence. + internal HourDetails HourlyRecurrence { get; set; } + + /// The time zone ID (e.g. China Standard Time, Greenland Standard Time, Pacific Standard time, etc.). The possible values for this property can be found in `IReadOnlyCollection<string> TimeZoneConverter.TZConvert.KnownWindowsTimeZoneIds` (https://github.com/mattjohnsonpint/TimeZoneConverter/blob/main/README.md). + public string TimeZoneId { get; set; } + + /// Notification settings. + public DevTestLabNotificationSettings NotificationSettings { get; set; } + + /// The resource ID to which the schedule belongs. + public ResourceIdentifier TargetResourceId { get; set; } + + /// The time of day the schedule will occur. + public string DailyRecurrenceTime + { + get + { + return DailyRecurrence is null ? default : DailyRecurrence.Time; + } + set + { + if (DailyRecurrence is null) + { + DailyRecurrence = new DayDetails(); + } + DailyRecurrence.Time = value; + } + } + + /// Minutes of the hour the schedule will run. + public int? HourlyRecurrenceMinute + { + get + { + return HourlyRecurrence is null ? default : HourlyRecurrence.Minute; + } + set + { + if (HourlyRecurrence is null) + { + HourlyRecurrence = new HourDetails(); + } + HourlyRecurrence.Minute = value; + } + } + } +} diff --git a/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/Models/ScheduleList.Serialization.cs b/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/Models/ScheduleList.Serialization.cs index f72a4ac114e4..d46b2b146301 100644 --- a/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/Models/ScheduleList.Serialization.cs +++ b/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/Models/ScheduleList.Serialization.cs @@ -9,14 +9,45 @@ using System.ClientModel.Primitives; using System.Collections.Generic; using System.Text.Json; -using Azure.Core; +using Azure; +using Azure.ResourceManager.DevTestLabs; namespace Azure.ResourceManager.DevTestLabs.Models { - internal partial class ScheduleList : IUtf8JsonSerializable, IJsonModel + /// The response of a list operation. + internal partial class ScheduleList : IJsonModel { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + /// Initializes a new instance of for deserialization. + internal ScheduleList() + { + } + /// The data to parse. + /// The client options for reading and writing models. + protected virtual ScheduleList 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 DeserializeScheduleList(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(ScheduleList)} does not support reading '{options.Format}' format."); + } + } + + /// The to deserialize the from. + internal static ScheduleList FromResponse(Response response) + { + using JsonDocument document = JsonDocument.Parse(response.Content, ModelSerializationExtensions.JsonDocumentOptions); + return DeserializeScheduleList(document.RootElement, ModelSerializationExtensions.WireOptions); + } + + /// The JSON writer. + /// The client options for reading and writing models. void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) { writer.WriteStartObject(); @@ -28,36 +59,32 @@ void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOpti /// 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(ScheduleList)} does not support writing '{format}' format."); } - - if (Optional.IsCollectionDefined(Value)) + writer.WritePropertyName("value"u8); + writer.WriteStartArray(); + foreach (DevTestLabScheduleData item in Value) { - writer.WritePropertyName("value"u8); - writer.WriteStartArray(); - foreach (var item in Value) - { - writer.WriteObjectValue(item, options); - } - writer.WriteEndArray(); + writer.WriteObjectValue(item, options); } + writer.WriteEndArray(); if (Optional.IsDefined(NextLink)) { writer.WritePropertyName("nextLink"u8); - writer.WriteStringValue(NextLink); + 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); } @@ -66,64 +93,70 @@ protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWrit } } - ScheduleList IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + /// The JSON reader. + /// The client options for reading and writing models. + ScheduleList IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) => JsonModelCreateCore(ref reader, options); + + /// The JSON reader. + /// The client options for reading and writing models. + protected virtual ScheduleList 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(ScheduleList)} does not support reading '{format}' format."); } - using JsonDocument document = JsonDocument.ParseValue(ref reader); return DeserializeScheduleList(document.RootElement, options); } - internal static ScheduleList DeserializeScheduleList(JsonElement element, ModelReaderWriterOptions options = null) + /// The JSON element to deserialize. + /// The client options for reading and writing models. + internal static ScheduleList DeserializeScheduleList(JsonElement element, ModelReaderWriterOptions options) { - options ??= ModelSerializationExtensions.WireOptions; - if (element.ValueKind == JsonValueKind.Null) { return null; } - IReadOnlyList value = default; - string nextLink = default; - IDictionary serializedAdditionalRawData = default; - Dictionary rawDataDictionary = new Dictionary(); - foreach (var property in element.EnumerateObject()) + IList value = default; + Uri nextLink = default; + IDictionary additionalBinaryDataProperties = new ChangeTrackingDictionary(); + foreach (var prop in element.EnumerateObject()) { - if (property.NameEquals("value"u8)) + if (prop.NameEquals("value"u8)) { - if (property.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(DevTestLabScheduleData.DeserializeDevTestLabScheduleData(item, options)); } value = array; continue; } - if (property.NameEquals("nextLink"u8)) + if (prop.NameEquals("nextLink"u8)) { - nextLink = property.Value.GetString(); + if (prop.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + nextLink = string.IsNullOrEmpty(prop.Value.GetString()) ? null : 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 ScheduleList(value ?? new ChangeTrackingList(), nextLink, serializedAdditionalRawData); + return new ScheduleList(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": @@ -133,22 +166,11 @@ BinaryData IPersistableModel.Write(ModelReaderWriterOptions option } } - ScheduleList 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 DeserializeScheduleList(document.RootElement, options); - } - default: - throw new FormatException($"The model {nameof(ScheduleList)} does not support reading '{options.Format}' format."); - } - } + /// The data to parse. + /// The client options for reading and writing models. + ScheduleList IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) => PersistableModelCreateCore(data, options); + /// The client options for reading and writing models. string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; } } diff --git a/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/Models/ScheduleList.cs b/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/Models/ScheduleList.cs index 29f840eefddb..0eba2eca2af8 100644 --- a/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/Models/ScheduleList.cs +++ b/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/Models/ScheduleList.cs @@ -7,64 +7,39 @@ using System; using System.Collections.Generic; +using System.Linq; +using Azure.ResourceManager.DevTestLabs; namespace Azure.ResourceManager.DevTestLabs.Models { /// The response of a list operation. internal partial class ScheduleList { - /// - /// 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 ScheduleList() + /// The Schedule items on this page. + internal ScheduleList(IEnumerable value) { - Value = new ChangeTrackingList(); + Value = value.ToList(); } /// Initializes a new instance of . - /// Results of the list operation. - /// Link for next set of results. - /// Keeps track of any properties unknown to the library. - internal ScheduleList(IReadOnlyList value, string nextLink, IDictionary serializedAdditionalRawData) + /// The Schedule items on this page. + /// The link to the next page of items. + /// Keeps track of any properties unknown to the library. + internal ScheduleList(IList value, Uri nextLink, IDictionary additionalBinaryDataProperties) { Value = value; NextLink = nextLink; - _serializedAdditionalRawData = serializedAdditionalRawData; + _additionalBinaryDataProperties = additionalBinaryDataProperties; } - /// Results of the list operation. - public IReadOnlyList Value { get; } - /// Link for next set of results. - public string NextLink { get; } + /// The Schedule items on this page. + public IList Value { get; } + + /// The link to the next page of items. + public Uri NextLink { get; } } } diff --git a/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/Models/ScheduleProperties.Serialization.cs b/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/Models/ScheduleProperties.Serialization.cs new file mode 100644 index 000000000000..a5171b527539 --- /dev/null +++ b/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/Models/ScheduleProperties.Serialization.cs @@ -0,0 +1,291 @@ +// 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.DevTestLabs; + +namespace Azure.ResourceManager.DevTestLabs.Models +{ + /// Properties of a schedule. + internal partial class ScheduleProperties : IJsonModel + { + /// The data to parse. + /// The client options for reading and writing models. + protected virtual ScheduleProperties 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 DeserializeScheduleProperties(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(ScheduleProperties)} does not support reading '{options.Format}' format."); + } + } + + /// 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(ScheduleProperties)} does not support writing '{format}' format."); + } + if (Optional.IsDefined(Status)) + { + writer.WritePropertyName("status"u8); + writer.WriteStringValue(Status.Value.ToString()); + } + if (Optional.IsDefined(TaskType)) + { + writer.WritePropertyName("taskType"u8); + writer.WriteStringValue(TaskType); + } + if (Optional.IsDefined(WeeklyRecurrence)) + { + writer.WritePropertyName("weeklyRecurrence"u8); + writer.WriteObjectValue(WeeklyRecurrence, options); + } + if (Optional.IsDefined(DailyRecurrence)) + { + writer.WritePropertyName("dailyRecurrence"u8); + writer.WriteObjectValue(DailyRecurrence, options); + } + if (Optional.IsDefined(HourlyRecurrence)) + { + writer.WritePropertyName("hourlyRecurrence"u8); + writer.WriteObjectValue(HourlyRecurrence, options); + } + if (Optional.IsDefined(TimeZoneId)) + { + writer.WritePropertyName("timeZoneId"u8); + writer.WriteStringValue(TimeZoneId); + } + if (Optional.IsDefined(NotificationSettings)) + { + writer.WritePropertyName("notificationSettings"u8); + writer.WriteObjectValue(NotificationSettings, options); + } + if (options.Format != "W" && Optional.IsDefined(CreatedOn)) + { + writer.WritePropertyName("createdDate"u8); + writer.WriteStringValue(CreatedOn.Value, "O"); + } + if (Optional.IsDefined(TargetResourceId)) + { + writer.WritePropertyName("targetResourceId"u8); + writer.WriteStringValue(TargetResourceId); + } + if (options.Format != "W" && Optional.IsDefined(ProvisioningState)) + { + writer.WritePropertyName("provisioningState"u8); + writer.WriteStringValue(ProvisioningState); + } + if (options.Format != "W" && Optional.IsDefined(UniqueIdentifier)) + { + writer.WritePropertyName("uniqueIdentifier"u8); + writer.WriteStringValue(UniqueIdentifier.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. + ScheduleProperties IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) => JsonModelCreateCore(ref reader, options); + + /// The JSON reader. + /// The client options for reading and writing models. + protected virtual ScheduleProperties 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(ScheduleProperties)} does not support reading '{format}' format."); + } + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeScheduleProperties(document.RootElement, options); + } + + /// The JSON element to deserialize. + /// The client options for reading and writing models. + internal static ScheduleProperties DeserializeScheduleProperties(JsonElement element, ModelReaderWriterOptions options) + { + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + DevTestLabEnableStatus? status = default; + string taskType = default; + DevTestLabWeekDetails weeklyRecurrence = default; + DayDetails dailyRecurrence = default; + HourDetails hourlyRecurrence = default; + string timeZoneId = default; + DevTestLabNotificationSettings notificationSettings = default; + DateTimeOffset? createdOn = default; + string targetResourceId = default; + string provisioningState = default; + Guid? uniqueIdentifier = default; + IDictionary additionalBinaryDataProperties = new ChangeTrackingDictionary(); + foreach (var prop in element.EnumerateObject()) + { + if (prop.NameEquals("status"u8)) + { + if (prop.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + status = new DevTestLabEnableStatus(prop.Value.GetString()); + continue; + } + if (prop.NameEquals("taskType"u8)) + { + taskType = prop.Value.GetString(); + continue; + } + if (prop.NameEquals("weeklyRecurrence"u8)) + { + if (prop.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + weeklyRecurrence = DevTestLabWeekDetails.DeserializeDevTestLabWeekDetails(prop.Value, options); + continue; + } + if (prop.NameEquals("dailyRecurrence"u8)) + { + if (prop.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + dailyRecurrence = DayDetails.DeserializeDayDetails(prop.Value, options); + continue; + } + if (prop.NameEquals("hourlyRecurrence"u8)) + { + if (prop.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + hourlyRecurrence = HourDetails.DeserializeHourDetails(prop.Value, options); + continue; + } + if (prop.NameEquals("timeZoneId"u8)) + { + timeZoneId = prop.Value.GetString(); + continue; + } + if (prop.NameEquals("notificationSettings"u8)) + { + if (prop.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + notificationSettings = DevTestLabNotificationSettings.DeserializeDevTestLabNotificationSettings(prop.Value, options); + continue; + } + if (prop.NameEquals("createdDate"u8)) + { + if (prop.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + createdOn = prop.Value.GetDateTimeOffset("O"); + continue; + } + if (prop.NameEquals("targetResourceId"u8)) + { + targetResourceId = prop.Value.GetString(); + continue; + } + if (prop.NameEquals("provisioningState"u8)) + { + provisioningState = prop.Value.GetString(); + continue; + } + if (prop.NameEquals("uniqueIdentifier"u8)) + { + if (prop.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + uniqueIdentifier = new Guid(prop.Value.GetString()); + continue; + } + if (options.Format != "W") + { + additionalBinaryDataProperties.Add(prop.Name, BinaryData.FromString(prop.Value.GetRawText())); + } + } + return new ScheduleProperties( + status, + taskType, + weeklyRecurrence, + dailyRecurrence, + hourlyRecurrence, + timeZoneId, + notificationSettings, + createdOn, + targetResourceId, + provisioningState, + uniqueIdentifier, + 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, AzureResourceManagerDevTestLabsContext.Default); + default: + throw new FormatException($"The model {nameof(ScheduleProperties)} does not support writing '{options.Format}' format."); + } + } + + /// The data to parse. + /// The client options for reading and writing models. + ScheduleProperties IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) => PersistableModelCreateCore(data, options); + + /// The client options for reading and writing models. + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + } +} diff --git a/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/Models/ScheduleProperties.cs b/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/Models/ScheduleProperties.cs new file mode 100644 index 000000000000..1d35525ca05b --- /dev/null +++ b/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/Models/ScheduleProperties.cs @@ -0,0 +1,120 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; + +namespace Azure.ResourceManager.DevTestLabs.Models +{ + /// Properties of a schedule. + internal partial class ScheduleProperties + { + /// Keeps track of any properties unknown to the library. + private protected readonly IDictionary _additionalBinaryDataProperties; + + /// Initializes a new instance of . + public ScheduleProperties() + { + } + + /// Initializes a new instance of . + /// The status of the schedule (i.e. Enabled, Disabled). + /// The task type of the schedule (e.g. LabVmsShutdownTask, LabVmAutoStart). + /// If the schedule will occur only some days of the week, specify the weekly recurrence. + /// If the schedule will occur once each day of the week, specify the daily recurrence. + /// If the schedule will occur multiple times a day, specify the hourly recurrence. + /// The time zone ID (e.g. China Standard Time, Greenland Standard Time, Pacific Standard time, etc.). The possible values for this property can be found in `IReadOnlyCollection<string> TimeZoneConverter.TZConvert.KnownWindowsTimeZoneIds` (https://github.com/mattjohnsonpint/TimeZoneConverter/blob/main/README.md). + /// Notification settings. + /// The creation date of the schedule. + /// The resource ID to which the schedule belongs. + /// The provisioning status of the resource. + /// The unique immutable identifier of a resource (Guid). + /// Keeps track of any properties unknown to the library. + internal ScheduleProperties(DevTestLabEnableStatus? status, string taskType, DevTestLabWeekDetails weeklyRecurrence, DayDetails dailyRecurrence, HourDetails hourlyRecurrence, string timeZoneId, DevTestLabNotificationSettings notificationSettings, DateTimeOffset? createdOn, string targetResourceId, string provisioningState, Guid? uniqueIdentifier, IDictionary additionalBinaryDataProperties) + { + Status = status; + TaskType = taskType; + WeeklyRecurrence = weeklyRecurrence; + DailyRecurrence = dailyRecurrence; + HourlyRecurrence = hourlyRecurrence; + TimeZoneId = timeZoneId; + NotificationSettings = notificationSettings; + CreatedOn = createdOn; + TargetResourceId = targetResourceId; + ProvisioningState = provisioningState; + UniqueIdentifier = uniqueIdentifier; + _additionalBinaryDataProperties = additionalBinaryDataProperties; + } + + /// The status of the schedule (i.e. Enabled, Disabled). + public DevTestLabEnableStatus? Status { get; set; } + + /// The task type of the schedule (e.g. LabVmsShutdownTask, LabVmAutoStart). + public string TaskType { get; set; } + + /// If the schedule will occur only some days of the week, specify the weekly recurrence. + public DevTestLabWeekDetails WeeklyRecurrence { get; set; } + + /// If the schedule will occur once each day of the week, specify the daily recurrence. + internal DayDetails DailyRecurrence { get; set; } + + /// If the schedule will occur multiple times a day, specify the hourly recurrence. + internal HourDetails HourlyRecurrence { get; set; } + + /// The time zone ID (e.g. China Standard Time, Greenland Standard Time, Pacific Standard time, etc.). The possible values for this property can be found in `IReadOnlyCollection<string> TimeZoneConverter.TZConvert.KnownWindowsTimeZoneIds` (https://github.com/mattjohnsonpint/TimeZoneConverter/blob/main/README.md). + public string TimeZoneId { get; set; } + + /// Notification settings. + public DevTestLabNotificationSettings NotificationSettings { get; set; } + + /// The creation date of the schedule. + public DateTimeOffset? CreatedOn { get; } + + /// The resource ID to which the schedule belongs. + public string TargetResourceId { get; set; } + + /// The provisioning status of the resource. + public string ProvisioningState { get; } + + /// The unique immutable identifier of a resource (Guid). + public Guid? UniqueIdentifier { get; } + + /// The time of day the schedule will occur. + public string DailyRecurrenceTime + { + get + { + return DailyRecurrence is null ? default : DailyRecurrence.Time; + } + set + { + if (DailyRecurrence is null) + { + DailyRecurrence = new DayDetails(); + } + DailyRecurrence.Time = value; + } + } + + /// Minutes of the hour the schedule will run. + public int? HourlyRecurrenceMinute + { + get + { + return HourlyRecurrence is null ? default : HourlyRecurrence.Minute; + } + set + { + if (HourlyRecurrence is null) + { + HourlyRecurrence = new HourDetails(); + } + HourlyRecurrence.Minute = value; + } + } + } +} diff --git a/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/Models/SecretList.Serialization.cs b/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/Models/SecretList.Serialization.cs index 7f17a6254772..f0cc9a614c15 100644 --- a/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/Models/SecretList.Serialization.cs +++ b/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/Models/SecretList.Serialization.cs @@ -9,14 +9,45 @@ using System.ClientModel.Primitives; using System.Collections.Generic; using System.Text.Json; -using Azure.Core; +using Azure; +using Azure.ResourceManager.DevTestLabs; namespace Azure.ResourceManager.DevTestLabs.Models { - internal partial class SecretList : IUtf8JsonSerializable, IJsonModel + /// The response of a list operation. + internal partial class SecretList : IJsonModel { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + /// Initializes a new instance of for deserialization. + internal SecretList() + { + } + /// The data to parse. + /// The client options for reading and writing models. + protected virtual SecretList 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 DeserializeSecretList(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(SecretList)} does not support reading '{options.Format}' format."); + } + } + + /// The to deserialize the from. + internal static SecretList FromResponse(Response response) + { + using JsonDocument document = JsonDocument.Parse(response.Content, ModelSerializationExtensions.JsonDocumentOptions); + return DeserializeSecretList(document.RootElement, ModelSerializationExtensions.WireOptions); + } + + /// The JSON writer. + /// The client options for reading and writing models. void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) { writer.WriteStartObject(); @@ -28,36 +59,32 @@ void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOption /// 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(SecretList)} does not support writing '{format}' format."); } - - if (Optional.IsCollectionDefined(Value)) + writer.WritePropertyName("value"u8); + writer.WriteStartArray(); + foreach (DevTestLabSecretData item in Value) { - writer.WritePropertyName("value"u8); - writer.WriteStartArray(); - foreach (var item in Value) - { - writer.WriteObjectValue(item, options); - } - writer.WriteEndArray(); + writer.WriteObjectValue(item, options); } + writer.WriteEndArray(); if (Optional.IsDefined(NextLink)) { writer.WritePropertyName("nextLink"u8); - writer.WriteStringValue(NextLink); + 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); } @@ -66,64 +93,70 @@ protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWrit } } - SecretList IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + /// The JSON reader. + /// The client options for reading and writing models. + SecretList IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) => JsonModelCreateCore(ref reader, options); + + /// The JSON reader. + /// The client options for reading and writing models. + protected virtual SecretList 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(SecretList)} does not support reading '{format}' format."); } - using JsonDocument document = JsonDocument.ParseValue(ref reader); return DeserializeSecretList(document.RootElement, options); } - internal static SecretList DeserializeSecretList(JsonElement element, ModelReaderWriterOptions options = null) + /// The JSON element to deserialize. + /// The client options for reading and writing models. + internal static SecretList DeserializeSecretList(JsonElement element, ModelReaderWriterOptions options) { - options ??= ModelSerializationExtensions.WireOptions; - if (element.ValueKind == JsonValueKind.Null) { return null; } - IReadOnlyList value = default; - string nextLink = default; - IDictionary serializedAdditionalRawData = default; - Dictionary rawDataDictionary = new Dictionary(); - foreach (var property in element.EnumerateObject()) + IList value = default; + Uri nextLink = default; + IDictionary additionalBinaryDataProperties = new ChangeTrackingDictionary(); + foreach (var prop in element.EnumerateObject()) { - if (property.NameEquals("value"u8)) + if (prop.NameEquals("value"u8)) { - if (property.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(DevTestLabSecretData.DeserializeDevTestLabSecretData(item, options)); } value = array; continue; } - if (property.NameEquals("nextLink"u8)) + if (prop.NameEquals("nextLink"u8)) { - nextLink = property.Value.GetString(); + if (prop.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + nextLink = string.IsNullOrEmpty(prop.Value.GetString()) ? null : 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 SecretList(value ?? new ChangeTrackingList(), nextLink, serializedAdditionalRawData); + return new SecretList(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": @@ -133,22 +166,11 @@ BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) } } - SecretList 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 DeserializeSecretList(document.RootElement, options); - } - default: - throw new FormatException($"The model {nameof(SecretList)} does not support reading '{options.Format}' format."); - } - } + /// The data to parse. + /// The client options for reading and writing models. + SecretList IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) => PersistableModelCreateCore(data, options); + /// The client options for reading and writing models. string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; } } diff --git a/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/Models/SecretList.cs b/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/Models/SecretList.cs index 12488a687cad..a0b61df444a7 100644 --- a/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/Models/SecretList.cs +++ b/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/Models/SecretList.cs @@ -7,64 +7,39 @@ using System; using System.Collections.Generic; +using System.Linq; +using Azure.ResourceManager.DevTestLabs; namespace Azure.ResourceManager.DevTestLabs.Models { /// The response of a list operation. internal partial class SecretList { - /// - /// 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 SecretList() + /// The Secret items on this page. + internal SecretList(IEnumerable value) { - Value = new ChangeTrackingList(); + Value = value.ToList(); } /// Initializes a new instance of . - /// Results of the list operation. - /// Link for next set of results. - /// Keeps track of any properties unknown to the library. - internal SecretList(IReadOnlyList value, string nextLink, IDictionary serializedAdditionalRawData) + /// The Secret items on this page. + /// The link to the next page of items. + /// Keeps track of any properties unknown to the library. + internal SecretList(IList value, Uri nextLink, IDictionary additionalBinaryDataProperties) { Value = value; NextLink = nextLink; - _serializedAdditionalRawData = serializedAdditionalRawData; + _additionalBinaryDataProperties = additionalBinaryDataProperties; } - /// Results of the list operation. - public IReadOnlyList Value { get; } - /// Link for next set of results. - public string NextLink { get; } + /// The Secret items on this page. + public IList Value { get; } + + /// The link to the next page of items. + public Uri NextLink { get; } } } diff --git a/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/Models/SecretProperties.Serialization.cs b/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/Models/SecretProperties.Serialization.cs new file mode 100644 index 000000000000..b2056eaa4a31 --- /dev/null +++ b/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/Models/SecretProperties.Serialization.cs @@ -0,0 +1,167 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Text.Json; +using Azure.ResourceManager.DevTestLabs; + +namespace Azure.ResourceManager.DevTestLabs.Models +{ + /// Properties of a secret. + internal partial class SecretProperties : IJsonModel + { + /// The data to parse. + /// The client options for reading and writing models. + protected virtual SecretProperties 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 DeserializeSecretProperties(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(SecretProperties)} does not support reading '{options.Format}' format."); + } + } + + /// 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(SecretProperties)} does not support writing '{format}' format."); + } + if (Optional.IsDefined(Value)) + { + writer.WritePropertyName("value"u8); + writer.WriteStringValue(Value); + } + if (options.Format != "W" && Optional.IsDefined(ProvisioningState)) + { + writer.WritePropertyName("provisioningState"u8); + writer.WriteStringValue(ProvisioningState); + } + if (options.Format != "W" && Optional.IsDefined(UniqueIdentifier)) + { + writer.WritePropertyName("uniqueIdentifier"u8); + writer.WriteStringValue(UniqueIdentifier.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. + SecretProperties IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) => JsonModelCreateCore(ref reader, options); + + /// The JSON reader. + /// The client options for reading and writing models. + protected virtual SecretProperties 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(SecretProperties)} does not support reading '{format}' format."); + } + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeSecretProperties(document.RootElement, options); + } + + /// The JSON element to deserialize. + /// The client options for reading and writing models. + internal static SecretProperties DeserializeSecretProperties(JsonElement element, ModelReaderWriterOptions options) + { + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + string value = default; + string provisioningState = default; + Guid? uniqueIdentifier = default; + IDictionary additionalBinaryDataProperties = new ChangeTrackingDictionary(); + foreach (var prop in element.EnumerateObject()) + { + if (prop.NameEquals("value"u8)) + { + value = prop.Value.GetString(); + continue; + } + if (prop.NameEquals("provisioningState"u8)) + { + provisioningState = prop.Value.GetString(); + continue; + } + if (prop.NameEquals("uniqueIdentifier"u8)) + { + if (prop.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + uniqueIdentifier = new Guid(prop.Value.GetString()); + continue; + } + if (options.Format != "W") + { + additionalBinaryDataProperties.Add(prop.Name, BinaryData.FromString(prop.Value.GetRawText())); + } + } + return new SecretProperties(value, provisioningState, uniqueIdentifier, 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, AzureResourceManagerDevTestLabsContext.Default); + default: + throw new FormatException($"The model {nameof(SecretProperties)} does not support writing '{options.Format}' format."); + } + } + + /// The data to parse. + /// The client options for reading and writing models. + SecretProperties IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) => PersistableModelCreateCore(data, options); + + /// The client options for reading and writing models. + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + } +} diff --git a/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/Models/SecretProperties.cs b/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/Models/SecretProperties.cs new file mode 100644 index 000000000000..710e36af09fb --- /dev/null +++ b/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/Models/SecretProperties.cs @@ -0,0 +1,46 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; + +namespace Azure.ResourceManager.DevTestLabs.Models +{ + /// Properties of a secret. + internal partial class SecretProperties + { + /// Keeps track of any properties unknown to the library. + private protected readonly IDictionary _additionalBinaryDataProperties; + + /// Initializes a new instance of . + public SecretProperties() + { + } + + /// Initializes a new instance of . + /// The value of the secret for secret creation. + /// The provisioning status of the resource. + /// The unique immutable identifier of a resource (Guid). + /// Keeps track of any properties unknown to the library. + internal SecretProperties(string value, string provisioningState, Guid? uniqueIdentifier, IDictionary additionalBinaryDataProperties) + { + Value = value; + ProvisioningState = provisioningState; + UniqueIdentifier = uniqueIdentifier; + _additionalBinaryDataProperties = additionalBinaryDataProperties; + } + + /// The value of the secret for secret creation. + public string Value { get; set; } + + /// The provisioning status of the resource. + public string ProvisioningState { get; } + + /// The unique immutable identifier of a resource (Guid). + public Guid? UniqueIdentifier { get; } + } +} diff --git a/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/Models/ServiceFabricList.Serialization.cs b/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/Models/ServiceFabricList.Serialization.cs index 821915ffa2aa..3db6d8e3a2bc 100644 --- a/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/Models/ServiceFabricList.Serialization.cs +++ b/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/Models/ServiceFabricList.Serialization.cs @@ -9,14 +9,45 @@ using System.ClientModel.Primitives; using System.Collections.Generic; using System.Text.Json; -using Azure.Core; +using Azure; +using Azure.ResourceManager.DevTestLabs; namespace Azure.ResourceManager.DevTestLabs.Models { - internal partial class ServiceFabricList : IUtf8JsonSerializable, IJsonModel + /// The response of a list operation. + internal partial class ServiceFabricList : IJsonModel { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + /// Initializes a new instance of for deserialization. + internal ServiceFabricList() + { + } + /// The data to parse. + /// The client options for reading and writing models. + protected virtual ServiceFabricList 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 DeserializeServiceFabricList(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(ServiceFabricList)} does not support reading '{options.Format}' format."); + } + } + + /// The to deserialize the from. + internal static ServiceFabricList FromResponse(Response response) + { + using JsonDocument document = JsonDocument.Parse(response.Content, ModelSerializationExtensions.JsonDocumentOptions); + return DeserializeServiceFabricList(document.RootElement, ModelSerializationExtensions.WireOptions); + } + + /// The JSON writer. + /// The client options for reading and writing models. void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) { writer.WriteStartObject(); @@ -28,36 +59,32 @@ 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(ServiceFabricList)} does not support writing '{format}' format."); } - - if (Optional.IsCollectionDefined(Value)) + writer.WritePropertyName("value"u8); + writer.WriteStartArray(); + foreach (DevTestLabServiceFabricData item in Value) { - writer.WritePropertyName("value"u8); - writer.WriteStartArray(); - foreach (var item in Value) - { - writer.WriteObjectValue(item, options); - } - writer.WriteEndArray(); + writer.WriteObjectValue(item, options); } + writer.WriteEndArray(); if (Optional.IsDefined(NextLink)) { writer.WritePropertyName("nextLink"u8); - writer.WriteStringValue(NextLink); + 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); } @@ -66,64 +93,70 @@ protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWrit } } - ServiceFabricList IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + /// The JSON reader. + /// The client options for reading and writing models. + ServiceFabricList IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) => JsonModelCreateCore(ref reader, options); + + /// The JSON reader. + /// The client options for reading and writing models. + protected virtual ServiceFabricList 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(ServiceFabricList)} does not support reading '{format}' format."); } - using JsonDocument document = JsonDocument.ParseValue(ref reader); return DeserializeServiceFabricList(document.RootElement, options); } - internal static ServiceFabricList DeserializeServiceFabricList(JsonElement element, ModelReaderWriterOptions options = null) + /// The JSON element to deserialize. + /// The client options for reading and writing models. + internal static ServiceFabricList DeserializeServiceFabricList(JsonElement element, ModelReaderWriterOptions options) { - options ??= ModelSerializationExtensions.WireOptions; - if (element.ValueKind == JsonValueKind.Null) { return null; } - IReadOnlyList value = default; - string nextLink = default; - IDictionary serializedAdditionalRawData = default; - Dictionary rawDataDictionary = new Dictionary(); - foreach (var property in element.EnumerateObject()) + IList value = default; + Uri nextLink = default; + IDictionary additionalBinaryDataProperties = new ChangeTrackingDictionary(); + foreach (var prop in element.EnumerateObject()) { - if (property.NameEquals("value"u8)) + if (prop.NameEquals("value"u8)) { - if (property.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(DevTestLabServiceFabricData.DeserializeDevTestLabServiceFabricData(item, options)); } value = array; continue; } - if (property.NameEquals("nextLink"u8)) + if (prop.NameEquals("nextLink"u8)) { - nextLink = property.Value.GetString(); + if (prop.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + nextLink = string.IsNullOrEmpty(prop.Value.GetString()) ? null : 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 ServiceFabricList(value ?? new ChangeTrackingList(), nextLink, serializedAdditionalRawData); + return new ServiceFabricList(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": @@ -133,22 +166,11 @@ BinaryData IPersistableModel.Write(ModelReaderWriterOptions o } } - ServiceFabricList 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 DeserializeServiceFabricList(document.RootElement, options); - } - default: - throw new FormatException($"The model {nameof(ServiceFabricList)} does not support reading '{options.Format}' format."); - } - } + /// The data to parse. + /// The client options for reading and writing models. + ServiceFabricList IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) => PersistableModelCreateCore(data, options); + /// The client options for reading and writing models. string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; } } diff --git a/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/Models/ServiceFabricList.cs b/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/Models/ServiceFabricList.cs index 70e3687864bd..fbcdc1eba0cd 100644 --- a/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/Models/ServiceFabricList.cs +++ b/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/Models/ServiceFabricList.cs @@ -7,64 +7,39 @@ using System; using System.Collections.Generic; +using System.Linq; +using Azure.ResourceManager.DevTestLabs; namespace Azure.ResourceManager.DevTestLabs.Models { /// The response of a list operation. internal partial class ServiceFabricList { - /// - /// 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 ServiceFabricList() + /// The ServiceFabric items on this page. + internal ServiceFabricList(IEnumerable value) { - Value = new ChangeTrackingList(); + Value = value.ToList(); } /// Initializes a new instance of . - /// Results of the list operation. - /// Link for next set of results. - /// Keeps track of any properties unknown to the library. - internal ServiceFabricList(IReadOnlyList value, string nextLink, IDictionary serializedAdditionalRawData) + /// The ServiceFabric items on this page. + /// The link to the next page of items. + /// Keeps track of any properties unknown to the library. + internal ServiceFabricList(IList value, Uri nextLink, IDictionary additionalBinaryDataProperties) { Value = value; NextLink = nextLink; - _serializedAdditionalRawData = serializedAdditionalRawData; + _additionalBinaryDataProperties = additionalBinaryDataProperties; } - /// Results of the list operation. - public IReadOnlyList Value { get; } - /// Link for next set of results. - public string NextLink { get; } + /// The ServiceFabric items on this page. + public IList Value { get; } + + /// The link to the next page of items. + public Uri NextLink { get; } } } diff --git a/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/Models/ServiceFabricProperties.Serialization.cs b/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/Models/ServiceFabricProperties.Serialization.cs new file mode 100644 index 000000000000..864f12c6ab04 --- /dev/null +++ b/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/Models/ServiceFabricProperties.Serialization.cs @@ -0,0 +1,199 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Text.Json; +using Azure.ResourceManager.DevTestLabs; + +namespace Azure.ResourceManager.DevTestLabs.Models +{ + /// Properties of a service fabric. + internal partial class ServiceFabricProperties : IJsonModel + { + /// The data to parse. + /// The client options for reading and writing models. + protected virtual ServiceFabricProperties 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 DeserializeServiceFabricProperties(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(ServiceFabricProperties)} does not support reading '{options.Format}' format."); + } + } + + /// 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(ServiceFabricProperties)} does not support writing '{format}' format."); + } + if (Optional.IsDefined(ExternalServiceFabricId)) + { + writer.WritePropertyName("externalServiceFabricId"u8); + writer.WriteStringValue(ExternalServiceFabricId); + } + if (Optional.IsDefined(EnvironmentId)) + { + writer.WritePropertyName("environmentId"u8); + writer.WriteStringValue(EnvironmentId); + } + if (options.Format != "W" && Optional.IsDefined(ApplicableSchedule)) + { + writer.WritePropertyName("applicableSchedule"u8); + writer.WriteObjectValue(ApplicableSchedule, options); + } + if (options.Format != "W" && Optional.IsDefined(ProvisioningState)) + { + writer.WritePropertyName("provisioningState"u8); + writer.WriteStringValue(ProvisioningState); + } + if (options.Format != "W" && Optional.IsDefined(UniqueIdentifier)) + { + writer.WritePropertyName("uniqueIdentifier"u8); + writer.WriteStringValue(UniqueIdentifier.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. + ServiceFabricProperties IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) => JsonModelCreateCore(ref reader, options); + + /// The JSON reader. + /// The client options for reading and writing models. + protected virtual ServiceFabricProperties 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(ServiceFabricProperties)} does not support reading '{format}' format."); + } + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeServiceFabricProperties(document.RootElement, options); + } + + /// The JSON element to deserialize. + /// The client options for reading and writing models. + internal static ServiceFabricProperties DeserializeServiceFabricProperties(JsonElement element, ModelReaderWriterOptions options) + { + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + string externalServiceFabricId = default; + string environmentId = default; + DevTestLabApplicableSchedule applicableSchedule = default; + string provisioningState = default; + Guid? uniqueIdentifier = default; + IDictionary additionalBinaryDataProperties = new ChangeTrackingDictionary(); + foreach (var prop in element.EnumerateObject()) + { + if (prop.NameEquals("externalServiceFabricId"u8)) + { + externalServiceFabricId = prop.Value.GetString(); + continue; + } + if (prop.NameEquals("environmentId"u8)) + { + environmentId = prop.Value.GetString(); + continue; + } + if (prop.NameEquals("applicableSchedule"u8)) + { + if (prop.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + applicableSchedule = DevTestLabApplicableSchedule.DeserializeDevTestLabApplicableSchedule(prop.Value, options); + continue; + } + if (prop.NameEquals("provisioningState"u8)) + { + provisioningState = prop.Value.GetString(); + continue; + } + if (prop.NameEquals("uniqueIdentifier"u8)) + { + if (prop.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + uniqueIdentifier = new Guid(prop.Value.GetString()); + continue; + } + if (options.Format != "W") + { + additionalBinaryDataProperties.Add(prop.Name, BinaryData.FromString(prop.Value.GetRawText())); + } + } + return new ServiceFabricProperties( + externalServiceFabricId, + environmentId, + applicableSchedule, + provisioningState, + uniqueIdentifier, + 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, AzureResourceManagerDevTestLabsContext.Default); + default: + throw new FormatException($"The model {nameof(ServiceFabricProperties)} does not support writing '{options.Format}' format."); + } + } + + /// The data to parse. + /// The client options for reading and writing models. + ServiceFabricProperties IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) => PersistableModelCreateCore(data, options); + + /// The client options for reading and writing models. + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + } +} diff --git a/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/Models/ServiceFabricProperties.cs b/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/Models/ServiceFabricProperties.cs new file mode 100644 index 000000000000..98ef40927be9 --- /dev/null +++ b/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/Models/ServiceFabricProperties.cs @@ -0,0 +1,56 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; + +namespace Azure.ResourceManager.DevTestLabs.Models +{ + /// Properties of a service fabric. + internal partial class ServiceFabricProperties + { + /// Keeps track of any properties unknown to the library. + private protected readonly IDictionary _additionalBinaryDataProperties; + + /// Initializes a new instance of . + public ServiceFabricProperties() + { + } + + /// Initializes a new instance of . + /// The backing service fabric resource's id. + /// The resource id of the environment under which the service fabric resource is present. + /// The applicable schedule for the virtual machine. + /// The provisioning status of the resource. + /// The unique immutable identifier of a resource (Guid). + /// Keeps track of any properties unknown to the library. + internal ServiceFabricProperties(string externalServiceFabricId, string environmentId, DevTestLabApplicableSchedule applicableSchedule, string provisioningState, Guid? uniqueIdentifier, IDictionary additionalBinaryDataProperties) + { + ExternalServiceFabricId = externalServiceFabricId; + EnvironmentId = environmentId; + ApplicableSchedule = applicableSchedule; + ProvisioningState = provisioningState; + UniqueIdentifier = uniqueIdentifier; + _additionalBinaryDataProperties = additionalBinaryDataProperties; + } + + /// The backing service fabric resource's id. + public string ExternalServiceFabricId { get; set; } + + /// The resource id of the environment under which the service fabric resource is present. + public string EnvironmentId { get; set; } + + /// The applicable schedule for the virtual machine. + public DevTestLabApplicableSchedule ApplicableSchedule { get; } + + /// The provisioning status of the resource. + public string ProvisioningState { get; } + + /// The unique immutable identifier of a resource (Guid). + public Guid? UniqueIdentifier { get; } + } +} diff --git a/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/Models/SharedPublicIPAddressConfiguration.Serialization.cs b/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/Models/SharedPublicIPAddressConfiguration.Serialization.cs deleted file mode 100644 index 56aeeb22c8cd..000000000000 --- a/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/Models/SharedPublicIPAddressConfiguration.Serialization.cs +++ /dev/null @@ -1,143 +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.DevTestLabs.Models -{ - internal partial class SharedPublicIPAddressConfiguration : 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(SharedPublicIPAddressConfiguration)} does not support writing '{format}' format."); - } - - if (Optional.IsCollectionDefined(InboundNatRules)) - { - writer.WritePropertyName("inboundNatRules"u8); - writer.WriteStartArray(); - foreach (var item in InboundNatRules) - { - writer.WriteObjectValue(item, options); - } - writer.WriteEndArray(); - } - if (options.Format != "W" && _serializedAdditionalRawData != null) - { - foreach (var item in _serializedAdditionalRawData) - { - writer.WritePropertyName(item.Key); -#if NET6_0_OR_GREATER - writer.WriteRawValue(item.Value); -#else - using (JsonDocument document = JsonDocument.Parse(item.Value, ModelSerializationExtensions.JsonDocumentOptions)) - { - JsonSerializer.Serialize(writer, document.RootElement); - } -#endif - } - } - } - - SharedPublicIPAddressConfiguration 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(SharedPublicIPAddressConfiguration)} does not support reading '{format}' format."); - } - - using JsonDocument document = JsonDocument.ParseValue(ref reader); - return DeserializeSharedPublicIPAddressConfiguration(document.RootElement, options); - } - - internal static SharedPublicIPAddressConfiguration DeserializeSharedPublicIPAddressConfiguration(JsonElement element, ModelReaderWriterOptions options = null) - { - options ??= ModelSerializationExtensions.WireOptions; - - if (element.ValueKind == JsonValueKind.Null) - { - return null; - } - IList inboundNatRules = default; - IDictionary serializedAdditionalRawData = default; - Dictionary rawDataDictionary = new Dictionary(); - foreach (var property in element.EnumerateObject()) - { - if (property.NameEquals("inboundNatRules"u8)) - { - if (property.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - List array = new List(); - foreach (var item in property.Value.EnumerateArray()) - { - array.Add(DevTestLabInboundNatRule.DeserializeDevTestLabInboundNatRule(item, options)); - } - inboundNatRules = array; - continue; - } - if (options.Format != "W") - { - rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); - } - } - serializedAdditionalRawData = rawDataDictionary; - return new SharedPublicIPAddressConfiguration(inboundNatRules ?? 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, AzureResourceManagerDevTestLabsContext.Default); - default: - throw new FormatException($"The model {nameof(SharedPublicIPAddressConfiguration)} does not support writing '{options.Format}' format."); - } - } - - SharedPublicIPAddressConfiguration 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 DeserializeSharedPublicIPAddressConfiguration(document.RootElement, options); - } - default: - throw new FormatException($"The model {nameof(SharedPublicIPAddressConfiguration)} does not support reading '{options.Format}' format."); - } - } - - string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; - } -} diff --git a/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/Models/SharedPublicIPAddressConfiguration.cs b/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/Models/SharedPublicIPAddressConfiguration.cs deleted file mode 100644 index cf468f7e3a83..000000000000 --- a/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/Models/SharedPublicIPAddressConfiguration.cs +++ /dev/null @@ -1,66 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System; -using System.Collections.Generic; - -namespace Azure.ResourceManager.DevTestLabs.Models -{ - /// Properties of a virtual machine that determine how it is connected to a load balancer. - internal partial class SharedPublicIPAddressConfiguration - { - /// - /// 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 SharedPublicIPAddressConfiguration() - { - InboundNatRules = new ChangeTrackingList(); - } - - /// Initializes a new instance of . - /// The incoming NAT rules. - /// Keeps track of any properties unknown to the library. - internal SharedPublicIPAddressConfiguration(IList inboundNatRules, IDictionary serializedAdditionalRawData) - { - InboundNatRules = inboundNatRules; - _serializedAdditionalRawData = serializedAdditionalRawData; - } - - /// The incoming NAT rules. - public IList InboundNatRules { get; } - } -} diff --git a/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/Models/SharedPublicIpAddressConfiguration.Serialization.cs b/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/Models/SharedPublicIpAddressConfiguration.Serialization.cs new file mode 100644 index 000000000000..95f0ea9665c7 --- /dev/null +++ b/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/Models/SharedPublicIpAddressConfiguration.Serialization.cs @@ -0,0 +1,155 @@ +// 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.DevTestLabs; + +namespace Azure.ResourceManager.DevTestLabs.Models +{ + /// Properties of a virtual machine that determine how it is connected to a load balancer. + internal partial class SharedPublicIpAddressConfiguration : IJsonModel + { + /// The data to parse. + /// The client options for reading and writing models. + protected virtual SharedPublicIpAddressConfiguration 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 DeserializeSharedPublicIpAddressConfiguration(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(SharedPublicIpAddressConfiguration)} does not support reading '{options.Format}' format."); + } + } + + /// 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(SharedPublicIpAddressConfiguration)} does not support writing '{format}' format."); + } + if (Optional.IsCollectionDefined(InboundNatRules)) + { + writer.WritePropertyName("inboundNatRules"u8); + writer.WriteStartArray(); + foreach (DevTestLabInboundNatRule item in InboundNatRules) + { + 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); +#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. + SharedPublicIpAddressConfiguration IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) => JsonModelCreateCore(ref reader, options); + + /// The JSON reader. + /// The client options for reading and writing models. + protected virtual SharedPublicIpAddressConfiguration 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(SharedPublicIpAddressConfiguration)} does not support reading '{format}' format."); + } + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeSharedPublicIpAddressConfiguration(document.RootElement, options); + } + + /// The JSON element to deserialize. + /// The client options for reading and writing models. + internal static SharedPublicIpAddressConfiguration DeserializeSharedPublicIpAddressConfiguration(JsonElement element, ModelReaderWriterOptions options) + { + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + IList inboundNatRules = default; + IDictionary additionalBinaryDataProperties = new ChangeTrackingDictionary(); + foreach (var prop in element.EnumerateObject()) + { + if (prop.NameEquals("inboundNatRules"u8)) + { + if (prop.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + List array = new List(); + foreach (var item in prop.Value.EnumerateArray()) + { + array.Add(DevTestLabInboundNatRule.DeserializeDevTestLabInboundNatRule(item, options)); + } + inboundNatRules = array; + continue; + } + if (options.Format != "W") + { + additionalBinaryDataProperties.Add(prop.Name, BinaryData.FromString(prop.Value.GetRawText())); + } + } + return new SharedPublicIpAddressConfiguration(inboundNatRules ?? 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, AzureResourceManagerDevTestLabsContext.Default); + default: + throw new FormatException($"The model {nameof(SharedPublicIpAddressConfiguration)} does not support writing '{options.Format}' format."); + } + } + + /// The data to parse. + /// The client options for reading and writing models. + SharedPublicIpAddressConfiguration IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) => PersistableModelCreateCore(data, options); + + /// The client options for reading and writing models. + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + } +} diff --git a/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/Models/SharedPublicIpAddressConfiguration.cs b/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/Models/SharedPublicIpAddressConfiguration.cs new file mode 100644 index 000000000000..a2c60f884506 --- /dev/null +++ b/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/Models/SharedPublicIpAddressConfiguration.cs @@ -0,0 +1,38 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; +using Azure.ResourceManager.DevTestLabs; + +namespace Azure.ResourceManager.DevTestLabs.Models +{ + /// Properties of a virtual machine that determine how it is connected to a load balancer. + internal partial class SharedPublicIpAddressConfiguration + { + /// Keeps track of any properties unknown to the library. + private protected readonly IDictionary _additionalBinaryDataProperties; + + /// Initializes a new instance of . + public SharedPublicIpAddressConfiguration() + { + InboundNatRules = new ChangeTrackingList(); + } + + /// Initializes a new instance of . + /// The incoming NAT rules. + /// Keeps track of any properties unknown to the library. + internal SharedPublicIpAddressConfiguration(IList inboundNatRules, IDictionary additionalBinaryDataProperties) + { + InboundNatRules = inboundNatRules; + _additionalBinaryDataProperties = additionalBinaryDataProperties; + } + + /// The incoming NAT rules. + public IList InboundNatRules { get; } + } +} diff --git a/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/Models/SubnetSharedPublicIPAddressConfiguration.Serialization.cs b/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/Models/SubnetSharedPublicIPAddressConfiguration.Serialization.cs index 6d525b735830..278521b2f3e4 100644 --- a/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/Models/SubnetSharedPublicIPAddressConfiguration.Serialization.cs +++ b/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/Models/SubnetSharedPublicIPAddressConfiguration.Serialization.cs @@ -9,14 +9,32 @@ using System.ClientModel.Primitives; using System.Collections.Generic; using System.Text.Json; -using Azure.Core; +using Azure.ResourceManager.DevTestLabs; namespace Azure.ResourceManager.DevTestLabs.Models { - internal partial class SubnetSharedPublicIPAddressConfiguration : IUtf8JsonSerializable, IJsonModel + /// Configuration for public IP address sharing. + internal partial class SubnetSharedPublicIPAddressConfiguration : IJsonModel { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + /// The data to parse. + /// The client options for reading and writing models. + protected virtual SubnetSharedPublicIPAddressConfiguration 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 DeserializeSubnetSharedPublicIPAddressConfiguration(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(SubnetSharedPublicIPAddressConfiguration)} does not support reading '{options.Format}' format."); + } + } + /// The JSON writer. + /// The client options for reading and writing models. void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) { writer.WriteStartObject(); @@ -28,31 +46,30 @@ void IJsonModel.Write(Utf8JsonWriter w /// 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(SubnetSharedPublicIPAddressConfiguration)} does not support writing '{format}' format."); } - if (Optional.IsCollectionDefined(AllowedPorts)) { writer.WritePropertyName("allowedPorts"u8); writer.WriteStartArray(); - foreach (var item in AllowedPorts) + foreach (DevTestLabPort item in AllowedPorts) { 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); } @@ -61,39 +78,43 @@ protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWrit } } - SubnetSharedPublicIPAddressConfiguration IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + /// The JSON reader. + /// The client options for reading and writing models. + SubnetSharedPublicIPAddressConfiguration IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) => JsonModelCreateCore(ref reader, options); + + /// The JSON reader. + /// The client options for reading and writing models. + protected virtual SubnetSharedPublicIPAddressConfiguration 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(SubnetSharedPublicIPAddressConfiguration)} does not support reading '{format}' format."); } - using JsonDocument document = JsonDocument.ParseValue(ref reader); return DeserializeSubnetSharedPublicIPAddressConfiguration(document.RootElement, options); } - internal static SubnetSharedPublicIPAddressConfiguration DeserializeSubnetSharedPublicIPAddressConfiguration(JsonElement element, ModelReaderWriterOptions options = null) + /// The JSON element to deserialize. + /// The client options for reading and writing models. + internal static SubnetSharedPublicIPAddressConfiguration DeserializeSubnetSharedPublicIPAddressConfiguration(JsonElement element, ModelReaderWriterOptions options) { - options ??= ModelSerializationExtensions.WireOptions; - if (element.ValueKind == JsonValueKind.Null) { return null; } IList allowedPorts = 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("allowedPorts"u8)) + if (prop.NameEquals("allowedPorts"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(DevTestLabPort.DeserializeDevTestLabPort(item, options)); } @@ -102,17 +123,19 @@ internal static SubnetSharedPublicIPAddressConfiguration DeserializeSubnetShared } 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 SubnetSharedPublicIPAddressConfiguration(allowedPorts ?? new ChangeTrackingList(), serializedAdditionalRawData); + return new SubnetSharedPublicIPAddressConfiguration(allowedPorts ?? 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": @@ -122,22 +145,11 @@ BinaryData IPersistableModel.Write(Mod } } - SubnetSharedPublicIPAddressConfiguration 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 DeserializeSubnetSharedPublicIPAddressConfiguration(document.RootElement, options); - } - default: - throw new FormatException($"The model {nameof(SubnetSharedPublicIPAddressConfiguration)} does not support reading '{options.Format}' format."); - } - } + /// The data to parse. + /// The client options for reading and writing models. + SubnetSharedPublicIPAddressConfiguration IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) => PersistableModelCreateCore(data, options); + /// The client options for reading and writing models. string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; } } diff --git a/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/Models/SubnetSharedPublicIPAddressConfiguration.cs b/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/Models/SubnetSharedPublicIPAddressConfiguration.cs index ddc28ecc153a..8d8fa4fc78bf 100644 --- a/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/Models/SubnetSharedPublicIPAddressConfiguration.cs +++ b/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/Models/SubnetSharedPublicIPAddressConfiguration.cs @@ -7,43 +7,15 @@ using System; using System.Collections.Generic; +using Azure.ResourceManager.DevTestLabs; namespace Azure.ResourceManager.DevTestLabs.Models { /// Configuration for public IP address sharing. internal partial class SubnetSharedPublicIPAddressConfiguration { - /// - /// 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 SubnetSharedPublicIPAddressConfiguration() @@ -53,11 +25,11 @@ public SubnetSharedPublicIPAddressConfiguration() /// Initializes a new instance of . /// Backend ports that virtual machines on this subnet are allowed to expose. - /// Keeps track of any properties unknown to the library. - internal SubnetSharedPublicIPAddressConfiguration(IList allowedPorts, IDictionary serializedAdditionalRawData) + /// Keeps track of any properties unknown to the library. + internal SubnetSharedPublicIPAddressConfiguration(IList allowedPorts, IDictionary additionalBinaryDataProperties) { AllowedPorts = allowedPorts; - _serializedAdditionalRawData = serializedAdditionalRawData; + _additionalBinaryDataProperties = additionalBinaryDataProperties; } /// Backend ports that virtual machines on this subnet are allowed to expose. diff --git a/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/Models/UserList.Serialization.cs b/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/Models/UserList.Serialization.cs index ea1a99428f9d..c84168ff375b 100644 --- a/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/Models/UserList.Serialization.cs +++ b/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/Models/UserList.Serialization.cs @@ -9,14 +9,45 @@ using System.ClientModel.Primitives; using System.Collections.Generic; using System.Text.Json; -using Azure.Core; +using Azure; +using Azure.ResourceManager.DevTestLabs; namespace Azure.ResourceManager.DevTestLabs.Models { - internal partial class UserList : IUtf8JsonSerializable, IJsonModel + /// The response of a list operation. + internal partial class UserList : IJsonModel { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + /// Initializes a new instance of for deserialization. + internal UserList() + { + } + /// The data to parse. + /// The client options for reading and writing models. + protected virtual UserList 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 DeserializeUserList(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(UserList)} does not support reading '{options.Format}' format."); + } + } + + /// The to deserialize the from. + internal static UserList FromResponse(Response response) + { + using JsonDocument document = JsonDocument.Parse(response.Content, ModelSerializationExtensions.JsonDocumentOptions); + return DeserializeUserList(document.RootElement, ModelSerializationExtensions.WireOptions); + } + + /// The JSON writer. + /// The client options for reading and writing models. void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) { writer.WriteStartObject(); @@ -28,36 +59,32 @@ void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions /// 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(UserList)} does not support writing '{format}' format."); } - - if (Optional.IsCollectionDefined(Value)) + writer.WritePropertyName("value"u8); + writer.WriteStartArray(); + foreach (DevTestLabUserData item in Value) { - writer.WritePropertyName("value"u8); - writer.WriteStartArray(); - foreach (var item in Value) - { - writer.WriteObjectValue(item, options); - } - writer.WriteEndArray(); + writer.WriteObjectValue(item, options); } + writer.WriteEndArray(); if (Optional.IsDefined(NextLink)) { writer.WritePropertyName("nextLink"u8); - writer.WriteStringValue(NextLink); + 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); } @@ -66,64 +93,70 @@ protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWrit } } - UserList IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + /// The JSON reader. + /// The client options for reading and writing models. + UserList IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) => JsonModelCreateCore(ref reader, options); + + /// The JSON reader. + /// The client options for reading and writing models. + protected virtual UserList 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(UserList)} does not support reading '{format}' format."); } - using JsonDocument document = JsonDocument.ParseValue(ref reader); return DeserializeUserList(document.RootElement, options); } - internal static UserList DeserializeUserList(JsonElement element, ModelReaderWriterOptions options = null) + /// The JSON element to deserialize. + /// The client options for reading and writing models. + internal static UserList DeserializeUserList(JsonElement element, ModelReaderWriterOptions options) { - options ??= ModelSerializationExtensions.WireOptions; - if (element.ValueKind == JsonValueKind.Null) { return null; } - IReadOnlyList value = default; - string nextLink = default; - IDictionary serializedAdditionalRawData = default; - Dictionary rawDataDictionary = new Dictionary(); - foreach (var property in element.EnumerateObject()) + IList value = default; + Uri nextLink = default; + IDictionary additionalBinaryDataProperties = new ChangeTrackingDictionary(); + foreach (var prop in element.EnumerateObject()) { - if (property.NameEquals("value"u8)) + if (prop.NameEquals("value"u8)) { - if (property.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(DevTestLabUserData.DeserializeDevTestLabUserData(item, options)); } value = array; continue; } - if (property.NameEquals("nextLink"u8)) + if (prop.NameEquals("nextLink"u8)) { - nextLink = property.Value.GetString(); + if (prop.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + nextLink = string.IsNullOrEmpty(prop.Value.GetString()) ? null : 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 UserList(value ?? new ChangeTrackingList(), nextLink, serializedAdditionalRawData); + return new UserList(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": @@ -133,22 +166,11 @@ BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) } } - UserList 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 DeserializeUserList(document.RootElement, options); - } - default: - throw new FormatException($"The model {nameof(UserList)} does not support reading '{options.Format}' format."); - } - } + /// The data to parse. + /// The client options for reading and writing models. + UserList IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) => PersistableModelCreateCore(data, options); + /// The client options for reading and writing models. string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; } } diff --git a/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/Models/UserList.cs b/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/Models/UserList.cs index 39f7ffa3a381..a007e1a977a2 100644 --- a/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/Models/UserList.cs +++ b/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/Models/UserList.cs @@ -7,64 +7,39 @@ using System; using System.Collections.Generic; +using System.Linq; +using Azure.ResourceManager.DevTestLabs; namespace Azure.ResourceManager.DevTestLabs.Models { /// The response of a list operation. internal partial class UserList { - /// - /// 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 UserList() + /// The User items on this page. + internal UserList(IEnumerable value) { - Value = new ChangeTrackingList(); + Value = value.ToList(); } /// Initializes a new instance of . - /// Results of the list operation. - /// Link for next set of results. - /// Keeps track of any properties unknown to the library. - internal UserList(IReadOnlyList value, string nextLink, IDictionary serializedAdditionalRawData) + /// The User items on this page. + /// The link to the next page of items. + /// Keeps track of any properties unknown to the library. + internal UserList(IList value, Uri nextLink, IDictionary additionalBinaryDataProperties) { Value = value; NextLink = nextLink; - _serializedAdditionalRawData = serializedAdditionalRawData; + _additionalBinaryDataProperties = additionalBinaryDataProperties; } - /// Results of the list operation. - public IReadOnlyList Value { get; } - /// Link for next set of results. - public string NextLink { get; } + /// The User items on this page. + public IList Value { get; } + + /// The link to the next page of items. + public Uri NextLink { get; } } } diff --git a/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/Models/UserProperties.Serialization.cs b/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/Models/UserProperties.Serialization.cs new file mode 100644 index 000000000000..c4822a8ae1b7 --- /dev/null +++ b/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/Models/UserProperties.Serialization.cs @@ -0,0 +1,207 @@ +// 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.DevTestLabs; + +namespace Azure.ResourceManager.DevTestLabs.Models +{ + /// Properties of a lab user profile. + internal partial class UserProperties : IJsonModel + { + /// The data to parse. + /// The client options for reading and writing models. + protected virtual UserProperties 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 DeserializeUserProperties(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(UserProperties)} does not support reading '{options.Format}' format."); + } + } + + /// 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(UserProperties)} does not support writing '{format}' format."); + } + if (Optional.IsDefined(Identity)) + { + writer.WritePropertyName("identity"u8); + writer.WriteObjectValue(Identity, options); + } + if (Optional.IsDefined(SecretStore)) + { + writer.WritePropertyName("secretStore"u8); + writer.WriteObjectValue(SecretStore, options); + } + if (options.Format != "W" && Optional.IsDefined(CreatedOn)) + { + writer.WritePropertyName("createdDate"u8); + writer.WriteStringValue(CreatedOn.Value, "O"); + } + if (options.Format != "W" && Optional.IsDefined(ProvisioningState)) + { + writer.WritePropertyName("provisioningState"u8); + writer.WriteStringValue(ProvisioningState); + } + if (options.Format != "W" && Optional.IsDefined(UniqueIdentifier)) + { + writer.WritePropertyName("uniqueIdentifier"u8); + writer.WriteStringValue(UniqueIdentifier.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. + UserProperties IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) => JsonModelCreateCore(ref reader, options); + + /// The JSON reader. + /// The client options for reading and writing models. + protected virtual UserProperties 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(UserProperties)} does not support reading '{format}' format."); + } + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeUserProperties(document.RootElement, options); + } + + /// The JSON element to deserialize. + /// The client options for reading and writing models. + internal static UserProperties DeserializeUserProperties(JsonElement element, ModelReaderWriterOptions options) + { + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + DevTestLabUserIdentity identity = default; + DevTestLabUserSecretStore secretStore = default; + DateTimeOffset? createdOn = default; + string provisioningState = default; + Guid? uniqueIdentifier = default; + IDictionary additionalBinaryDataProperties = new ChangeTrackingDictionary(); + foreach (var prop in element.EnumerateObject()) + { + if (prop.NameEquals("identity"u8)) + { + if (prop.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + identity = DevTestLabUserIdentity.DeserializeDevTestLabUserIdentity(prop.Value, options); + continue; + } + if (prop.NameEquals("secretStore"u8)) + { + if (prop.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + secretStore = DevTestLabUserSecretStore.DeserializeDevTestLabUserSecretStore(prop.Value, options); + continue; + } + if (prop.NameEquals("createdDate"u8)) + { + if (prop.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + createdOn = prop.Value.GetDateTimeOffset("O"); + continue; + } + if (prop.NameEquals("provisioningState"u8)) + { + provisioningState = prop.Value.GetString(); + continue; + } + if (prop.NameEquals("uniqueIdentifier"u8)) + { + if (prop.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + uniqueIdentifier = new Guid(prop.Value.GetString()); + continue; + } + if (options.Format != "W") + { + additionalBinaryDataProperties.Add(prop.Name, BinaryData.FromString(prop.Value.GetRawText())); + } + } + return new UserProperties( + identity, + secretStore, + createdOn, + provisioningState, + uniqueIdentifier, + 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, AzureResourceManagerDevTestLabsContext.Default); + default: + throw new FormatException($"The model {nameof(UserProperties)} does not support writing '{options.Format}' format."); + } + } + + /// The data to parse. + /// The client options for reading and writing models. + UserProperties IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) => PersistableModelCreateCore(data, options); + + /// The client options for reading and writing models. + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + } +} diff --git a/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/Models/UserProperties.cs b/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/Models/UserProperties.cs new file mode 100644 index 000000000000..fe5bb9e3aa9d --- /dev/null +++ b/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/Models/UserProperties.cs @@ -0,0 +1,56 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; + +namespace Azure.ResourceManager.DevTestLabs.Models +{ + /// Properties of a lab user profile. + internal partial class UserProperties + { + /// Keeps track of any properties unknown to the library. + private protected readonly IDictionary _additionalBinaryDataProperties; + + /// Initializes a new instance of . + public UserProperties() + { + } + + /// Initializes a new instance of . + /// The identity of the user. + /// The secret store of the user. + /// The creation date of the user profile. + /// The provisioning status of the resource. + /// The unique immutable identifier of a resource (Guid). + /// Keeps track of any properties unknown to the library. + internal UserProperties(DevTestLabUserIdentity identity, DevTestLabUserSecretStore secretStore, DateTimeOffset? createdOn, string provisioningState, Guid? uniqueIdentifier, IDictionary additionalBinaryDataProperties) + { + Identity = identity; + SecretStore = secretStore; + CreatedOn = createdOn; + ProvisioningState = provisioningState; + UniqueIdentifier = uniqueIdentifier; + _additionalBinaryDataProperties = additionalBinaryDataProperties; + } + + /// The identity of the user. + public DevTestLabUserIdentity Identity { get; set; } + + /// The secret store of the user. + public DevTestLabUserSecretStore SecretStore { get; set; } + + /// The creation date of the user profile. + public DateTimeOffset? CreatedOn { get; } + + /// The provisioning status of the resource. + public string ProvisioningState { get; } + + /// The unique immutable identifier of a resource (Guid). + public Guid? UniqueIdentifier { get; } + } +} diff --git a/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/Models/VirtualNetworkList.Serialization.cs b/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/Models/VirtualNetworkList.Serialization.cs index 91f8e87fa9fe..5c1bcc1004c2 100644 --- a/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/Models/VirtualNetworkList.Serialization.cs +++ b/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/Models/VirtualNetworkList.Serialization.cs @@ -9,14 +9,45 @@ using System.ClientModel.Primitives; using System.Collections.Generic; using System.Text.Json; -using Azure.Core; +using Azure; +using Azure.ResourceManager.DevTestLabs; namespace Azure.ResourceManager.DevTestLabs.Models { - internal partial class VirtualNetworkList : IUtf8JsonSerializable, IJsonModel + /// The response of a list operation. + internal partial class VirtualNetworkList : IJsonModel { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + /// Initializes a new instance of for deserialization. + internal VirtualNetworkList() + { + } + /// The data to parse. + /// The client options for reading and writing models. + protected virtual VirtualNetworkList 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 DeserializeVirtualNetworkList(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(VirtualNetworkList)} does not support reading '{options.Format}' format."); + } + } + + /// The to deserialize the from. + internal static VirtualNetworkList FromResponse(Response response) + { + using JsonDocument document = JsonDocument.Parse(response.Content, ModelSerializationExtensions.JsonDocumentOptions); + return DeserializeVirtualNetworkList(document.RootElement, ModelSerializationExtensions.WireOptions); + } + + /// The JSON writer. + /// The client options for reading and writing models. void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) { writer.WriteStartObject(); @@ -28,36 +59,32 @@ void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWrit /// 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(VirtualNetworkList)} does not support writing '{format}' format."); } - - if (Optional.IsCollectionDefined(Value)) + writer.WritePropertyName("value"u8); + writer.WriteStartArray(); + foreach (DevTestLabVirtualNetworkData item in Value) { - writer.WritePropertyName("value"u8); - writer.WriteStartArray(); - foreach (var item in Value) - { - writer.WriteObjectValue(item, options); - } - writer.WriteEndArray(); + writer.WriteObjectValue(item, options); } + writer.WriteEndArray(); if (Optional.IsDefined(NextLink)) { writer.WritePropertyName("nextLink"u8); - writer.WriteStringValue(NextLink); + 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); } @@ -66,64 +93,70 @@ protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWrit } } - VirtualNetworkList IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + /// The JSON reader. + /// The client options for reading and writing models. + VirtualNetworkList IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) => JsonModelCreateCore(ref reader, options); + + /// The JSON reader. + /// The client options for reading and writing models. + protected virtual VirtualNetworkList 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(VirtualNetworkList)} does not support reading '{format}' format."); } - using JsonDocument document = JsonDocument.ParseValue(ref reader); return DeserializeVirtualNetworkList(document.RootElement, options); } - internal static VirtualNetworkList DeserializeVirtualNetworkList(JsonElement element, ModelReaderWriterOptions options = null) + /// The JSON element to deserialize. + /// The client options for reading and writing models. + internal static VirtualNetworkList DeserializeVirtualNetworkList(JsonElement element, ModelReaderWriterOptions options) { - options ??= ModelSerializationExtensions.WireOptions; - if (element.ValueKind == JsonValueKind.Null) { return null; } - IReadOnlyList value = default; - string nextLink = default; - IDictionary serializedAdditionalRawData = default; - Dictionary rawDataDictionary = new Dictionary(); - foreach (var property in element.EnumerateObject()) + IList value = default; + Uri nextLink = default; + IDictionary additionalBinaryDataProperties = new ChangeTrackingDictionary(); + foreach (var prop in element.EnumerateObject()) { - if (property.NameEquals("value"u8)) + if (prop.NameEquals("value"u8)) { - if (property.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(DevTestLabVirtualNetworkData.DeserializeDevTestLabVirtualNetworkData(item, options)); } value = array; continue; } - if (property.NameEquals("nextLink"u8)) + if (prop.NameEquals("nextLink"u8)) { - nextLink = property.Value.GetString(); + if (prop.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + nextLink = string.IsNullOrEmpty(prop.Value.GetString()) ? null : 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 VirtualNetworkList(value ?? new ChangeTrackingList(), nextLink, serializedAdditionalRawData); + return new VirtualNetworkList(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": @@ -133,22 +166,11 @@ BinaryData IPersistableModel.Write(ModelReaderWriterOptions } } - VirtualNetworkList 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 DeserializeVirtualNetworkList(document.RootElement, options); - } - default: - throw new FormatException($"The model {nameof(VirtualNetworkList)} does not support reading '{options.Format}' format."); - } - } + /// The data to parse. + /// The client options for reading and writing models. + VirtualNetworkList IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) => PersistableModelCreateCore(data, options); + /// The client options for reading and writing models. string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; } } diff --git a/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/Models/VirtualNetworkList.cs b/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/Models/VirtualNetworkList.cs index 7872f189bc25..177382b09576 100644 --- a/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/Models/VirtualNetworkList.cs +++ b/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/Models/VirtualNetworkList.cs @@ -7,64 +7,39 @@ using System; using System.Collections.Generic; +using System.Linq; +using Azure.ResourceManager.DevTestLabs; namespace Azure.ResourceManager.DevTestLabs.Models { /// The response of a list operation. internal partial class VirtualNetworkList { - /// - /// 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 VirtualNetworkList() + /// The VirtualNetwork items on this page. + internal VirtualNetworkList(IEnumerable value) { - Value = new ChangeTrackingList(); + Value = value.ToList(); } /// Initializes a new instance of . - /// Results of the list operation. - /// Link for next set of results. - /// Keeps track of any properties unknown to the library. - internal VirtualNetworkList(IReadOnlyList value, string nextLink, IDictionary serializedAdditionalRawData) + /// The VirtualNetwork items on this page. + /// The link to the next page of items. + /// Keeps track of any properties unknown to the library. + internal VirtualNetworkList(IList value, Uri nextLink, IDictionary additionalBinaryDataProperties) { Value = value; NextLink = nextLink; - _serializedAdditionalRawData = serializedAdditionalRawData; + _additionalBinaryDataProperties = additionalBinaryDataProperties; } - /// Results of the list operation. - public IReadOnlyList Value { get; } - /// Link for next set of results. - public string NextLink { get; } + /// The VirtualNetwork items on this page. + public IList Value { get; } + + /// The link to the next page of items. + public Uri NextLink { get; } } } diff --git a/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/Models/VirtualNetworkProperties.Serialization.cs b/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/Models/VirtualNetworkProperties.Serialization.cs new file mode 100644 index 000000000000..03c5320b6129 --- /dev/null +++ b/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/Models/VirtualNetworkProperties.Serialization.cs @@ -0,0 +1,277 @@ +// 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.DevTestLabs; + +namespace Azure.ResourceManager.DevTestLabs.Models +{ + /// Properties of a virtual network. + internal partial class VirtualNetworkProperties : IJsonModel + { + /// The data to parse. + /// The client options for reading and writing models. + protected virtual VirtualNetworkProperties 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 DeserializeVirtualNetworkProperties(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(VirtualNetworkProperties)} does not support reading '{options.Format}' format."); + } + } + + /// 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(VirtualNetworkProperties)} does not support writing '{format}' format."); + } + if (Optional.IsCollectionDefined(AllowedSubnets)) + { + writer.WritePropertyName("allowedSubnets"u8); + writer.WriteStartArray(); + foreach (DevTestLabSubnet item in AllowedSubnets) + { + writer.WriteObjectValue(item, options); + } + writer.WriteEndArray(); + } + if (Optional.IsDefined(Description)) + { + writer.WritePropertyName("description"u8); + writer.WriteStringValue(Description); + } + if (Optional.IsDefined(ExternalProviderResourceId)) + { + writer.WritePropertyName("externalProviderResourceId"u8); + writer.WriteStringValue(ExternalProviderResourceId); + } + if (options.Format != "W" && Optional.IsCollectionDefined(ExternalSubnets)) + { + writer.WritePropertyName("externalSubnets"u8); + writer.WriteStartArray(); + foreach (DevTestLabExternalSubnet item in ExternalSubnets) + { + writer.WriteObjectValue(item, options); + } + writer.WriteEndArray(); + } + if (Optional.IsCollectionDefined(SubnetOverrides)) + { + writer.WritePropertyName("subnetOverrides"u8); + writer.WriteStartArray(); + foreach (DevTestLabSubnetOverride item in SubnetOverrides) + { + writer.WriteObjectValue(item, options); + } + writer.WriteEndArray(); + } + if (options.Format != "W" && Optional.IsDefined(CreatedOn)) + { + writer.WritePropertyName("createdDate"u8); + writer.WriteStringValue(CreatedOn.Value, "O"); + } + if (options.Format != "W" && Optional.IsDefined(ProvisioningState)) + { + writer.WritePropertyName("provisioningState"u8); + writer.WriteStringValue(ProvisioningState); + } + if (options.Format != "W" && Optional.IsDefined(UniqueIdentifier)) + { + writer.WritePropertyName("uniqueIdentifier"u8); + writer.WriteStringValue(UniqueIdentifier.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. + VirtualNetworkProperties IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) => JsonModelCreateCore(ref reader, options); + + /// The JSON reader. + /// The client options for reading and writing models. + protected virtual VirtualNetworkProperties 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(VirtualNetworkProperties)} does not support reading '{format}' format."); + } + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeVirtualNetworkProperties(document.RootElement, options); + } + + /// The JSON element to deserialize. + /// The client options for reading and writing models. + internal static VirtualNetworkProperties DeserializeVirtualNetworkProperties(JsonElement element, ModelReaderWriterOptions options) + { + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + IList allowedSubnets = default; + string description = default; + string externalProviderResourceId = default; + IReadOnlyList externalSubnets = default; + IList subnetOverrides = default; + DateTimeOffset? createdOn = default; + string provisioningState = default; + Guid? uniqueIdentifier = default; + IDictionary additionalBinaryDataProperties = new ChangeTrackingDictionary(); + foreach (var prop in element.EnumerateObject()) + { + if (prop.NameEquals("allowedSubnets"u8)) + { + if (prop.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + List array = new List(); + foreach (var item in prop.Value.EnumerateArray()) + { + array.Add(DevTestLabSubnet.DeserializeDevTestLabSubnet(item, options)); + } + allowedSubnets = array; + continue; + } + if (prop.NameEquals("description"u8)) + { + description = prop.Value.GetString(); + continue; + } + if (prop.NameEquals("externalProviderResourceId"u8)) + { + externalProviderResourceId = prop.Value.GetString(); + continue; + } + if (prop.NameEquals("externalSubnets"u8)) + { + if (prop.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + List array = new List(); + foreach (var item in prop.Value.EnumerateArray()) + { + array.Add(DevTestLabExternalSubnet.DeserializeDevTestLabExternalSubnet(item, options)); + } + externalSubnets = array; + continue; + } + if (prop.NameEquals("subnetOverrides"u8)) + { + if (prop.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + List array = new List(); + foreach (var item in prop.Value.EnumerateArray()) + { + array.Add(DevTestLabSubnetOverride.DeserializeDevTestLabSubnetOverride(item, options)); + } + subnetOverrides = array; + continue; + } + if (prop.NameEquals("createdDate"u8)) + { + if (prop.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + createdOn = prop.Value.GetDateTimeOffset("O"); + continue; + } + if (prop.NameEquals("provisioningState"u8)) + { + provisioningState = prop.Value.GetString(); + continue; + } + if (prop.NameEquals("uniqueIdentifier"u8)) + { + if (prop.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + uniqueIdentifier = new Guid(prop.Value.GetString()); + continue; + } + if (options.Format != "W") + { + additionalBinaryDataProperties.Add(prop.Name, BinaryData.FromString(prop.Value.GetRawText())); + } + } + return new VirtualNetworkProperties( + allowedSubnets ?? new ChangeTrackingList(), + description, + externalProviderResourceId, + externalSubnets ?? new ChangeTrackingList(), + subnetOverrides ?? new ChangeTrackingList(), + createdOn, + provisioningState, + uniqueIdentifier, + 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, AzureResourceManagerDevTestLabsContext.Default); + default: + throw new FormatException($"The model {nameof(VirtualNetworkProperties)} does not support writing '{options.Format}' format."); + } + } + + /// The data to parse. + /// The client options for reading and writing models. + VirtualNetworkProperties IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) => PersistableModelCreateCore(data, options); + + /// The client options for reading and writing models. + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + } +} diff --git a/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/Models/VirtualNetworkProperties.cs b/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/Models/VirtualNetworkProperties.cs new file mode 100644 index 000000000000..4fd9a732702f --- /dev/null +++ b/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/Models/VirtualNetworkProperties.cs @@ -0,0 +1,75 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; +using Azure.ResourceManager.DevTestLabs; + +namespace Azure.ResourceManager.DevTestLabs.Models +{ + /// Properties of a virtual network. + internal partial class VirtualNetworkProperties + { + /// Keeps track of any properties unknown to the library. + private protected readonly IDictionary _additionalBinaryDataProperties; + + /// Initializes a new instance of . + public VirtualNetworkProperties() + { + AllowedSubnets = new ChangeTrackingList(); + ExternalSubnets = new ChangeTrackingList(); + SubnetOverrides = new ChangeTrackingList(); + } + + /// Initializes a new instance of . + /// The allowed subnets of the virtual network. + /// The description of the virtual network. + /// The Microsoft.Network resource identifier of the virtual network. + /// The external subnet properties. + /// The subnet overrides of the virtual network. + /// The creation date of the virtual network. + /// The provisioning status of the resource. + /// The unique immutable identifier of a resource (Guid). + /// Keeps track of any properties unknown to the library. + internal VirtualNetworkProperties(IList allowedSubnets, string description, string externalProviderResourceId, IReadOnlyList externalSubnets, IList subnetOverrides, DateTimeOffset? createdOn, string provisioningState, Guid? uniqueIdentifier, IDictionary additionalBinaryDataProperties) + { + AllowedSubnets = allowedSubnets; + Description = description; + ExternalProviderResourceId = externalProviderResourceId; + ExternalSubnets = externalSubnets; + SubnetOverrides = subnetOverrides; + CreatedOn = createdOn; + ProvisioningState = provisioningState; + UniqueIdentifier = uniqueIdentifier; + _additionalBinaryDataProperties = additionalBinaryDataProperties; + } + + /// The allowed subnets of the virtual network. + public IList AllowedSubnets { get; } = new ChangeTrackingList(); + + /// The description of the virtual network. + public string Description { get; set; } + + /// The Microsoft.Network resource identifier of the virtual network. + public string ExternalProviderResourceId { get; set; } + + /// The external subnet properties. + public IReadOnlyList ExternalSubnets { get; } = new ChangeTrackingList(); + + /// The subnet overrides of the virtual network. + public IList SubnetOverrides { get; } = new ChangeTrackingList(); + + /// The creation date of the virtual network. + public DateTimeOffset? CreatedOn { get; } + + /// The provisioning status of the resource. + public string ProvisioningState { get; } + + /// The unique immutable identifier of a resource (Guid). + public Guid? UniqueIdentifier { get; } + } +} diff --git a/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/Models/WindowsOSInfo.Serialization.cs b/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/Models/WindowsOSInfo.Serialization.cs deleted file mode 100644 index da7dc07e5fa1..000000000000 --- a/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/Models/WindowsOSInfo.Serialization.cs +++ /dev/null @@ -1,133 +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.DevTestLabs.Models -{ - internal partial class WindowsOSInfo : 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(WindowsOSInfo)} does not support writing '{format}' format."); - } - - if (Optional.IsDefined(WindowsOSState)) - { - writer.WritePropertyName("windowsOsState"u8); - writer.WriteStringValue(WindowsOSState.Value.ToString()); - } - if (options.Format != "W" && _serializedAdditionalRawData != null) - { - foreach (var item in _serializedAdditionalRawData) - { - writer.WritePropertyName(item.Key); -#if NET6_0_OR_GREATER - writer.WriteRawValue(item.Value); -#else - using (JsonDocument document = JsonDocument.Parse(item.Value, ModelSerializationExtensions.JsonDocumentOptions)) - { - JsonSerializer.Serialize(writer, document.RootElement); - } -#endif - } - } - } - - WindowsOSInfo 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(WindowsOSInfo)} does not support reading '{format}' format."); - } - - using JsonDocument document = JsonDocument.ParseValue(ref reader); - return DeserializeWindowsOSInfo(document.RootElement, options); - } - - internal static WindowsOSInfo DeserializeWindowsOSInfo(JsonElement element, ModelReaderWriterOptions options = null) - { - options ??= ModelSerializationExtensions.WireOptions; - - if (element.ValueKind == JsonValueKind.Null) - { - return null; - } - WindowsOSState? windowsOSState = default; - IDictionary serializedAdditionalRawData = default; - Dictionary rawDataDictionary = new Dictionary(); - foreach (var property in element.EnumerateObject()) - { - if (property.NameEquals("windowsOsState"u8)) - { - if (property.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - windowsOSState = new WindowsOSState(property.Value.GetString()); - continue; - } - if (options.Format != "W") - { - rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); - } - } - serializedAdditionalRawData = rawDataDictionary; - return new WindowsOSInfo(windowsOSState, 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, AzureResourceManagerDevTestLabsContext.Default); - default: - throw new FormatException($"The model {nameof(WindowsOSInfo)} does not support writing '{options.Format}' format."); - } - } - - WindowsOSInfo 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 DeserializeWindowsOSInfo(document.RootElement, options); - } - default: - throw new FormatException($"The model {nameof(WindowsOSInfo)} does not support reading '{options.Format}' format."); - } - } - - string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; - } -} diff --git a/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/Models/WindowsOSInfo.cs b/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/Models/WindowsOSInfo.cs deleted file mode 100644 index aea7eaf219ae..000000000000 --- a/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/Models/WindowsOSInfo.cs +++ /dev/null @@ -1,65 +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.DevTestLabs.Models -{ - /// Information about a Windows OS. - internal partial class WindowsOSInfo - { - /// - /// 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 WindowsOSInfo() - { - } - - /// Initializes a new instance of . - /// The state of the Windows OS (i.e. NonSysprepped, SysprepRequested, SysprepApplied). - /// Keeps track of any properties unknown to the library. - internal WindowsOSInfo(WindowsOSState? windowsOSState, IDictionary serializedAdditionalRawData) - { - WindowsOSState = windowsOSState; - _serializedAdditionalRawData = serializedAdditionalRawData; - } - - /// The state of the Windows OS (i.e. NonSysprepped, SysprepRequested, SysprepApplied). - public WindowsOSState? WindowsOSState { get; set; } - } -} diff --git a/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/Models/WindowsOSState.cs b/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/Models/WindowsOSState.cs index 07ed0cd2ef24..75a1659aa15c 100644 --- a/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/Models/WindowsOSState.cs +++ b/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/Models/WindowsOSState.cs @@ -7,6 +7,7 @@ using System; using System.ComponentModel; +using Azure.ResourceManager.DevTestLabs; namespace Azure.ResourceManager.DevTestLabs.Models { @@ -14,41 +15,59 @@ namespace Azure.ResourceManager.DevTestLabs.Models public readonly partial struct WindowsOSState : IEquatable { private readonly string _value; + private const string NonSyspreppedValue = "NonSysprepped"; + private const string SysprepRequestedValue = "SysprepRequested"; + private const string SysprepAppliedValue = "SysprepApplied"; /// Initializes a new instance of . + /// The value. /// is null. public WindowsOSState(string value) { - _value = value ?? throw new ArgumentNullException(nameof(value)); - } + Argument.AssertNotNull(value, nameof(value)); - private const string NonSyspreppedValue = "NonSysprepped"; - private const string SysprepRequestedValue = "SysprepRequested"; - private const string SysprepAppliedValue = "SysprepApplied"; + _value = value; + } - /// NonSysprepped. + /// Gets the NonSysprepped. public static WindowsOSState NonSysprepped { get; } = new WindowsOSState(NonSyspreppedValue); - /// SysprepRequested. + + /// Gets the SysprepRequested. public static WindowsOSState SysprepRequested { get; } = new WindowsOSState(SysprepRequestedValue); - /// SysprepApplied. + + /// Gets the SysprepApplied. public static WindowsOSState SysprepApplied { get; } = new WindowsOSState(SysprepAppliedValue); + /// Determines if two values are the same. + /// The left value to compare. + /// The right value to compare. public static bool operator ==(WindowsOSState left, WindowsOSState 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 !=(WindowsOSState left, WindowsOSState right) => !left.Equals(right); - /// Converts a to a . + + /// Converts a string to a . + /// The value. public static implicit operator WindowsOSState(string value) => new WindowsOSState(value); - /// + /// Converts a string to a . + /// The value. + public static implicit operator WindowsOSState?(string value) => value == null ? null : new WindowsOSState(value); + + /// [EditorBrowsable(EditorBrowsableState.Never)] public override bool Equals(object obj) => obj is WindowsOSState other && Equals(other); - /// + + /// public bool Equals(WindowsOSState 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/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/ProviderConstants.cs b/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/ProviderConstants.cs index b187a8ef8d2e..997e4c0e3370 100644 --- a/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/ProviderConstants.cs +++ b/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/ProviderConstants.cs @@ -9,8 +9,9 @@ namespace Azure.ResourceManager.DevTestLabs { - 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/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/RestOperations/ArmTemplatesRestOperations.cs b/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/RestOperations/ArmTemplatesRestOperations.cs index 78f9cf793245..1479dba0ec5c 100644 --- a/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/RestOperations/ArmTemplatesRestOperations.cs +++ b/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/RestOperations/ArmTemplatesRestOperations.cs @@ -6,39 +6,44 @@ #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.DevTestLabs.Models; namespace Azure.ResourceManager.DevTestLabs { - internal partial class ArmTemplatesRestOperations + internal partial class ArmTemplates { - private readonly TelemetryDetails _userAgent; - private readonly HttpPipeline _pipeline; private readonly Uri _endpoint; private readonly string _apiVersion; - /// Initializes a new instance of ArmTemplatesRestOperations. + /// Initializes a new instance of ArmTemplates for mocking. + protected ArmTemplates() + { + } + + /// Initializes a new instance of ArmTemplates. + /// The ClientDiagnostics is used to provide tracing support for the client library. /// The HTTP pipeline for sending and receiving REST requests and responses. - /// The application id to use for user agent. - /// server parameter. - /// Api Version. - /// or is null. - public ArmTemplatesRestOperations(HttpPipeline pipeline, string applicationId, Uri endpoint = null, string apiVersion = default) + /// Service endpoint. + /// + internal ArmTemplates(ClientDiagnostics clientDiagnostics, HttpPipeline pipeline, Uri endpoint, string apiVersion) { - _pipeline = pipeline ?? throw new ArgumentNullException(nameof(pipeline)); - _endpoint = endpoint ?? new Uri("https://management.azure.com"); - _apiVersion = apiVersion ?? "2018-09-15"; - _userAgent = new TelemetryDetails(GetType().Assembly, applicationId); + ClientDiagnostics = clientDiagnostics; + _endpoint = endpoint; + Pipeline = pipeline; + _apiVersion = apiVersion; } - internal RequestUriBuilder CreateListRequestUri(string subscriptionId, string resourceGroupName, string labName, string artifactSourceName, string expand, string filter, int? top, string orderby) + /// 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(string subscriptionId, string resourceGroupName, string labName, string artifactSourceName, string name, string expand, RequestContext context) { - var uri = new RawRequestUriBuilder(); + RawRequestUriBuilder uri = new RawRequestUriBuilder(); uri.Reset(_endpoint); uri.AppendPath("/subscriptions/", false); uri.AppendPath(subscriptionId, true); @@ -48,33 +53,24 @@ internal RequestUriBuilder CreateListRequestUri(string subscriptionId, string re uri.AppendPath(labName, true); uri.AppendPath("/artifactsources/", false); uri.AppendPath(artifactSourceName, true); - uri.AppendPath("/armtemplates", false); + uri.AppendPath("/armtemplates/", false); + uri.AppendPath(name, true); + uri.AppendQuery("api-version", _apiVersion, true); if (expand != null) { uri.AppendQuery("$expand", expand, true); } - if (filter != null) - { - uri.AppendQuery("$filter", filter, true); - } - if (top != null) - { - uri.AppendQuery("$top", top.Value, true); - } - if (orderby != null) - { - uri.AppendQuery("$orderby", orderby, 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 CreateListRequest(string subscriptionId, string resourceGroupName, string labName, string artifactSourceName, string expand, string filter, int? top, string orderby) + internal HttpMessage CreateGetAllRequest(string subscriptionId, string resourceGroupName, string labName, string artifactSourceName, string expand, string filter, int? top, string @orderby, 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); @@ -85,6 +81,7 @@ internal HttpMessage CreateListRequest(string subscriptionId, string resourceGro uri.AppendPath("/artifactsources/", false); uri.AppendPath(artifactSourceName, true); uri.AppendPath("/armtemplates", false); + uri.AppendQuery("api-version", _apiVersion, true); if (expand != null) { uri.AppendQuery("$expand", expand, true); @@ -95,305 +92,31 @@ internal HttpMessage CreateListRequest(string subscriptionId, string resourceGro } if (top != null) { - uri.AppendQuery("$top", top.Value, true); + uri.AppendQuery("$top", TypeFormatters.ConvertToString(top), true); } - if (orderby != null) + if (@orderby != null) { - uri.AppendQuery("$orderby", orderby, true); + uri.AppendQuery("$orderby", @orderby, 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); - return message; - } - - /// List azure resource manager templates in a given artifact source. - /// The subscription ID. - /// The name of the resource group. - /// The name of the lab. - /// The name of the artifact source. - /// Specify the $expand query. Example: 'properties($select=displayName)'. - /// The filter to apply to the operation. Example: '$filter=contains(name,'myName'). - /// The maximum number of resources to return from the operation. Example: '$top=10'. - /// The ordering expression for the results, using OData notation. Example: '$orderby=name desc'. - /// The cancellation token to use. - /// , , or is null. - /// , , or is an empty string, and was expected to be non-empty. - public async Task> ListAsync(string subscriptionId, string resourceGroupName, string labName, string artifactSourceName, string expand = null, string filter = null, int? top = null, string orderby = null, CancellationToken cancellationToken = default) - { - Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); - Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); - Argument.AssertNotNullOrEmpty(labName, nameof(labName)); - Argument.AssertNotNullOrEmpty(artifactSourceName, nameof(artifactSourceName)); - - using var message = CreateListRequest(subscriptionId, resourceGroupName, labName, artifactSourceName, expand, filter, top, orderby); - await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); - switch (message.Response.Status) - { - case 200: - { - ArmTemplateList value = default; - using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, ModelSerializationExtensions.JsonDocumentOptions, cancellationToken).ConfigureAwait(false); - value = ArmTemplateList.DeserializeArmTemplateList(document.RootElement); - return Response.FromValue(value, message.Response); - } - default: - throw new RequestFailedException(message.Response); - } - } - - /// List azure resource manager templates in a given artifact source. - /// The subscription ID. - /// The name of the resource group. - /// The name of the lab. - /// The name of the artifact source. - /// Specify the $expand query. Example: 'properties($select=displayName)'. - /// The filter to apply to the operation. Example: '$filter=contains(name,'myName'). - /// The maximum number of resources to return from the operation. Example: '$top=10'. - /// The ordering expression for the results, using OData notation. Example: '$orderby=name desc'. - /// The cancellation token to use. - /// , , or is null. - /// , , or is an empty string, and was expected to be non-empty. - public Response List(string subscriptionId, string resourceGroupName, string labName, string artifactSourceName, string expand = null, string filter = null, int? top = null, string orderby = null, CancellationToken cancellationToken = default) - { - Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); - Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); - Argument.AssertNotNullOrEmpty(labName, nameof(labName)); - Argument.AssertNotNullOrEmpty(artifactSourceName, nameof(artifactSourceName)); - - using var message = CreateListRequest(subscriptionId, resourceGroupName, labName, artifactSourceName, expand, filter, top, orderby); - _pipeline.Send(message, cancellationToken); - switch (message.Response.Status) - { - case 200: - { - ArmTemplateList value = default; - using var document = JsonDocument.Parse(message.Response.ContentStream, ModelSerializationExtensions.JsonDocumentOptions); - value = ArmTemplateList.DeserializeArmTemplateList(document.RootElement); - return Response.FromValue(value, message.Response); - } - default: - throw new RequestFailedException(message.Response); - } - } - - internal RequestUriBuilder CreateGetRequestUri(string subscriptionId, string resourceGroupName, string labName, string artifactSourceName, string name, string expand) - { - 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.DevTestLab/labs/", false); - uri.AppendPath(labName, true); - uri.AppendPath("/artifactsources/", false); - uri.AppendPath(artifactSourceName, true); - uri.AppendPath("/armtemplates/", false); - uri.AppendPath(name, true); - if (expand != null) - { - uri.AppendQuery("$expand", expand, true); - } - uri.AppendQuery("api-version", _apiVersion, true); - return uri; - } - - internal HttpMessage CreateGetRequest(string subscriptionId, string resourceGroupName, string labName, string artifactSourceName, string name, string expand) - { - 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.DevTestLab/labs/", false); - uri.AppendPath(labName, true); - uri.AppendPath("/artifactsources/", false); - uri.AppendPath(artifactSourceName, true); - uri.AppendPath("/armtemplates/", false); - uri.AppendPath(name, true); - if (expand != null) - { - uri.AppendQuery("$expand", expand, true); - } - uri.AppendQuery("api-version", _apiVersion, true); - request.Uri = uri; - request.Headers.Add("Accept", "application/json"); - _userAgent.Apply(message); + request.Headers.SetValue("Accept", "application/json"); return message; } - /// Get azure resource manager template. - /// The subscription ID. - /// The name of the resource group. - /// The name of the lab. - /// The name of the artifact source. - /// The name of the azure resource manager template. - /// Specify the $expand query. Example: 'properties($select=displayName)'. - /// 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 labName, string artifactSourceName, string name, string expand = null, CancellationToken cancellationToken = default) - { - Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); - Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); - Argument.AssertNotNullOrEmpty(labName, nameof(labName)); - Argument.AssertNotNullOrEmpty(artifactSourceName, nameof(artifactSourceName)); - Argument.AssertNotNullOrEmpty(name, nameof(name)); - - using var message = CreateGetRequest(subscriptionId, resourceGroupName, labName, artifactSourceName, name, expand); - await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); - switch (message.Response.Status) - { - case 200: - { - DevTestLabArmTemplateData value = default; - using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, ModelSerializationExtensions.JsonDocumentOptions, cancellationToken).ConfigureAwait(false); - value = DevTestLabArmTemplateData.DeserializeDevTestLabArmTemplateData(document.RootElement); - return Response.FromValue(value, message.Response); - } - case 404: - return Response.FromValue((DevTestLabArmTemplateData)null, message.Response); - default: - throw new RequestFailedException(message.Response); - } - } - - /// Get azure resource manager template. - /// The subscription ID. - /// The name of the resource group. - /// The name of the lab. - /// The name of the artifact source. - /// The name of the azure resource manager template. - /// Specify the $expand query. Example: 'properties($select=displayName)'. - /// 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 labName, string artifactSourceName, string name, string expand = null, CancellationToken cancellationToken = default) - { - Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); - Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); - Argument.AssertNotNullOrEmpty(labName, nameof(labName)); - Argument.AssertNotNullOrEmpty(artifactSourceName, nameof(artifactSourceName)); - Argument.AssertNotNullOrEmpty(name, nameof(name)); - - using var message = CreateGetRequest(subscriptionId, resourceGroupName, labName, artifactSourceName, name, expand); - _pipeline.Send(message, cancellationToken); - switch (message.Response.Status) - { - case 200: - { - DevTestLabArmTemplateData value = default; - using var document = JsonDocument.Parse(message.Response.ContentStream, ModelSerializationExtensions.JsonDocumentOptions); - value = DevTestLabArmTemplateData.DeserializeDevTestLabArmTemplateData(document.RootElement); - return Response.FromValue(value, message.Response); - } - case 404: - return Response.FromValue((DevTestLabArmTemplateData)null, message.Response); - default: - throw new RequestFailedException(message.Response); - } - } - - internal RequestUriBuilder CreateListNextPageRequestUri(string nextLink, string subscriptionId, string resourceGroupName, string labName, string artifactSourceName, string expand, string filter, int? top, string orderby) + internal HttpMessage CreateNextGetAllRequest(Uri nextPage, string subscriptionId, string resourceGroupName, string labName, string artifactSourceName, string expand, string filter, int? top, string @orderby, RequestContext context) { - var uri = new RawRequestUriBuilder(); - uri.Reset(_endpoint); - uri.AppendRawNextLink(nextLink, false); - return uri; - } - - internal HttpMessage CreateListNextPageRequest(string nextLink, string subscriptionId, string resourceGroupName, string labName, string artifactSourceName, string expand, string filter, int? top, string orderby) - { - 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); + uri.UpdateQuery("api-version", _apiVersion); + 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 azure resource manager templates in a given artifact source. - /// The URL to the next page of results. - /// The subscription ID. - /// The name of the resource group. - /// The name of the lab. - /// The name of the artifact source. - /// Specify the $expand query. Example: 'properties($select=displayName)'. - /// The filter to apply to the operation. Example: '$filter=contains(name,'myName'). - /// The maximum number of resources to return from the operation. Example: '$top=10'. - /// The ordering expression for the results, using OData notation. Example: '$orderby=name desc'. - /// The cancellation token to use. - /// , , , or is null. - /// , , or is an empty string, and was expected to be non-empty. - public async Task> ListNextPageAsync(string nextLink, string subscriptionId, string resourceGroupName, string labName, string artifactSourceName, string expand = null, string filter = null, int? top = null, string orderby = null, CancellationToken cancellationToken = default) - { - Argument.AssertNotNull(nextLink, nameof(nextLink)); - Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); - Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); - Argument.AssertNotNullOrEmpty(labName, nameof(labName)); - Argument.AssertNotNullOrEmpty(artifactSourceName, nameof(artifactSourceName)); - - using var message = CreateListNextPageRequest(nextLink, subscriptionId, resourceGroupName, labName, artifactSourceName, expand, filter, top, orderby); - await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); - switch (message.Response.Status) - { - case 200: - { - ArmTemplateList value = default; - using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, ModelSerializationExtensions.JsonDocumentOptions, cancellationToken).ConfigureAwait(false); - value = ArmTemplateList.DeserializeArmTemplateList(document.RootElement); - return Response.FromValue(value, message.Response); - } - default: - throw new RequestFailedException(message.Response); - } - } - - /// List azure resource manager templates in a given artifact source. - /// The URL to the next page of results. - /// The subscription ID. - /// The name of the resource group. - /// The name of the lab. - /// The name of the artifact source. - /// Specify the $expand query. Example: 'properties($select=displayName)'. - /// The filter to apply to the operation. Example: '$filter=contains(name,'myName'). - /// The maximum number of resources to return from the operation. Example: '$top=10'. - /// The ordering expression for the results, using OData notation. Example: '$orderby=name desc'. - /// The cancellation token to use. - /// , , , or is null. - /// , , or is an empty string, and was expected to be non-empty. - public Response ListNextPage(string nextLink, string subscriptionId, string resourceGroupName, string labName, string artifactSourceName, string expand = null, string filter = null, int? top = null, string orderby = null, CancellationToken cancellationToken = default) - { - Argument.AssertNotNull(nextLink, nameof(nextLink)); - Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); - Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); - Argument.AssertNotNullOrEmpty(labName, nameof(labName)); - Argument.AssertNotNullOrEmpty(artifactSourceName, nameof(artifactSourceName)); - - using var message = CreateListNextPageRequest(nextLink, subscriptionId, resourceGroupName, labName, artifactSourceName, expand, filter, top, orderby); - _pipeline.Send(message, cancellationToken); - switch (message.Response.Status) - { - case 200: - { - ArmTemplateList value = default; - using var document = JsonDocument.Parse(message.Response.ContentStream, ModelSerializationExtensions.JsonDocumentOptions); - value = ArmTemplateList.DeserializeArmTemplateList(document.RootElement); - return Response.FromValue(value, message.Response); - } - default: - throw new RequestFailedException(message.Response); - } - } } } diff --git a/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/RestOperations/ArtifactSourcesRestOperations.cs b/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/RestOperations/ArtifactSourcesRestOperations.cs index a35d8e781313..241d1e73e4b7 100644 --- a/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/RestOperations/ArtifactSourcesRestOperations.cs +++ b/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/RestOperations/ArtifactSourcesRestOperations.cs @@ -6,173 +6,44 @@ #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.DevTestLabs.Models; namespace Azure.ResourceManager.DevTestLabs { - internal partial class ArtifactSourcesRestOperations + internal partial class ArtifactSources { - private readonly TelemetryDetails _userAgent; - private readonly HttpPipeline _pipeline; private readonly Uri _endpoint; private readonly string _apiVersion; - /// Initializes a new instance of ArtifactSourcesRestOperations. - /// The HTTP pipeline for sending and receiving REST requests and responses. - /// The application id to use for user agent. - /// server parameter. - /// Api Version. - /// or is null. - public ArtifactSourcesRestOperations(HttpPipeline pipeline, string applicationId, Uri endpoint = null, string apiVersion = default) + /// Initializes a new instance of ArtifactSources for mocking. + protected ArtifactSources() { - _pipeline = pipeline ?? throw new ArgumentNullException(nameof(pipeline)); - _endpoint = endpoint ?? new Uri("https://management.azure.com"); - _apiVersion = apiVersion ?? "2018-09-15"; - _userAgent = new TelemetryDetails(GetType().Assembly, applicationId); } - internal RequestUriBuilder CreateListRequestUri(string subscriptionId, string resourceGroupName, string labName, string expand, string filter, int? top, string orderby) - { - 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.DevTestLab/labs/", false); - uri.AppendPath(labName, true); - uri.AppendPath("/artifactsources", false); - if (expand != null) - { - uri.AppendQuery("$expand", expand, true); - } - if (filter != null) - { - uri.AppendQuery("$filter", filter, true); - } - if (top != null) - { - uri.AppendQuery("$top", top.Value, true); - } - if (orderby != null) - { - uri.AppendQuery("$orderby", orderby, true); - } - uri.AppendQuery("api-version", _apiVersion, true); - return uri; - } - - internal HttpMessage CreateListRequest(string subscriptionId, string resourceGroupName, string labName, string expand, string filter, int? top, string orderby) - { - 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.DevTestLab/labs/", false); - uri.AppendPath(labName, true); - uri.AppendPath("/artifactsources", false); - if (expand != null) - { - uri.AppendQuery("$expand", expand, true); - } - if (filter != null) - { - uri.AppendQuery("$filter", filter, true); - } - if (top != null) - { - uri.AppendQuery("$top", top.Value, true); - } - if (orderby != null) - { - uri.AppendQuery("$orderby", orderby, true); - } - uri.AppendQuery("api-version", _apiVersion, true); - request.Uri = uri; - request.Headers.Add("Accept", "application/json"); - _userAgent.Apply(message); - return message; - } - - /// List artifact sources in a given lab. - /// The subscription ID. - /// The name of the resource group. - /// The name of the lab. - /// Specify the $expand query. Example: 'properties($select=displayName)'. - /// The filter to apply to the operation. Example: '$filter=contains(name,'myName'). - /// The maximum number of resources to return from the operation. Example: '$top=10'. - /// The ordering expression for the results, using OData notation. Example: '$orderby=name desc'. - /// The cancellation token to use. - /// , or is null. - /// , or is an empty string, and was expected to be non-empty. - public async Task> ListAsync(string subscriptionId, string resourceGroupName, string labName, string expand = null, string filter = null, int? top = null, string orderby = null, CancellationToken cancellationToken = default) + /// Initializes a new instance of ArtifactSources. + /// 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 ArtifactSources(ClientDiagnostics clientDiagnostics, HttpPipeline pipeline, Uri endpoint, string apiVersion) { - Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); - Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); - Argument.AssertNotNullOrEmpty(labName, nameof(labName)); - - using var message = CreateListRequest(subscriptionId, resourceGroupName, labName, expand, filter, top, orderby); - await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); - switch (message.Response.Status) - { - case 200: - { - ArtifactSourceList value = default; - using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, ModelSerializationExtensions.JsonDocumentOptions, cancellationToken).ConfigureAwait(false); - value = ArtifactSourceList.DeserializeArtifactSourceList(document.RootElement); - return Response.FromValue(value, message.Response); - } - default: - throw new RequestFailedException(message.Response); - } + ClientDiagnostics = clientDiagnostics; + _endpoint = endpoint; + Pipeline = pipeline; + _apiVersion = apiVersion; } - /// List artifact sources in a given lab. - /// The subscription ID. - /// The name of the resource group. - /// The name of the lab. - /// Specify the $expand query. Example: 'properties($select=displayName)'. - /// The filter to apply to the operation. Example: '$filter=contains(name,'myName'). - /// The maximum number of resources to return from the operation. Example: '$top=10'. - /// The ordering expression for the results, using OData notation. Example: '$orderby=name desc'. - /// The cancellation token to use. - /// , or is null. - /// , or is an empty string, and was expected to be non-empty. - public Response List(string subscriptionId, string resourceGroupName, string labName, string expand = null, string filter = null, int? top = null, string orderby = null, CancellationToken cancellationToken = default) - { - Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); - Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); - Argument.AssertNotNullOrEmpty(labName, nameof(labName)); + /// The HTTP pipeline for sending and receiving REST requests and responses. + public virtual HttpPipeline Pipeline { get; } - using var message = CreateListRequest(subscriptionId, resourceGroupName, labName, expand, filter, top, orderby); - _pipeline.Send(message, cancellationToken); - switch (message.Response.Status) - { - case 200: - { - ArtifactSourceList value = default; - using var document = JsonDocument.Parse(message.Response.ContentStream, ModelSerializationExtensions.JsonDocumentOptions); - value = ArtifactSourceList.DeserializeArtifactSourceList(document.RootElement); - return Response.FromValue(value, 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 CreateGetRequestUri(string subscriptionId, string resourceGroupName, string labName, string name, string expand) + internal HttpMessage CreateGetRequest(string subscriptionId, string resourceGroupName, string labName, string name, string expand, RequestContext context) { - var uri = new RawRequestUriBuilder(); + RawRequestUriBuilder uri = new RawRequestUriBuilder(); uri.Reset(_endpoint); uri.AppendPath("/subscriptions/", false); uri.AppendPath(subscriptionId, true); @@ -182,111 +53,22 @@ internal RequestUriBuilder CreateGetRequestUri(string subscriptionId, string res uri.AppendPath(labName, true); uri.AppendPath("/artifactsources/", false); uri.AppendPath(name, true); - if (expand != null) - { - uri.AppendQuery("$expand", expand, true); - } uri.AppendQuery("api-version", _apiVersion, true); - return uri; - } - - internal HttpMessage CreateGetRequest(string subscriptionId, string resourceGroupName, string labName, string name, string expand) - { - 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.DevTestLab/labs/", false); - uri.AppendPath(labName, true); - uri.AppendPath("/artifactsources/", false); - uri.AppendPath(name, true); if (expand != null) { uri.AppendQuery("$expand", expand, 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 artifact source. - /// The subscription ID. - /// The name of the resource group. - /// The name of the lab. - /// The name of the artifact source. - /// Specify the $expand query. Example: 'properties($select=displayName)'. - /// 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 labName, string name, string expand = null, CancellationToken cancellationToken = default) - { - Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); - Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); - Argument.AssertNotNullOrEmpty(labName, nameof(labName)); - Argument.AssertNotNullOrEmpty(name, nameof(name)); - - using var message = CreateGetRequest(subscriptionId, resourceGroupName, labName, name, expand); - await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); - switch (message.Response.Status) - { - case 200: - { - DevTestLabArtifactSourceData value = default; - using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, ModelSerializationExtensions.JsonDocumentOptions, cancellationToken).ConfigureAwait(false); - value = DevTestLabArtifactSourceData.DeserializeDevTestLabArtifactSourceData(document.RootElement); - return Response.FromValue(value, message.Response); - } - case 404: - return Response.FromValue((DevTestLabArtifactSourceData)null, message.Response); - default: - throw new RequestFailedException(message.Response); - } - } - - /// Get artifact source. - /// The subscription ID. - /// The name of the resource group. - /// The name of the lab. - /// The name of the artifact source. - /// Specify the $expand query. Example: 'properties($select=displayName)'. - /// 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 labName, string name, string expand = null, CancellationToken cancellationToken = default) - { - Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); - Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); - Argument.AssertNotNullOrEmpty(labName, nameof(labName)); - Argument.AssertNotNullOrEmpty(name, nameof(name)); - - using var message = CreateGetRequest(subscriptionId, resourceGroupName, labName, name, expand); - _pipeline.Send(message, cancellationToken); - switch (message.Response.Status) - { - case 200: - { - DevTestLabArtifactSourceData value = default; - using var document = JsonDocument.Parse(message.Response.ContentStream, ModelSerializationExtensions.JsonDocumentOptions); - value = DevTestLabArtifactSourceData.DeserializeDevTestLabArtifactSourceData(document.RootElement); - return Response.FromValue(value, message.Response); - } - case 404: - return Response.FromValue((DevTestLabArtifactSourceData)null, message.Response); - default: - throw new RequestFailedException(message.Response); - } - } - - internal RequestUriBuilder CreateCreateOrUpdateRequestUri(string subscriptionId, string resourceGroupName, string labName, string name, DevTestLabArtifactSourceData data) + internal HttpMessage CreateCreateOrUpdateRequest(string subscriptionId, string resourceGroupName, string labName, string name, RequestContent content, RequestContext context) { - var uri = new RawRequestUriBuilder(); + RawRequestUriBuilder uri = new RawRequestUriBuilder(); uri.Reset(_endpoint); uri.AppendPath("/subscriptions/", false); uri.AppendPath(subscriptionId, true); @@ -297,15 +79,19 @@ internal RequestUriBuilder CreateCreateOrUpdateRequestUri(string subscriptionId, uri.AppendPath("/artifactsources/", false); uri.AppendPath(name, true); uri.AppendQuery("api-version", _apiVersion, true); - return uri; + HttpMessage message = Pipeline.CreateMessage(); + Request request = message.Request; + request.Uri = uri; + request.Method = RequestMethod.Put; + request.Headers.SetValue("Content-Type", "application/json"); + request.Headers.SetValue("Accept", "application/json"); + request.Content = content; + return message; } - internal HttpMessage CreateCreateOrUpdateRequest(string subscriptionId, string resourceGroupName, string labName, string name, DevTestLabArtifactSourceData data) + internal HttpMessage CreateUpdateRequest(string subscriptionId, string resourceGroupName, string labName, string name, 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); @@ -316,87 +102,19 @@ internal HttpMessage CreateCreateOrUpdateRequest(string subscriptionId, string r uri.AppendPath("/artifactsources/", false); uri.AppendPath(name, 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.Patch; + request.Headers.SetValue("Content-Type", "application/json"); + request.Headers.SetValue("Accept", "application/json"); request.Content = content; - _userAgent.Apply(message); return message; } - /// Create or replace an existing artifact source. - /// The subscription ID. - /// The name of the resource group. - /// The name of the lab. - /// The name of the artifact source. - /// Properties of an artifact source. - /// 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 labName, string name, DevTestLabArtifactSourceData data, CancellationToken cancellationToken = default) - { - Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); - Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); - Argument.AssertNotNullOrEmpty(labName, nameof(labName)); - Argument.AssertNotNullOrEmpty(name, nameof(name)); - Argument.AssertNotNull(data, nameof(data)); - - using var message = CreateCreateOrUpdateRequest(subscriptionId, resourceGroupName, labName, name, data); - await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); - switch (message.Response.Status) - { - case 200: - case 201: - { - DevTestLabArtifactSourceData value = default; - using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, ModelSerializationExtensions.JsonDocumentOptions, cancellationToken).ConfigureAwait(false); - value = DevTestLabArtifactSourceData.DeserializeDevTestLabArtifactSourceData(document.RootElement); - return Response.FromValue(value, message.Response); - } - default: - throw new RequestFailedException(message.Response); - } - } - - /// Create or replace an existing artifact source. - /// The subscription ID. - /// The name of the resource group. - /// The name of the lab. - /// The name of the artifact source. - /// Properties of an artifact source. - /// 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 labName, string name, DevTestLabArtifactSourceData data, CancellationToken cancellationToken = default) - { - Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); - Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); - Argument.AssertNotNullOrEmpty(labName, nameof(labName)); - Argument.AssertNotNullOrEmpty(name, nameof(name)); - Argument.AssertNotNull(data, nameof(data)); - - using var message = CreateCreateOrUpdateRequest(subscriptionId, resourceGroupName, labName, name, data); - _pipeline.Send(message, cancellationToken); - switch (message.Response.Status) - { - case 200: - case 201: - { - DevTestLabArtifactSourceData value = default; - using var document = JsonDocument.Parse(message.Response.ContentStream, ModelSerializationExtensions.JsonDocumentOptions); - value = DevTestLabArtifactSourceData.DeserializeDevTestLabArtifactSourceData(document.RootElement); - return Response.FromValue(value, message.Response); - } - default: - throw new RequestFailedException(message.Response); - } - } - - internal RequestUriBuilder CreateDeleteRequestUri(string subscriptionId, string resourceGroupName, string labName, string name) + internal HttpMessage CreateDeleteRequest(string subscriptionId, string resourceGroupName, string labName, string name, RequestContext context) { - var uri = new RawRequestUriBuilder(); + RawRequestUriBuilder uri = new RawRequestUriBuilder(); uri.Reset(_endpoint); uri.AppendPath("/subscriptions/", false); uri.AppendPath(subscriptionId, true); @@ -407,15 +125,16 @@ internal RequestUriBuilder CreateDeleteRequestUri(string subscriptionId, string uri.AppendPath("/artifactsources/", false); uri.AppendPath(name, true); uri.AppendQuery("api-version", _apiVersion, true); - return uri; + HttpMessage message = Pipeline.CreateMessage(); + Request request = message.Request; + request.Uri = uri; + request.Method = RequestMethod.Delete; + return message; } - internal HttpMessage CreateDeleteRequest(string subscriptionId, string resourceGroupName, string labName, string name) + internal HttpMessage CreateGetAllRequest(string subscriptionId, string resourceGroupName, string labName, string expand, string filter, int? top, string @orderby, RequestContext context) { - var message = _pipeline.CreateMessage(); - var request = message.Request; - request.Method = RequestMethod.Delete; - var uri = new RawRequestUriBuilder(); + RawRequestUriBuilder uri = new RawRequestUriBuilder(); uri.Reset(_endpoint); uri.AppendPath("/subscriptions/", false); uri.AppendPath(subscriptionId, true); @@ -423,267 +142,43 @@ internal HttpMessage CreateDeleteRequest(string subscriptionId, string resourceG uri.AppendPath(resourceGroupName, true); uri.AppendPath("/providers/Microsoft.DevTestLab/labs/", false); uri.AppendPath(labName, true); - uri.AppendPath("/artifactsources/", false); - uri.AppendPath(name, true); + uri.AppendPath("/artifactsources", false); uri.AppendQuery("api-version", _apiVersion, true); - request.Uri = uri; - request.Headers.Add("Accept", "application/json"); - _userAgent.Apply(message); - return message; - } - - /// Delete artifact source. - /// The subscription ID. - /// The name of the resource group. - /// The name of the lab. - /// The name of the artifact source. - /// 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 labName, string name, CancellationToken cancellationToken = default) - { - Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); - Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); - Argument.AssertNotNullOrEmpty(labName, nameof(labName)); - Argument.AssertNotNullOrEmpty(name, nameof(name)); - - using var message = CreateDeleteRequest(subscriptionId, resourceGroupName, labName, name); - await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); - switch (message.Response.Status) + if (expand != null) { - case 200: - case 204: - return message.Response; - default: - throw new RequestFailedException(message.Response); + uri.AppendQuery("$expand", expand, true); } - } - - /// Delete artifact source. - /// The subscription ID. - /// The name of the resource group. - /// The name of the lab. - /// The name of the artifact source. - /// 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 labName, string name, CancellationToken cancellationToken = default) - { - Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); - Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); - Argument.AssertNotNullOrEmpty(labName, nameof(labName)); - Argument.AssertNotNullOrEmpty(name, nameof(name)); - - using var message = CreateDeleteRequest(subscriptionId, resourceGroupName, labName, name); - _pipeline.Send(message, cancellationToken); - switch (message.Response.Status) + if (filter != null) { - case 200: - case 204: - return message.Response; - default: - throw new RequestFailedException(message.Response); + uri.AppendQuery("$filter", filter, true); } - } - - internal RequestUriBuilder CreateUpdateRequestUri(string subscriptionId, string resourceGroupName, string labName, string name, DevTestLabArtifactSourcePatch 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.DevTestLab/labs/", false); - uri.AppendPath(labName, true); - uri.AppendPath("/artifactsources/", false); - uri.AppendPath(name, true); - uri.AppendQuery("api-version", _apiVersion, true); - return uri; - } - - internal HttpMessage CreateUpdateRequest(string subscriptionId, string resourceGroupName, string labName, string name, DevTestLabArtifactSourcePatch patch) - { - var message = _pipeline.CreateMessage(); - var request = message.Request; - request.Method = RequestMethod.Patch; - var uri = new RawRequestUriBuilder(); - uri.Reset(_endpoint); - uri.AppendPath("/subscriptions/", false); - uri.AppendPath(subscriptionId, true); - uri.AppendPath("/resourceGroups/", false); - uri.AppendPath(resourceGroupName, true); - uri.AppendPath("/providers/Microsoft.DevTestLab/labs/", false); - uri.AppendPath(labName, true); - uri.AppendPath("/artifactsources/", false); - uri.AppendPath(name, true); - uri.AppendQuery("api-version", _apiVersion, true); - request.Uri = uri; - request.Headers.Add("Accept", "application/json"); - request.Headers.Add("Content-Type", "application/json"); - var content = new Utf8JsonRequestContent(); - content.JsonWriter.WriteObjectValue(patch, ModelSerializationExtensions.WireOptions); - request.Content = content; - _userAgent.Apply(message); - return message; - } - - /// Allows modifying tags of artifact sources. All other properties will be ignored. - /// The subscription ID. - /// The name of the resource group. - /// The name of the lab. - /// The name of the artifact source. - /// Properties of an artifact source. - /// 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 labName, string name, DevTestLabArtifactSourcePatch patch, CancellationToken cancellationToken = default) - { - Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); - Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); - Argument.AssertNotNullOrEmpty(labName, nameof(labName)); - Argument.AssertNotNullOrEmpty(name, nameof(name)); - Argument.AssertNotNull(patch, nameof(patch)); - - using var message = CreateUpdateRequest(subscriptionId, resourceGroupName, labName, name, patch); - await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); - switch (message.Response.Status) + if (top != null) { - case 200: - { - DevTestLabArtifactSourceData value = default; - using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, ModelSerializationExtensions.JsonDocumentOptions, cancellationToken).ConfigureAwait(false); - value = DevTestLabArtifactSourceData.DeserializeDevTestLabArtifactSourceData(document.RootElement); - return Response.FromValue(value, message.Response); - } - default: - throw new RequestFailedException(message.Response); + uri.AppendQuery("$top", TypeFormatters.ConvertToString(top), true); } - } - - /// Allows modifying tags of artifact sources. All other properties will be ignored. - /// The subscription ID. - /// The name of the resource group. - /// The name of the lab. - /// The name of the artifact source. - /// Properties of an artifact source. - /// 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 labName, string name, DevTestLabArtifactSourcePatch patch, CancellationToken cancellationToken = default) - { - Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); - Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); - Argument.AssertNotNullOrEmpty(labName, nameof(labName)); - Argument.AssertNotNullOrEmpty(name, nameof(name)); - Argument.AssertNotNull(patch, nameof(patch)); - - using var message = CreateUpdateRequest(subscriptionId, resourceGroupName, labName, name, patch); - _pipeline.Send(message, cancellationToken); - switch (message.Response.Status) + if (@orderby != null) { - case 200: - { - DevTestLabArtifactSourceData value = default; - using var document = JsonDocument.Parse(message.Response.ContentStream, ModelSerializationExtensions.JsonDocumentOptions); - value = DevTestLabArtifactSourceData.DeserializeDevTestLabArtifactSourceData(document.RootElement); - return Response.FromValue(value, message.Response); - } - default: - throw new RequestFailedException(message.Response); + uri.AppendQuery("$orderby", @orderby, true); } - } - - internal RequestUriBuilder CreateListNextPageRequestUri(string nextLink, string subscriptionId, string resourceGroupName, string labName, string expand, string filter, int? top, string orderby) - { - var uri = new RawRequestUriBuilder(); - uri.Reset(_endpoint); - uri.AppendRawNextLink(nextLink, false); - return uri; - } - - internal HttpMessage CreateListNextPageRequest(string nextLink, string subscriptionId, string resourceGroupName, string labName, string expand, string filter, int? top, string orderby) - { - var message = _pipeline.CreateMessage(); - var request = message.Request; - request.Method = RequestMethod.Get; - var uri = new RawRequestUriBuilder(); - uri.Reset(_endpoint); - uri.AppendRawNextLink(nextLink, false); + 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 artifact sources in a given lab. - /// The URL to the next page of results. - /// The subscription ID. - /// The name of the resource group. - /// The name of the lab. - /// Specify the $expand query. Example: 'properties($select=displayName)'. - /// The filter to apply to the operation. Example: '$filter=contains(name,'myName'). - /// The maximum number of resources to return from the operation. Example: '$top=10'. - /// The ordering expression for the results, using OData notation. Example: '$orderby=name desc'. - /// The cancellation token to use. - /// , , or is null. - /// , or is an empty string, and was expected to be non-empty. - public async Task> ListNextPageAsync(string nextLink, string subscriptionId, string resourceGroupName, string labName, string expand = null, string filter = null, int? top = null, string orderby = null, CancellationToken cancellationToken = default) + internal HttpMessage CreateNextGetAllRequest(Uri nextPage, string subscriptionId, string resourceGroupName, string labName, string expand, string filter, int? top, string @orderby, RequestContext context) { - Argument.AssertNotNull(nextLink, nameof(nextLink)); - Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); - Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); - Argument.AssertNotNullOrEmpty(labName, nameof(labName)); - - using var message = CreateListNextPageRequest(nextLink, subscriptionId, resourceGroupName, labName, expand, filter, top, orderby); - await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); - switch (message.Response.Status) - { - case 200: - { - ArtifactSourceList value = default; - using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, ModelSerializationExtensions.JsonDocumentOptions, cancellationToken).ConfigureAwait(false); - value = ArtifactSourceList.DeserializeArtifactSourceList(document.RootElement); - return Response.FromValue(value, message.Response); - } - default: - throw new RequestFailedException(message.Response); - } - } - - /// List artifact sources in a given lab. - /// The URL to the next page of results. - /// The subscription ID. - /// The name of the resource group. - /// The name of the lab. - /// Specify the $expand query. Example: 'properties($select=displayName)'. - /// The filter to apply to the operation. Example: '$filter=contains(name,'myName'). - /// The maximum number of resources to return from the operation. Example: '$top=10'. - /// The ordering expression for the results, using OData notation. Example: '$orderby=name desc'. - /// The cancellation token to use. - /// , , or is null. - /// , or is an empty string, and was expected to be non-empty. - public Response ListNextPage(string nextLink, string subscriptionId, string resourceGroupName, string labName, string expand = null, string filter = null, int? top = null, string orderby = null, CancellationToken cancellationToken = default) - { - Argument.AssertNotNull(nextLink, nameof(nextLink)); - Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); - Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); - Argument.AssertNotNullOrEmpty(labName, nameof(labName)); - - using var message = CreateListNextPageRequest(nextLink, subscriptionId, resourceGroupName, labName, expand, filter, top, orderby); - _pipeline.Send(message, cancellationToken); - switch (message.Response.Status) - { - case 200: - { - ArtifactSourceList value = default; - using var document = JsonDocument.Parse(message.Response.ContentStream, ModelSerializationExtensions.JsonDocumentOptions); - value = ArtifactSourceList.DeserializeArtifactSourceList(document.RootElement); - return Response.FromValue(value, message.Response); - } - default: - throw new RequestFailedException(message.Response); - } + RawRequestUriBuilder uri = new RawRequestUriBuilder(); + uri.Reset(nextPage); + uri.UpdateQuery("api-version", _apiVersion); + HttpMessage message = Pipeline.CreateMessage(); + Request request = message.Request; + request.Uri = uri; + request.Method = RequestMethod.Get; + request.Headers.SetValue("Accept", "application/json"); + return message; } } } diff --git a/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/RestOperations/ArtifactsRestOperations.cs b/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/RestOperations/ArtifactsRestOperations.cs index 7429695303fb..fe7349959199 100644 --- a/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/RestOperations/ArtifactsRestOperations.cs +++ b/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/RestOperations/ArtifactsRestOperations.cs @@ -6,39 +6,44 @@ #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.DevTestLabs.Models; namespace Azure.ResourceManager.DevTestLabs { - internal partial class ArtifactsRestOperations + internal partial class Artifacts { - private readonly TelemetryDetails _userAgent; - private readonly HttpPipeline _pipeline; private readonly Uri _endpoint; private readonly string _apiVersion; - /// Initializes a new instance of ArtifactsRestOperations. + /// Initializes a new instance of Artifacts for mocking. + protected Artifacts() + { + } + + /// Initializes a new instance of Artifacts. + /// The ClientDiagnostics is used to provide tracing support for the client library. /// The HTTP pipeline for sending and receiving REST requests and responses. - /// The application id to use for user agent. - /// server parameter. - /// Api Version. - /// or is null. - public ArtifactsRestOperations(HttpPipeline pipeline, string applicationId, Uri endpoint = null, string apiVersion = default) + /// Service endpoint. + /// + internal Artifacts(ClientDiagnostics clientDiagnostics, HttpPipeline pipeline, Uri endpoint, string apiVersion) { - _pipeline = pipeline ?? throw new ArgumentNullException(nameof(pipeline)); - _endpoint = endpoint ?? new Uri("https://management.azure.com"); - _apiVersion = apiVersion ?? "2018-09-15"; - _userAgent = new TelemetryDetails(GetType().Assembly, applicationId); + ClientDiagnostics = clientDiagnostics; + _endpoint = endpoint; + Pipeline = pipeline; + _apiVersion = apiVersion; } - internal RequestUriBuilder CreateListRequestUri(string subscriptionId, string resourceGroupName, string labName, string artifactSourceName, string expand, string filter, int? top, string orderby) + /// 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(string subscriptionId, string resourceGroupName, string labName, string artifactSourceName, string name, string expand, RequestContext context) { - var uri = new RawRequestUriBuilder(); + RawRequestUriBuilder uri = new RawRequestUriBuilder(); uri.Reset(_endpoint); uri.AppendPath("/subscriptions/", false); uri.AppendPath(subscriptionId, true); @@ -48,33 +53,24 @@ internal RequestUriBuilder CreateListRequestUri(string subscriptionId, string re uri.AppendPath(labName, true); uri.AppendPath("/artifactsources/", false); uri.AppendPath(artifactSourceName, true); - uri.AppendPath("/artifacts", false); + uri.AppendPath("/artifacts/", false); + uri.AppendPath(name, true); + uri.AppendQuery("api-version", _apiVersion, true); if (expand != null) { uri.AppendQuery("$expand", expand, true); } - if (filter != null) - { - uri.AppendQuery("$filter", filter, true); - } - if (top != null) - { - uri.AppendQuery("$top", top.Value, true); - } - if (orderby != null) - { - uri.AppendQuery("$orderby", orderby, 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 CreateListRequest(string subscriptionId, string resourceGroupName, string labName, string artifactSourceName, string expand, string filter, int? top, string orderby) + internal HttpMessage CreateGetAllRequest(string subscriptionId, string resourceGroupName, string labName, string artifactSourceName, string expand, string filter, int? top, string @orderby, 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); @@ -85,6 +81,7 @@ internal HttpMessage CreateListRequest(string subscriptionId, string resourceGro uri.AppendPath("/artifactsources/", false); uri.AppendPath(artifactSourceName, true); uri.AppendPath("/artifacts", false); + uri.AppendQuery("api-version", _apiVersion, true); if (expand != null) { uri.AppendQuery("$expand", expand, true); @@ -95,214 +92,36 @@ internal HttpMessage CreateListRequest(string subscriptionId, string resourceGro } if (top != null) { - uri.AppendQuery("$top", top.Value, true); + uri.AppendQuery("$top", TypeFormatters.ConvertToString(top), true); } - if (orderby != null) + if (@orderby != null) { - uri.AppendQuery("$orderby", orderby, true); + uri.AppendQuery("$orderby", @orderby, 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; } - /// List artifacts in a given artifact source. - /// The subscription ID. - /// The name of the resource group. - /// The name of the lab. - /// The name of the artifact source. - /// Specify the $expand query. Example: 'properties($select=title)'. - /// The filter to apply to the operation. Example: '$filter=contains(name,'myName'). - /// The maximum number of resources to return from the operation. Example: '$top=10'. - /// The ordering expression for the results, using OData notation. Example: '$orderby=name desc'. - /// The cancellation token to use. - /// , , or is null. - /// , , or is an empty string, and was expected to be non-empty. - public async Task> ListAsync(string subscriptionId, string resourceGroupName, string labName, string artifactSourceName, string expand = null, string filter = null, int? top = null, string orderby = null, CancellationToken cancellationToken = default) - { - Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); - Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); - Argument.AssertNotNullOrEmpty(labName, nameof(labName)); - Argument.AssertNotNullOrEmpty(artifactSourceName, nameof(artifactSourceName)); - - using var message = CreateListRequest(subscriptionId, resourceGroupName, labName, artifactSourceName, expand, filter, top, orderby); - await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); - switch (message.Response.Status) - { - case 200: - { - ArtifactList value = default; - using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, ModelSerializationExtensions.JsonDocumentOptions, cancellationToken).ConfigureAwait(false); - value = ArtifactList.DeserializeArtifactList(document.RootElement); - return Response.FromValue(value, message.Response); - } - default: - throw new RequestFailedException(message.Response); - } - } - - /// List artifacts in a given artifact source. - /// The subscription ID. - /// The name of the resource group. - /// The name of the lab. - /// The name of the artifact source. - /// Specify the $expand query. Example: 'properties($select=title)'. - /// The filter to apply to the operation. Example: '$filter=contains(name,'myName'). - /// The maximum number of resources to return from the operation. Example: '$top=10'. - /// The ordering expression for the results, using OData notation. Example: '$orderby=name desc'. - /// The cancellation token to use. - /// , , or is null. - /// , , or is an empty string, and was expected to be non-empty. - public Response List(string subscriptionId, string resourceGroupName, string labName, string artifactSourceName, string expand = null, string filter = null, int? top = null, string orderby = null, CancellationToken cancellationToken = default) - { - Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); - Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); - Argument.AssertNotNullOrEmpty(labName, nameof(labName)); - Argument.AssertNotNullOrEmpty(artifactSourceName, nameof(artifactSourceName)); - - using var message = CreateListRequest(subscriptionId, resourceGroupName, labName, artifactSourceName, expand, filter, top, orderby); - _pipeline.Send(message, cancellationToken); - switch (message.Response.Status) - { - case 200: - { - ArtifactList value = default; - using var document = JsonDocument.Parse(message.Response.ContentStream, ModelSerializationExtensions.JsonDocumentOptions); - value = ArtifactList.DeserializeArtifactList(document.RootElement); - return Response.FromValue(value, message.Response); - } - default: - throw new RequestFailedException(message.Response); - } - } - - internal RequestUriBuilder CreateGetRequestUri(string subscriptionId, string resourceGroupName, string labName, string artifactSourceName, string name, string expand) + internal HttpMessage CreateNextGetAllRequest(Uri nextPage, string subscriptionId, string resourceGroupName, string labName, string artifactSourceName, string expand, string filter, int? top, string @orderby, RequestContext context) { - 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.DevTestLab/labs/", false); - uri.AppendPath(labName, true); - uri.AppendPath("/artifactsources/", false); - uri.AppendPath(artifactSourceName, true); - uri.AppendPath("/artifacts/", false); - uri.AppendPath(name, true); - if (expand != null) - { - uri.AppendQuery("$expand", expand, true); - } - uri.AppendQuery("api-version", _apiVersion, true); - return uri; - } - - internal HttpMessage CreateGetRequest(string subscriptionId, string resourceGroupName, string labName, string artifactSourceName, string name, string expand) - { - 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.DevTestLab/labs/", false); - uri.AppendPath(labName, true); - uri.AppendPath("/artifactsources/", false); - uri.AppendPath(artifactSourceName, true); - uri.AppendPath("/artifacts/", false); - uri.AppendPath(name, true); - if (expand != null) - { - uri.AppendQuery("$expand", expand, true); - } - uri.AppendQuery("api-version", _apiVersion, true); + RawRequestUriBuilder uri = new RawRequestUriBuilder(); + uri.Reset(nextPage); + uri.UpdateQuery("api-version", _apiVersion); + 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 artifact. - /// The subscription ID. - /// The name of the resource group. - /// The name of the lab. - /// The name of the artifact source. - /// The name of the artifact. - /// Specify the $expand query. Example: 'properties($select=title)'. - /// 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 labName, string artifactSourceName, string name, string expand = null, CancellationToken cancellationToken = default) - { - Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); - Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); - Argument.AssertNotNullOrEmpty(labName, nameof(labName)); - Argument.AssertNotNullOrEmpty(artifactSourceName, nameof(artifactSourceName)); - Argument.AssertNotNullOrEmpty(name, nameof(name)); - - using var message = CreateGetRequest(subscriptionId, resourceGroupName, labName, artifactSourceName, name, expand); - await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); - switch (message.Response.Status) - { - case 200: - { - DevTestLabArtifactData value = default; - using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, ModelSerializationExtensions.JsonDocumentOptions, cancellationToken).ConfigureAwait(false); - value = DevTestLabArtifactData.DeserializeDevTestLabArtifactData(document.RootElement); - return Response.FromValue(value, message.Response); - } - case 404: - return Response.FromValue((DevTestLabArtifactData)null, message.Response); - default: - throw new RequestFailedException(message.Response); - } - } - - /// Get artifact. - /// The subscription ID. - /// The name of the resource group. - /// The name of the lab. - /// The name of the artifact source. - /// The name of the artifact. - /// Specify the $expand query. Example: 'properties($select=title)'. - /// 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 labName, string artifactSourceName, string name, string expand = null, CancellationToken cancellationToken = default) + internal HttpMessage CreateGenerateArmTemplateRequest(string subscriptionId, string resourceGroupName, string labName, string artifactSourceName, string name, RequestContent content, RequestContext context) { - Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); - Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); - Argument.AssertNotNullOrEmpty(labName, nameof(labName)); - Argument.AssertNotNullOrEmpty(artifactSourceName, nameof(artifactSourceName)); - Argument.AssertNotNullOrEmpty(name, nameof(name)); - - using var message = CreateGetRequest(subscriptionId, resourceGroupName, labName, artifactSourceName, name, expand); - _pipeline.Send(message, cancellationToken); - switch (message.Response.Status) - { - case 200: - { - DevTestLabArtifactData value = default; - using var document = JsonDocument.Parse(message.Response.ContentStream, ModelSerializationExtensions.JsonDocumentOptions); - value = DevTestLabArtifactData.DeserializeDevTestLabArtifactData(document.RootElement); - return Response.FromValue(value, message.Response); - } - case 404: - return Response.FromValue((DevTestLabArtifactData)null, message.Response); - default: - throw new RequestFailedException(message.Response); - } - } - - internal RequestUriBuilder CreateGenerateArmTemplateRequestUri(string subscriptionId, string resourceGroupName, string labName, string artifactSourceName, string name, DevTestLabArtifactGenerateArmTemplateContent content) - { - var uri = new RawRequestUriBuilder(); + RawRequestUriBuilder uri = new RawRequestUriBuilder(); uri.Reset(_endpoint); uri.AppendPath("/subscriptions/", false); uri.AppendPath(subscriptionId, true); @@ -316,202 +135,14 @@ internal RequestUriBuilder CreateGenerateArmTemplateRequestUri(string subscripti uri.AppendPath(name, true); uri.AppendPath("/generateArmTemplate", false); uri.AppendQuery("api-version", _apiVersion, true); - return uri; - } - - internal HttpMessage CreateGenerateArmTemplateRequest(string subscriptionId, string resourceGroupName, string labName, string artifactSourceName, string name, DevTestLabArtifactGenerateArmTemplateContent content) - { - var message = _pipeline.CreateMessage(); - var request = message.Request; - request.Method = RequestMethod.Post; - var uri = new RawRequestUriBuilder(); - uri.Reset(_endpoint); - uri.AppendPath("/subscriptions/", false); - uri.AppendPath(subscriptionId, true); - uri.AppendPath("/resourceGroups/", false); - uri.AppendPath(resourceGroupName, true); - uri.AppendPath("/providers/Microsoft.DevTestLab/labs/", false); - uri.AppendPath(labName, true); - uri.AppendPath("/artifactsources/", false); - uri.AppendPath(artifactSourceName, true); - uri.AppendPath("/artifacts/", false); - uri.AppendPath(name, true); - uri.AppendPath("/generateArmTemplate", false); - uri.AppendQuery("api-version", _apiVersion, true); - request.Uri = uri; - request.Headers.Add("Accept", "application/json"); - request.Headers.Add("Content-Type", "application/json"); - var content0 = new Utf8JsonRequestContent(); - content0.JsonWriter.WriteObjectValue(content, ModelSerializationExtensions.WireOptions); - request.Content = content0; - _userAgent.Apply(message); - return message; - } - - /// Generates an ARM template for the given artifact, uploads the required files to a storage account, and validates the generated artifact. - /// The subscription ID. - /// The name of the resource group. - /// The name of the lab. - /// The name of the artifact source. - /// The name of the artifact. - /// Parameters for generating an ARM template for deploying artifacts. - /// The cancellation token to use. - /// , , , , or is null. - /// , , , or is an empty string, and was expected to be non-empty. - public async Task> GenerateArmTemplateAsync(string subscriptionId, string resourceGroupName, string labName, string artifactSourceName, string name, DevTestLabArtifactGenerateArmTemplateContent content, CancellationToken cancellationToken = default) - { - Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); - Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); - Argument.AssertNotNullOrEmpty(labName, nameof(labName)); - Argument.AssertNotNullOrEmpty(artifactSourceName, nameof(artifactSourceName)); - Argument.AssertNotNullOrEmpty(name, nameof(name)); - Argument.AssertNotNull(content, nameof(content)); - - using var message = CreateGenerateArmTemplateRequest(subscriptionId, resourceGroupName, labName, artifactSourceName, name, content); - await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); - switch (message.Response.Status) - { - case 200: - { - DevTestLabArmTemplateInfo value = default; - using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, ModelSerializationExtensions.JsonDocumentOptions, cancellationToken).ConfigureAwait(false); - value = DevTestLabArmTemplateInfo.DeserializeDevTestLabArmTemplateInfo(document.RootElement); - return Response.FromValue(value, message.Response); - } - default: - throw new RequestFailedException(message.Response); - } - } - - /// Generates an ARM template for the given artifact, uploads the required files to a storage account, and validates the generated artifact. - /// The subscription ID. - /// The name of the resource group. - /// The name of the lab. - /// The name of the artifact source. - /// The name of the artifact. - /// Parameters for generating an ARM template for deploying artifacts. - /// The cancellation token to use. - /// , , , , or is null. - /// , , , or is an empty string, and was expected to be non-empty. - public Response GenerateArmTemplate(string subscriptionId, string resourceGroupName, string labName, string artifactSourceName, string name, DevTestLabArtifactGenerateArmTemplateContent content, CancellationToken cancellationToken = default) - { - Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); - Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); - Argument.AssertNotNullOrEmpty(labName, nameof(labName)); - Argument.AssertNotNullOrEmpty(artifactSourceName, nameof(artifactSourceName)); - Argument.AssertNotNullOrEmpty(name, nameof(name)); - Argument.AssertNotNull(content, nameof(content)); - - using var message = CreateGenerateArmTemplateRequest(subscriptionId, resourceGroupName, labName, artifactSourceName, name, content); - _pipeline.Send(message, cancellationToken); - switch (message.Response.Status) - { - case 200: - { - DevTestLabArmTemplateInfo value = default; - using var document = JsonDocument.Parse(message.Response.ContentStream, ModelSerializationExtensions.JsonDocumentOptions); - value = DevTestLabArmTemplateInfo.DeserializeDevTestLabArmTemplateInfo(document.RootElement); - return Response.FromValue(value, message.Response); - } - default: - throw new RequestFailedException(message.Response); - } - } - - internal RequestUriBuilder CreateListNextPageRequestUri(string nextLink, string subscriptionId, string resourceGroupName, string labName, string artifactSourceName, string expand, string filter, int? top, string orderby) - { - var uri = new RawRequestUriBuilder(); - uri.Reset(_endpoint); - uri.AppendRawNextLink(nextLink, false); - return uri; - } - - internal HttpMessage CreateListNextPageRequest(string nextLink, string subscriptionId, string resourceGroupName, string labName, string artifactSourceName, string expand, string filter, int? top, string orderby) - { - var message = _pipeline.CreateMessage(); - var request = message.Request; - request.Method = RequestMethod.Get; - var uri = new RawRequestUriBuilder(); - uri.Reset(_endpoint); - uri.AppendRawNextLink(nextLink, false); + HttpMessage message = Pipeline.CreateMessage(); + Request request = message.Request; request.Uri = uri; - request.Headers.Add("Accept", "application/json"); - _userAgent.Apply(message); + request.Method = RequestMethod.Post; + request.Headers.SetValue("Content-Type", "application/json"); + request.Headers.SetValue("Accept", "application/json"); + request.Content = content; return message; } - - /// List artifacts in a given artifact source. - /// The URL to the next page of results. - /// The subscription ID. - /// The name of the resource group. - /// The name of the lab. - /// The name of the artifact source. - /// Specify the $expand query. Example: 'properties($select=title)'. - /// The filter to apply to the operation. Example: '$filter=contains(name,'myName'). - /// The maximum number of resources to return from the operation. Example: '$top=10'. - /// The ordering expression for the results, using OData notation. Example: '$orderby=name desc'. - /// The cancellation token to use. - /// , , , or is null. - /// , , or is an empty string, and was expected to be non-empty. - public async Task> ListNextPageAsync(string nextLink, string subscriptionId, string resourceGroupName, string labName, string artifactSourceName, string expand = null, string filter = null, int? top = null, string orderby = null, CancellationToken cancellationToken = default) - { - Argument.AssertNotNull(nextLink, nameof(nextLink)); - Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); - Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); - Argument.AssertNotNullOrEmpty(labName, nameof(labName)); - Argument.AssertNotNullOrEmpty(artifactSourceName, nameof(artifactSourceName)); - - using var message = CreateListNextPageRequest(nextLink, subscriptionId, resourceGroupName, labName, artifactSourceName, expand, filter, top, orderby); - await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); - switch (message.Response.Status) - { - case 200: - { - ArtifactList value = default; - using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, ModelSerializationExtensions.JsonDocumentOptions, cancellationToken).ConfigureAwait(false); - value = ArtifactList.DeserializeArtifactList(document.RootElement); - return Response.FromValue(value, message.Response); - } - default: - throw new RequestFailedException(message.Response); - } - } - - /// List artifacts in a given artifact source. - /// The URL to the next page of results. - /// The subscription ID. - /// The name of the resource group. - /// The name of the lab. - /// The name of the artifact source. - /// Specify the $expand query. Example: 'properties($select=title)'. - /// The filter to apply to the operation. Example: '$filter=contains(name,'myName'). - /// The maximum number of resources to return from the operation. Example: '$top=10'. - /// The ordering expression for the results, using OData notation. Example: '$orderby=name desc'. - /// The cancellation token to use. - /// , , , or is null. - /// , , or is an empty string, and was expected to be non-empty. - public Response ListNextPage(string nextLink, string subscriptionId, string resourceGroupName, string labName, string artifactSourceName, string expand = null, string filter = null, int? top = null, string orderby = null, CancellationToken cancellationToken = default) - { - Argument.AssertNotNull(nextLink, nameof(nextLink)); - Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); - Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); - Argument.AssertNotNullOrEmpty(labName, nameof(labName)); - Argument.AssertNotNullOrEmpty(artifactSourceName, nameof(artifactSourceName)); - - using var message = CreateListNextPageRequest(nextLink, subscriptionId, resourceGroupName, labName, artifactSourceName, expand, filter, top, orderby); - _pipeline.Send(message, cancellationToken); - switch (message.Response.Status) - { - case 200: - { - ArtifactList value = default; - using var document = JsonDocument.Parse(message.Response.ContentStream, ModelSerializationExtensions.JsonDocumentOptions); - value = ArtifactList.DeserializeArtifactList(document.RootElement); - return Response.FromValue(value, message.Response); - } - default: - throw new RequestFailedException(message.Response); - } - } } } diff --git a/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/RestOperations/CostsRestOperations.cs b/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/RestOperations/CostsRestOperations.cs index cc6fe10ac552..91ab47e9a648 100644 --- a/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/RestOperations/CostsRestOperations.cs +++ b/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/RestOperations/CostsRestOperations.cs @@ -6,61 +6,44 @@ #nullable disable using System; -using System.Text.Json; -using System.Threading; -using System.Threading.Tasks; +using Azure; using Azure.Core; using Azure.Core.Pipeline; namespace Azure.ResourceManager.DevTestLabs { - internal partial class CostsRestOperations + internal partial class Costs { - private readonly TelemetryDetails _userAgent; - private readonly HttpPipeline _pipeline; private readonly Uri _endpoint; private readonly string _apiVersion; - /// Initializes a new instance of CostsRestOperations. - /// The HTTP pipeline for sending and receiving REST requests and responses. - /// The application id to use for user agent. - /// server parameter. - /// Api Version. - /// or is null. - public CostsRestOperations(HttpPipeline pipeline, string applicationId, Uri endpoint = null, string apiVersion = default) + /// Initializes a new instance of Costs for mocking. + protected Costs() { - _pipeline = pipeline ?? throw new ArgumentNullException(nameof(pipeline)); - _endpoint = endpoint ?? new Uri("https://management.azure.com"); - _apiVersion = apiVersion ?? "2018-09-15"; - _userAgent = new TelemetryDetails(GetType().Assembly, applicationId); } - internal RequestUriBuilder CreateGetRequestUri(string subscriptionId, string resourceGroupName, string labName, string name, string expand) + /// Initializes a new instance of Costs. + /// 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 Costs(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.DevTestLab/labs/", false); - uri.AppendPath(labName, true); - uri.AppendPath("/costs/", false); - uri.AppendPath(name, true); - if (expand != null) - { - uri.AppendQuery("$expand", expand, 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 labName, string name, string expand) + /// 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(string subscriptionId, string resourceGroupName, string labName, string name, string expand, 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); @@ -70,107 +53,22 @@ internal HttpMessage CreateGetRequest(string subscriptionId, string resourceGrou uri.AppendPath(labName, true); uri.AppendPath("/costs/", false); uri.AppendPath(name, true); + uri.AppendQuery("api-version", _apiVersion, true); if (expand != null) { uri.AppendQuery("$expand", expand, 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 cost. - /// The subscription ID. - /// The name of the resource group. - /// The name of the lab. - /// The name of the cost. - /// Specify the $expand query. Example: 'properties($expand=labCostDetails)'. - /// 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 labName, string name, string expand = null, CancellationToken cancellationToken = default) + internal HttpMessage CreateCreateOrUpdateRequest(string subscriptionId, string resourceGroupName, string labName, string name, RequestContent content, RequestContext context) { - Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); - Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); - Argument.AssertNotNullOrEmpty(labName, nameof(labName)); - Argument.AssertNotNullOrEmpty(name, nameof(name)); - - using var message = CreateGetRequest(subscriptionId, resourceGroupName, labName, name, expand); - await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); - switch (message.Response.Status) - { - case 200: - { - DevTestLabCostData value = default; - using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, ModelSerializationExtensions.JsonDocumentOptions, cancellationToken).ConfigureAwait(false); - value = DevTestLabCostData.DeserializeDevTestLabCostData(document.RootElement); - return Response.FromValue(value, message.Response); - } - case 404: - return Response.FromValue((DevTestLabCostData)null, message.Response); - default: - throw new RequestFailedException(message.Response); - } - } - - /// Get cost. - /// The subscription ID. - /// The name of the resource group. - /// The name of the lab. - /// The name of the cost. - /// Specify the $expand query. Example: 'properties($expand=labCostDetails)'. - /// 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 labName, string name, string expand = null, CancellationToken cancellationToken = default) - { - Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); - Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); - Argument.AssertNotNullOrEmpty(labName, nameof(labName)); - Argument.AssertNotNullOrEmpty(name, nameof(name)); - - using var message = CreateGetRequest(subscriptionId, resourceGroupName, labName, name, expand); - _pipeline.Send(message, cancellationToken); - switch (message.Response.Status) - { - case 200: - { - DevTestLabCostData value = default; - using var document = JsonDocument.Parse(message.Response.ContentStream, ModelSerializationExtensions.JsonDocumentOptions); - value = DevTestLabCostData.DeserializeDevTestLabCostData(document.RootElement); - return Response.FromValue(value, message.Response); - } - case 404: - return Response.FromValue((DevTestLabCostData)null, message.Response); - default: - throw new RequestFailedException(message.Response); - } - } - - internal RequestUriBuilder CreateCreateOrUpdateRequestUri(string subscriptionId, string resourceGroupName, string labName, string name, DevTestLabCostData data) - { - var uri = new RawRequestUriBuilder(); - uri.Reset(_endpoint); - uri.AppendPath("/subscriptions/", false); - uri.AppendPath(subscriptionId, true); - uri.AppendPath("/resourceGroups/", false); - uri.AppendPath(resourceGroupName, true); - uri.AppendPath("/providers/Microsoft.DevTestLab/labs/", false); - uri.AppendPath(labName, true); - uri.AppendPath("/costs/", false); - uri.AppendPath(name, true); - uri.AppendQuery("api-version", _apiVersion, true); - return uri; - } - - internal HttpMessage CreateCreateOrUpdateRequest(string subscriptionId, string resourceGroupName, string labName, string name, DevTestLabCostData data) - { - 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); @@ -181,82 +79,14 @@ internal HttpMessage CreateCreateOrUpdateRequest(string subscriptionId, string r uri.AppendPath("/costs/", false); uri.AppendPath(name, 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 or replace an existing cost. - /// The subscription ID. - /// The name of the resource group. - /// The name of the lab. - /// The name of the cost. - /// A cost item. - /// 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 labName, string name, DevTestLabCostData data, CancellationToken cancellationToken = default) - { - Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); - Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); - Argument.AssertNotNullOrEmpty(labName, nameof(labName)); - Argument.AssertNotNullOrEmpty(name, nameof(name)); - Argument.AssertNotNull(data, nameof(data)); - - using var message = CreateCreateOrUpdateRequest(subscriptionId, resourceGroupName, labName, name, data); - await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); - switch (message.Response.Status) - { - case 200: - case 201: - { - DevTestLabCostData value = default; - using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, ModelSerializationExtensions.JsonDocumentOptions, cancellationToken).ConfigureAwait(false); - value = DevTestLabCostData.DeserializeDevTestLabCostData(document.RootElement); - return Response.FromValue(value, message.Response); - } - default: - throw new RequestFailedException(message.Response); - } - } - - /// Create or replace an existing cost. - /// The subscription ID. - /// The name of the resource group. - /// The name of the lab. - /// The name of the cost. - /// A cost item. - /// 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 labName, string name, DevTestLabCostData data, CancellationToken cancellationToken = default) - { - Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); - Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); - Argument.AssertNotNullOrEmpty(labName, nameof(labName)); - Argument.AssertNotNullOrEmpty(name, nameof(name)); - Argument.AssertNotNull(data, nameof(data)); - - using var message = CreateCreateOrUpdateRequest(subscriptionId, resourceGroupName, labName, name, data); - _pipeline.Send(message, cancellationToken); - switch (message.Response.Status) - { - case 200: - case 201: - { - DevTestLabCostData value = default; - using var document = JsonDocument.Parse(message.Response.ContentStream, ModelSerializationExtensions.JsonDocumentOptions); - value = DevTestLabCostData.DeserializeDevTestLabCostData(document.RootElement); - return Response.FromValue(value, message.Response); - } - default: - throw new RequestFailedException(message.Response); - } - } } } diff --git a/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/RestOperations/CustomImagesRestOperations.cs b/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/RestOperations/CustomImagesRestOperations.cs index ccf8caacf37d..ba004322fbc2 100644 --- a/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/RestOperations/CustomImagesRestOperations.cs +++ b/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/RestOperations/CustomImagesRestOperations.cs @@ -6,173 +6,44 @@ #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.DevTestLabs.Models; namespace Azure.ResourceManager.DevTestLabs { - internal partial class CustomImagesRestOperations + internal partial class CustomImages { - private readonly TelemetryDetails _userAgent; - private readonly HttpPipeline _pipeline; private readonly Uri _endpoint; private readonly string _apiVersion; - /// Initializes a new instance of CustomImagesRestOperations. - /// The HTTP pipeline for sending and receiving REST requests and responses. - /// The application id to use for user agent. - /// server parameter. - /// Api Version. - /// or is null. - public CustomImagesRestOperations(HttpPipeline pipeline, string applicationId, Uri endpoint = null, string apiVersion = default) + /// Initializes a new instance of CustomImages for mocking. + protected CustomImages() { - _pipeline = pipeline ?? throw new ArgumentNullException(nameof(pipeline)); - _endpoint = endpoint ?? new Uri("https://management.azure.com"); - _apiVersion = apiVersion ?? "2018-09-15"; - _userAgent = new TelemetryDetails(GetType().Assembly, applicationId); } - internal RequestUriBuilder CreateListRequestUri(string subscriptionId, string resourceGroupName, string labName, string expand, string filter, int? top, string orderby) - { - 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.DevTestLab/labs/", false); - uri.AppendPath(labName, true); - uri.AppendPath("/customimages", false); - if (expand != null) - { - uri.AppendQuery("$expand", expand, true); - } - if (filter != null) - { - uri.AppendQuery("$filter", filter, true); - } - if (top != null) - { - uri.AppendQuery("$top", top.Value, true); - } - if (orderby != null) - { - uri.AppendQuery("$orderby", orderby, true); - } - uri.AppendQuery("api-version", _apiVersion, true); - return uri; - } - - internal HttpMessage CreateListRequest(string subscriptionId, string resourceGroupName, string labName, string expand, string filter, int? top, string orderby) - { - 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.DevTestLab/labs/", false); - uri.AppendPath(labName, true); - uri.AppendPath("/customimages", false); - if (expand != null) - { - uri.AppendQuery("$expand", expand, true); - } - if (filter != null) - { - uri.AppendQuery("$filter", filter, true); - } - if (top != null) - { - uri.AppendQuery("$top", top.Value, true); - } - if (orderby != null) - { - uri.AppendQuery("$orderby", orderby, true); - } - uri.AppendQuery("api-version", _apiVersion, true); - request.Uri = uri; - request.Headers.Add("Accept", "application/json"); - _userAgent.Apply(message); - return message; - } - - /// List custom images in a given lab. - /// The subscription ID. - /// The name of the resource group. - /// The name of the lab. - /// Specify the $expand query. Example: 'properties($select=vm)'. - /// The filter to apply to the operation. Example: '$filter=contains(name,'myName'). - /// The maximum number of resources to return from the operation. Example: '$top=10'. - /// The ordering expression for the results, using OData notation. Example: '$orderby=name desc'. - /// The cancellation token to use. - /// , or is null. - /// , or is an empty string, and was expected to be non-empty. - public async Task> ListAsync(string subscriptionId, string resourceGroupName, string labName, string expand = null, string filter = null, int? top = null, string orderby = null, CancellationToken cancellationToken = default) + /// Initializes a new instance of CustomImages. + /// 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 CustomImages(ClientDiagnostics clientDiagnostics, HttpPipeline pipeline, Uri endpoint, string apiVersion) { - Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); - Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); - Argument.AssertNotNullOrEmpty(labName, nameof(labName)); - - using var message = CreateListRequest(subscriptionId, resourceGroupName, labName, expand, filter, top, orderby); - await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); - switch (message.Response.Status) - { - case 200: - { - CustomImageList value = default; - using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, ModelSerializationExtensions.JsonDocumentOptions, cancellationToken).ConfigureAwait(false); - value = CustomImageList.DeserializeCustomImageList(document.RootElement); - return Response.FromValue(value, message.Response); - } - default: - throw new RequestFailedException(message.Response); - } + ClientDiagnostics = clientDiagnostics; + _endpoint = endpoint; + Pipeline = pipeline; + _apiVersion = apiVersion; } - /// List custom images in a given lab. - /// The subscription ID. - /// The name of the resource group. - /// The name of the lab. - /// Specify the $expand query. Example: 'properties($select=vm)'. - /// The filter to apply to the operation. Example: '$filter=contains(name,'myName'). - /// The maximum number of resources to return from the operation. Example: '$top=10'. - /// The ordering expression for the results, using OData notation. Example: '$orderby=name desc'. - /// The cancellation token to use. - /// , or is null. - /// , or is an empty string, and was expected to be non-empty. - public Response List(string subscriptionId, string resourceGroupName, string labName, string expand = null, string filter = null, int? top = null, string orderby = null, CancellationToken cancellationToken = default) - { - Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); - Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); - Argument.AssertNotNullOrEmpty(labName, nameof(labName)); + /// The HTTP pipeline for sending and receiving REST requests and responses. + public virtual HttpPipeline Pipeline { get; } - using var message = CreateListRequest(subscriptionId, resourceGroupName, labName, expand, filter, top, orderby); - _pipeline.Send(message, cancellationToken); - switch (message.Response.Status) - { - case 200: - { - CustomImageList value = default; - using var document = JsonDocument.Parse(message.Response.ContentStream, ModelSerializationExtensions.JsonDocumentOptions); - value = CustomImageList.DeserializeCustomImageList(document.RootElement); - return Response.FromValue(value, 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 CreateGetRequestUri(string subscriptionId, string resourceGroupName, string labName, string name, string expand) + internal HttpMessage CreateGetRequest(string subscriptionId, string resourceGroupName, string labName, string name, string expand, RequestContext context) { - var uri = new RawRequestUriBuilder(); + RawRequestUriBuilder uri = new RawRequestUriBuilder(); uri.Reset(_endpoint); uri.AppendPath("/subscriptions/", false); uri.AppendPath(subscriptionId, true); @@ -182,111 +53,22 @@ internal RequestUriBuilder CreateGetRequestUri(string subscriptionId, string res uri.AppendPath(labName, true); uri.AppendPath("/customimages/", false); uri.AppendPath(name, true); - if (expand != null) - { - uri.AppendQuery("$expand", expand, true); - } uri.AppendQuery("api-version", _apiVersion, true); - return uri; - } - - internal HttpMessage CreateGetRequest(string subscriptionId, string resourceGroupName, string labName, string name, string expand) - { - 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.DevTestLab/labs/", false); - uri.AppendPath(labName, true); - uri.AppendPath("/customimages/", false); - uri.AppendPath(name, true); if (expand != null) { uri.AppendQuery("$expand", expand, 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 custom image. - /// The subscription ID. - /// The name of the resource group. - /// The name of the lab. - /// The name of the custom image. - /// Specify the $expand query. Example: 'properties($select=vm)'. - /// The cancellation token to use. - /// , , or is null. - /// , , or is an empty string, and was expected to be non-empty. - public async Task> GetAsync(string subscriptionId, string resourceGroupName, string labName, string name, string expand = null, CancellationToken cancellationToken = default) - { - Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); - Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); - Argument.AssertNotNullOrEmpty(labName, nameof(labName)); - Argument.AssertNotNullOrEmpty(name, nameof(name)); - - using var message = CreateGetRequest(subscriptionId, resourceGroupName, labName, name, expand); - await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); - switch (message.Response.Status) - { - case 200: - { - DevTestLabCustomImageData value = default; - using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, ModelSerializationExtensions.JsonDocumentOptions, cancellationToken).ConfigureAwait(false); - value = DevTestLabCustomImageData.DeserializeDevTestLabCustomImageData(document.RootElement); - return Response.FromValue(value, message.Response); - } - case 404: - return Response.FromValue((DevTestLabCustomImageData)null, message.Response); - default: - throw new RequestFailedException(message.Response); - } - } - - /// Get custom image. - /// The subscription ID. - /// The name of the resource group. - /// The name of the lab. - /// The name of the custom image. - /// Specify the $expand query. Example: 'properties($select=vm)'. - /// The cancellation token to use. - /// , , or is null. - /// , , or is an empty string, and was expected to be non-empty. - public Response Get(string subscriptionId, string resourceGroupName, string labName, string name, string expand = null, CancellationToken cancellationToken = default) - { - Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); - Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); - Argument.AssertNotNullOrEmpty(labName, nameof(labName)); - Argument.AssertNotNullOrEmpty(name, nameof(name)); - - using var message = CreateGetRequest(subscriptionId, resourceGroupName, labName, name, expand); - _pipeline.Send(message, cancellationToken); - switch (message.Response.Status) - { - case 200: - { - DevTestLabCustomImageData value = default; - using var document = JsonDocument.Parse(message.Response.ContentStream, ModelSerializationExtensions.JsonDocumentOptions); - value = DevTestLabCustomImageData.DeserializeDevTestLabCustomImageData(document.RootElement); - return Response.FromValue(value, message.Response); - } - case 404: - return Response.FromValue((DevTestLabCustomImageData)null, message.Response); - default: - throw new RequestFailedException(message.Response); - } - } - - internal RequestUriBuilder CreateCreateOrUpdateRequestUri(string subscriptionId, string resourceGroupName, string labName, string name, DevTestLabCustomImageData data) + internal HttpMessage CreateCreateOrUpdateRequest(string subscriptionId, string resourceGroupName, string labName, string name, RequestContent content, RequestContext context) { - var uri = new RawRequestUriBuilder(); + RawRequestUriBuilder uri = new RawRequestUriBuilder(); uri.Reset(_endpoint); uri.AppendPath("/subscriptions/", false); uri.AppendPath(subscriptionId, true); @@ -297,15 +79,19 @@ internal RequestUriBuilder CreateCreateOrUpdateRequestUri(string subscriptionId, uri.AppendPath("/customimages/", false); uri.AppendPath(name, true); uri.AppendQuery("api-version", _apiVersion, true); - return uri; + HttpMessage message = Pipeline.CreateMessage(); + Request request = message.Request; + request.Uri = uri; + request.Method = RequestMethod.Put; + request.Headers.SetValue("Content-Type", "application/json"); + request.Headers.SetValue("Accept", "application/json"); + request.Content = content; + return message; } - internal HttpMessage CreateCreateOrUpdateRequest(string subscriptionId, string resourceGroupName, string labName, string name, DevTestLabCustomImageData data) + internal HttpMessage CreateUpdateRequest(string subscriptionId, string resourceGroupName, string labName, string name, 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); @@ -316,77 +102,19 @@ internal HttpMessage CreateCreateOrUpdateRequest(string subscriptionId, string r uri.AppendPath("/customimages/", false); uri.AppendPath(name, 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.Patch; + request.Headers.SetValue("Content-Type", "application/json"); + request.Headers.SetValue("Accept", "application/json"); request.Content = content; - _userAgent.Apply(message); return message; } - /// Create or replace an existing custom image. This operation can take a while to complete. - /// The subscription ID. - /// The name of the resource group. - /// The name of the lab. - /// The name of the custom image. - /// A custom image. - /// 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 labName, string name, DevTestLabCustomImageData data, CancellationToken cancellationToken = default) - { - Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); - Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); - Argument.AssertNotNullOrEmpty(labName, nameof(labName)); - Argument.AssertNotNullOrEmpty(name, nameof(name)); - Argument.AssertNotNull(data, nameof(data)); - - using var message = CreateCreateOrUpdateRequest(subscriptionId, resourceGroupName, labName, name, data); - await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); - switch (message.Response.Status) - { - case 200: - case 201: - return message.Response; - default: - throw new RequestFailedException(message.Response); - } - } - - /// Create or replace an existing custom image. This operation can take a while to complete. - /// The subscription ID. - /// The name of the resource group. - /// The name of the lab. - /// The name of the custom image. - /// A custom image. - /// 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 labName, string name, DevTestLabCustomImageData data, CancellationToken cancellationToken = default) - { - Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); - Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); - Argument.AssertNotNullOrEmpty(labName, nameof(labName)); - Argument.AssertNotNullOrEmpty(name, nameof(name)); - Argument.AssertNotNull(data, nameof(data)); - - using var message = CreateCreateOrUpdateRequest(subscriptionId, resourceGroupName, labName, name, 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 labName, string name) + internal HttpMessage CreateDeleteRequest(string subscriptionId, string resourceGroupName, string labName, string name, RequestContext context) { - var uri = new RawRequestUriBuilder(); + RawRequestUriBuilder uri = new RawRequestUriBuilder(); uri.Reset(_endpoint); uri.AppendPath("/subscriptions/", false); uri.AppendPath(subscriptionId, true); @@ -397,15 +125,16 @@ internal RequestUriBuilder CreateDeleteRequestUri(string subscriptionId, string uri.AppendPath("/customimages/", false); uri.AppendPath(name, true); uri.AppendQuery("api-version", _apiVersion, true); - return uri; + HttpMessage message = Pipeline.CreateMessage(); + Request request = message.Request; + request.Uri = uri; + request.Method = RequestMethod.Delete; + return message; } - internal HttpMessage CreateDeleteRequest(string subscriptionId, string resourceGroupName, string labName, string name) + internal HttpMessage CreateGetAllRequest(string subscriptionId, string resourceGroupName, string labName, string expand, string filter, int? top, string @orderby, RequestContext context) { - var message = _pipeline.CreateMessage(); - var request = message.Request; - request.Method = RequestMethod.Delete; - var uri = new RawRequestUriBuilder(); + RawRequestUriBuilder uri = new RawRequestUriBuilder(); uri.Reset(_endpoint); uri.AppendPath("/subscriptions/", false); uri.AppendPath(subscriptionId, true); @@ -413,269 +142,43 @@ internal HttpMessage CreateDeleteRequest(string subscriptionId, string resourceG uri.AppendPath(resourceGroupName, true); uri.AppendPath("/providers/Microsoft.DevTestLab/labs/", false); uri.AppendPath(labName, true); - uri.AppendPath("/customimages/", false); - uri.AppendPath(name, true); + uri.AppendPath("/customimages", false); uri.AppendQuery("api-version", _apiVersion, true); - request.Uri = uri; - request.Headers.Add("Accept", "application/json"); - _userAgent.Apply(message); - return message; - } - - /// Delete custom image. This operation can take a while to complete. - /// The subscription ID. - /// The name of the resource group. - /// The name of the lab. - /// The name of the custom image. - /// 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 labName, string name, CancellationToken cancellationToken = default) - { - Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); - Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); - Argument.AssertNotNullOrEmpty(labName, nameof(labName)); - Argument.AssertNotNullOrEmpty(name, nameof(name)); - - using var message = CreateDeleteRequest(subscriptionId, resourceGroupName, labName, name); - await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); - switch (message.Response.Status) + if (expand != null) { - case 200: - case 202: - case 204: - return message.Response; - default: - throw new RequestFailedException(message.Response); + uri.AppendQuery("$expand", expand, true); } - } - - /// Delete custom image. This operation can take a while to complete. - /// The subscription ID. - /// The name of the resource group. - /// The name of the lab. - /// The name of the custom image. - /// 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 labName, string name, CancellationToken cancellationToken = default) - { - Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); - Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); - Argument.AssertNotNullOrEmpty(labName, nameof(labName)); - Argument.AssertNotNullOrEmpty(name, nameof(name)); - - using var message = CreateDeleteRequest(subscriptionId, resourceGroupName, labName, name); - _pipeline.Send(message, cancellationToken); - switch (message.Response.Status) + if (filter != null) { - case 200: - case 202: - case 204: - return message.Response; - default: - throw new RequestFailedException(message.Response); + uri.AppendQuery("$filter", filter, true); } - } - - internal RequestUriBuilder CreateUpdateRequestUri(string subscriptionId, string resourceGroupName, string labName, string name, DevTestLabCustomImagePatch 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.DevTestLab/labs/", false); - uri.AppendPath(labName, true); - uri.AppendPath("/customimages/", false); - uri.AppendPath(name, true); - uri.AppendQuery("api-version", _apiVersion, true); - return uri; - } - - internal HttpMessage CreateUpdateRequest(string subscriptionId, string resourceGroupName, string labName, string name, DevTestLabCustomImagePatch patch) - { - var message = _pipeline.CreateMessage(); - var request = message.Request; - request.Method = RequestMethod.Patch; - var uri = new RawRequestUriBuilder(); - uri.Reset(_endpoint); - uri.AppendPath("/subscriptions/", false); - uri.AppendPath(subscriptionId, true); - uri.AppendPath("/resourceGroups/", false); - uri.AppendPath(resourceGroupName, true); - uri.AppendPath("/providers/Microsoft.DevTestLab/labs/", false); - uri.AppendPath(labName, true); - uri.AppendPath("/customimages/", false); - uri.AppendPath(name, true); - uri.AppendQuery("api-version", _apiVersion, true); - request.Uri = uri; - request.Headers.Add("Accept", "application/json"); - request.Headers.Add("Content-Type", "application/json"); - var content = new Utf8JsonRequestContent(); - content.JsonWriter.WriteObjectValue(patch, ModelSerializationExtensions.WireOptions); - request.Content = content; - _userAgent.Apply(message); - return message; - } - - /// Allows modifying tags of custom images. All other properties will be ignored. - /// The subscription ID. - /// The name of the resource group. - /// The name of the lab. - /// The name of the custom image. - /// A custom image. - /// 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 labName, string name, DevTestLabCustomImagePatch patch, CancellationToken cancellationToken = default) - { - Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); - Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); - Argument.AssertNotNullOrEmpty(labName, nameof(labName)); - Argument.AssertNotNullOrEmpty(name, nameof(name)); - Argument.AssertNotNull(patch, nameof(patch)); - - using var message = CreateUpdateRequest(subscriptionId, resourceGroupName, labName, name, patch); - await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); - switch (message.Response.Status) + if (top != null) { - case 200: - { - DevTestLabCustomImageData value = default; - using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, ModelSerializationExtensions.JsonDocumentOptions, cancellationToken).ConfigureAwait(false); - value = DevTestLabCustomImageData.DeserializeDevTestLabCustomImageData(document.RootElement); - return Response.FromValue(value, message.Response); - } - default: - throw new RequestFailedException(message.Response); + uri.AppendQuery("$top", TypeFormatters.ConvertToString(top), true); } - } - - /// Allows modifying tags of custom images. All other properties will be ignored. - /// The subscription ID. - /// The name of the resource group. - /// The name of the lab. - /// The name of the custom image. - /// A custom image. - /// 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 labName, string name, DevTestLabCustomImagePatch patch, CancellationToken cancellationToken = default) - { - Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); - Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); - Argument.AssertNotNullOrEmpty(labName, nameof(labName)); - Argument.AssertNotNullOrEmpty(name, nameof(name)); - Argument.AssertNotNull(patch, nameof(patch)); - - using var message = CreateUpdateRequest(subscriptionId, resourceGroupName, labName, name, patch); - _pipeline.Send(message, cancellationToken); - switch (message.Response.Status) + if (@orderby != null) { - case 200: - { - DevTestLabCustomImageData value = default; - using var document = JsonDocument.Parse(message.Response.ContentStream, ModelSerializationExtensions.JsonDocumentOptions); - value = DevTestLabCustomImageData.DeserializeDevTestLabCustomImageData(document.RootElement); - return Response.FromValue(value, message.Response); - } - default: - throw new RequestFailedException(message.Response); + uri.AppendQuery("$orderby", @orderby, true); } - } - - internal RequestUriBuilder CreateListNextPageRequestUri(string nextLink, string subscriptionId, string resourceGroupName, string labName, string expand, string filter, int? top, string orderby) - { - var uri = new RawRequestUriBuilder(); - uri.Reset(_endpoint); - uri.AppendRawNextLink(nextLink, false); - return uri; - } - - internal HttpMessage CreateListNextPageRequest(string nextLink, string subscriptionId, string resourceGroupName, string labName, string expand, string filter, int? top, string orderby) - { - var message = _pipeline.CreateMessage(); - var request = message.Request; - request.Method = RequestMethod.Get; - var uri = new RawRequestUriBuilder(); - uri.Reset(_endpoint); - uri.AppendRawNextLink(nextLink, false); + 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 custom images in a given lab. - /// The URL to the next page of results. - /// The subscription ID. - /// The name of the resource group. - /// The name of the lab. - /// Specify the $expand query. Example: 'properties($select=vm)'. - /// The filter to apply to the operation. Example: '$filter=contains(name,'myName'). - /// The maximum number of resources to return from the operation. Example: '$top=10'. - /// The ordering expression for the results, using OData notation. Example: '$orderby=name desc'. - /// The cancellation token to use. - /// , , or is null. - /// , or is an empty string, and was expected to be non-empty. - public async Task> ListNextPageAsync(string nextLink, string subscriptionId, string resourceGroupName, string labName, string expand = null, string filter = null, int? top = null, string orderby = null, CancellationToken cancellationToken = default) + internal HttpMessage CreateNextGetAllRequest(Uri nextPage, string subscriptionId, string resourceGroupName, string labName, string expand, string filter, int? top, string @orderby, RequestContext context) { - Argument.AssertNotNull(nextLink, nameof(nextLink)); - Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); - Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); - Argument.AssertNotNullOrEmpty(labName, nameof(labName)); - - using var message = CreateListNextPageRequest(nextLink, subscriptionId, resourceGroupName, labName, expand, filter, top, orderby); - await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); - switch (message.Response.Status) - { - case 200: - { - CustomImageList value = default; - using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, ModelSerializationExtensions.JsonDocumentOptions, cancellationToken).ConfigureAwait(false); - value = CustomImageList.DeserializeCustomImageList(document.RootElement); - return Response.FromValue(value, message.Response); - } - default: - throw new RequestFailedException(message.Response); - } - } - - /// List custom images in a given lab. - /// The URL to the next page of results. - /// The subscription ID. - /// The name of the resource group. - /// The name of the lab. - /// Specify the $expand query. Example: 'properties($select=vm)'. - /// The filter to apply to the operation. Example: '$filter=contains(name,'myName'). - /// The maximum number of resources to return from the operation. Example: '$top=10'. - /// The ordering expression for the results, using OData notation. Example: '$orderby=name desc'. - /// The cancellation token to use. - /// , , or is null. - /// , or is an empty string, and was expected to be non-empty. - public Response ListNextPage(string nextLink, string subscriptionId, string resourceGroupName, string labName, string expand = null, string filter = null, int? top = null, string orderby = null, CancellationToken cancellationToken = default) - { - Argument.AssertNotNull(nextLink, nameof(nextLink)); - Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); - Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); - Argument.AssertNotNullOrEmpty(labName, nameof(labName)); - - using var message = CreateListNextPageRequest(nextLink, subscriptionId, resourceGroupName, labName, expand, filter, top, orderby); - _pipeline.Send(message, cancellationToken); - switch (message.Response.Status) - { - case 200: - { - CustomImageList value = default; - using var document = JsonDocument.Parse(message.Response.ContentStream, ModelSerializationExtensions.JsonDocumentOptions); - value = CustomImageList.DeserializeCustomImageList(document.RootElement); - return Response.FromValue(value, message.Response); - } - default: - throw new RequestFailedException(message.Response); - } + RawRequestUriBuilder uri = new RawRequestUriBuilder(); + uri.Reset(nextPage); + uri.UpdateQuery("api-version", _apiVersion); + HttpMessage message = Pipeline.CreateMessage(); + Request request = message.Request; + request.Uri = uri; + request.Method = RequestMethod.Get; + request.Headers.SetValue("Accept", "application/json"); + return message; } } } diff --git a/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/RestOperations/DevTestLabGlobalSchedulesRestOperations.cs b/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/RestOperations/DevTestLabGlobalSchedulesRestOperations.cs new file mode 100644 index 000000000000..b938e7f7c935 --- /dev/null +++ b/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/RestOperations/DevTestLabGlobalSchedulesRestOperations.cs @@ -0,0 +1,259 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using Azure; +using Azure.Core; +using Azure.Core.Pipeline; + +namespace Azure.ResourceManager.DevTestLabs +{ + internal partial class DevTestLabGlobalSchedules + { + private readonly Uri _endpoint; + private readonly string _apiVersion; + + /// Initializes a new instance of DevTestLabGlobalSchedules for mocking. + protected DevTestLabGlobalSchedules() + { + } + + /// Initializes a new instance of DevTestLabGlobalSchedules. + /// 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 DevTestLabGlobalSchedules(ClientDiagnostics clientDiagnostics, HttpPipeline pipeline, Uri endpoint, string apiVersion) + { + ClientDiagnostics = clientDiagnostics; + _endpoint = endpoint; + Pipeline = pipeline; + _apiVersion = apiVersion; + } + + /// 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(string subscriptionId, string resourceGroupName, string name, string expand, RequestContext context) + { + 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.DevTestLab/schedules/", false); + uri.AppendPath(name, true); + uri.AppendQuery("api-version", _apiVersion, true); + if (expand != null) + { + uri.AppendQuery("$expand", expand, true); + } + 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 name, RequestContent content, RequestContext context) + { + 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.DevTestLab/schedules/", false); + uri.AppendPath(name, true); + uri.AppendQuery("api-version", _apiVersion, true); + HttpMessage message = Pipeline.CreateMessage(); + Request request = message.Request; + request.Uri = uri; + request.Method = RequestMethod.Put; + request.Headers.SetValue("Content-Type", "application/json"); + request.Headers.SetValue("Accept", "application/json"); + request.Content = content; + return message; + } + + internal HttpMessage CreateUpdateRequest(string subscriptionId, string resourceGroupName, string name, RequestContent content, RequestContext context) + { + 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.DevTestLab/schedules/", false); + uri.AppendPath(name, true); + uri.AppendQuery("api-version", _apiVersion, true); + HttpMessage message = Pipeline.CreateMessage(); + Request request = message.Request; + request.Uri = uri; + request.Method = RequestMethod.Patch; + request.Headers.SetValue("Content-Type", "application/json"); + request.Headers.SetValue("Accept", "application/json"); + request.Content = content; + return message; + } + + internal HttpMessage CreateDeleteRequest(string subscriptionId, string resourceGroupName, string name, RequestContext context) + { + 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.DevTestLab/schedules/", false); + uri.AppendPath(name, true); + uri.AppendQuery("api-version", _apiVersion, true); + HttpMessage message = Pipeline.CreateMessage(); + Request request = message.Request; + request.Uri = uri; + request.Method = RequestMethod.Delete; + return message; + } + + internal HttpMessage CreateGetByResourceGroupRequest(string subscriptionId, string resourceGroupName, string expand, string filter, int? top, string @orderby, RequestContext context) + { + 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.DevTestLab/schedules", false); + uri.AppendQuery("api-version", _apiVersion, true); + if (expand != null) + { + uri.AppendQuery("$expand", expand, true); + } + if (filter != null) + { + uri.AppendQuery("$filter", filter, true); + } + if (top != null) + { + uri.AppendQuery("$top", TypeFormatters.ConvertToString(top), true); + } + if (@orderby != null) + { + uri.AppendQuery("$orderby", @orderby, true); + } + 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 CreateNextGetByResourceGroupRequest(Uri nextPage, string subscriptionId, string resourceGroupName, string expand, string filter, int? top, string @orderby, RequestContext context) + { + RawRequestUriBuilder uri = new RawRequestUriBuilder(); + uri.Reset(nextPage); + uri.UpdateQuery("api-version", _apiVersion); + 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 CreateGetBySubscriptionRequest(string subscriptionId, string expand, string filter, int? top, string @orderby, RequestContext context) + { + RawRequestUriBuilder uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/subscriptions/", false); + uri.AppendPath(subscriptionId, true); + uri.AppendPath("/providers/Microsoft.DevTestLab/schedules", false); + uri.AppendQuery("api-version", _apiVersion, true); + if (expand != null) + { + uri.AppendQuery("$expand", expand, true); + } + if (filter != null) + { + uri.AppendQuery("$filter", filter, true); + } + if (top != null) + { + uri.AppendQuery("$top", TypeFormatters.ConvertToString(top), true); + } + if (@orderby != null) + { + uri.AppendQuery("$orderby", @orderby, true); + } + 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 CreateNextGetBySubscriptionRequest(Uri nextPage, string subscriptionId, string expand, string filter, int? top, string @orderby, RequestContext context) + { + RawRequestUriBuilder uri = new RawRequestUriBuilder(); + uri.Reset(nextPage); + uri.UpdateQuery("api-version", _apiVersion); + 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 CreateExecuteRequest(string subscriptionId, string resourceGroupName, string name, RequestContext context) + { + 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.DevTestLab/schedules/", false); + uri.AppendPath(name, true); + uri.AppendPath("/execute", false); + uri.AppendQuery("api-version", _apiVersion, true); + HttpMessage message = Pipeline.CreateMessage(); + Request request = message.Request; + request.Uri = uri; + request.Method = RequestMethod.Post; + return message; + } + + internal HttpMessage CreateRetargetRequest(string subscriptionId, string resourceGroupName, string name, RequestContent content, RequestContext context) + { + 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.DevTestLab/schedules/", false); + uri.AppendPath(name, true); + uri.AppendPath("/retarget", false); + uri.AppendQuery("api-version", _apiVersion, true); + HttpMessage message = Pipeline.CreateMessage(); + Request request = message.Request; + request.Uri = uri; + request.Method = RequestMethod.Post; + request.Headers.SetValue("Content-Type", "application/json"); + request.Content = content; + return message; + } + } +} diff --git a/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/RestOperations/DevTestLabSchedulesRestOperations.cs b/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/RestOperations/DevTestLabSchedulesRestOperations.cs new file mode 100644 index 000000000000..eb49d85f4a7a --- /dev/null +++ b/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/RestOperations/DevTestLabSchedulesRestOperations.cs @@ -0,0 +1,240 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using Azure; +using Azure.Core; +using Azure.Core.Pipeline; + +namespace Azure.ResourceManager.DevTestLabs +{ + internal partial class DevTestLabSchedules + { + private readonly Uri _endpoint; + private readonly string _apiVersion; + + /// Initializes a new instance of DevTestLabSchedules for mocking. + protected DevTestLabSchedules() + { + } + + /// Initializes a new instance of DevTestLabSchedules. + /// 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 DevTestLabSchedules(ClientDiagnostics clientDiagnostics, HttpPipeline pipeline, Uri endpoint, string apiVersion) + { + ClientDiagnostics = clientDiagnostics; + _endpoint = endpoint; + Pipeline = pipeline; + _apiVersion = apiVersion; + } + + /// 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(string subscriptionId, string resourceGroupName, string labName, string name, string expand, RequestContext context) + { + 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.DevTestLab/labs/", false); + uri.AppendPath(labName, true); + uri.AppendPath("/schedules/", false); + uri.AppendPath(name, true); + uri.AppendQuery("api-version", _apiVersion, true); + if (expand != null) + { + uri.AppendQuery("$expand", expand, true); + } + 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 labName, string name, RequestContent content, RequestContext context) + { + 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.DevTestLab/labs/", false); + uri.AppendPath(labName, true); + uri.AppendPath("/schedules/", false); + uri.AppendPath(name, true); + uri.AppendQuery("api-version", _apiVersion, true); + HttpMessage message = Pipeline.CreateMessage(); + Request request = message.Request; + request.Uri = uri; + request.Method = RequestMethod.Put; + request.Headers.SetValue("Content-Type", "application/json"); + request.Headers.SetValue("Accept", "application/json"); + request.Content = content; + return message; + } + + internal HttpMessage CreateUpdateRequest(string subscriptionId, string resourceGroupName, string labName, string name, RequestContent content, RequestContext context) + { + 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.DevTestLab/labs/", false); + uri.AppendPath(labName, true); + uri.AppendPath("/schedules/", false); + uri.AppendPath(name, true); + uri.AppendQuery("api-version", _apiVersion, true); + HttpMessage message = Pipeline.CreateMessage(); + Request request = message.Request; + request.Uri = uri; + request.Method = RequestMethod.Patch; + request.Headers.SetValue("Content-Type", "application/json"); + request.Headers.SetValue("Accept", "application/json"); + request.Content = content; + return message; + } + + internal HttpMessage CreateDeleteRequest(string subscriptionId, string resourceGroupName, string labName, string name, RequestContext context) + { + 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.DevTestLab/labs/", false); + uri.AppendPath(labName, true); + uri.AppendPath("/schedules/", false); + uri.AppendPath(name, true); + uri.AppendQuery("api-version", _apiVersion, true); + HttpMessage message = Pipeline.CreateMessage(); + Request request = message.Request; + request.Uri = uri; + request.Method = RequestMethod.Delete; + return message; + } + + internal HttpMessage CreateGetAllRequest(string subscriptionId, string resourceGroupName, string labName, string expand, string filter, int? top, string @orderby, RequestContext context) + { + 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.DevTestLab/labs/", false); + uri.AppendPath(labName, true); + uri.AppendPath("/schedules", false); + uri.AppendQuery("api-version", _apiVersion, true); + if (expand != null) + { + uri.AppendQuery("$expand", expand, true); + } + if (filter != null) + { + uri.AppendQuery("$filter", filter, true); + } + if (top != null) + { + uri.AppendQuery("$top", TypeFormatters.ConvertToString(top), true); + } + if (@orderby != null) + { + uri.AppendQuery("$orderby", @orderby, true); + } + 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 CreateNextGetAllRequest(Uri nextPage, string subscriptionId, string resourceGroupName, string labName, string expand, string filter, int? top, string @orderby, RequestContext context) + { + RawRequestUriBuilder uri = new RawRequestUriBuilder(); + uri.Reset(nextPage); + uri.UpdateQuery("api-version", _apiVersion); + 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 CreateExecuteRequest(string subscriptionId, string resourceGroupName, string labName, string name, RequestContext context) + { + 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.DevTestLab/labs/", false); + uri.AppendPath(labName, true); + uri.AppendPath("/schedules/", false); + uri.AppendPath(name, true); + uri.AppendPath("/execute", false); + uri.AppendQuery("api-version", _apiVersion, true); + HttpMessage message = Pipeline.CreateMessage(); + Request request = message.Request; + request.Uri = uri; + request.Method = RequestMethod.Post; + return message; + } + + internal HttpMessage CreateGetApplicableRequest(string subscriptionId, string resourceGroupName, string labName, string name, RequestContext context) + { + 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.DevTestLab/labs/", false); + uri.AppendPath(labName, true); + uri.AppendPath("/schedules/", false); + uri.AppendPath(name, true); + uri.AppendPath("/listApplicable", false); + uri.AppendQuery("api-version", _apiVersion, true); + HttpMessage message = Pipeline.CreateMessage(); + Request request = message.Request; + request.Uri = uri; + request.Method = RequestMethod.Post; + request.Headers.SetValue("Accept", "application/json"); + return message; + } + + internal HttpMessage CreateNextGetApplicableRequest(Uri nextPage, string subscriptionId, string resourceGroupName, string labName, string name, RequestContext context) + { + RawRequestUriBuilder uri = new RawRequestUriBuilder(); + uri.Reset(nextPage); + uri.UpdateQuery("api-version", _apiVersion); + HttpMessage message = Pipeline.CreateMessage(); + Request request = message.Request; + request.Uri = uri; + request.Method = RequestMethod.Post; + request.Headers.SetValue("Accept", "application/json"); + return message; + } + } +} diff --git a/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/RestOperations/DevTestLabServiceFabricSchedulesRestOperations.cs b/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/RestOperations/DevTestLabServiceFabricSchedulesRestOperations.cs new file mode 100644 index 000000000000..316f7f683d6e --- /dev/null +++ b/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/RestOperations/DevTestLabServiceFabricSchedulesRestOperations.cs @@ -0,0 +1,229 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using Azure; +using Azure.Core; +using Azure.Core.Pipeline; + +namespace Azure.ResourceManager.DevTestLabs +{ + internal partial class DevTestLabServiceFabricSchedules + { + private readonly Uri _endpoint; + private readonly string _apiVersion; + + /// Initializes a new instance of DevTestLabServiceFabricSchedules for mocking. + protected DevTestLabServiceFabricSchedules() + { + } + + /// Initializes a new instance of DevTestLabServiceFabricSchedules. + /// 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 DevTestLabServiceFabricSchedules(ClientDiagnostics clientDiagnostics, HttpPipeline pipeline, Uri endpoint, string apiVersion) + { + ClientDiagnostics = clientDiagnostics; + _endpoint = endpoint; + Pipeline = pipeline; + _apiVersion = apiVersion; + } + + /// 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(string subscriptionId, string resourceGroupName, string labName, string userName, string serviceFabricName, string name, string expand, RequestContext context) + { + 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.DevTestLab/labs/", false); + uri.AppendPath(labName, true); + uri.AppendPath("/users/", false); + uri.AppendPath(userName, true); + uri.AppendPath("/servicefabrics/", false); + uri.AppendPath(serviceFabricName, true); + uri.AppendPath("/schedules/", false); + uri.AppendPath(name, true); + uri.AppendQuery("api-version", _apiVersion, true); + if (expand != null) + { + uri.AppendQuery("$expand", expand, true); + } + 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 labName, string userName, string serviceFabricName, string name, RequestContent content, RequestContext context) + { + 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.DevTestLab/labs/", false); + uri.AppendPath(labName, true); + uri.AppendPath("/users/", false); + uri.AppendPath(userName, true); + uri.AppendPath("/servicefabrics/", false); + uri.AppendPath(serviceFabricName, true); + uri.AppendPath("/schedules/", false); + uri.AppendPath(name, true); + uri.AppendQuery("api-version", _apiVersion, true); + HttpMessage message = Pipeline.CreateMessage(); + Request request = message.Request; + request.Uri = uri; + request.Method = RequestMethod.Put; + request.Headers.SetValue("Content-Type", "application/json"); + request.Headers.SetValue("Accept", "application/json"); + request.Content = content; + return message; + } + + internal HttpMessage CreateUpdateRequest(string subscriptionId, string resourceGroupName, string labName, string userName, string serviceFabricName, string name, RequestContent content, RequestContext context) + { + 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.DevTestLab/labs/", false); + uri.AppendPath(labName, true); + uri.AppendPath("/users/", false); + uri.AppendPath(userName, true); + uri.AppendPath("/servicefabrics/", false); + uri.AppendPath(serviceFabricName, true); + uri.AppendPath("/schedules/", false); + uri.AppendPath(name, true); + uri.AppendQuery("api-version", _apiVersion, true); + HttpMessage message = Pipeline.CreateMessage(); + Request request = message.Request; + request.Uri = uri; + request.Method = RequestMethod.Patch; + request.Headers.SetValue("Content-Type", "application/json"); + request.Headers.SetValue("Accept", "application/json"); + request.Content = content; + return message; + } + + internal HttpMessage CreateDeleteRequest(string subscriptionId, string resourceGroupName, string labName, string userName, string serviceFabricName, string name, RequestContext context) + { + 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.DevTestLab/labs/", false); + uri.AppendPath(labName, true); + uri.AppendPath("/users/", false); + uri.AppendPath(userName, true); + uri.AppendPath("/servicefabrics/", false); + uri.AppendPath(serviceFabricName, true); + uri.AppendPath("/schedules/", false); + uri.AppendPath(name, true); + uri.AppendQuery("api-version", _apiVersion, true); + HttpMessage message = Pipeline.CreateMessage(); + Request request = message.Request; + request.Uri = uri; + request.Method = RequestMethod.Delete; + return message; + } + + internal HttpMessage CreateGetAllRequest(string subscriptionId, string resourceGroupName, string labName, string userName, string serviceFabricName, string expand, string filter, int? top, string @orderby, RequestContext context) + { + 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.DevTestLab/labs/", false); + uri.AppendPath(labName, true); + uri.AppendPath("/users/", false); + uri.AppendPath(userName, true); + uri.AppendPath("/servicefabrics/", false); + uri.AppendPath(serviceFabricName, true); + uri.AppendPath("/schedules", false); + uri.AppendQuery("api-version", _apiVersion, true); + if (expand != null) + { + uri.AppendQuery("$expand", expand, true); + } + if (filter != null) + { + uri.AppendQuery("$filter", filter, true); + } + if (top != null) + { + uri.AppendQuery("$top", TypeFormatters.ConvertToString(top), true); + } + if (@orderby != null) + { + uri.AppendQuery("$orderby", @orderby, true); + } + 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 CreateNextGetAllRequest(Uri nextPage, string subscriptionId, string resourceGroupName, string labName, string userName, string serviceFabricName, string expand, string filter, int? top, string @orderby, RequestContext context) + { + RawRequestUriBuilder uri = new RawRequestUriBuilder(); + uri.Reset(nextPage); + uri.UpdateQuery("api-version", _apiVersion); + 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 CreateExecuteRequest(string subscriptionId, string resourceGroupName, string labName, string userName, string serviceFabricName, string name, RequestContext context) + { + 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.DevTestLab/labs/", false); + uri.AppendPath(labName, true); + uri.AppendPath("/users/", false); + uri.AppendPath(userName, true); + uri.AppendPath("/servicefabrics/", false); + uri.AppendPath(serviceFabricName, true); + uri.AppendPath("/schedules/", false); + uri.AppendPath(name, true); + uri.AppendPath("/execute", false); + uri.AppendQuery("api-version", _apiVersion, true); + HttpMessage message = Pipeline.CreateMessage(); + Request request = message.Request; + request.Uri = uri; + request.Method = RequestMethod.Post; + return message; + } + } +} diff --git a/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/RestOperations/DevTestLabVmSchedulesRestOperations.cs b/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/RestOperations/DevTestLabVmSchedulesRestOperations.cs new file mode 100644 index 000000000000..5625f39d4b9b --- /dev/null +++ b/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/RestOperations/DevTestLabVmSchedulesRestOperations.cs @@ -0,0 +1,217 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using Azure; +using Azure.Core; +using Azure.Core.Pipeline; + +namespace Azure.ResourceManager.DevTestLabs +{ + internal partial class DevTestLabVmSchedules + { + private readonly Uri _endpoint; + private readonly string _apiVersion; + + /// Initializes a new instance of DevTestLabVmSchedules for mocking. + protected DevTestLabVmSchedules() + { + } + + /// Initializes a new instance of DevTestLabVmSchedules. + /// 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 DevTestLabVmSchedules(ClientDiagnostics clientDiagnostics, HttpPipeline pipeline, Uri endpoint, string apiVersion) + { + ClientDiagnostics = clientDiagnostics; + _endpoint = endpoint; + Pipeline = pipeline; + _apiVersion = apiVersion; + } + + /// 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(string subscriptionId, string resourceGroupName, string labName, string virtualMachineName, string name, string expand, RequestContext context) + { + 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.DevTestLab/labs/", false); + uri.AppendPath(labName, true); + uri.AppendPath("/virtualmachines/", false); + uri.AppendPath(virtualMachineName, true); + uri.AppendPath("/schedules/", false); + uri.AppendPath(name, true); + uri.AppendQuery("api-version", _apiVersion, true); + if (expand != null) + { + uri.AppendQuery("$expand", expand, true); + } + 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 labName, string virtualMachineName, string name, RequestContent content, RequestContext context) + { + 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.DevTestLab/labs/", false); + uri.AppendPath(labName, true); + uri.AppendPath("/virtualmachines/", false); + uri.AppendPath(virtualMachineName, true); + uri.AppendPath("/schedules/", false); + uri.AppendPath(name, true); + uri.AppendQuery("api-version", _apiVersion, true); + HttpMessage message = Pipeline.CreateMessage(); + Request request = message.Request; + request.Uri = uri; + request.Method = RequestMethod.Put; + request.Headers.SetValue("Content-Type", "application/json"); + request.Headers.SetValue("Accept", "application/json"); + request.Content = content; + return message; + } + + internal HttpMessage CreateUpdateRequest(string subscriptionId, string resourceGroupName, string labName, string virtualMachineName, string name, RequestContent content, RequestContext context) + { + 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.DevTestLab/labs/", false); + uri.AppendPath(labName, true); + uri.AppendPath("/virtualmachines/", false); + uri.AppendPath(virtualMachineName, true); + uri.AppendPath("/schedules/", false); + uri.AppendPath(name, true); + uri.AppendQuery("api-version", _apiVersion, true); + HttpMessage message = Pipeline.CreateMessage(); + Request request = message.Request; + request.Uri = uri; + request.Method = RequestMethod.Patch; + request.Headers.SetValue("Content-Type", "application/json"); + request.Headers.SetValue("Accept", "application/json"); + request.Content = content; + return message; + } + + internal HttpMessage CreateDeleteRequest(string subscriptionId, string resourceGroupName, string labName, string virtualMachineName, string name, RequestContext context) + { + 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.DevTestLab/labs/", false); + uri.AppendPath(labName, true); + uri.AppendPath("/virtualmachines/", false); + uri.AppendPath(virtualMachineName, true); + uri.AppendPath("/schedules/", false); + uri.AppendPath(name, true); + uri.AppendQuery("api-version", _apiVersion, true); + HttpMessage message = Pipeline.CreateMessage(); + Request request = message.Request; + request.Uri = uri; + request.Method = RequestMethod.Delete; + return message; + } + + internal HttpMessage CreateGetAllRequest(string subscriptionId, string resourceGroupName, string labName, string virtualMachineName, string expand, string filter, int? top, string @orderby, RequestContext context) + { + 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.DevTestLab/labs/", false); + uri.AppendPath(labName, true); + uri.AppendPath("/virtualmachines/", false); + uri.AppendPath(virtualMachineName, true); + uri.AppendPath("/schedules", false); + uri.AppendQuery("api-version", _apiVersion, true); + if (expand != null) + { + uri.AppendQuery("$expand", expand, true); + } + if (filter != null) + { + uri.AppendQuery("$filter", filter, true); + } + if (top != null) + { + uri.AppendQuery("$top", TypeFormatters.ConvertToString(top), true); + } + if (@orderby != null) + { + uri.AppendQuery("$orderby", @orderby, true); + } + 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 CreateNextGetAllRequest(Uri nextPage, string subscriptionId, string resourceGroupName, string labName, string virtualMachineName, string expand, string filter, int? top, string @orderby, RequestContext context) + { + RawRequestUriBuilder uri = new RawRequestUriBuilder(); + uri.Reset(nextPage); + uri.UpdateQuery("api-version", _apiVersion); + 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 CreateExecuteRequest(string subscriptionId, string resourceGroupName, string labName, string virtualMachineName, string name, RequestContext context) + { + 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.DevTestLab/labs/", false); + uri.AppendPath(labName, true); + uri.AppendPath("/virtualmachines/", false); + uri.AppendPath(virtualMachineName, true); + uri.AppendPath("/schedules/", false); + uri.AppendPath(name, true); + uri.AppendPath("/execute", false); + uri.AppendQuery("api-version", _apiVersion, true); + HttpMessage message = Pipeline.CreateMessage(); + Request request = message.Request; + request.Uri = uri; + request.Method = RequestMethod.Post; + return message; + } + } +} diff --git a/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/RestOperations/DisksRestOperations.cs b/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/RestOperations/DisksRestOperations.cs index d9fb7f706a82..f0d6e7cc5f22 100644 --- a/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/RestOperations/DisksRestOperations.cs +++ b/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/RestOperations/DisksRestOperations.cs @@ -6,181 +6,44 @@ #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.DevTestLabs.Models; namespace Azure.ResourceManager.DevTestLabs { - internal partial class DisksRestOperations + internal partial class Disks { - private readonly TelemetryDetails _userAgent; - private readonly HttpPipeline _pipeline; private readonly Uri _endpoint; private readonly string _apiVersion; - /// Initializes a new instance of DisksRestOperations. - /// The HTTP pipeline for sending and receiving REST requests and responses. - /// The application id to use for user agent. - /// server parameter. - /// Api Version. - /// or is null. - public DisksRestOperations(HttpPipeline pipeline, string applicationId, Uri endpoint = null, string apiVersion = default) - { - _pipeline = pipeline ?? throw new ArgumentNullException(nameof(pipeline)); - _endpoint = endpoint ?? new Uri("https://management.azure.com"); - _apiVersion = apiVersion ?? "2018-09-15"; - _userAgent = new TelemetryDetails(GetType().Assembly, applicationId); - } - - internal RequestUriBuilder CreateListRequestUri(string subscriptionId, string resourceGroupName, string labName, string userName, string expand, string filter, int? top, string orderby) - { - 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.DevTestLab/labs/", false); - uri.AppendPath(labName, true); - uri.AppendPath("/users/", false); - uri.AppendPath(userName, true); - uri.AppendPath("/disks", false); - if (expand != null) - { - uri.AppendQuery("$expand", expand, true); - } - if (filter != null) - { - uri.AppendQuery("$filter", filter, true); - } - if (top != null) - { - uri.AppendQuery("$top", top.Value, true); - } - if (orderby != null) - { - uri.AppendQuery("$orderby", orderby, true); - } - uri.AppendQuery("api-version", _apiVersion, true); - return uri; - } - - internal HttpMessage CreateListRequest(string subscriptionId, string resourceGroupName, string labName, string userName, string expand, string filter, int? top, string orderby) + /// Initializes a new instance of Disks for mocking. + protected Disks() { - 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.DevTestLab/labs/", false); - uri.AppendPath(labName, true); - uri.AppendPath("/users/", false); - uri.AppendPath(userName, true); - uri.AppendPath("/disks", false); - if (expand != null) - { - uri.AppendQuery("$expand", expand, true); - } - if (filter != null) - { - uri.AppendQuery("$filter", filter, true); - } - if (top != null) - { - uri.AppendQuery("$top", top.Value, true); - } - if (orderby != null) - { - uri.AppendQuery("$orderby", orderby, true); - } - uri.AppendQuery("api-version", _apiVersion, true); - request.Uri = uri; - request.Headers.Add("Accept", "application/json"); - _userAgent.Apply(message); - return message; } - /// List disks in a given user profile. - /// The subscription ID. - /// The name of the resource group. - /// The name of the lab. - /// The name of the user profile. - /// Specify the $expand query. Example: 'properties($select=diskType)'. - /// The filter to apply to the operation. Example: '$filter=contains(name,'myName'). - /// The maximum number of resources to return from the operation. Example: '$top=10'. - /// The ordering expression for the results, using OData notation. Example: '$orderby=name desc'. - /// The cancellation token to use. - /// , , or is null. - /// , , or is an empty string, and was expected to be non-empty. - public async Task> ListAsync(string subscriptionId, string resourceGroupName, string labName, string userName, string expand = null, string filter = null, int? top = null, string orderby = null, CancellationToken cancellationToken = default) + /// Initializes a new instance of Disks. + /// 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 Disks(ClientDiagnostics clientDiagnostics, HttpPipeline pipeline, Uri endpoint, string apiVersion) { - Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); - Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); - Argument.AssertNotNullOrEmpty(labName, nameof(labName)); - Argument.AssertNotNullOrEmpty(userName, nameof(userName)); - - using var message = CreateListRequest(subscriptionId, resourceGroupName, labName, userName, expand, filter, top, orderby); - await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); - switch (message.Response.Status) - { - case 200: - { - DiskList value = default; - using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, ModelSerializationExtensions.JsonDocumentOptions, cancellationToken).ConfigureAwait(false); - value = DiskList.DeserializeDiskList(document.RootElement); - return Response.FromValue(value, message.Response); - } - default: - throw new RequestFailedException(message.Response); - } + ClientDiagnostics = clientDiagnostics; + _endpoint = endpoint; + Pipeline = pipeline; + _apiVersion = apiVersion; } - /// List disks in a given user profile. - /// The subscription ID. - /// The name of the resource group. - /// The name of the lab. - /// The name of the user profile. - /// Specify the $expand query. Example: 'properties($select=diskType)'. - /// The filter to apply to the operation. Example: '$filter=contains(name,'myName'). - /// The maximum number of resources to return from the operation. Example: '$top=10'. - /// The ordering expression for the results, using OData notation. Example: '$orderby=name desc'. - /// The cancellation token to use. - /// , , or is null. - /// , , or is an empty string, and was expected to be non-empty. - public Response List(string subscriptionId, string resourceGroupName, string labName, string userName, string expand = null, string filter = null, int? top = null, string orderby = null, CancellationToken cancellationToken = default) - { - Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); - Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); - Argument.AssertNotNullOrEmpty(labName, nameof(labName)); - Argument.AssertNotNullOrEmpty(userName, nameof(userName)); + /// The HTTP pipeline for sending and receiving REST requests and responses. + public virtual HttpPipeline Pipeline { get; } - using var message = CreateListRequest(subscriptionId, resourceGroupName, labName, userName, expand, filter, top, orderby); - _pipeline.Send(message, cancellationToken); - switch (message.Response.Status) - { - case 200: - { - DiskList value = default; - using var document = JsonDocument.Parse(message.Response.ContentStream, ModelSerializationExtensions.JsonDocumentOptions); - value = DiskList.DeserializeDiskList(document.RootElement); - return Response.FromValue(value, 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 CreateGetRequestUri(string subscriptionId, string resourceGroupName, string labName, string userName, string name, string expand) + internal HttpMessage CreateGetRequest(string subscriptionId, string resourceGroupName, string labName, string userName, string name, string expand, RequestContext context) { - var uri = new RawRequestUriBuilder(); + RawRequestUriBuilder uri = new RawRequestUriBuilder(); uri.Reset(_endpoint); uri.AppendPath("/subscriptions/", false); uri.AppendPath(subscriptionId, true); @@ -192,117 +55,22 @@ internal RequestUriBuilder CreateGetRequestUri(string subscriptionId, string res uri.AppendPath(userName, true); uri.AppendPath("/disks/", false); uri.AppendPath(name, true); - if (expand != null) - { - uri.AppendQuery("$expand", expand, true); - } uri.AppendQuery("api-version", _apiVersion, true); - return uri; - } - - internal HttpMessage CreateGetRequest(string subscriptionId, string resourceGroupName, string labName, string userName, string name, string expand) - { - 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.DevTestLab/labs/", false); - uri.AppendPath(labName, true); - uri.AppendPath("/users/", false); - uri.AppendPath(userName, true); - uri.AppendPath("/disks/", false); - uri.AppendPath(name, true); if (expand != null) { uri.AppendQuery("$expand", expand, 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 disk. - /// The subscription ID. - /// The name of the resource group. - /// The name of the lab. - /// The name of the user profile. - /// The name of the disk. - /// Specify the $expand query. Example: 'properties($select=diskType)'. - /// 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 labName, string userName, string name, string expand = null, CancellationToken cancellationToken = default) + internal HttpMessage CreateCreateOrUpdateRequest(string subscriptionId, string resourceGroupName, string labName, string userName, string name, RequestContent content, RequestContext context) { - Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); - Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); - Argument.AssertNotNullOrEmpty(labName, nameof(labName)); - Argument.AssertNotNullOrEmpty(userName, nameof(userName)); - Argument.AssertNotNullOrEmpty(name, nameof(name)); - - using var message = CreateGetRequest(subscriptionId, resourceGroupName, labName, userName, name, expand); - await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); - switch (message.Response.Status) - { - case 200: - { - DevTestLabDiskData value = default; - using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, ModelSerializationExtensions.JsonDocumentOptions, cancellationToken).ConfigureAwait(false); - value = DevTestLabDiskData.DeserializeDevTestLabDiskData(document.RootElement); - return Response.FromValue(value, message.Response); - } - case 404: - return Response.FromValue((DevTestLabDiskData)null, message.Response); - default: - throw new RequestFailedException(message.Response); - } - } - - /// Get disk. - /// The subscription ID. - /// The name of the resource group. - /// The name of the lab. - /// The name of the user profile. - /// The name of the disk. - /// Specify the $expand query. Example: 'properties($select=diskType)'. - /// 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 labName, string userName, string name, string expand = null, CancellationToken cancellationToken = default) - { - Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); - Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); - Argument.AssertNotNullOrEmpty(labName, nameof(labName)); - Argument.AssertNotNullOrEmpty(userName, nameof(userName)); - Argument.AssertNotNullOrEmpty(name, nameof(name)); - - using var message = CreateGetRequest(subscriptionId, resourceGroupName, labName, userName, name, expand); - _pipeline.Send(message, cancellationToken); - switch (message.Response.Status) - { - case 200: - { - DevTestLabDiskData value = default; - using var document = JsonDocument.Parse(message.Response.ContentStream, ModelSerializationExtensions.JsonDocumentOptions); - value = DevTestLabDiskData.DeserializeDevTestLabDiskData(document.RootElement); - return Response.FromValue(value, message.Response); - } - case 404: - return Response.FromValue((DevTestLabDiskData)null, message.Response); - default: - throw new RequestFailedException(message.Response); - } - } - - internal RequestUriBuilder CreateCreateOrUpdateRequestUri(string subscriptionId, string resourceGroupName, string labName, string userName, string name, DevTestLabDiskData data) - { - var uri = new RawRequestUriBuilder(); + RawRequestUriBuilder uri = new RawRequestUriBuilder(); uri.Reset(_endpoint); uri.AppendPath("/subscriptions/", false); uri.AppendPath(subscriptionId, true); @@ -315,15 +83,19 @@ internal RequestUriBuilder CreateCreateOrUpdateRequestUri(string subscriptionId, uri.AppendPath("/disks/", false); uri.AppendPath(name, true); uri.AppendQuery("api-version", _apiVersion, true); - return uri; + HttpMessage message = Pipeline.CreateMessage(); + Request request = message.Request; + request.Uri = uri; + request.Method = RequestMethod.Put; + request.Headers.SetValue("Content-Type", "application/json"); + request.Headers.SetValue("Accept", "application/json"); + request.Content = content; + return message; } - internal HttpMessage CreateCreateOrUpdateRequest(string subscriptionId, string resourceGroupName, string labName, string userName, string name, DevTestLabDiskData data) + internal HttpMessage CreateUpdateRequest(string subscriptionId, string resourceGroupName, string labName, string userName, string name, 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); @@ -336,81 +108,19 @@ internal HttpMessage CreateCreateOrUpdateRequest(string subscriptionId, string r uri.AppendPath("/disks/", false); uri.AppendPath(name, 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.Patch; + request.Headers.SetValue("Content-Type", "application/json"); + request.Headers.SetValue("Accept", "application/json"); request.Content = content; - _userAgent.Apply(message); return message; } - /// Create or replace an existing disk. This operation can take a while to complete. - /// The subscription ID. - /// The name of the resource group. - /// The name of the lab. - /// The name of the user profile. - /// The name of the disk. - /// A Disk. - /// 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 labName, string userName, string name, DevTestLabDiskData data, CancellationToken cancellationToken = default) - { - Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); - Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); - Argument.AssertNotNullOrEmpty(labName, nameof(labName)); - Argument.AssertNotNullOrEmpty(userName, nameof(userName)); - Argument.AssertNotNullOrEmpty(name, nameof(name)); - Argument.AssertNotNull(data, nameof(data)); - - using var message = CreateCreateOrUpdateRequest(subscriptionId, resourceGroupName, labName, userName, name, data); - await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); - switch (message.Response.Status) - { - case 200: - case 201: - return message.Response; - default: - throw new RequestFailedException(message.Response); - } - } - - /// Create or replace an existing disk. This operation can take a while to complete. - /// The subscription ID. - /// The name of the resource group. - /// The name of the lab. - /// The name of the user profile. - /// The name of the disk. - /// A Disk. - /// 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 labName, string userName, string name, DevTestLabDiskData data, CancellationToken cancellationToken = default) + internal HttpMessage CreateDeleteRequest(string subscriptionId, string resourceGroupName, string labName, string userName, string name, RequestContext context) { - Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); - Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); - Argument.AssertNotNullOrEmpty(labName, nameof(labName)); - Argument.AssertNotNullOrEmpty(userName, nameof(userName)); - Argument.AssertNotNullOrEmpty(name, nameof(name)); - Argument.AssertNotNull(data, nameof(data)); - - using var message = CreateCreateOrUpdateRequest(subscriptionId, resourceGroupName, labName, userName, name, 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 labName, string userName, string name) - { - var uri = new RawRequestUriBuilder(); + RawRequestUriBuilder uri = new RawRequestUriBuilder(); uri.Reset(_endpoint); uri.AppendPath("/subscriptions/", false); uri.AppendPath(subscriptionId, true); @@ -423,15 +133,16 @@ internal RequestUriBuilder CreateDeleteRequestUri(string subscriptionId, string uri.AppendPath("/disks/", false); uri.AppendPath(name, true); uri.AppendQuery("api-version", _apiVersion, true); - return uri; + HttpMessage message = Pipeline.CreateMessage(); + Request request = message.Request; + request.Uri = uri; + request.Method = RequestMethod.Delete; + return message; } - internal HttpMessage CreateDeleteRequest(string subscriptionId, string resourceGroupName, string labName, string userName, string name) + internal HttpMessage CreateGetAllRequest(string subscriptionId, string resourceGroupName, string labName, string userName, string expand, string filter, int? top, string @orderby, RequestContext context) { - var message = _pipeline.CreateMessage(); - var request = message.Request; - request.Method = RequestMethod.Delete; - var uri = new RawRequestUriBuilder(); + RawRequestUriBuilder uri = new RawRequestUriBuilder(); uri.Reset(_endpoint); uri.AppendPath("/subscriptions/", false); uri.AppendPath(subscriptionId, true); @@ -441,216 +152,48 @@ internal HttpMessage CreateDeleteRequest(string subscriptionId, string resourceG uri.AppendPath(labName, true); uri.AppendPath("/users/", false); uri.AppendPath(userName, true); - uri.AppendPath("/disks/", false); - uri.AppendPath(name, true); + uri.AppendPath("/disks", false); uri.AppendQuery("api-version", _apiVersion, true); - request.Uri = uri; - request.Headers.Add("Accept", "application/json"); - _userAgent.Apply(message); - return message; - } - - /// Delete disk. This operation can take a while to complete. - /// The subscription ID. - /// The name of the resource group. - /// The name of the lab. - /// The name of the user profile. - /// The name of the disk. - /// 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 labName, string userName, string name, CancellationToken cancellationToken = default) - { - Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); - Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); - Argument.AssertNotNullOrEmpty(labName, nameof(labName)); - Argument.AssertNotNullOrEmpty(userName, nameof(userName)); - Argument.AssertNotNullOrEmpty(name, nameof(name)); - - using var message = CreateDeleteRequest(subscriptionId, resourceGroupName, labName, userName, name); - await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); - switch (message.Response.Status) + if (expand != null) { - case 200: - case 202: - case 204: - return message.Response; - default: - throw new RequestFailedException(message.Response); + uri.AppendQuery("$expand", expand, true); } - } - - /// Delete disk. This operation can take a while to complete. - /// The subscription ID. - /// The name of the resource group. - /// The name of the lab. - /// The name of the user profile. - /// The name of the disk. - /// 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 labName, string userName, string name, CancellationToken cancellationToken = default) - { - Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); - Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); - Argument.AssertNotNullOrEmpty(labName, nameof(labName)); - Argument.AssertNotNullOrEmpty(userName, nameof(userName)); - Argument.AssertNotNullOrEmpty(name, nameof(name)); - - using var message = CreateDeleteRequest(subscriptionId, resourceGroupName, labName, userName, name); - _pipeline.Send(message, cancellationToken); - switch (message.Response.Status) + if (filter != null) { - case 200: - case 202: - case 204: - return message.Response; - default: - throw new RequestFailedException(message.Response); + uri.AppendQuery("$filter", filter, true); } - } - - internal RequestUriBuilder CreateUpdateRequestUri(string subscriptionId, string resourceGroupName, string labName, string userName, string name, DevTestLabDiskPatch 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.DevTestLab/labs/", false); - uri.AppendPath(labName, true); - uri.AppendPath("/users/", false); - uri.AppendPath(userName, true); - uri.AppendPath("/disks/", false); - uri.AppendPath(name, true); - uri.AppendQuery("api-version", _apiVersion, true); - return uri; - } - - internal HttpMessage CreateUpdateRequest(string subscriptionId, string resourceGroupName, string labName, string userName, string name, DevTestLabDiskPatch patch) - { - var message = _pipeline.CreateMessage(); - var request = message.Request; - request.Method = RequestMethod.Patch; - var uri = new RawRequestUriBuilder(); - uri.Reset(_endpoint); - uri.AppendPath("/subscriptions/", false); - uri.AppendPath(subscriptionId, true); - uri.AppendPath("/resourceGroups/", false); - uri.AppendPath(resourceGroupName, true); - uri.AppendPath("/providers/Microsoft.DevTestLab/labs/", false); - uri.AppendPath(labName, true); - uri.AppendPath("/users/", false); - uri.AppendPath(userName, true); - uri.AppendPath("/disks/", false); - uri.AppendPath(name, true); - uri.AppendQuery("api-version", _apiVersion, true); - request.Uri = uri; - request.Headers.Add("Accept", "application/json"); - request.Headers.Add("Content-Type", "application/json"); - var content = new Utf8JsonRequestContent(); - content.JsonWriter.WriteObjectValue(patch, ModelSerializationExtensions.WireOptions); - request.Content = content; - _userAgent.Apply(message); - return message; - } - - /// Allows modifying tags of disks. All other properties will be ignored. - /// The subscription ID. - /// The name of the resource group. - /// The name of the lab. - /// The name of the user profile. - /// The name of the disk. - /// A Disk. - /// 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 labName, string userName, string name, DevTestLabDiskPatch patch, CancellationToken cancellationToken = default) - { - Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); - Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); - Argument.AssertNotNullOrEmpty(labName, nameof(labName)); - Argument.AssertNotNullOrEmpty(userName, nameof(userName)); - Argument.AssertNotNullOrEmpty(name, nameof(name)); - Argument.AssertNotNull(patch, nameof(patch)); - - using var message = CreateUpdateRequest(subscriptionId, resourceGroupName, labName, userName, name, patch); - await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); - switch (message.Response.Status) + if (top != null) { - case 200: - { - DevTestLabDiskData value = default; - using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, ModelSerializationExtensions.JsonDocumentOptions, cancellationToken).ConfigureAwait(false); - value = DevTestLabDiskData.DeserializeDevTestLabDiskData(document.RootElement); - return Response.FromValue(value, message.Response); - } - default: - throw new RequestFailedException(message.Response); + uri.AppendQuery("$top", TypeFormatters.ConvertToString(top), true); } - } - - /// Allows modifying tags of disks. All other properties will be ignored. - /// The subscription ID. - /// The name of the resource group. - /// The name of the lab. - /// The name of the user profile. - /// The name of the disk. - /// A Disk. - /// 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 labName, string userName, string name, DevTestLabDiskPatch patch, CancellationToken cancellationToken = default) - { - Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); - Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); - Argument.AssertNotNullOrEmpty(labName, nameof(labName)); - Argument.AssertNotNullOrEmpty(userName, nameof(userName)); - Argument.AssertNotNullOrEmpty(name, nameof(name)); - Argument.AssertNotNull(patch, nameof(patch)); - - using var message = CreateUpdateRequest(subscriptionId, resourceGroupName, labName, userName, name, patch); - _pipeline.Send(message, cancellationToken); - switch (message.Response.Status) + if (@orderby != null) { - case 200: - { - DevTestLabDiskData value = default; - using var document = JsonDocument.Parse(message.Response.ContentStream, ModelSerializationExtensions.JsonDocumentOptions); - value = DevTestLabDiskData.DeserializeDevTestLabDiskData(document.RootElement); - return Response.FromValue(value, message.Response); - } - default: - throw new RequestFailedException(message.Response); + uri.AppendQuery("$orderby", @orderby, true); } + HttpMessage message = Pipeline.CreateMessage(); + Request request = message.Request; + request.Uri = uri; + request.Method = RequestMethod.Get; + request.Headers.SetValue("Accept", "application/json"); + return message; } - internal RequestUriBuilder CreateAttachRequestUri(string subscriptionId, string resourceGroupName, string labName, string userName, string name, DevTestLabDiskAttachContent content) + internal HttpMessage CreateNextGetAllRequest(Uri nextPage, string subscriptionId, string resourceGroupName, string labName, string userName, string expand, string filter, int? top, string @orderby, RequestContext context) { - 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.DevTestLab/labs/", false); - uri.AppendPath(labName, true); - uri.AppendPath("/users/", false); - uri.AppendPath(userName, true); - uri.AppendPath("/disks/", false); - uri.AppendPath(name, true); - uri.AppendPath("/attach", false); - uri.AppendQuery("api-version", _apiVersion, true); - return uri; + RawRequestUriBuilder uri = new RawRequestUriBuilder(); + uri.Reset(nextPage); + uri.UpdateQuery("api-version", _apiVersion); + 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 CreateAttachRequest(string subscriptionId, string resourceGroupName, string labName, string userName, string name, DevTestLabDiskAttachContent content) + internal HttpMessage CreateAttachRequest(string subscriptionId, string resourceGroupName, string labName, string userName, string name, RequestContent content, RequestContext context) { - var message = _pipeline.CreateMessage(); - var request = message.Request; - request.Method = RequestMethod.Post; - var uri = new RawRequestUriBuilder(); + RawRequestUriBuilder uri = new RawRequestUriBuilder(); uri.Reset(_endpoint); uri.AppendPath("/subscriptions/", false); uri.AppendPath(subscriptionId, true); @@ -664,103 +207,18 @@ internal HttpMessage CreateAttachRequest(string subscriptionId, string resourceG uri.AppendPath(name, true); uri.AppendPath("/attach", false); 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 content0 = new Utf8JsonRequestContent(); - content0.JsonWriter.WriteObjectValue(content, ModelSerializationExtensions.WireOptions); - request.Content = content0; - _userAgent.Apply(message); + request.Method = RequestMethod.Post; + request.Headers.SetValue("Content-Type", "application/json"); + request.Content = content; return message; } - /// Attach and create the lease of the disk to the virtual machine. This operation can take a while to complete. - /// The subscription ID. - /// The name of the resource group. - /// The name of the lab. - /// The name of the user profile. - /// The name of the disk. - /// Properties of the disk to attach. - /// The cancellation token to use. - /// , , , , or is null. - /// , , , or is an empty string, and was expected to be non-empty. - public async Task AttachAsync(string subscriptionId, string resourceGroupName, string labName, string userName, string name, DevTestLabDiskAttachContent content, CancellationToken cancellationToken = default) - { - Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); - Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); - Argument.AssertNotNullOrEmpty(labName, nameof(labName)); - Argument.AssertNotNullOrEmpty(userName, nameof(userName)); - Argument.AssertNotNullOrEmpty(name, nameof(name)); - Argument.AssertNotNull(content, nameof(content)); - - using var message = CreateAttachRequest(subscriptionId, resourceGroupName, labName, userName, name, content); - await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); - switch (message.Response.Status) - { - case 200: - case 202: - return message.Response; - default: - throw new RequestFailedException(message.Response); - } - } - - /// Attach and create the lease of the disk to the virtual machine. This operation can take a while to complete. - /// The subscription ID. - /// The name of the resource group. - /// The name of the lab. - /// The name of the user profile. - /// The name of the disk. - /// Properties of the disk to attach. - /// The cancellation token to use. - /// , , , , or is null. - /// , , , or is an empty string, and was expected to be non-empty. - public Response Attach(string subscriptionId, string resourceGroupName, string labName, string userName, string name, DevTestLabDiskAttachContent content, CancellationToken cancellationToken = default) - { - Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); - Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); - Argument.AssertNotNullOrEmpty(labName, nameof(labName)); - Argument.AssertNotNullOrEmpty(userName, nameof(userName)); - Argument.AssertNotNullOrEmpty(name, nameof(name)); - Argument.AssertNotNull(content, nameof(content)); - - using var message = CreateAttachRequest(subscriptionId, resourceGroupName, labName, userName, name, content); - _pipeline.Send(message, cancellationToken); - switch (message.Response.Status) - { - case 200: - case 202: - return message.Response; - default: - throw new RequestFailedException(message.Response); - } - } - - internal RequestUriBuilder CreateDetachRequestUri(string subscriptionId, string resourceGroupName, string labName, string userName, string name, DevTestLabDiskDetachContent content) - { - 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.DevTestLab/labs/", false); - uri.AppendPath(labName, true); - uri.AppendPath("/users/", false); - uri.AppendPath(userName, true); - uri.AppendPath("/disks/", false); - uri.AppendPath(name, true); - uri.AppendPath("/detach", false); - uri.AppendQuery("api-version", _apiVersion, true); - return uri; - } - - internal HttpMessage CreateDetachRequest(string subscriptionId, string resourceGroupName, string labName, string userName, string name, DevTestLabDiskDetachContent content) + internal HttpMessage CreateDetachRequest(string subscriptionId, string resourceGroupName, string labName, string userName, string name, RequestContent content, RequestContext context) { - var message = _pipeline.CreateMessage(); - var request = message.Request; - request.Method = RequestMethod.Post; - var uri = new RawRequestUriBuilder(); + RawRequestUriBuilder uri = new RawRequestUriBuilder(); uri.Reset(_endpoint); uri.AppendPath("/subscriptions/", false); uri.AppendPath(subscriptionId, true); @@ -774,172 +232,13 @@ internal HttpMessage CreateDetachRequest(string subscriptionId, string resourceG uri.AppendPath(name, true); uri.AppendPath("/detach", false); 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 content0 = new Utf8JsonRequestContent(); - content0.JsonWriter.WriteObjectValue(content, ModelSerializationExtensions.WireOptions); - request.Content = content0; - _userAgent.Apply(message); - return message; - } - - /// Detach and break the lease of the disk attached to the virtual machine. This operation can take a while to complete. - /// The subscription ID. - /// The name of the resource group. - /// The name of the lab. - /// The name of the user profile. - /// The name of the disk. - /// Properties of the disk to detach. - /// The cancellation token to use. - /// , , , , or is null. - /// , , , or is an empty string, and was expected to be non-empty. - public async Task DetachAsync(string subscriptionId, string resourceGroupName, string labName, string userName, string name, DevTestLabDiskDetachContent content, CancellationToken cancellationToken = default) - { - Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); - Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); - Argument.AssertNotNullOrEmpty(labName, nameof(labName)); - Argument.AssertNotNullOrEmpty(userName, nameof(userName)); - Argument.AssertNotNullOrEmpty(name, nameof(name)); - Argument.AssertNotNull(content, nameof(content)); - - using var message = CreateDetachRequest(subscriptionId, resourceGroupName, labName, userName, name, content); - await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); - switch (message.Response.Status) - { - case 200: - case 202: - return message.Response; - default: - throw new RequestFailedException(message.Response); - } - } - - /// Detach and break the lease of the disk attached to the virtual machine. This operation can take a while to complete. - /// The subscription ID. - /// The name of the resource group. - /// The name of the lab. - /// The name of the user profile. - /// The name of the disk. - /// Properties of the disk to detach. - /// The cancellation token to use. - /// , , , , or is null. - /// , , , or is an empty string, and was expected to be non-empty. - public Response Detach(string subscriptionId, string resourceGroupName, string labName, string userName, string name, DevTestLabDiskDetachContent content, CancellationToken cancellationToken = default) - { - Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); - Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); - Argument.AssertNotNullOrEmpty(labName, nameof(labName)); - Argument.AssertNotNullOrEmpty(userName, nameof(userName)); - Argument.AssertNotNullOrEmpty(name, nameof(name)); - Argument.AssertNotNull(content, nameof(content)); - - using var message = CreateDetachRequest(subscriptionId, resourceGroupName, labName, userName, name, content); - _pipeline.Send(message, cancellationToken); - switch (message.Response.Status) - { - case 200: - case 202: - return message.Response; - default: - throw new RequestFailedException(message.Response); - } - } - - internal RequestUriBuilder CreateListNextPageRequestUri(string nextLink, string subscriptionId, string resourceGroupName, string labName, string userName, string expand, string filter, int? top, string orderby) - { - var uri = new RawRequestUriBuilder(); - uri.Reset(_endpoint); - uri.AppendRawNextLink(nextLink, false); - return uri; - } - - internal HttpMessage CreateListNextPageRequest(string nextLink, string subscriptionId, string resourceGroupName, string labName, string userName, string expand, string filter, int? top, string orderby) - { - 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.Method = RequestMethod.Post; + request.Headers.SetValue("Content-Type", "application/json"); + request.Content = content; return message; } - - /// List disks in a given user profile. - /// The URL to the next page of results. - /// The subscription ID. - /// The name of the resource group. - /// The name of the lab. - /// The name of the user profile. - /// Specify the $expand query. Example: 'properties($select=diskType)'. - /// The filter to apply to the operation. Example: '$filter=contains(name,'myName'). - /// The maximum number of resources to return from the operation. Example: '$top=10'. - /// The ordering expression for the results, using OData notation. Example: '$orderby=name desc'. - /// The cancellation token to use. - /// , , , or is null. - /// , , or is an empty string, and was expected to be non-empty. - public async Task> ListNextPageAsync(string nextLink, string subscriptionId, string resourceGroupName, string labName, string userName, string expand = null, string filter = null, int? top = null, string orderby = null, CancellationToken cancellationToken = default) - { - Argument.AssertNotNull(nextLink, nameof(nextLink)); - Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); - Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); - Argument.AssertNotNullOrEmpty(labName, nameof(labName)); - Argument.AssertNotNullOrEmpty(userName, nameof(userName)); - - using var message = CreateListNextPageRequest(nextLink, subscriptionId, resourceGroupName, labName, userName, expand, filter, top, orderby); - await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); - switch (message.Response.Status) - { - case 200: - { - DiskList value = default; - using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, ModelSerializationExtensions.JsonDocumentOptions, cancellationToken).ConfigureAwait(false); - value = DiskList.DeserializeDiskList(document.RootElement); - return Response.FromValue(value, message.Response); - } - default: - throw new RequestFailedException(message.Response); - } - } - - /// List disks in a given user profile. - /// The URL to the next page of results. - /// The subscription ID. - /// The name of the resource group. - /// The name of the lab. - /// The name of the user profile. - /// Specify the $expand query. Example: 'properties($select=diskType)'. - /// The filter to apply to the operation. Example: '$filter=contains(name,'myName'). - /// The maximum number of resources to return from the operation. Example: '$top=10'. - /// The ordering expression for the results, using OData notation. Example: '$orderby=name desc'. - /// The cancellation token to use. - /// , , , or is null. - /// , , or is an empty string, and was expected to be non-empty. - public Response ListNextPage(string nextLink, string subscriptionId, string resourceGroupName, string labName, string userName, string expand = null, string filter = null, int? top = null, string orderby = null, CancellationToken cancellationToken = default) - { - Argument.AssertNotNull(nextLink, nameof(nextLink)); - Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); - Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); - Argument.AssertNotNullOrEmpty(labName, nameof(labName)); - Argument.AssertNotNullOrEmpty(userName, nameof(userName)); - - using var message = CreateListNextPageRequest(nextLink, subscriptionId, resourceGroupName, labName, userName, expand, filter, top, orderby); - _pipeline.Send(message, cancellationToken); - switch (message.Response.Status) - { - case 200: - { - DiskList value = default; - using var document = JsonDocument.Parse(message.Response.ContentStream, ModelSerializationExtensions.JsonDocumentOptions); - value = DiskList.DeserializeDiskList(document.RootElement); - return Response.FromValue(value, message.Response); - } - default: - throw new RequestFailedException(message.Response); - } - } } } diff --git a/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/RestOperations/EnvironmentsRestOperations.cs b/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/RestOperations/EnvironmentsRestOperations.cs index 82df47a7b103..1d476f4acb6e 100644 --- a/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/RestOperations/EnvironmentsRestOperations.cs +++ b/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/RestOperations/EnvironmentsRestOperations.cs @@ -6,181 +6,44 @@ #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.DevTestLabs.Models; namespace Azure.ResourceManager.DevTestLabs { - internal partial class EnvironmentsRestOperations + internal partial class Environments { - private readonly TelemetryDetails _userAgent; - private readonly HttpPipeline _pipeline; private readonly Uri _endpoint; private readonly string _apiVersion; - /// Initializes a new instance of EnvironmentsRestOperations. - /// The HTTP pipeline for sending and receiving REST requests and responses. - /// The application id to use for user agent. - /// server parameter. - /// Api Version. - /// or is null. - public EnvironmentsRestOperations(HttpPipeline pipeline, string applicationId, Uri endpoint = null, string apiVersion = default) - { - _pipeline = pipeline ?? throw new ArgumentNullException(nameof(pipeline)); - _endpoint = endpoint ?? new Uri("https://management.azure.com"); - _apiVersion = apiVersion ?? "2018-09-15"; - _userAgent = new TelemetryDetails(GetType().Assembly, applicationId); - } - - internal RequestUriBuilder CreateListRequestUri(string subscriptionId, string resourceGroupName, string labName, string userName, string expand, string filter, int? top, string orderby) + /// Initializes a new instance of Environments for mocking. + protected Environments() { - 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.DevTestLab/labs/", false); - uri.AppendPath(labName, true); - uri.AppendPath("/users/", false); - uri.AppendPath(userName, true); - uri.AppendPath("/environments", false); - if (expand != null) - { - uri.AppendQuery("$expand", expand, true); - } - if (filter != null) - { - uri.AppendQuery("$filter", filter, true); - } - if (top != null) - { - uri.AppendQuery("$top", top.Value, true); - } - if (orderby != null) - { - uri.AppendQuery("$orderby", orderby, true); - } - uri.AppendQuery("api-version", _apiVersion, true); - return uri; - } - - internal HttpMessage CreateListRequest(string subscriptionId, string resourceGroupName, string labName, string userName, string expand, string filter, int? top, string orderby) - { - 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.DevTestLab/labs/", false); - uri.AppendPath(labName, true); - uri.AppendPath("/users/", false); - uri.AppendPath(userName, true); - uri.AppendPath("/environments", false); - if (expand != null) - { - uri.AppendQuery("$expand", expand, true); - } - if (filter != null) - { - uri.AppendQuery("$filter", filter, true); - } - if (top != null) - { - uri.AppendQuery("$top", top.Value, true); - } - if (orderby != null) - { - uri.AppendQuery("$orderby", orderby, true); - } - uri.AppendQuery("api-version", _apiVersion, true); - request.Uri = uri; - request.Headers.Add("Accept", "application/json"); - _userAgent.Apply(message); - return message; } - /// List environments in a given user profile. - /// The subscription ID. - /// The name of the resource group. - /// The name of the lab. - /// The name of the user profile. - /// Specify the $expand query. Example: 'properties($select=deploymentProperties)'. - /// The filter to apply to the operation. Example: '$filter=contains(name,'myName'). - /// The maximum number of resources to return from the operation. Example: '$top=10'. - /// The ordering expression for the results, using OData notation. Example: '$orderby=name desc'. - /// The cancellation token to use. - /// , , or is null. - /// , , or is an empty string, and was expected to be non-empty. - public async Task> ListAsync(string subscriptionId, string resourceGroupName, string labName, string userName, string expand = null, string filter = null, int? top = null, string orderby = null, CancellationToken cancellationToken = default) + /// Initializes a new instance of Environments. + /// 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 Environments(ClientDiagnostics clientDiagnostics, HttpPipeline pipeline, Uri endpoint, string apiVersion) { - Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); - Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); - Argument.AssertNotNullOrEmpty(labName, nameof(labName)); - Argument.AssertNotNullOrEmpty(userName, nameof(userName)); - - using var message = CreateListRequest(subscriptionId, resourceGroupName, labName, userName, expand, filter, top, orderby); - await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); - switch (message.Response.Status) - { - case 200: - { - DtlEnvironmentList value = default; - using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, ModelSerializationExtensions.JsonDocumentOptions, cancellationToken).ConfigureAwait(false); - value = DtlEnvironmentList.DeserializeDtlEnvironmentList(document.RootElement); - return Response.FromValue(value, message.Response); - } - default: - throw new RequestFailedException(message.Response); - } + ClientDiagnostics = clientDiagnostics; + _endpoint = endpoint; + Pipeline = pipeline; + _apiVersion = apiVersion; } - /// List environments in a given user profile. - /// The subscription ID. - /// The name of the resource group. - /// The name of the lab. - /// The name of the user profile. - /// Specify the $expand query. Example: 'properties($select=deploymentProperties)'. - /// The filter to apply to the operation. Example: '$filter=contains(name,'myName'). - /// The maximum number of resources to return from the operation. Example: '$top=10'. - /// The ordering expression for the results, using OData notation. Example: '$orderby=name desc'. - /// The cancellation token to use. - /// , , or is null. - /// , , or is an empty string, and was expected to be non-empty. - public Response List(string subscriptionId, string resourceGroupName, string labName, string userName, string expand = null, string filter = null, int? top = null, string orderby = null, CancellationToken cancellationToken = default) - { - Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); - Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); - Argument.AssertNotNullOrEmpty(labName, nameof(labName)); - Argument.AssertNotNullOrEmpty(userName, nameof(userName)); + /// The HTTP pipeline for sending and receiving REST requests and responses. + public virtual HttpPipeline Pipeline { get; } - using var message = CreateListRequest(subscriptionId, resourceGroupName, labName, userName, expand, filter, top, orderby); - _pipeline.Send(message, cancellationToken); - switch (message.Response.Status) - { - case 200: - { - DtlEnvironmentList value = default; - using var document = JsonDocument.Parse(message.Response.ContentStream, ModelSerializationExtensions.JsonDocumentOptions); - value = DtlEnvironmentList.DeserializeDtlEnvironmentList(document.RootElement); - return Response.FromValue(value, 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 CreateGetRequestUri(string subscriptionId, string resourceGroupName, string labName, string userName, string name, string expand) + internal HttpMessage CreateGetRequest(string subscriptionId, string resourceGroupName, string labName, string userName, string name, string expand, RequestContext context) { - var uri = new RawRequestUriBuilder(); + RawRequestUriBuilder uri = new RawRequestUriBuilder(); uri.Reset(_endpoint); uri.AppendPath("/subscriptions/", false); uri.AppendPath(subscriptionId, true); @@ -192,117 +55,22 @@ internal RequestUriBuilder CreateGetRequestUri(string subscriptionId, string res uri.AppendPath(userName, true); uri.AppendPath("/environments/", false); uri.AppendPath(name, true); - if (expand != null) - { - uri.AppendQuery("$expand", expand, true); - } uri.AppendQuery("api-version", _apiVersion, true); - return uri; - } - - internal HttpMessage CreateGetRequest(string subscriptionId, string resourceGroupName, string labName, string userName, string name, string expand) - { - 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.DevTestLab/labs/", false); - uri.AppendPath(labName, true); - uri.AppendPath("/users/", false); - uri.AppendPath(userName, true); - uri.AppendPath("/environments/", false); - uri.AppendPath(name, true); if (expand != null) { uri.AppendQuery("$expand", expand, 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 environment. - /// The subscription ID. - /// The name of the resource group. - /// The name of the lab. - /// The name of the user profile. - /// The name of the environment. - /// Specify the $expand query. Example: 'properties($select=deploymentProperties)'. - /// 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 labName, string userName, string name, string expand = null, CancellationToken cancellationToken = default) + internal HttpMessage CreateCreateOrUpdateRequest(string subscriptionId, string resourceGroupName, string labName, string userName, string name, RequestContent content, RequestContext context) { - Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); - Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); - Argument.AssertNotNullOrEmpty(labName, nameof(labName)); - Argument.AssertNotNullOrEmpty(userName, nameof(userName)); - Argument.AssertNotNullOrEmpty(name, nameof(name)); - - using var message = CreateGetRequest(subscriptionId, resourceGroupName, labName, userName, name, expand); - await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); - switch (message.Response.Status) - { - case 200: - { - DevTestLabEnvironmentData value = default; - using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, ModelSerializationExtensions.JsonDocumentOptions, cancellationToken).ConfigureAwait(false); - value = DevTestLabEnvironmentData.DeserializeDevTestLabEnvironmentData(document.RootElement); - return Response.FromValue(value, message.Response); - } - case 404: - return Response.FromValue((DevTestLabEnvironmentData)null, message.Response); - default: - throw new RequestFailedException(message.Response); - } - } - - /// Get environment. - /// The subscription ID. - /// The name of the resource group. - /// The name of the lab. - /// The name of the user profile. - /// The name of the environment. - /// Specify the $expand query. Example: 'properties($select=deploymentProperties)'. - /// 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 labName, string userName, string name, string expand = null, CancellationToken cancellationToken = default) - { - Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); - Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); - Argument.AssertNotNullOrEmpty(labName, nameof(labName)); - Argument.AssertNotNullOrEmpty(userName, nameof(userName)); - Argument.AssertNotNullOrEmpty(name, nameof(name)); - - using var message = CreateGetRequest(subscriptionId, resourceGroupName, labName, userName, name, expand); - _pipeline.Send(message, cancellationToken); - switch (message.Response.Status) - { - case 200: - { - DevTestLabEnvironmentData value = default; - using var document = JsonDocument.Parse(message.Response.ContentStream, ModelSerializationExtensions.JsonDocumentOptions); - value = DevTestLabEnvironmentData.DeserializeDevTestLabEnvironmentData(document.RootElement); - return Response.FromValue(value, message.Response); - } - case 404: - return Response.FromValue((DevTestLabEnvironmentData)null, message.Response); - default: - throw new RequestFailedException(message.Response); - } - } - - internal RequestUriBuilder CreateCreateOrUpdateRequestUri(string subscriptionId, string resourceGroupName, string labName, string userName, string name, DevTestLabEnvironmentData data) - { - var uri = new RawRequestUriBuilder(); + RawRequestUriBuilder uri = new RawRequestUriBuilder(); uri.Reset(_endpoint); uri.AppendPath("/subscriptions/", false); uri.AppendPath(subscriptionId, true); @@ -315,15 +83,19 @@ internal RequestUriBuilder CreateCreateOrUpdateRequestUri(string subscriptionId, uri.AppendPath("/environments/", false); uri.AppendPath(name, true); uri.AppendQuery("api-version", _apiVersion, true); - return uri; + HttpMessage message = Pipeline.CreateMessage(); + Request request = message.Request; + request.Uri = uri; + request.Method = RequestMethod.Put; + request.Headers.SetValue("Content-Type", "application/json"); + request.Headers.SetValue("Accept", "application/json"); + request.Content = content; + return message; } - internal HttpMessage CreateCreateOrUpdateRequest(string subscriptionId, string resourceGroupName, string labName, string userName, string name, DevTestLabEnvironmentData data) + internal HttpMessage CreateUpdateRequest(string subscriptionId, string resourceGroupName, string labName, string userName, string name, 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); @@ -336,81 +108,19 @@ internal HttpMessage CreateCreateOrUpdateRequest(string subscriptionId, string r uri.AppendPath("/environments/", false); uri.AppendPath(name, 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.Patch; + request.Headers.SetValue("Content-Type", "application/json"); + request.Headers.SetValue("Accept", "application/json"); request.Content = content; - _userAgent.Apply(message); return message; } - /// Create or replace an existing environment. This operation can take a while to complete. - /// The subscription ID. - /// The name of the resource group. - /// The name of the lab. - /// The name of the user profile. - /// The name of the environment. - /// An environment, which is essentially an ARM template deployment. - /// 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 labName, string userName, string name, DevTestLabEnvironmentData data, CancellationToken cancellationToken = default) - { - Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); - Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); - Argument.AssertNotNullOrEmpty(labName, nameof(labName)); - Argument.AssertNotNullOrEmpty(userName, nameof(userName)); - Argument.AssertNotNullOrEmpty(name, nameof(name)); - Argument.AssertNotNull(data, nameof(data)); - - using var message = CreateCreateOrUpdateRequest(subscriptionId, resourceGroupName, labName, userName, name, data); - await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); - switch (message.Response.Status) - { - case 200: - case 201: - return message.Response; - default: - throw new RequestFailedException(message.Response); - } - } - - /// Create or replace an existing environment. This operation can take a while to complete. - /// The subscription ID. - /// The name of the resource group. - /// The name of the lab. - /// The name of the user profile. - /// The name of the environment. - /// An environment, which is essentially an ARM template deployment. - /// 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 labName, string userName, string name, DevTestLabEnvironmentData data, CancellationToken cancellationToken = default) - { - Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); - Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); - Argument.AssertNotNullOrEmpty(labName, nameof(labName)); - Argument.AssertNotNullOrEmpty(userName, nameof(userName)); - Argument.AssertNotNullOrEmpty(name, nameof(name)); - Argument.AssertNotNull(data, nameof(data)); - - using var message = CreateCreateOrUpdateRequest(subscriptionId, resourceGroupName, labName, userName, name, 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 labName, string userName, string name) + internal HttpMessage CreateDeleteRequest(string subscriptionId, string resourceGroupName, string labName, string userName, string name, RequestContext context) { - var uri = new RawRequestUriBuilder(); + RawRequestUriBuilder uri = new RawRequestUriBuilder(); uri.Reset(_endpoint); uri.AppendPath("/subscriptions/", false); uri.AppendPath(subscriptionId, true); @@ -423,15 +133,16 @@ internal RequestUriBuilder CreateDeleteRequestUri(string subscriptionId, string uri.AppendPath("/environments/", false); uri.AppendPath(name, true); uri.AppendQuery("api-version", _apiVersion, true); - return uri; + HttpMessage message = Pipeline.CreateMessage(); + Request request = message.Request; + request.Uri = uri; + request.Method = RequestMethod.Delete; + return message; } - internal HttpMessage CreateDeleteRequest(string subscriptionId, string resourceGroupName, string labName, string userName, string name) + internal HttpMessage CreateGetAllRequest(string subscriptionId, string resourceGroupName, string labName, string userName, string expand, string filter, int? top, string @orderby, RequestContext context) { - var message = _pipeline.CreateMessage(); - var request = message.Request; - request.Method = RequestMethod.Delete; - var uri = new RawRequestUriBuilder(); + RawRequestUriBuilder uri = new RawRequestUriBuilder(); uri.Reset(_endpoint); uri.AppendPath("/subscriptions/", false); uri.AppendPath(subscriptionId, true); @@ -441,285 +152,43 @@ internal HttpMessage CreateDeleteRequest(string subscriptionId, string resourceG uri.AppendPath(labName, true); uri.AppendPath("/users/", false); uri.AppendPath(userName, true); - uri.AppendPath("/environments/", false); - uri.AppendPath(name, true); + uri.AppendPath("/environments", false); uri.AppendQuery("api-version", _apiVersion, true); - request.Uri = uri; - request.Headers.Add("Accept", "application/json"); - _userAgent.Apply(message); - return message; - } - - /// Delete environment. This operation can take a while to complete. - /// The subscription ID. - /// The name of the resource group. - /// The name of the lab. - /// The name of the user profile. - /// The name of the environment. - /// 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 labName, string userName, string name, CancellationToken cancellationToken = default) - { - Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); - Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); - Argument.AssertNotNullOrEmpty(labName, nameof(labName)); - Argument.AssertNotNullOrEmpty(userName, nameof(userName)); - Argument.AssertNotNullOrEmpty(name, nameof(name)); - - using var message = CreateDeleteRequest(subscriptionId, resourceGroupName, labName, userName, name); - await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); - switch (message.Response.Status) + if (expand != null) { - case 200: - case 202: - case 204: - return message.Response; - default: - throw new RequestFailedException(message.Response); + uri.AppendQuery("$expand", expand, true); } - } - - /// Delete environment. This operation can take a while to complete. - /// The subscription ID. - /// The name of the resource group. - /// The name of the lab. - /// The name of the user profile. - /// The name of the environment. - /// 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 labName, string userName, string name, CancellationToken cancellationToken = default) - { - Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); - Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); - Argument.AssertNotNullOrEmpty(labName, nameof(labName)); - Argument.AssertNotNullOrEmpty(userName, nameof(userName)); - Argument.AssertNotNullOrEmpty(name, nameof(name)); - - using var message = CreateDeleteRequest(subscriptionId, resourceGroupName, labName, userName, name); - _pipeline.Send(message, cancellationToken); - switch (message.Response.Status) + if (filter != null) { - case 200: - case 202: - case 204: - return message.Response; - default: - throw new RequestFailedException(message.Response); + uri.AppendQuery("$filter", filter, true); } - } - - internal RequestUriBuilder CreateUpdateRequestUri(string subscriptionId, string resourceGroupName, string labName, string userName, string name, DevTestLabEnvironmentPatch 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.DevTestLab/labs/", false); - uri.AppendPath(labName, true); - uri.AppendPath("/users/", false); - uri.AppendPath(userName, true); - uri.AppendPath("/environments/", false); - uri.AppendPath(name, true); - uri.AppendQuery("api-version", _apiVersion, true); - return uri; - } - - internal HttpMessage CreateUpdateRequest(string subscriptionId, string resourceGroupName, string labName, string userName, string name, DevTestLabEnvironmentPatch patch) - { - var message = _pipeline.CreateMessage(); - var request = message.Request; - request.Method = RequestMethod.Patch; - var uri = new RawRequestUriBuilder(); - uri.Reset(_endpoint); - uri.AppendPath("/subscriptions/", false); - uri.AppendPath(subscriptionId, true); - uri.AppendPath("/resourceGroups/", false); - uri.AppendPath(resourceGroupName, true); - uri.AppendPath("/providers/Microsoft.DevTestLab/labs/", false); - uri.AppendPath(labName, true); - uri.AppendPath("/users/", false); - uri.AppendPath(userName, true); - uri.AppendPath("/environments/", false); - uri.AppendPath(name, true); - uri.AppendQuery("api-version", _apiVersion, true); - request.Uri = uri; - request.Headers.Add("Accept", "application/json"); - request.Headers.Add("Content-Type", "application/json"); - var content = new Utf8JsonRequestContent(); - content.JsonWriter.WriteObjectValue(patch, ModelSerializationExtensions.WireOptions); - request.Content = content; - _userAgent.Apply(message); - return message; - } - - /// Allows modifying tags of environments. All other properties will be ignored. - /// The subscription ID. - /// The name of the resource group. - /// The name of the lab. - /// The name of the user profile. - /// The name of the environment. - /// An environment, which is essentially an ARM template deployment. - /// 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 labName, string userName, string name, DevTestLabEnvironmentPatch patch, CancellationToken cancellationToken = default) - { - Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); - Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); - Argument.AssertNotNullOrEmpty(labName, nameof(labName)); - Argument.AssertNotNullOrEmpty(userName, nameof(userName)); - Argument.AssertNotNullOrEmpty(name, nameof(name)); - Argument.AssertNotNull(patch, nameof(patch)); - - using var message = CreateUpdateRequest(subscriptionId, resourceGroupName, labName, userName, name, patch); - await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); - switch (message.Response.Status) + if (top != null) { - case 200: - { - DevTestLabEnvironmentData value = default; - using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, ModelSerializationExtensions.JsonDocumentOptions, cancellationToken).ConfigureAwait(false); - value = DevTestLabEnvironmentData.DeserializeDevTestLabEnvironmentData(document.RootElement); - return Response.FromValue(value, message.Response); - } - default: - throw new RequestFailedException(message.Response); + uri.AppendQuery("$top", TypeFormatters.ConvertToString(top), true); } - } - - /// Allows modifying tags of environments. All other properties will be ignored. - /// The subscription ID. - /// The name of the resource group. - /// The name of the lab. - /// The name of the user profile. - /// The name of the environment. - /// An environment, which is essentially an ARM template deployment. - /// 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 labName, string userName, string name, DevTestLabEnvironmentPatch patch, CancellationToken cancellationToken = default) - { - Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); - Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); - Argument.AssertNotNullOrEmpty(labName, nameof(labName)); - Argument.AssertNotNullOrEmpty(userName, nameof(userName)); - Argument.AssertNotNullOrEmpty(name, nameof(name)); - Argument.AssertNotNull(patch, nameof(patch)); - - using var message = CreateUpdateRequest(subscriptionId, resourceGroupName, labName, userName, name, patch); - _pipeline.Send(message, cancellationToken); - switch (message.Response.Status) + if (@orderby != null) { - case 200: - { - DevTestLabEnvironmentData value = default; - using var document = JsonDocument.Parse(message.Response.ContentStream, ModelSerializationExtensions.JsonDocumentOptions); - value = DevTestLabEnvironmentData.DeserializeDevTestLabEnvironmentData(document.RootElement); - return Response.FromValue(value, message.Response); - } - default: - throw new RequestFailedException(message.Response); + uri.AppendQuery("$orderby", @orderby, true); } - } - - internal RequestUriBuilder CreateListNextPageRequestUri(string nextLink, string subscriptionId, string resourceGroupName, string labName, string userName, string expand, string filter, int? top, string orderby) - { - var uri = new RawRequestUriBuilder(); - uri.Reset(_endpoint); - uri.AppendRawNextLink(nextLink, false); - return uri; - } - - internal HttpMessage CreateListNextPageRequest(string nextLink, string subscriptionId, string resourceGroupName, string labName, string userName, string expand, string filter, int? top, string orderby) - { - var message = _pipeline.CreateMessage(); - var request = message.Request; - request.Method = RequestMethod.Get; - var uri = new RawRequestUriBuilder(); - uri.Reset(_endpoint); - uri.AppendRawNextLink(nextLink, false); + 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 environments in a given user profile. - /// The URL to the next page of results. - /// The subscription ID. - /// The name of the resource group. - /// The name of the lab. - /// The name of the user profile. - /// Specify the $expand query. Example: 'properties($select=deploymentProperties)'. - /// The filter to apply to the operation. Example: '$filter=contains(name,'myName'). - /// The maximum number of resources to return from the operation. Example: '$top=10'. - /// The ordering expression for the results, using OData notation. Example: '$orderby=name desc'. - /// The cancellation token to use. - /// , , , or is null. - /// , , or is an empty string, and was expected to be non-empty. - public async Task> ListNextPageAsync(string nextLink, string subscriptionId, string resourceGroupName, string labName, string userName, string expand = null, string filter = null, int? top = null, string orderby = null, CancellationToken cancellationToken = default) + internal HttpMessage CreateNextGetAllRequest(Uri nextPage, string subscriptionId, string resourceGroupName, string labName, string userName, string expand, string filter, int? top, string @orderby, RequestContext context) { - Argument.AssertNotNull(nextLink, nameof(nextLink)); - Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); - Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); - Argument.AssertNotNullOrEmpty(labName, nameof(labName)); - Argument.AssertNotNullOrEmpty(userName, nameof(userName)); - - using var message = CreateListNextPageRequest(nextLink, subscriptionId, resourceGroupName, labName, userName, expand, filter, top, orderby); - await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); - switch (message.Response.Status) - { - case 200: - { - DtlEnvironmentList value = default; - using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, ModelSerializationExtensions.JsonDocumentOptions, cancellationToken).ConfigureAwait(false); - value = DtlEnvironmentList.DeserializeDtlEnvironmentList(document.RootElement); - return Response.FromValue(value, message.Response); - } - default: - throw new RequestFailedException(message.Response); - } - } - - /// List environments in a given user profile. - /// The URL to the next page of results. - /// The subscription ID. - /// The name of the resource group. - /// The name of the lab. - /// The name of the user profile. - /// Specify the $expand query. Example: 'properties($select=deploymentProperties)'. - /// The filter to apply to the operation. Example: '$filter=contains(name,'myName'). - /// The maximum number of resources to return from the operation. Example: '$top=10'. - /// The ordering expression for the results, using OData notation. Example: '$orderby=name desc'. - /// The cancellation token to use. - /// , , , or is null. - /// , , or is an empty string, and was expected to be non-empty. - public Response ListNextPage(string nextLink, string subscriptionId, string resourceGroupName, string labName, string userName, string expand = null, string filter = null, int? top = null, string orderby = null, CancellationToken cancellationToken = default) - { - Argument.AssertNotNull(nextLink, nameof(nextLink)); - Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); - Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); - Argument.AssertNotNullOrEmpty(labName, nameof(labName)); - Argument.AssertNotNullOrEmpty(userName, nameof(userName)); - - using var message = CreateListNextPageRequest(nextLink, subscriptionId, resourceGroupName, labName, userName, expand, filter, top, orderby); - _pipeline.Send(message, cancellationToken); - switch (message.Response.Status) - { - case 200: - { - DtlEnvironmentList value = default; - using var document = JsonDocument.Parse(message.Response.ContentStream, ModelSerializationExtensions.JsonDocumentOptions); - value = DtlEnvironmentList.DeserializeDtlEnvironmentList(document.RootElement); - return Response.FromValue(value, message.Response); - } - default: - throw new RequestFailedException(message.Response); - } + RawRequestUriBuilder uri = new RawRequestUriBuilder(); + uri.Reset(nextPage); + uri.UpdateQuery("api-version", _apiVersion); + HttpMessage message = Pipeline.CreateMessage(); + Request request = message.Request; + request.Uri = uri; + request.Method = RequestMethod.Get; + request.Headers.SetValue("Accept", "application/json"); + return message; } } } diff --git a/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/RestOperations/FormulasRestOperations.cs b/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/RestOperations/FormulasRestOperations.cs index cb00cf8434d5..deae14491087 100644 --- a/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/RestOperations/FormulasRestOperations.cs +++ b/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/RestOperations/FormulasRestOperations.cs @@ -6,173 +6,44 @@ #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.DevTestLabs.Models; namespace Azure.ResourceManager.DevTestLabs { - internal partial class FormulasRestOperations + internal partial class Formulas { - private readonly TelemetryDetails _userAgent; - private readonly HttpPipeline _pipeline; private readonly Uri _endpoint; private readonly string _apiVersion; - /// Initializes a new instance of FormulasRestOperations. - /// The HTTP pipeline for sending and receiving REST requests and responses. - /// The application id to use for user agent. - /// server parameter. - /// Api Version. - /// or is null. - public FormulasRestOperations(HttpPipeline pipeline, string applicationId, Uri endpoint = null, string apiVersion = default) + /// Initializes a new instance of Formulas for mocking. + protected Formulas() { - _pipeline = pipeline ?? throw new ArgumentNullException(nameof(pipeline)); - _endpoint = endpoint ?? new Uri("https://management.azure.com"); - _apiVersion = apiVersion ?? "2018-09-15"; - _userAgent = new TelemetryDetails(GetType().Assembly, applicationId); } - internal RequestUriBuilder CreateListRequestUri(string subscriptionId, string resourceGroupName, string labName, string expand, string filter, int? top, string orderby) - { - 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.DevTestLab/labs/", false); - uri.AppendPath(labName, true); - uri.AppendPath("/formulas", false); - if (expand != null) - { - uri.AppendQuery("$expand", expand, true); - } - if (filter != null) - { - uri.AppendQuery("$filter", filter, true); - } - if (top != null) - { - uri.AppendQuery("$top", top.Value, true); - } - if (orderby != null) - { - uri.AppendQuery("$orderby", orderby, true); - } - uri.AppendQuery("api-version", _apiVersion, true); - return uri; - } - - internal HttpMessage CreateListRequest(string subscriptionId, string resourceGroupName, string labName, string expand, string filter, int? top, string orderby) - { - 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.DevTestLab/labs/", false); - uri.AppendPath(labName, true); - uri.AppendPath("/formulas", false); - if (expand != null) - { - uri.AppendQuery("$expand", expand, true); - } - if (filter != null) - { - uri.AppendQuery("$filter", filter, true); - } - if (top != null) - { - uri.AppendQuery("$top", top.Value, true); - } - if (orderby != null) - { - uri.AppendQuery("$orderby", orderby, true); - } - uri.AppendQuery("api-version", _apiVersion, true); - request.Uri = uri; - request.Headers.Add("Accept", "application/json"); - _userAgent.Apply(message); - return message; - } - - /// List formulas in a given lab. - /// The subscription ID. - /// The name of the resource group. - /// The name of the lab. - /// Specify the $expand query. Example: 'properties($select=description)'. - /// The filter to apply to the operation. Example: '$filter=contains(name,'myName'). - /// The maximum number of resources to return from the operation. Example: '$top=10'. - /// The ordering expression for the results, using OData notation. Example: '$orderby=name desc'. - /// The cancellation token to use. - /// , or is null. - /// , or is an empty string, and was expected to be non-empty. - public async Task> ListAsync(string subscriptionId, string resourceGroupName, string labName, string expand = null, string filter = null, int? top = null, string orderby = null, CancellationToken cancellationToken = default) + /// Initializes a new instance of Formulas. + /// 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 Formulas(ClientDiagnostics clientDiagnostics, HttpPipeline pipeline, Uri endpoint, string apiVersion) { - Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); - Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); - Argument.AssertNotNullOrEmpty(labName, nameof(labName)); - - using var message = CreateListRequest(subscriptionId, resourceGroupName, labName, expand, filter, top, orderby); - await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); - switch (message.Response.Status) - { - case 200: - { - FormulaList value = default; - using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, ModelSerializationExtensions.JsonDocumentOptions, cancellationToken).ConfigureAwait(false); - value = FormulaList.DeserializeFormulaList(document.RootElement); - return Response.FromValue(value, message.Response); - } - default: - throw new RequestFailedException(message.Response); - } + ClientDiagnostics = clientDiagnostics; + _endpoint = endpoint; + Pipeline = pipeline; + _apiVersion = apiVersion; } - /// List formulas in a given lab. - /// The subscription ID. - /// The name of the resource group. - /// The name of the lab. - /// Specify the $expand query. Example: 'properties($select=description)'. - /// The filter to apply to the operation. Example: '$filter=contains(name,'myName'). - /// The maximum number of resources to return from the operation. Example: '$top=10'. - /// The ordering expression for the results, using OData notation. Example: '$orderby=name desc'. - /// The cancellation token to use. - /// , or is null. - /// , or is an empty string, and was expected to be non-empty. - public Response List(string subscriptionId, string resourceGroupName, string labName, string expand = null, string filter = null, int? top = null, string orderby = null, CancellationToken cancellationToken = default) - { - Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); - Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); - Argument.AssertNotNullOrEmpty(labName, nameof(labName)); + /// The HTTP pipeline for sending and receiving REST requests and responses. + public virtual HttpPipeline Pipeline { get; } - using var message = CreateListRequest(subscriptionId, resourceGroupName, labName, expand, filter, top, orderby); - _pipeline.Send(message, cancellationToken); - switch (message.Response.Status) - { - case 200: - { - FormulaList value = default; - using var document = JsonDocument.Parse(message.Response.ContentStream, ModelSerializationExtensions.JsonDocumentOptions); - value = FormulaList.DeserializeFormulaList(document.RootElement); - return Response.FromValue(value, 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 CreateGetRequestUri(string subscriptionId, string resourceGroupName, string labName, string name, string expand) + internal HttpMessage CreateGetRequest(string subscriptionId, string resourceGroupName, string labName, string name, string expand, RequestContext context) { - var uri = new RawRequestUriBuilder(); + RawRequestUriBuilder uri = new RawRequestUriBuilder(); uri.Reset(_endpoint); uri.AppendPath("/subscriptions/", false); uri.AppendPath(subscriptionId, true); @@ -182,111 +53,22 @@ internal RequestUriBuilder CreateGetRequestUri(string subscriptionId, string res uri.AppendPath(labName, true); uri.AppendPath("/formulas/", false); uri.AppendPath(name, true); - if (expand != null) - { - uri.AppendQuery("$expand", expand, true); - } uri.AppendQuery("api-version", _apiVersion, true); - return uri; - } - - internal HttpMessage CreateGetRequest(string subscriptionId, string resourceGroupName, string labName, string name, string expand) - { - 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.DevTestLab/labs/", false); - uri.AppendPath(labName, true); - uri.AppendPath("/formulas/", false); - uri.AppendPath(name, true); if (expand != null) { uri.AppendQuery("$expand", expand, 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 formula. - /// The subscription ID. - /// The name of the resource group. - /// The name of the lab. - /// The name of the formula. - /// Specify the $expand query. Example: 'properties($select=description)'. - /// 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 labName, string name, string expand = null, CancellationToken cancellationToken = default) - { - Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); - Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); - Argument.AssertNotNullOrEmpty(labName, nameof(labName)); - Argument.AssertNotNullOrEmpty(name, nameof(name)); - - using var message = CreateGetRequest(subscriptionId, resourceGroupName, labName, name, expand); - await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); - switch (message.Response.Status) - { - case 200: - { - DevTestLabFormulaData value = default; - using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, ModelSerializationExtensions.JsonDocumentOptions, cancellationToken).ConfigureAwait(false); - value = DevTestLabFormulaData.DeserializeDevTestLabFormulaData(document.RootElement); - return Response.FromValue(value, message.Response); - } - case 404: - return Response.FromValue((DevTestLabFormulaData)null, message.Response); - default: - throw new RequestFailedException(message.Response); - } - } - - /// Get formula. - /// The subscription ID. - /// The name of the resource group. - /// The name of the lab. - /// The name of the formula. - /// Specify the $expand query. Example: 'properties($select=description)'. - /// 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 labName, string name, string expand = null, CancellationToken cancellationToken = default) - { - Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); - Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); - Argument.AssertNotNullOrEmpty(labName, nameof(labName)); - Argument.AssertNotNullOrEmpty(name, nameof(name)); - - using var message = CreateGetRequest(subscriptionId, resourceGroupName, labName, name, expand); - _pipeline.Send(message, cancellationToken); - switch (message.Response.Status) - { - case 200: - { - DevTestLabFormulaData value = default; - using var document = JsonDocument.Parse(message.Response.ContentStream, ModelSerializationExtensions.JsonDocumentOptions); - value = DevTestLabFormulaData.DeserializeDevTestLabFormulaData(document.RootElement); - return Response.FromValue(value, message.Response); - } - case 404: - return Response.FromValue((DevTestLabFormulaData)null, message.Response); - default: - throw new RequestFailedException(message.Response); - } - } - - internal RequestUriBuilder CreateCreateOrUpdateRequestUri(string subscriptionId, string resourceGroupName, string labName, string name, DevTestLabFormulaData data) + internal HttpMessage CreateCreateOrUpdateRequest(string subscriptionId, string resourceGroupName, string labName, string name, RequestContent content, RequestContext context) { - var uri = new RawRequestUriBuilder(); + RawRequestUriBuilder uri = new RawRequestUriBuilder(); uri.Reset(_endpoint); uri.AppendPath("/subscriptions/", false); uri.AppendPath(subscriptionId, true); @@ -297,15 +79,19 @@ internal RequestUriBuilder CreateCreateOrUpdateRequestUri(string subscriptionId, uri.AppendPath("/formulas/", false); uri.AppendPath(name, true); uri.AppendQuery("api-version", _apiVersion, true); - return uri; + HttpMessage message = Pipeline.CreateMessage(); + Request request = message.Request; + request.Uri = uri; + request.Method = RequestMethod.Put; + request.Headers.SetValue("Content-Type", "application/json"); + request.Headers.SetValue("Accept", "application/json"); + request.Content = content; + return message; } - internal HttpMessage CreateCreateOrUpdateRequest(string subscriptionId, string resourceGroupName, string labName, string name, DevTestLabFormulaData data) + internal HttpMessage CreateUpdateRequest(string subscriptionId, string resourceGroupName, string labName, string name, 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); @@ -316,77 +102,19 @@ internal HttpMessage CreateCreateOrUpdateRequest(string subscriptionId, string r uri.AppendPath("/formulas/", false); uri.AppendPath(name, 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.Patch; + request.Headers.SetValue("Content-Type", "application/json"); + request.Headers.SetValue("Accept", "application/json"); request.Content = content; - _userAgent.Apply(message); return message; } - /// Create or replace an existing formula. This operation can take a while to complete. - /// The subscription ID. - /// The name of the resource group. - /// The name of the lab. - /// The name of the formula. - /// A formula for creating a VM, specifying an image base and other 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 labName, string name, DevTestLabFormulaData data, CancellationToken cancellationToken = default) - { - Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); - Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); - Argument.AssertNotNullOrEmpty(labName, nameof(labName)); - Argument.AssertNotNullOrEmpty(name, nameof(name)); - Argument.AssertNotNull(data, nameof(data)); - - using var message = CreateCreateOrUpdateRequest(subscriptionId, resourceGroupName, labName, name, data); - await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); - switch (message.Response.Status) - { - case 200: - case 201: - return message.Response; - default: - throw new RequestFailedException(message.Response); - } - } - - /// Create or replace an existing formula. This operation can take a while to complete. - /// The subscription ID. - /// The name of the resource group. - /// The name of the lab. - /// The name of the formula. - /// A formula for creating a VM, specifying an image base and other 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 labName, string name, DevTestLabFormulaData data, CancellationToken cancellationToken = default) - { - Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); - Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); - Argument.AssertNotNullOrEmpty(labName, nameof(labName)); - Argument.AssertNotNullOrEmpty(name, nameof(name)); - Argument.AssertNotNull(data, nameof(data)); - - using var message = CreateCreateOrUpdateRequest(subscriptionId, resourceGroupName, labName, name, 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 labName, string name) + internal HttpMessage CreateDeleteRequest(string subscriptionId, string resourceGroupName, string labName, string name, RequestContext context) { - var uri = new RawRequestUriBuilder(); + RawRequestUriBuilder uri = new RawRequestUriBuilder(); uri.Reset(_endpoint); uri.AppendPath("/subscriptions/", false); uri.AppendPath(subscriptionId, true); @@ -397,15 +125,16 @@ internal RequestUriBuilder CreateDeleteRequestUri(string subscriptionId, string uri.AppendPath("/formulas/", false); uri.AppendPath(name, true); uri.AppendQuery("api-version", _apiVersion, true); - return uri; + HttpMessage message = Pipeline.CreateMessage(); + Request request = message.Request; + request.Uri = uri; + request.Method = RequestMethod.Delete; + return message; } - internal HttpMessage CreateDeleteRequest(string subscriptionId, string resourceGroupName, string labName, string name) + internal HttpMessage CreateGetAllRequest(string subscriptionId, string resourceGroupName, string labName, string expand, string filter, int? top, string @orderby, RequestContext context) { - var message = _pipeline.CreateMessage(); - var request = message.Request; - request.Method = RequestMethod.Delete; - var uri = new RawRequestUriBuilder(); + RawRequestUriBuilder uri = new RawRequestUriBuilder(); uri.Reset(_endpoint); uri.AppendPath("/subscriptions/", false); uri.AppendPath(subscriptionId, true); @@ -413,267 +142,43 @@ internal HttpMessage CreateDeleteRequest(string subscriptionId, string resourceG uri.AppendPath(resourceGroupName, true); uri.AppendPath("/providers/Microsoft.DevTestLab/labs/", false); uri.AppendPath(labName, true); - uri.AppendPath("/formulas/", false); - uri.AppendPath(name, true); + uri.AppendPath("/formulas", false); uri.AppendQuery("api-version", _apiVersion, true); - request.Uri = uri; - request.Headers.Add("Accept", "application/json"); - _userAgent.Apply(message); - return message; - } - - /// Delete formula. - /// The subscription ID. - /// The name of the resource group. - /// The name of the lab. - /// The name of the formula. - /// 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 labName, string name, CancellationToken cancellationToken = default) - { - Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); - Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); - Argument.AssertNotNullOrEmpty(labName, nameof(labName)); - Argument.AssertNotNullOrEmpty(name, nameof(name)); - - using var message = CreateDeleteRequest(subscriptionId, resourceGroupName, labName, name); - await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); - switch (message.Response.Status) + if (expand != null) { - case 200: - case 204: - return message.Response; - default: - throw new RequestFailedException(message.Response); + uri.AppendQuery("$expand", expand, true); } - } - - /// Delete formula. - /// The subscription ID. - /// The name of the resource group. - /// The name of the lab. - /// The name of the formula. - /// 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 labName, string name, CancellationToken cancellationToken = default) - { - Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); - Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); - Argument.AssertNotNullOrEmpty(labName, nameof(labName)); - Argument.AssertNotNullOrEmpty(name, nameof(name)); - - using var message = CreateDeleteRequest(subscriptionId, resourceGroupName, labName, name); - _pipeline.Send(message, cancellationToken); - switch (message.Response.Status) + if (filter != null) { - case 200: - case 204: - return message.Response; - default: - throw new RequestFailedException(message.Response); + uri.AppendQuery("$filter", filter, true); } - } - - internal RequestUriBuilder CreateUpdateRequestUri(string subscriptionId, string resourceGroupName, string labName, string name, DevTestLabFormulaPatch 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.DevTestLab/labs/", false); - uri.AppendPath(labName, true); - uri.AppendPath("/formulas/", false); - uri.AppendPath(name, true); - uri.AppendQuery("api-version", _apiVersion, true); - return uri; - } - - internal HttpMessage CreateUpdateRequest(string subscriptionId, string resourceGroupName, string labName, string name, DevTestLabFormulaPatch patch) - { - var message = _pipeline.CreateMessage(); - var request = message.Request; - request.Method = RequestMethod.Patch; - var uri = new RawRequestUriBuilder(); - uri.Reset(_endpoint); - uri.AppendPath("/subscriptions/", false); - uri.AppendPath(subscriptionId, true); - uri.AppendPath("/resourceGroups/", false); - uri.AppendPath(resourceGroupName, true); - uri.AppendPath("/providers/Microsoft.DevTestLab/labs/", false); - uri.AppendPath(labName, true); - uri.AppendPath("/formulas/", false); - uri.AppendPath(name, true); - uri.AppendQuery("api-version", _apiVersion, true); - request.Uri = uri; - request.Headers.Add("Accept", "application/json"); - request.Headers.Add("Content-Type", "application/json"); - var content = new Utf8JsonRequestContent(); - content.JsonWriter.WriteObjectValue(patch, ModelSerializationExtensions.WireOptions); - request.Content = content; - _userAgent.Apply(message); - return message; - } - - /// Allows modifying tags of formulas. All other properties will be ignored. - /// The subscription ID. - /// The name of the resource group. - /// The name of the lab. - /// The name of the formula. - /// A formula for creating a VM, specifying an image base and other parameters. - /// 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 labName, string name, DevTestLabFormulaPatch patch, CancellationToken cancellationToken = default) - { - Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); - Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); - Argument.AssertNotNullOrEmpty(labName, nameof(labName)); - Argument.AssertNotNullOrEmpty(name, nameof(name)); - Argument.AssertNotNull(patch, nameof(patch)); - - using var message = CreateUpdateRequest(subscriptionId, resourceGroupName, labName, name, patch); - await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); - switch (message.Response.Status) + if (top != null) { - case 200: - { - DevTestLabFormulaData value = default; - using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, ModelSerializationExtensions.JsonDocumentOptions, cancellationToken).ConfigureAwait(false); - value = DevTestLabFormulaData.DeserializeDevTestLabFormulaData(document.RootElement); - return Response.FromValue(value, message.Response); - } - default: - throw new RequestFailedException(message.Response); + uri.AppendQuery("$top", TypeFormatters.ConvertToString(top), true); } - } - - /// Allows modifying tags of formulas. All other properties will be ignored. - /// The subscription ID. - /// The name of the resource group. - /// The name of the lab. - /// The name of the formula. - /// A formula for creating a VM, specifying an image base and other parameters. - /// 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 labName, string name, DevTestLabFormulaPatch patch, CancellationToken cancellationToken = default) - { - Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); - Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); - Argument.AssertNotNullOrEmpty(labName, nameof(labName)); - Argument.AssertNotNullOrEmpty(name, nameof(name)); - Argument.AssertNotNull(patch, nameof(patch)); - - using var message = CreateUpdateRequest(subscriptionId, resourceGroupName, labName, name, patch); - _pipeline.Send(message, cancellationToken); - switch (message.Response.Status) + if (@orderby != null) { - case 200: - { - DevTestLabFormulaData value = default; - using var document = JsonDocument.Parse(message.Response.ContentStream, ModelSerializationExtensions.JsonDocumentOptions); - value = DevTestLabFormulaData.DeserializeDevTestLabFormulaData(document.RootElement); - return Response.FromValue(value, message.Response); - } - default: - throw new RequestFailedException(message.Response); + uri.AppendQuery("$orderby", @orderby, true); } - } - - internal RequestUriBuilder CreateListNextPageRequestUri(string nextLink, string subscriptionId, string resourceGroupName, string labName, string expand, string filter, int? top, string orderby) - { - var uri = new RawRequestUriBuilder(); - uri.Reset(_endpoint); - uri.AppendRawNextLink(nextLink, false); - return uri; - } - - internal HttpMessage CreateListNextPageRequest(string nextLink, string subscriptionId, string resourceGroupName, string labName, string expand, string filter, int? top, string orderby) - { - var message = _pipeline.CreateMessage(); - var request = message.Request; - request.Method = RequestMethod.Get; - var uri = new RawRequestUriBuilder(); - uri.Reset(_endpoint); - uri.AppendRawNextLink(nextLink, false); + 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 formulas in a given lab. - /// The URL to the next page of results. - /// The subscription ID. - /// The name of the resource group. - /// The name of the lab. - /// Specify the $expand query. Example: 'properties($select=description)'. - /// The filter to apply to the operation. Example: '$filter=contains(name,'myName'). - /// The maximum number of resources to return from the operation. Example: '$top=10'. - /// The ordering expression for the results, using OData notation. Example: '$orderby=name desc'. - /// The cancellation token to use. - /// , , or is null. - /// , or is an empty string, and was expected to be non-empty. - public async Task> ListNextPageAsync(string nextLink, string subscriptionId, string resourceGroupName, string labName, string expand = null, string filter = null, int? top = null, string orderby = null, CancellationToken cancellationToken = default) + internal HttpMessage CreateNextGetAllRequest(Uri nextPage, string subscriptionId, string resourceGroupName, string labName, string expand, string filter, int? top, string @orderby, RequestContext context) { - Argument.AssertNotNull(nextLink, nameof(nextLink)); - Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); - Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); - Argument.AssertNotNullOrEmpty(labName, nameof(labName)); - - using var message = CreateListNextPageRequest(nextLink, subscriptionId, resourceGroupName, labName, expand, filter, top, orderby); - await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); - switch (message.Response.Status) - { - case 200: - { - FormulaList value = default; - using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, ModelSerializationExtensions.JsonDocumentOptions, cancellationToken).ConfigureAwait(false); - value = FormulaList.DeserializeFormulaList(document.RootElement); - return Response.FromValue(value, message.Response); - } - default: - throw new RequestFailedException(message.Response); - } - } - - /// List formulas in a given lab. - /// The URL to the next page of results. - /// The subscription ID. - /// The name of the resource group. - /// The name of the lab. - /// Specify the $expand query. Example: 'properties($select=description)'. - /// The filter to apply to the operation. Example: '$filter=contains(name,'myName'). - /// The maximum number of resources to return from the operation. Example: '$top=10'. - /// The ordering expression for the results, using OData notation. Example: '$orderby=name desc'. - /// The cancellation token to use. - /// , , or is null. - /// , or is an empty string, and was expected to be non-empty. - public Response ListNextPage(string nextLink, string subscriptionId, string resourceGroupName, string labName, string expand = null, string filter = null, int? top = null, string orderby = null, CancellationToken cancellationToken = default) - { - Argument.AssertNotNull(nextLink, nameof(nextLink)); - Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); - Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); - Argument.AssertNotNullOrEmpty(labName, nameof(labName)); - - using var message = CreateListNextPageRequest(nextLink, subscriptionId, resourceGroupName, labName, expand, filter, top, orderby); - _pipeline.Send(message, cancellationToken); - switch (message.Response.Status) - { - case 200: - { - FormulaList value = default; - using var document = JsonDocument.Parse(message.Response.ContentStream, ModelSerializationExtensions.JsonDocumentOptions); - value = FormulaList.DeserializeFormulaList(document.RootElement); - return Response.FromValue(value, message.Response); - } - default: - throw new RequestFailedException(message.Response); - } + RawRequestUriBuilder uri = new RawRequestUriBuilder(); + uri.Reset(nextPage); + uri.UpdateQuery("api-version", _apiVersion); + HttpMessage message = Pipeline.CreateMessage(); + Request request = message.Request; + request.Uri = uri; + request.Method = RequestMethod.Get; + request.Headers.SetValue("Accept", "application/json"); + return message; } } } diff --git a/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/RestOperations/GalleryImagesRestOperations.cs b/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/RestOperations/GalleryImagesRestOperations.cs index 4931cb684bbe..22c854ab3c57 100644 --- a/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/RestOperations/GalleryImagesRestOperations.cs +++ b/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/RestOperations/GalleryImagesRestOperations.cs @@ -6,73 +6,44 @@ #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.DevTestLabs.Models; namespace Azure.ResourceManager.DevTestLabs { - internal partial class GalleryImagesRestOperations + internal partial class GalleryImages { - private readonly TelemetryDetails _userAgent; - private readonly HttpPipeline _pipeline; private readonly Uri _endpoint; private readonly string _apiVersion; - /// Initializes a new instance of GalleryImagesRestOperations. - /// The HTTP pipeline for sending and receiving REST requests and responses. - /// The application id to use for user agent. - /// server parameter. - /// Api Version. - /// or is null. - public GalleryImagesRestOperations(HttpPipeline pipeline, string applicationId, Uri endpoint = null, string apiVersion = default) + /// Initializes a new instance of GalleryImages for mocking. + protected GalleryImages() { - _pipeline = pipeline ?? throw new ArgumentNullException(nameof(pipeline)); - _endpoint = endpoint ?? new Uri("https://management.azure.com"); - _apiVersion = apiVersion ?? "2018-09-15"; - _userAgent = new TelemetryDetails(GetType().Assembly, applicationId); } - internal RequestUriBuilder CreateListRequestUri(string subscriptionId, string resourceGroupName, string labName, string expand, string filter, int? top, string orderby) + /// Initializes a new instance of GalleryImages. + /// 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 GalleryImages(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.DevTestLab/labs/", false); - uri.AppendPath(labName, true); - uri.AppendPath("/galleryimages", false); - if (expand != null) - { - uri.AppendQuery("$expand", expand, true); - } - if (filter != null) - { - uri.AppendQuery("$filter", filter, true); - } - if (top != null) - { - uri.AppendQuery("$top", top.Value, true); - } - if (orderby != null) - { - uri.AppendQuery("$orderby", orderby, true); - } - uri.AppendQuery("api-version", _apiVersion, true); - return uri; + ClientDiagnostics = clientDiagnostics; + _endpoint = endpoint; + Pipeline = pipeline; + _apiVersion = apiVersion; } - internal HttpMessage CreateListRequest(string subscriptionId, string resourceGroupName, string labName, string expand, string filter, int? top, string orderby) + /// 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 CreateGetGalleryImagesRequest(string subscriptionId, string resourceGroupName, string labName, string expand, string filter, int? top, string @orderby, 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); @@ -81,6 +52,7 @@ internal HttpMessage CreateListRequest(string subscriptionId, string resourceGro uri.AppendPath("/providers/Microsoft.DevTestLab/labs/", false); uri.AppendPath(labName, true); uri.AppendPath("/galleryimages", false); + uri.AppendQuery("api-version", _apiVersion, true); if (expand != null) { uri.AppendQuery("$expand", expand, true); @@ -91,175 +63,31 @@ internal HttpMessage CreateListRequest(string subscriptionId, string resourceGro } if (top != null) { - uri.AppendQuery("$top", top.Value, true); + uri.AppendQuery("$top", TypeFormatters.ConvertToString(top), true); } - if (orderby != null) + if (@orderby != null) { - uri.AppendQuery("$orderby", orderby, true); + uri.AppendQuery("$orderby", @orderby, 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; } - /// List gallery images in a given lab. - /// The subscription ID. - /// The name of the resource group. - /// The name of the lab. - /// Specify the $expand query. Example: 'properties($select=author)'. - /// The filter to apply to the operation. Example: '$filter=contains(name,'myName'). - /// The maximum number of resources to return from the operation. Example: '$top=10'. - /// The ordering expression for the results, using OData notation. Example: '$orderby=name desc'. - /// The cancellation token to use. - /// , or is null. - /// , or is an empty string, and was expected to be non-empty. - public async Task> ListAsync(string subscriptionId, string resourceGroupName, string labName, string expand = null, string filter = null, int? top = null, string orderby = null, CancellationToken cancellationToken = default) + internal HttpMessage CreateNextGetGalleryImagesRequest(Uri nextPage, string subscriptionId, string resourceGroupName, string labName, string expand, string filter, int? top, string @orderby, RequestContext context) { - Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); - Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); - Argument.AssertNotNullOrEmpty(labName, nameof(labName)); - - using var message = CreateListRequest(subscriptionId, resourceGroupName, labName, expand, filter, top, orderby); - await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); - switch (message.Response.Status) - { - case 200: - { - GalleryImageList value = default; - using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, ModelSerializationExtensions.JsonDocumentOptions, cancellationToken).ConfigureAwait(false); - value = GalleryImageList.DeserializeGalleryImageList(document.RootElement); - return Response.FromValue(value, message.Response); - } - default: - throw new RequestFailedException(message.Response); - } - } - - /// List gallery images in a given lab. - /// The subscription ID. - /// The name of the resource group. - /// The name of the lab. - /// Specify the $expand query. Example: 'properties($select=author)'. - /// The filter to apply to the operation. Example: '$filter=contains(name,'myName'). - /// The maximum number of resources to return from the operation. Example: '$top=10'. - /// The ordering expression for the results, using OData notation. Example: '$orderby=name desc'. - /// The cancellation token to use. - /// , or is null. - /// , or is an empty string, and was expected to be non-empty. - public Response List(string subscriptionId, string resourceGroupName, string labName, string expand = null, string filter = null, int? top = null, string orderby = null, CancellationToken cancellationToken = default) - { - Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); - Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); - Argument.AssertNotNullOrEmpty(labName, nameof(labName)); - - using var message = CreateListRequest(subscriptionId, resourceGroupName, labName, expand, filter, top, orderby); - _pipeline.Send(message, cancellationToken); - switch (message.Response.Status) - { - case 200: - { - GalleryImageList value = default; - using var document = JsonDocument.Parse(message.Response.ContentStream, ModelSerializationExtensions.JsonDocumentOptions); - value = GalleryImageList.DeserializeGalleryImageList(document.RootElement); - return Response.FromValue(value, message.Response); - } - default: - throw new RequestFailedException(message.Response); - } - } - - internal RequestUriBuilder CreateListNextPageRequestUri(string nextLink, string subscriptionId, string resourceGroupName, string labName, string expand, string filter, int? top, string orderby) - { - var uri = new RawRequestUriBuilder(); - uri.Reset(_endpoint); - uri.AppendRawNextLink(nextLink, false); - return uri; - } - - internal HttpMessage CreateListNextPageRequest(string nextLink, string subscriptionId, string resourceGroupName, string labName, string expand, string filter, int? top, string orderby) - { - 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); + uri.UpdateQuery("api-version", _apiVersion); + 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 gallery images in a given lab. - /// The URL to the next page of results. - /// The subscription ID. - /// The name of the resource group. - /// The name of the lab. - /// Specify the $expand query. Example: 'properties($select=author)'. - /// The filter to apply to the operation. Example: '$filter=contains(name,'myName'). - /// The maximum number of resources to return from the operation. Example: '$top=10'. - /// The ordering expression for the results, using OData notation. Example: '$orderby=name desc'. - /// The cancellation token to use. - /// , , or is null. - /// , or is an empty string, and was expected to be non-empty. - public async Task> ListNextPageAsync(string nextLink, string subscriptionId, string resourceGroupName, string labName, string expand = null, string filter = null, int? top = null, string orderby = null, CancellationToken cancellationToken = default) - { - Argument.AssertNotNull(nextLink, nameof(nextLink)); - Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); - Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); - Argument.AssertNotNullOrEmpty(labName, nameof(labName)); - - using var message = CreateListNextPageRequest(nextLink, subscriptionId, resourceGroupName, labName, expand, filter, top, orderby); - await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); - switch (message.Response.Status) - { - case 200: - { - GalleryImageList value = default; - using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, ModelSerializationExtensions.JsonDocumentOptions, cancellationToken).ConfigureAwait(false); - value = GalleryImageList.DeserializeGalleryImageList(document.RootElement); - return Response.FromValue(value, message.Response); - } - default: - throw new RequestFailedException(message.Response); - } - } - - /// List gallery images in a given lab. - /// The URL to the next page of results. - /// The subscription ID. - /// The name of the resource group. - /// The name of the lab. - /// Specify the $expand query. Example: 'properties($select=author)'. - /// The filter to apply to the operation. Example: '$filter=contains(name,'myName'). - /// The maximum number of resources to return from the operation. Example: '$top=10'. - /// The ordering expression for the results, using OData notation. Example: '$orderby=name desc'. - /// The cancellation token to use. - /// , , or is null. - /// , or is an empty string, and was expected to be non-empty. - public Response ListNextPage(string nextLink, string subscriptionId, string resourceGroupName, string labName, string expand = null, string filter = null, int? top = null, string orderby = null, CancellationToken cancellationToken = default) - { - Argument.AssertNotNull(nextLink, nameof(nextLink)); - Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); - Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); - Argument.AssertNotNullOrEmpty(labName, nameof(labName)); - - using var message = CreateListNextPageRequest(nextLink, subscriptionId, resourceGroupName, labName, expand, filter, top, orderby); - _pipeline.Send(message, cancellationToken); - switch (message.Response.Status) - { - case 200: - { - GalleryImageList value = default; - using var document = JsonDocument.Parse(message.Response.ContentStream, ModelSerializationExtensions.JsonDocumentOptions); - value = GalleryImageList.DeserializeGalleryImageList(document.RootElement); - return Response.FromValue(value, message.Response); - } - default: - throw new RequestFailedException(message.Response); - } - } } } diff --git a/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/RestOperations/GlobalSchedulesRestOperations.cs b/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/RestOperations/GlobalSchedulesRestOperations.cs deleted file mode 100644 index a03fb772f927..000000000000 --- a/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/RestOperations/GlobalSchedulesRestOperations.cs +++ /dev/null @@ -1,1027 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System; -using System.Text.Json; -using System.Threading; -using System.Threading.Tasks; -using Azure.Core; -using Azure.Core.Pipeline; -using Azure.ResourceManager.DevTestLabs.Models; - -namespace Azure.ResourceManager.DevTestLabs -{ - internal partial class GlobalSchedulesRestOperations - { - private readonly TelemetryDetails _userAgent; - private readonly HttpPipeline _pipeline; - private readonly Uri _endpoint; - private readonly string _apiVersion; - - /// Initializes a new instance of GlobalSchedulesRestOperations. - /// The HTTP pipeline for sending and receiving REST requests and responses. - /// The application id to use for user agent. - /// server parameter. - /// Api Version. - /// or is null. - public GlobalSchedulesRestOperations(HttpPipeline pipeline, string applicationId, Uri endpoint = null, string apiVersion = default) - { - _pipeline = pipeline ?? throw new ArgumentNullException(nameof(pipeline)); - _endpoint = endpoint ?? new Uri("https://management.azure.com"); - _apiVersion = apiVersion ?? "2018-09-15"; - _userAgent = new TelemetryDetails(GetType().Assembly, applicationId); - } - - internal RequestUriBuilder CreateListBySubscriptionRequestUri(string subscriptionId, string expand, string filter, int? top, string orderby) - { - var uri = new RawRequestUriBuilder(); - uri.Reset(_endpoint); - uri.AppendPath("/subscriptions/", false); - uri.AppendPath(subscriptionId, true); - uri.AppendPath("/providers/Microsoft.DevTestLab/schedules", false); - if (expand != null) - { - uri.AppendQuery("$expand", expand, true); - } - if (filter != null) - { - uri.AppendQuery("$filter", filter, true); - } - if (top != null) - { - uri.AppendQuery("$top", top.Value, true); - } - if (orderby != null) - { - uri.AppendQuery("$orderby", orderby, true); - } - uri.AppendQuery("api-version", _apiVersion, true); - return uri; - } - - internal HttpMessage CreateListBySubscriptionRequest(string subscriptionId, string expand, string filter, int? top, string orderby) - { - var message = _pipeline.CreateMessage(); - var request = message.Request; - request.Method = RequestMethod.Get; - var uri = new RawRequestUriBuilder(); - uri.Reset(_endpoint); - uri.AppendPath("/subscriptions/", false); - uri.AppendPath(subscriptionId, true); - uri.AppendPath("/providers/Microsoft.DevTestLab/schedules", false); - if (expand != null) - { - uri.AppendQuery("$expand", expand, true); - } - if (filter != null) - { - uri.AppendQuery("$filter", filter, true); - } - if (top != null) - { - uri.AppendQuery("$top", top.Value, true); - } - if (orderby != null) - { - uri.AppendQuery("$orderby", orderby, true); - } - uri.AppendQuery("api-version", _apiVersion, true); - request.Uri = uri; - request.Headers.Add("Accept", "application/json"); - _userAgent.Apply(message); - return message; - } - - /// List schedules in a subscription. - /// The subscription ID. - /// Specify the $expand query. Example: 'properties($select=status)'. - /// The filter to apply to the operation. Example: '$filter=contains(name,'myName'). - /// The maximum number of resources to return from the operation. Example: '$top=10'. - /// The ordering expression for the results, using OData notation. Example: '$orderby=name desc'. - /// The cancellation token to use. - /// is null. - /// is an empty string, and was expected to be non-empty. - public async Task> ListBySubscriptionAsync(string subscriptionId, string expand = null, string filter = null, int? top = null, string orderby = null, CancellationToken cancellationToken = default) - { - Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); - - using var message = CreateListBySubscriptionRequest(subscriptionId, expand, filter, top, orderby); - await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); - switch (message.Response.Status) - { - case 200: - { - ScheduleList value = default; - using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, ModelSerializationExtensions.JsonDocumentOptions, cancellationToken).ConfigureAwait(false); - value = ScheduleList.DeserializeScheduleList(document.RootElement); - return Response.FromValue(value, message.Response); - } - default: - throw new RequestFailedException(message.Response); - } - } - - /// List schedules in a subscription. - /// The subscription ID. - /// Specify the $expand query. Example: 'properties($select=status)'. - /// The filter to apply to the operation. Example: '$filter=contains(name,'myName'). - /// The maximum number of resources to return from the operation. Example: '$top=10'. - /// The ordering expression for the results, using OData notation. Example: '$orderby=name desc'. - /// The cancellation token to use. - /// is null. - /// is an empty string, and was expected to be non-empty. - public Response ListBySubscription(string subscriptionId, string expand = null, string filter = null, int? top = null, string orderby = null, CancellationToken cancellationToken = default) - { - Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); - - using var message = CreateListBySubscriptionRequest(subscriptionId, expand, filter, top, orderby); - _pipeline.Send(message, cancellationToken); - switch (message.Response.Status) - { - case 200: - { - ScheduleList value = default; - using var document = JsonDocument.Parse(message.Response.ContentStream, ModelSerializationExtensions.JsonDocumentOptions); - value = ScheduleList.DeserializeScheduleList(document.RootElement); - return Response.FromValue(value, message.Response); - } - default: - throw new RequestFailedException(message.Response); - } - } - - internal RequestUriBuilder CreateListByResourceGroupRequestUri(string subscriptionId, string resourceGroupName, string expand, string filter, int? top, string orderby) - { - 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.DevTestLab/schedules", false); - if (expand != null) - { - uri.AppendQuery("$expand", expand, true); - } - if (filter != null) - { - uri.AppendQuery("$filter", filter, true); - } - if (top != null) - { - uri.AppendQuery("$top", top.Value, true); - } - if (orderby != null) - { - uri.AppendQuery("$orderby", orderby, true); - } - uri.AppendQuery("api-version", _apiVersion, true); - return uri; - } - - internal HttpMessage CreateListByResourceGroupRequest(string subscriptionId, string resourceGroupName, string expand, string filter, int? top, string orderby) - { - 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.DevTestLab/schedules", false); - if (expand != null) - { - uri.AppendQuery("$expand", expand, true); - } - if (filter != null) - { - uri.AppendQuery("$filter", filter, true); - } - if (top != null) - { - uri.AppendQuery("$top", top.Value, true); - } - if (orderby != null) - { - uri.AppendQuery("$orderby", orderby, true); - } - uri.AppendQuery("api-version", _apiVersion, true); - request.Uri = uri; - request.Headers.Add("Accept", "application/json"); - _userAgent.Apply(message); - return message; - } - - /// List schedules in a resource group. - /// The subscription ID. - /// The name of the resource group. - /// Specify the $expand query. Example: 'properties($select=status)'. - /// The filter to apply to the operation. Example: '$filter=contains(name,'myName'). - /// The maximum number of resources to return from the operation. Example: '$top=10'. - /// The ordering expression for the results, using OData notation. Example: '$orderby=name desc'. - /// The cancellation token to use. - /// or is null. - /// or is an empty string, and was expected to be non-empty. - public async Task> ListByResourceGroupAsync(string subscriptionId, string resourceGroupName, string expand = null, string filter = null, int? top = null, string orderby = null, CancellationToken cancellationToken = default) - { - Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); - Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); - - using var message = CreateListByResourceGroupRequest(subscriptionId, resourceGroupName, expand, filter, top, orderby); - await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); - switch (message.Response.Status) - { - case 200: - { - ScheduleList value = default; - using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, ModelSerializationExtensions.JsonDocumentOptions, cancellationToken).ConfigureAwait(false); - value = ScheduleList.DeserializeScheduleList(document.RootElement); - return Response.FromValue(value, message.Response); - } - default: - throw new RequestFailedException(message.Response); - } - } - - /// List schedules in a resource group. - /// The subscription ID. - /// The name of the resource group. - /// Specify the $expand query. Example: 'properties($select=status)'. - /// The filter to apply to the operation. Example: '$filter=contains(name,'myName'). - /// The maximum number of resources to return from the operation. Example: '$top=10'. - /// The ordering expression for the results, using OData notation. Example: '$orderby=name desc'. - /// The cancellation token to use. - /// or is null. - /// or is an empty string, and was expected to be non-empty. - public Response ListByResourceGroup(string subscriptionId, string resourceGroupName, string expand = null, string filter = null, int? top = null, string orderby = null, CancellationToken cancellationToken = default) - { - Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); - Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); - - using var message = CreateListByResourceGroupRequest(subscriptionId, resourceGroupName, expand, filter, top, orderby); - _pipeline.Send(message, cancellationToken); - switch (message.Response.Status) - { - case 200: - { - ScheduleList value = default; - using var document = JsonDocument.Parse(message.Response.ContentStream, ModelSerializationExtensions.JsonDocumentOptions); - value = ScheduleList.DeserializeScheduleList(document.RootElement); - return Response.FromValue(value, message.Response); - } - default: - throw new RequestFailedException(message.Response); - } - } - - internal RequestUriBuilder CreateGetRequestUri(string subscriptionId, string resourceGroupName, string name, string expand) - { - 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.DevTestLab/schedules/", false); - uri.AppendPath(name, true); - if (expand != null) - { - uri.AppendQuery("$expand", expand, true); - } - uri.AppendQuery("api-version", _apiVersion, true); - return uri; - } - - internal HttpMessage CreateGetRequest(string subscriptionId, string resourceGroupName, string name, string expand) - { - 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.DevTestLab/schedules/", false); - uri.AppendPath(name, true); - if (expand != null) - { - uri.AppendQuery("$expand", expand, true); - } - uri.AppendQuery("api-version", _apiVersion, true); - request.Uri = uri; - request.Headers.Add("Accept", "application/json"); - _userAgent.Apply(message); - return message; - } - - /// Get schedule. - /// The subscription ID. - /// The name of the resource group. - /// The name of the schedule. - /// Specify the $expand query. Example: 'properties($select=status)'. - /// 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 name, string expand = null, CancellationToken cancellationToken = default) - { - Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); - Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); - Argument.AssertNotNullOrEmpty(name, nameof(name)); - - using var message = CreateGetRequest(subscriptionId, resourceGroupName, name, expand); - await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); - switch (message.Response.Status) - { - case 200: - { - DevTestLabScheduleData value = default; - using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, ModelSerializationExtensions.JsonDocumentOptions, cancellationToken).ConfigureAwait(false); - value = DevTestLabScheduleData.DeserializeDevTestLabScheduleData(document.RootElement); - return Response.FromValue(value, message.Response); - } - case 404: - return Response.FromValue((DevTestLabScheduleData)null, message.Response); - default: - throw new RequestFailedException(message.Response); - } - } - - /// Get schedule. - /// The subscription ID. - /// The name of the resource group. - /// The name of the schedule. - /// Specify the $expand query. Example: 'properties($select=status)'. - /// 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 name, string expand = null, CancellationToken cancellationToken = default) - { - Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); - Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); - Argument.AssertNotNullOrEmpty(name, nameof(name)); - - using var message = CreateGetRequest(subscriptionId, resourceGroupName, name, expand); - _pipeline.Send(message, cancellationToken); - switch (message.Response.Status) - { - case 200: - { - DevTestLabScheduleData value = default; - using var document = JsonDocument.Parse(message.Response.ContentStream, ModelSerializationExtensions.JsonDocumentOptions); - value = DevTestLabScheduleData.DeserializeDevTestLabScheduleData(document.RootElement); - return Response.FromValue(value, message.Response); - } - case 404: - return Response.FromValue((DevTestLabScheduleData)null, message.Response); - default: - throw new RequestFailedException(message.Response); - } - } - - internal RequestUriBuilder CreateCreateOrUpdateRequestUri(string subscriptionId, string resourceGroupName, string name, DevTestLabScheduleData data) - { - var uri = new RawRequestUriBuilder(); - uri.Reset(_endpoint); - uri.AppendPath("/subscriptions/", false); - uri.AppendPath(subscriptionId, true); - uri.AppendPath("/resourceGroups/", false); - uri.AppendPath(resourceGroupName, true); - uri.AppendPath("/providers/Microsoft.DevTestLab/schedules/", false); - uri.AppendPath(name, true); - uri.AppendQuery("api-version", _apiVersion, true); - return uri; - } - - internal HttpMessage CreateCreateOrUpdateRequest(string subscriptionId, string resourceGroupName, string name, DevTestLabScheduleData data) - { - var message = _pipeline.CreateMessage(); - var request = message.Request; - request.Method = RequestMethod.Put; - var uri = new RawRequestUriBuilder(); - uri.Reset(_endpoint); - uri.AppendPath("/subscriptions/", false); - uri.AppendPath(subscriptionId, true); - uri.AppendPath("/resourceGroups/", false); - uri.AppendPath(resourceGroupName, true); - uri.AppendPath("/providers/Microsoft.DevTestLab/schedules/", false); - uri.AppendPath(name, true); - uri.AppendQuery("api-version", _apiVersion, true); - request.Uri = uri; - request.Headers.Add("Accept", "application/json"); - request.Headers.Add("Content-Type", "application/json"); - var content = new Utf8JsonRequestContent(); - content.JsonWriter.WriteObjectValue(data, ModelSerializationExtensions.WireOptions); - request.Content = content; - _userAgent.Apply(message); - return message; - } - - /// Create or replace an existing schedule. - /// The subscription ID. - /// The name of the resource group. - /// The name of the schedule. - /// A schedule. - /// 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 name, DevTestLabScheduleData data, CancellationToken cancellationToken = default) - { - Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); - Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); - Argument.AssertNotNullOrEmpty(name, nameof(name)); - Argument.AssertNotNull(data, nameof(data)); - - using var message = CreateCreateOrUpdateRequest(subscriptionId, resourceGroupName, name, data); - await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); - switch (message.Response.Status) - { - case 200: - case 201: - { - DevTestLabScheduleData value = default; - using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, ModelSerializationExtensions.JsonDocumentOptions, cancellationToken).ConfigureAwait(false); - value = DevTestLabScheduleData.DeserializeDevTestLabScheduleData(document.RootElement); - return Response.FromValue(value, message.Response); - } - default: - throw new RequestFailedException(message.Response); - } - } - - /// Create or replace an existing schedule. - /// The subscription ID. - /// The name of the resource group. - /// The name of the schedule. - /// A schedule. - /// 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 name, DevTestLabScheduleData data, CancellationToken cancellationToken = default) - { - Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); - Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); - Argument.AssertNotNullOrEmpty(name, nameof(name)); - Argument.AssertNotNull(data, nameof(data)); - - using var message = CreateCreateOrUpdateRequest(subscriptionId, resourceGroupName, name, data); - _pipeline.Send(message, cancellationToken); - switch (message.Response.Status) - { - case 200: - case 201: - { - DevTestLabScheduleData value = default; - using var document = JsonDocument.Parse(message.Response.ContentStream, ModelSerializationExtensions.JsonDocumentOptions); - value = DevTestLabScheduleData.DeserializeDevTestLabScheduleData(document.RootElement); - return Response.FromValue(value, message.Response); - } - default: - throw new RequestFailedException(message.Response); - } - } - - internal RequestUriBuilder CreateDeleteRequestUri(string subscriptionId, string resourceGroupName, string name) - { - 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.DevTestLab/schedules/", false); - uri.AppendPath(name, true); - uri.AppendQuery("api-version", _apiVersion, true); - return uri; - } - - internal HttpMessage CreateDeleteRequest(string subscriptionId, string resourceGroupName, string name) - { - 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("/resourceGroups/", false); - uri.AppendPath(resourceGroupName, true); - uri.AppendPath("/providers/Microsoft.DevTestLab/schedules/", false); - uri.AppendPath(name, true); - uri.AppendQuery("api-version", _apiVersion, true); - request.Uri = uri; - request.Headers.Add("Accept", "application/json"); - _userAgent.Apply(message); - return message; - } - - /// Delete schedule. - /// The subscription ID. - /// The name of the resource group. - /// The name of the schedule. - /// 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 name, CancellationToken cancellationToken = default) - { - Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); - Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); - Argument.AssertNotNullOrEmpty(name, nameof(name)); - - using var message = CreateDeleteRequest(subscriptionId, resourceGroupName, name); - await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); - switch (message.Response.Status) - { - case 200: - case 204: - return message.Response; - default: - throw new RequestFailedException(message.Response); - } - } - - /// Delete schedule. - /// The subscription ID. - /// The name of the resource group. - /// The name of the schedule. - /// 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 name, CancellationToken cancellationToken = default) - { - Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); - Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); - Argument.AssertNotNullOrEmpty(name, nameof(name)); - - using var message = CreateDeleteRequest(subscriptionId, resourceGroupName, name); - _pipeline.Send(message, cancellationToken); - switch (message.Response.Status) - { - case 200: - case 204: - return message.Response; - default: - throw new RequestFailedException(message.Response); - } - } - - internal RequestUriBuilder CreateUpdateRequestUri(string subscriptionId, string resourceGroupName, string name, DevTestLabSchedulePatch 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.DevTestLab/schedules/", false); - uri.AppendPath(name, true); - uri.AppendQuery("api-version", _apiVersion, true); - return uri; - } - - internal HttpMessage CreateUpdateRequest(string subscriptionId, string resourceGroupName, string name, DevTestLabSchedulePatch patch) - { - var message = _pipeline.CreateMessage(); - var request = message.Request; - request.Method = RequestMethod.Patch; - var uri = new RawRequestUriBuilder(); - uri.Reset(_endpoint); - uri.AppendPath("/subscriptions/", false); - uri.AppendPath(subscriptionId, true); - uri.AppendPath("/resourceGroups/", false); - uri.AppendPath(resourceGroupName, true); - uri.AppendPath("/providers/Microsoft.DevTestLab/schedules/", false); - uri.AppendPath(name, true); - uri.AppendQuery("api-version", _apiVersion, true); - request.Uri = uri; - request.Headers.Add("Accept", "application/json"); - request.Headers.Add("Content-Type", "application/json"); - var content = new Utf8JsonRequestContent(); - content.JsonWriter.WriteObjectValue(patch, ModelSerializationExtensions.WireOptions); - request.Content = content; - _userAgent.Apply(message); - return message; - } - - /// Allows modifying tags of schedules. All other properties will be ignored. - /// The subscription ID. - /// The name of the resource group. - /// The name of the schedule. - /// A schedule. - /// 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 name, DevTestLabSchedulePatch patch, CancellationToken cancellationToken = default) - { - Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); - Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); - Argument.AssertNotNullOrEmpty(name, nameof(name)); - Argument.AssertNotNull(patch, nameof(patch)); - - using var message = CreateUpdateRequest(subscriptionId, resourceGroupName, name, patch); - await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); - switch (message.Response.Status) - { - case 200: - { - DevTestLabScheduleData value = default; - using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, ModelSerializationExtensions.JsonDocumentOptions, cancellationToken).ConfigureAwait(false); - value = DevTestLabScheduleData.DeserializeDevTestLabScheduleData(document.RootElement); - return Response.FromValue(value, message.Response); - } - default: - throw new RequestFailedException(message.Response); - } - } - - /// Allows modifying tags of schedules. All other properties will be ignored. - /// The subscription ID. - /// The name of the resource group. - /// The name of the schedule. - /// A schedule. - /// 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 name, DevTestLabSchedulePatch patch, CancellationToken cancellationToken = default) - { - Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); - Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); - Argument.AssertNotNullOrEmpty(name, nameof(name)); - Argument.AssertNotNull(patch, nameof(patch)); - - using var message = CreateUpdateRequest(subscriptionId, resourceGroupName, name, patch); - _pipeline.Send(message, cancellationToken); - switch (message.Response.Status) - { - case 200: - { - DevTestLabScheduleData value = default; - using var document = JsonDocument.Parse(message.Response.ContentStream, ModelSerializationExtensions.JsonDocumentOptions); - value = DevTestLabScheduleData.DeserializeDevTestLabScheduleData(document.RootElement); - return Response.FromValue(value, message.Response); - } - default: - throw new RequestFailedException(message.Response); - } - } - - internal RequestUriBuilder CreateExecuteRequestUri(string subscriptionId, string resourceGroupName, string name) - { - 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.DevTestLab/schedules/", false); - uri.AppendPath(name, true); - uri.AppendPath("/execute", false); - uri.AppendQuery("api-version", _apiVersion, true); - return uri; - } - - internal HttpMessage CreateExecuteRequest(string subscriptionId, string resourceGroupName, string name) - { - var message = _pipeline.CreateMessage(); - var request = message.Request; - request.Method = RequestMethod.Post; - var uri = new RawRequestUriBuilder(); - uri.Reset(_endpoint); - uri.AppendPath("/subscriptions/", false); - uri.AppendPath(subscriptionId, true); - uri.AppendPath("/resourceGroups/", false); - uri.AppendPath(resourceGroupName, true); - uri.AppendPath("/providers/Microsoft.DevTestLab/schedules/", false); - uri.AppendPath(name, true); - uri.AppendPath("/execute", false); - uri.AppendQuery("api-version", _apiVersion, true); - request.Uri = uri; - request.Headers.Add("Accept", "application/json"); - _userAgent.Apply(message); - return message; - } - - /// Execute a schedule. This operation can take a while to complete. - /// The subscription ID. - /// The name of the resource group. - /// The name of the schedule. - /// The cancellation token to use. - /// , or is null. - /// , or is an empty string, and was expected to be non-empty. - public async Task ExecuteAsync(string subscriptionId, string resourceGroupName, string name, CancellationToken cancellationToken = default) - { - Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); - Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); - Argument.AssertNotNullOrEmpty(name, nameof(name)); - - using var message = CreateExecuteRequest(subscriptionId, resourceGroupName, name); - await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); - switch (message.Response.Status) - { - case 200: - case 202: - return message.Response; - default: - throw new RequestFailedException(message.Response); - } - } - - /// Execute a schedule. This operation can take a while to complete. - /// The subscription ID. - /// The name of the resource group. - /// The name of the schedule. - /// The cancellation token to use. - /// , or is null. - /// , or is an empty string, and was expected to be non-empty. - public Response Execute(string subscriptionId, string resourceGroupName, string name, CancellationToken cancellationToken = default) - { - Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); - Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); - Argument.AssertNotNullOrEmpty(name, nameof(name)); - - using var message = CreateExecuteRequest(subscriptionId, resourceGroupName, name); - _pipeline.Send(message, cancellationToken); - switch (message.Response.Status) - { - case 200: - case 202: - return message.Response; - default: - throw new RequestFailedException(message.Response); - } - } - - internal RequestUriBuilder CreateRetargetRequestUri(string subscriptionId, string resourceGroupName, string name, DevTestLabGlobalScheduleRetargetContent content) - { - 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.DevTestLab/schedules/", false); - uri.AppendPath(name, true); - uri.AppendPath("/retarget", false); - uri.AppendQuery("api-version", _apiVersion, true); - return uri; - } - - internal HttpMessage CreateRetargetRequest(string subscriptionId, string resourceGroupName, string name, DevTestLabGlobalScheduleRetargetContent content) - { - var message = _pipeline.CreateMessage(); - var request = message.Request; - request.Method = RequestMethod.Post; - var uri = new RawRequestUriBuilder(); - uri.Reset(_endpoint); - uri.AppendPath("/subscriptions/", false); - uri.AppendPath(subscriptionId, true); - uri.AppendPath("/resourceGroups/", false); - uri.AppendPath(resourceGroupName, true); - uri.AppendPath("/providers/Microsoft.DevTestLab/schedules/", false); - uri.AppendPath(name, true); - uri.AppendPath("/retarget", false); - uri.AppendQuery("api-version", _apiVersion, true); - request.Uri = uri; - request.Headers.Add("Accept", "application/json"); - request.Headers.Add("Content-Type", "application/json"); - var content0 = new Utf8JsonRequestContent(); - content0.JsonWriter.WriteObjectValue(content, ModelSerializationExtensions.WireOptions); - request.Content = content0; - _userAgent.Apply(message); - return message; - } - - /// Updates a schedule's target resource Id. This operation can take a while to complete. - /// The subscription ID. - /// The name of the resource group. - /// The name of the schedule. - /// Properties for retargeting a virtual machine schedule. - /// The cancellation token to use. - /// , , or is null. - /// , or is an empty string, and was expected to be non-empty. - public async Task RetargetAsync(string subscriptionId, string resourceGroupName, string name, DevTestLabGlobalScheduleRetargetContent content, CancellationToken cancellationToken = default) - { - Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); - Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); - Argument.AssertNotNullOrEmpty(name, nameof(name)); - Argument.AssertNotNull(content, nameof(content)); - - using var message = CreateRetargetRequest(subscriptionId, resourceGroupName, name, content); - await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); - switch (message.Response.Status) - { - case 200: - case 202: - return message.Response; - default: - throw new RequestFailedException(message.Response); - } - } - - /// Updates a schedule's target resource Id. This operation can take a while to complete. - /// The subscription ID. - /// The name of the resource group. - /// The name of the schedule. - /// Properties for retargeting a virtual machine schedule. - /// The cancellation token to use. - /// , , or is null. - /// , or is an empty string, and was expected to be non-empty. - public Response Retarget(string subscriptionId, string resourceGroupName, string name, DevTestLabGlobalScheduleRetargetContent content, CancellationToken cancellationToken = default) - { - Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); - Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); - Argument.AssertNotNullOrEmpty(name, nameof(name)); - Argument.AssertNotNull(content, nameof(content)); - - using var message = CreateRetargetRequest(subscriptionId, resourceGroupName, name, content); - _pipeline.Send(message, cancellationToken); - switch (message.Response.Status) - { - case 200: - case 202: - return message.Response; - default: - throw new RequestFailedException(message.Response); - } - } - - internal RequestUriBuilder CreateListBySubscriptionNextPageRequestUri(string nextLink, string subscriptionId, string expand, string filter, int? top, string orderby) - { - var uri = new RawRequestUriBuilder(); - uri.Reset(_endpoint); - uri.AppendRawNextLink(nextLink, false); - return uri; - } - - internal HttpMessage CreateListBySubscriptionNextPageRequest(string nextLink, string subscriptionId, string expand, string filter, int? top, string orderby) - { - var message = _pipeline.CreateMessage(); - var request = message.Request; - request.Method = RequestMethod.Get; - var uri = new RawRequestUriBuilder(); - uri.Reset(_endpoint); - uri.AppendRawNextLink(nextLink, false); - request.Uri = uri; - request.Headers.Add("Accept", "application/json"); - _userAgent.Apply(message); - return message; - } - - /// List schedules in a subscription. - /// The URL to the next page of results. - /// The subscription ID. - /// Specify the $expand query. Example: 'properties($select=status)'. - /// The filter to apply to the operation. Example: '$filter=contains(name,'myName'). - /// The maximum number of resources to return from the operation. Example: '$top=10'. - /// The ordering expression for the results, using OData notation. Example: '$orderby=name desc'. - /// The cancellation token to use. - /// or is null. - /// is an empty string, and was expected to be non-empty. - public async Task> ListBySubscriptionNextPageAsync(string nextLink, string subscriptionId, string expand = null, string filter = null, int? top = null, string orderby = null, CancellationToken cancellationToken = default) - { - Argument.AssertNotNull(nextLink, nameof(nextLink)); - Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); - - using var message = CreateListBySubscriptionNextPageRequest(nextLink, subscriptionId, expand, filter, top, orderby); - await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); - switch (message.Response.Status) - { - case 200: - { - ScheduleList value = default; - using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, ModelSerializationExtensions.JsonDocumentOptions, cancellationToken).ConfigureAwait(false); - value = ScheduleList.DeserializeScheduleList(document.RootElement); - return Response.FromValue(value, message.Response); - } - default: - throw new RequestFailedException(message.Response); - } - } - - /// List schedules in a subscription. - /// The URL to the next page of results. - /// The subscription ID. - /// Specify the $expand query. Example: 'properties($select=status)'. - /// The filter to apply to the operation. Example: '$filter=contains(name,'myName'). - /// The maximum number of resources to return from the operation. Example: '$top=10'. - /// The ordering expression for the results, using OData notation. Example: '$orderby=name desc'. - /// The cancellation token to use. - /// or is null. - /// is an empty string, and was expected to be non-empty. - public Response ListBySubscriptionNextPage(string nextLink, string subscriptionId, string expand = null, string filter = null, int? top = null, string orderby = null, CancellationToken cancellationToken = default) - { - Argument.AssertNotNull(nextLink, nameof(nextLink)); - Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); - - using var message = CreateListBySubscriptionNextPageRequest(nextLink, subscriptionId, expand, filter, top, orderby); - _pipeline.Send(message, cancellationToken); - switch (message.Response.Status) - { - case 200: - { - ScheduleList value = default; - using var document = JsonDocument.Parse(message.Response.ContentStream, ModelSerializationExtensions.JsonDocumentOptions); - value = ScheduleList.DeserializeScheduleList(document.RootElement); - return Response.FromValue(value, message.Response); - } - default: - throw new RequestFailedException(message.Response); - } - } - - internal RequestUriBuilder CreateListByResourceGroupNextPageRequestUri(string nextLink, string subscriptionId, string resourceGroupName, string expand, string filter, int? top, string orderby) - { - var uri = new RawRequestUriBuilder(); - uri.Reset(_endpoint); - uri.AppendRawNextLink(nextLink, false); - return uri; - } - - internal HttpMessage CreateListByResourceGroupNextPageRequest(string nextLink, string subscriptionId, string resourceGroupName, string expand, string filter, int? top, string orderby) - { - var message = _pipeline.CreateMessage(); - var request = message.Request; - request.Method = RequestMethod.Get; - var uri = new RawRequestUriBuilder(); - uri.Reset(_endpoint); - uri.AppendRawNextLink(nextLink, false); - request.Uri = uri; - request.Headers.Add("Accept", "application/json"); - _userAgent.Apply(message); - return message; - } - - /// List schedules in a resource group. - /// The URL to the next page of results. - /// The subscription ID. - /// The name of the resource group. - /// Specify the $expand query. Example: 'properties($select=status)'. - /// The filter to apply to the operation. Example: '$filter=contains(name,'myName'). - /// The maximum number of resources to return from the operation. Example: '$top=10'. - /// The ordering expression for the results, using OData notation. Example: '$orderby=name desc'. - /// The cancellation token to use. - /// , or is null. - /// or is an empty string, and was expected to be non-empty. - public async Task> ListByResourceGroupNextPageAsync(string nextLink, string subscriptionId, string resourceGroupName, string expand = null, string filter = null, int? top = null, string orderby = null, CancellationToken cancellationToken = default) - { - Argument.AssertNotNull(nextLink, nameof(nextLink)); - Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); - Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); - - using var message = CreateListByResourceGroupNextPageRequest(nextLink, subscriptionId, resourceGroupName, expand, filter, top, orderby); - await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); - switch (message.Response.Status) - { - case 200: - { - ScheduleList value = default; - using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, ModelSerializationExtensions.JsonDocumentOptions, cancellationToken).ConfigureAwait(false); - value = ScheduleList.DeserializeScheduleList(document.RootElement); - return Response.FromValue(value, message.Response); - } - default: - throw new RequestFailedException(message.Response); - } - } - - /// List schedules in a resource group. - /// The URL to the next page of results. - /// The subscription ID. - /// The name of the resource group. - /// Specify the $expand query. Example: 'properties($select=status)'. - /// The filter to apply to the operation. Example: '$filter=contains(name,'myName'). - /// The maximum number of resources to return from the operation. Example: '$top=10'. - /// The ordering expression for the results, using OData notation. Example: '$orderby=name desc'. - /// The cancellation token to use. - /// , or is null. - /// or is an empty string, and was expected to be non-empty. - public Response ListByResourceGroupNextPage(string nextLink, string subscriptionId, string resourceGroupName, string expand = null, string filter = null, int? top = null, string orderby = null, CancellationToken cancellationToken = default) - { - Argument.AssertNotNull(nextLink, nameof(nextLink)); - Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); - Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); - - using var message = CreateListByResourceGroupNextPageRequest(nextLink, subscriptionId, resourceGroupName, expand, filter, top, orderby); - _pipeline.Send(message, cancellationToken); - switch (message.Response.Status) - { - case 200: - { - ScheduleList value = default; - using var document = JsonDocument.Parse(message.Response.ContentStream, ModelSerializationExtensions.JsonDocumentOptions); - value = ScheduleList.DeserializeScheduleList(document.RootElement); - return Response.FromValue(value, message.Response); - } - default: - throw new RequestFailedException(message.Response); - } - } - } -} diff --git a/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/RestOperations/LabsRestOperations.cs b/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/RestOperations/LabsRestOperations.cs index 84ddccb486b3..87ff56da2b15 100644 --- a/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/RestOperations/LabsRestOperations.cs +++ b/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/RestOperations/LabsRestOperations.cs @@ -6,283 +6,67 @@ #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.DevTestLabs.Models; namespace Azure.ResourceManager.DevTestLabs { - internal partial class LabsRestOperations + internal partial class Labs { - private readonly TelemetryDetails _userAgent; - private readonly HttpPipeline _pipeline; private readonly Uri _endpoint; private readonly string _apiVersion; - /// Initializes a new instance of LabsRestOperations. - /// The HTTP pipeline for sending and receiving REST requests and responses. - /// The application id to use for user agent. - /// server parameter. - /// Api Version. - /// or is null. - public LabsRestOperations(HttpPipeline pipeline, string applicationId, Uri endpoint = null, string apiVersion = default) + /// Initializes a new instance of Labs for mocking. + protected Labs() { - _pipeline = pipeline ?? throw new ArgumentNullException(nameof(pipeline)); - _endpoint = endpoint ?? new Uri("https://management.azure.com"); - _apiVersion = apiVersion ?? "2018-09-15"; - _userAgent = new TelemetryDetails(GetType().Assembly, applicationId); } - internal RequestUriBuilder CreateListBySubscriptionRequestUri(string subscriptionId, string expand, string filter, int? top, string orderby) - { - var uri = new RawRequestUriBuilder(); - uri.Reset(_endpoint); - uri.AppendPath("/subscriptions/", false); - uri.AppendPath(subscriptionId, true); - uri.AppendPath("/providers/Microsoft.DevTestLab/labs", false); - if (expand != null) - { - uri.AppendQuery("$expand", expand, true); - } - if (filter != null) - { - uri.AppendQuery("$filter", filter, true); - } - if (top != null) - { - uri.AppendQuery("$top", top.Value, true); - } - if (orderby != null) - { - uri.AppendQuery("$orderby", orderby, true); - } - uri.AppendQuery("api-version", _apiVersion, true); - return uri; - } - - internal HttpMessage CreateListBySubscriptionRequest(string subscriptionId, string expand, string filter, int? top, string orderby) - { - var message = _pipeline.CreateMessage(); - var request = message.Request; - request.Method = RequestMethod.Get; - var uri = new RawRequestUriBuilder(); - uri.Reset(_endpoint); - uri.AppendPath("/subscriptions/", false); - uri.AppendPath(subscriptionId, true); - uri.AppendPath("/providers/Microsoft.DevTestLab/labs", false); - if (expand != null) - { - uri.AppendQuery("$expand", expand, true); - } - if (filter != null) - { - uri.AppendQuery("$filter", filter, true); - } - if (top != null) - { - uri.AppendQuery("$top", top.Value, true); - } - if (orderby != null) - { - uri.AppendQuery("$orderby", orderby, true); - } - uri.AppendQuery("api-version", _apiVersion, true); - request.Uri = uri; - request.Headers.Add("Accept", "application/json"); - _userAgent.Apply(message); - return message; - } - - /// List labs in a subscription. - /// The subscription ID. - /// Specify the $expand query. Example: 'properties($select=defaultStorageAccount)'. - /// The filter to apply to the operation. Example: '$filter=contains(name,'myName'). - /// The maximum number of resources to return from the operation. Example: '$top=10'. - /// The ordering expression for the results, using OData notation. Example: '$orderby=name desc'. - /// The cancellation token to use. - /// is null. - /// is an empty string, and was expected to be non-empty. - public async Task> ListBySubscriptionAsync(string subscriptionId, string expand = null, string filter = null, int? top = null, string orderby = null, CancellationToken cancellationToken = default) + /// Initializes a new instance of Labs. + /// 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 Labs(ClientDiagnostics clientDiagnostics, HttpPipeline pipeline, Uri endpoint, string apiVersion) { - Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); - - using var message = CreateListBySubscriptionRequest(subscriptionId, expand, filter, top, orderby); - await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); - switch (message.Response.Status) - { - case 200: - { - LabList value = default; - using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, ModelSerializationExtensions.JsonDocumentOptions, cancellationToken).ConfigureAwait(false); - value = LabList.DeserializeLabList(document.RootElement); - return Response.FromValue(value, message.Response); - } - default: - throw new RequestFailedException(message.Response); - } + ClientDiagnostics = clientDiagnostics; + _endpoint = endpoint; + Pipeline = pipeline; + _apiVersion = apiVersion; } - /// List labs in a subscription. - /// The subscription ID. - /// Specify the $expand query. Example: 'properties($select=defaultStorageAccount)'. - /// The filter to apply to the operation. Example: '$filter=contains(name,'myName'). - /// The maximum number of resources to return from the operation. Example: '$top=10'. - /// The ordering expression for the results, using OData notation. Example: '$orderby=name desc'. - /// The cancellation token to use. - /// is null. - /// is an empty string, and was expected to be non-empty. - public Response ListBySubscription(string subscriptionId, string expand = null, string filter = null, int? top = null, string orderby = null, CancellationToken cancellationToken = default) - { - Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + /// The HTTP pipeline for sending and receiving REST requests and responses. + public virtual HttpPipeline Pipeline { get; } - using var message = CreateListBySubscriptionRequest(subscriptionId, expand, filter, top, orderby); - _pipeline.Send(message, cancellationToken); - switch (message.Response.Status) - { - case 200: - { - LabList value = default; - using var document = JsonDocument.Parse(message.Response.ContentStream, ModelSerializationExtensions.JsonDocumentOptions); - value = LabList.DeserializeLabList(document.RootElement); - return Response.FromValue(value, 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 CreateListByResourceGroupRequestUri(string subscriptionId, string resourceGroupName, string expand, string filter, int? top, string orderby) + internal HttpMessage CreateGetRequest(string subscriptionId, string resourceGroupName, string name, string expand, RequestContext context) { - 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.DevTestLab/labs", false); - if (expand != null) - { - uri.AppendQuery("$expand", expand, true); - } - if (filter != null) - { - uri.AppendQuery("$filter", filter, true); - } - if (top != null) - { - uri.AppendQuery("$top", top.Value, true); - } - if (orderby != null) - { - uri.AppendQuery("$orderby", orderby, true); - } + uri.AppendPath("/providers/Microsoft.DevTestLab/labs/", false); + uri.AppendPath(name, true); uri.AppendQuery("api-version", _apiVersion, true); - return uri; - } - - internal HttpMessage CreateListByResourceGroupRequest(string subscriptionId, string resourceGroupName, string expand, string filter, int? top, string orderby) - { - 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.DevTestLab/labs", false); if (expand != null) { uri.AppendQuery("$expand", expand, true); } - if (filter != null) - { - uri.AppendQuery("$filter", filter, true); - } - if (top != null) - { - uri.AppendQuery("$top", top.Value, true); - } - if (orderby != null) - { - uri.AppendQuery("$orderby", orderby, 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; } - /// List labs in a resource group. - /// The subscription ID. - /// The name of the resource group. - /// Specify the $expand query. Example: 'properties($select=defaultStorageAccount)'. - /// The filter to apply to the operation. Example: '$filter=contains(name,'myName'). - /// The maximum number of resources to return from the operation. Example: '$top=10'. - /// The ordering expression for the results, using OData notation. Example: '$orderby=name desc'. - /// The cancellation token to use. - /// or is null. - /// or is an empty string, and was expected to be non-empty. - public async Task> ListByResourceGroupAsync(string subscriptionId, string resourceGroupName, string expand = null, string filter = null, int? top = null, string orderby = null, CancellationToken cancellationToken = default) - { - Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); - Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); - - using var message = CreateListByResourceGroupRequest(subscriptionId, resourceGroupName, expand, filter, top, orderby); - await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); - switch (message.Response.Status) - { - case 200: - { - LabList value = default; - using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, ModelSerializationExtensions.JsonDocumentOptions, cancellationToken).ConfigureAwait(false); - value = LabList.DeserializeLabList(document.RootElement); - return Response.FromValue(value, message.Response); - } - default: - throw new RequestFailedException(message.Response); - } - } - - /// List labs in a resource group. - /// The subscription ID. - /// The name of the resource group. - /// Specify the $expand query. Example: 'properties($select=defaultStorageAccount)'. - /// The filter to apply to the operation. Example: '$filter=contains(name,'myName'). - /// The maximum number of resources to return from the operation. Example: '$top=10'. - /// The ordering expression for the results, using OData notation. Example: '$orderby=name desc'. - /// The cancellation token to use. - /// or is null. - /// or is an empty string, and was expected to be non-empty. - public Response ListByResourceGroup(string subscriptionId, string resourceGroupName, string expand = null, string filter = null, int? top = null, string orderby = null, CancellationToken cancellationToken = default) - { - Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); - Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); - - using var message = CreateListByResourceGroupRequest(subscriptionId, resourceGroupName, expand, filter, top, orderby); - _pipeline.Send(message, cancellationToken); - switch (message.Response.Status) - { - case 200: - { - LabList value = default; - using var document = JsonDocument.Parse(message.Response.ContentStream, ModelSerializationExtensions.JsonDocumentOptions); - value = LabList.DeserializeLabList(document.RootElement); - return Response.FromValue(value, message.Response); - } - default: - throw new RequestFailedException(message.Response); - } - } - - internal RequestUriBuilder CreateGetRequestUri(string subscriptionId, string resourceGroupName, string name, string expand) + internal HttpMessage CreateCreateOrUpdateRequest(string subscriptionId, string resourceGroupName, string name, RequestContent content, RequestContext context) { - var uri = new RawRequestUriBuilder(); + RawRequestUriBuilder uri = new RawRequestUriBuilder(); uri.Reset(_endpoint); uri.AppendPath("/subscriptions/", false); uri.AppendPath(subscriptionId, true); @@ -290,20 +74,20 @@ internal RequestUriBuilder CreateGetRequestUri(string subscriptionId, string res uri.AppendPath(resourceGroupName, true); uri.AppendPath("/providers/Microsoft.DevTestLab/labs/", false); uri.AppendPath(name, true); - if (expand != null) - { - uri.AppendQuery("$expand", expand, true); - } uri.AppendQuery("api-version", _apiVersion, true); - return uri; + HttpMessage message = Pipeline.CreateMessage(); + Request request = message.Request; + request.Uri = uri; + request.Method = RequestMethod.Put; + request.Headers.SetValue("Content-Type", "application/json"); + request.Headers.SetValue("Accept", "application/json"); + request.Content = content; + return message; } - internal HttpMessage CreateGetRequest(string subscriptionId, string resourceGroupName, string name, string expand) + internal HttpMessage CreateUpdateRequest(string subscriptionId, string resourceGroupName, string name, RequestContent content, 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); @@ -311,84 +95,20 @@ internal HttpMessage CreateGetRequest(string subscriptionId, string resourceGrou uri.AppendPath(resourceGroupName, true); uri.AppendPath("/providers/Microsoft.DevTestLab/labs/", false); uri.AppendPath(name, true); - if (expand != null) - { - uri.AppendQuery("$expand", expand, 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.Patch; + request.Headers.SetValue("Content-Type", "application/json"); + request.Headers.SetValue("Accept", "application/json"); + request.Content = content; return message; } - /// Get lab. - /// The subscription ID. - /// The name of the resource group. - /// The name of the lab. - /// Specify the $expand query. Example: 'properties($select=defaultStorageAccount)'. - /// 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 name, string expand = null, CancellationToken cancellationToken = default) + internal HttpMessage CreateDeleteRequest(string subscriptionId, string resourceGroupName, string name, RequestContext context) { - Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); - Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); - Argument.AssertNotNullOrEmpty(name, nameof(name)); - - using var message = CreateGetRequest(subscriptionId, resourceGroupName, name, expand); - await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); - switch (message.Response.Status) - { - case 200: - { - DevTestLabData value = default; - using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, ModelSerializationExtensions.JsonDocumentOptions, cancellationToken).ConfigureAwait(false); - value = DevTestLabData.DeserializeDevTestLabData(document.RootElement); - return Response.FromValue(value, message.Response); - } - case 404: - return Response.FromValue((DevTestLabData)null, message.Response); - default: - throw new RequestFailedException(message.Response); - } - } - - /// Get lab. - /// The subscription ID. - /// The name of the resource group. - /// The name of the lab. - /// Specify the $expand query. Example: 'properties($select=defaultStorageAccount)'. - /// 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 name, string expand = null, CancellationToken cancellationToken = default) - { - Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); - Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); - Argument.AssertNotNullOrEmpty(name, nameof(name)); - - using var message = CreateGetRequest(subscriptionId, resourceGroupName, name, expand); - _pipeline.Send(message, cancellationToken); - switch (message.Response.Status) - { - case 200: - { - DevTestLabData value = default; - using var document = JsonDocument.Parse(message.Response.ContentStream, ModelSerializationExtensions.JsonDocumentOptions); - value = DevTestLabData.DeserializeDevTestLabData(document.RootElement); - return Response.FromValue(value, message.Response); - } - case 404: - return Response.FromValue((DevTestLabData)null, message.Response); - default: - throw new RequestFailedException(message.Response); - } - } - - internal RequestUriBuilder CreateCreateOrUpdateRequestUri(string subscriptionId, string resourceGroupName, string name, DevTestLabData data) - { - var uri = new RawRequestUriBuilder(); + RawRequestUriBuilder uri = new RawRequestUriBuilder(); uri.Reset(_endpoint); uri.AppendPath("/subscriptions/", false); uri.AppendPath(subscriptionId, true); @@ -397,380 +117,108 @@ internal RequestUriBuilder CreateCreateOrUpdateRequestUri(string subscriptionId, uri.AppendPath("/providers/Microsoft.DevTestLab/labs/", false); uri.AppendPath(name, true); uri.AppendQuery("api-version", _apiVersion, true); - return uri; + HttpMessage message = Pipeline.CreateMessage(); + Request request = message.Request; + request.Uri = uri; + request.Method = RequestMethod.Delete; + return message; } - internal HttpMessage CreateCreateOrUpdateRequest(string subscriptionId, string resourceGroupName, string name, DevTestLabData data) + internal HttpMessage CreateGetByResourceGroupRequest(string subscriptionId, string resourceGroupName, string expand, string filter, int? top, string @orderby, 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("/resourceGroups/", false); uri.AppendPath(resourceGroupName, true); - uri.AppendPath("/providers/Microsoft.DevTestLab/labs/", false); - uri.AppendPath(name, true); + uri.AppendPath("/providers/Microsoft.DevTestLab/labs", false); uri.AppendQuery("api-version", _apiVersion, true); - request.Uri = uri; - request.Headers.Add("Accept", "application/json"); - request.Headers.Add("Content-Type", "application/json"); - var content = new Utf8JsonRequestContent(); - content.JsonWriter.WriteObjectValue(data, ModelSerializationExtensions.WireOptions); - request.Content = content; - _userAgent.Apply(message); - return message; - } - - /// Create or replace an existing lab. This operation can take a while to complete. - /// The subscription ID. - /// The name of the resource group. - /// The name of the lab. - /// A lab. - /// 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 name, DevTestLabData data, CancellationToken cancellationToken = default) - { - Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); - Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); - Argument.AssertNotNullOrEmpty(name, nameof(name)); - Argument.AssertNotNull(data, nameof(data)); - - using var message = CreateCreateOrUpdateRequest(subscriptionId, resourceGroupName, name, data); - await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); - switch (message.Response.Status) + if (expand != null) { - case 200: - case 201: - return message.Response; - default: - throw new RequestFailedException(message.Response); + uri.AppendQuery("$expand", expand, true); } - } - - /// Create or replace an existing lab. This operation can take a while to complete. - /// The subscription ID. - /// The name of the resource group. - /// The name of the lab. - /// A lab. - /// 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 name, DevTestLabData data, CancellationToken cancellationToken = default) - { - Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); - Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); - Argument.AssertNotNullOrEmpty(name, nameof(name)); - Argument.AssertNotNull(data, nameof(data)); - - using var message = CreateCreateOrUpdateRequest(subscriptionId, resourceGroupName, name, data); - _pipeline.Send(message, cancellationToken); - switch (message.Response.Status) + if (filter != null) { - case 200: - case 201: - return message.Response; - default: - throw new RequestFailedException(message.Response); + uri.AppendQuery("$filter", filter, true); } - } - - internal RequestUriBuilder CreateDeleteRequestUri(string subscriptionId, string resourceGroupName, string name) - { - 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.DevTestLab/labs/", false); - uri.AppendPath(name, true); - uri.AppendQuery("api-version", _apiVersion, true); - return uri; - } - - internal HttpMessage CreateDeleteRequest(string subscriptionId, string resourceGroupName, string name) - { - 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("/resourceGroups/", false); - uri.AppendPath(resourceGroupName, true); - uri.AppendPath("/providers/Microsoft.DevTestLab/labs/", false); - uri.AppendPath(name, true); - uri.AppendQuery("api-version", _apiVersion, true); - request.Uri = uri; - request.Headers.Add("Accept", "application/json"); - _userAgent.Apply(message); - return message; - } - - /// Delete lab. This operation can take a while to complete. - /// The subscription ID. - /// The name of the resource group. - /// The name of the lab. - /// 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 name, CancellationToken cancellationToken = default) - { - Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); - Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); - Argument.AssertNotNullOrEmpty(name, nameof(name)); - - using var message = CreateDeleteRequest(subscriptionId, resourceGroupName, name); - await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); - switch (message.Response.Status) + if (top != null) { - case 200: - case 202: - case 204: - return message.Response; - default: - throw new RequestFailedException(message.Response); + uri.AppendQuery("$top", TypeFormatters.ConvertToString(top), true); } - } - - /// Delete lab. This operation can take a while to complete. - /// The subscription ID. - /// The name of the resource group. - /// The name of the lab. - /// 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 name, CancellationToken cancellationToken = default) - { - Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); - Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); - Argument.AssertNotNullOrEmpty(name, nameof(name)); - - using var message = CreateDeleteRequest(subscriptionId, resourceGroupName, name); - _pipeline.Send(message, cancellationToken); - switch (message.Response.Status) + if (@orderby != null) { - case 200: - case 202: - case 204: - return message.Response; - default: - throw new RequestFailedException(message.Response); + uri.AppendQuery("$orderby", @orderby, true); } + HttpMessage message = Pipeline.CreateMessage(); + Request request = message.Request; + request.Uri = uri; + request.Method = RequestMethod.Get; + request.Headers.SetValue("Accept", "application/json"); + return message; } - internal RequestUriBuilder CreateUpdateRequestUri(string subscriptionId, string resourceGroupName, string name, DevTestLabPatch patch) + internal HttpMessage CreateNextGetByResourceGroupRequest(Uri nextPage, string subscriptionId, string resourceGroupName, string expand, string filter, int? top, string @orderby, RequestContext context) { - 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.DevTestLab/labs/", false); - uri.AppendPath(name, true); - uri.AppendQuery("api-version", _apiVersion, true); - return uri; + RawRequestUriBuilder uri = new RawRequestUriBuilder(); + uri.Reset(nextPage); + uri.UpdateQuery("api-version", _apiVersion); + 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 CreateUpdateRequest(string subscriptionId, string resourceGroupName, string name, DevTestLabPatch patch) + internal HttpMessage CreateGetBySubscriptionRequest(string subscriptionId, string expand, string filter, int? top, string @orderby, RequestContext context) { - 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("/resourceGroups/", false); - uri.AppendPath(resourceGroupName, true); - uri.AppendPath("/providers/Microsoft.DevTestLab/labs/", false); - uri.AppendPath(name, true); + uri.AppendPath("/providers/Microsoft.DevTestLab/labs", false); uri.AppendQuery("api-version", _apiVersion, true); - request.Uri = uri; - request.Headers.Add("Accept", "application/json"); - request.Headers.Add("Content-Type", "application/json"); - var content = new Utf8JsonRequestContent(); - content.JsonWriter.WriteObjectValue(patch, ModelSerializationExtensions.WireOptions); - request.Content = content; - _userAgent.Apply(message); - return message; - } - - /// Allows modifying tags of labs. All other properties will be ignored. - /// The subscription ID. - /// The name of the resource group. - /// The name of the lab. - /// A lab. - /// 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 name, DevTestLabPatch patch, CancellationToken cancellationToken = default) - { - Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); - Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); - Argument.AssertNotNullOrEmpty(name, nameof(name)); - Argument.AssertNotNull(patch, nameof(patch)); - - using var message = CreateUpdateRequest(subscriptionId, resourceGroupName, name, patch); - await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); - switch (message.Response.Status) + if (expand != null) { - case 200: - { - DevTestLabData value = default; - using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, ModelSerializationExtensions.JsonDocumentOptions, cancellationToken).ConfigureAwait(false); - value = DevTestLabData.DeserializeDevTestLabData(document.RootElement); - return Response.FromValue(value, message.Response); - } - default: - throw new RequestFailedException(message.Response); + uri.AppendQuery("$expand", expand, true); } - } - - /// Allows modifying tags of labs. All other properties will be ignored. - /// The subscription ID. - /// The name of the resource group. - /// The name of the lab. - /// A lab. - /// 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 name, DevTestLabPatch patch, CancellationToken cancellationToken = default) - { - Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); - Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); - Argument.AssertNotNullOrEmpty(name, nameof(name)); - Argument.AssertNotNull(patch, nameof(patch)); - - using var message = CreateUpdateRequest(subscriptionId, resourceGroupName, name, patch); - _pipeline.Send(message, cancellationToken); - switch (message.Response.Status) + if (filter != null) { - case 200: - { - DevTestLabData value = default; - using var document = JsonDocument.Parse(message.Response.ContentStream, ModelSerializationExtensions.JsonDocumentOptions); - value = DevTestLabData.DeserializeDevTestLabData(document.RootElement); - return Response.FromValue(value, message.Response); - } - default: - throw new RequestFailedException(message.Response); + uri.AppendQuery("$filter", filter, true); } - } - - internal RequestUriBuilder CreateClaimAnyVmRequestUri(string subscriptionId, string resourceGroupName, string name) - { - 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.DevTestLab/labs/", false); - uri.AppendPath(name, true); - uri.AppendPath("/claimAnyVm", false); - uri.AppendQuery("api-version", _apiVersion, true); - return uri; - } - - internal HttpMessage CreateClaimAnyVmRequest(string subscriptionId, string resourceGroupName, string name) - { - var message = _pipeline.CreateMessage(); - var request = message.Request; - request.Method = RequestMethod.Post; - var uri = new RawRequestUriBuilder(); - uri.Reset(_endpoint); - uri.AppendPath("/subscriptions/", false); - uri.AppendPath(subscriptionId, true); - uri.AppendPath("/resourceGroups/", false); - uri.AppendPath(resourceGroupName, true); - uri.AppendPath("/providers/Microsoft.DevTestLab/labs/", false); - uri.AppendPath(name, true); - uri.AppendPath("/claimAnyVm", false); - uri.AppendQuery("api-version", _apiVersion, true); - request.Uri = uri; - request.Headers.Add("Accept", "application/json"); - _userAgent.Apply(message); - return message; - } - - /// Claim a random claimable virtual machine in the lab. This operation can take a while to complete. - /// The subscription ID. - /// The name of the resource group. - /// The name of the lab. - /// The cancellation token to use. - /// , or is null. - /// , or is an empty string, and was expected to be non-empty. - public async Task ClaimAnyVmAsync(string subscriptionId, string resourceGroupName, string name, CancellationToken cancellationToken = default) - { - Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); - Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); - Argument.AssertNotNullOrEmpty(name, nameof(name)); - - using var message = CreateClaimAnyVmRequest(subscriptionId, resourceGroupName, name); - await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); - switch (message.Response.Status) + if (top != null) { - case 200: - case 202: - return message.Response; - default: - throw new RequestFailedException(message.Response); + uri.AppendQuery("$top", TypeFormatters.ConvertToString(top), true); } - } - - /// Claim a random claimable virtual machine in the lab. This operation can take a while to complete. - /// The subscription ID. - /// The name of the resource group. - /// The name of the lab. - /// The cancellation token to use. - /// , or is null. - /// , or is an empty string, and was expected to be non-empty. - public Response ClaimAnyVm(string subscriptionId, string resourceGroupName, string name, CancellationToken cancellationToken = default) - { - Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); - Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); - Argument.AssertNotNullOrEmpty(name, nameof(name)); - - using var message = CreateClaimAnyVmRequest(subscriptionId, resourceGroupName, name); - _pipeline.Send(message, cancellationToken); - switch (message.Response.Status) + if (@orderby != null) { - case 200: - case 202: - return message.Response; - default: - throw new RequestFailedException(message.Response); + uri.AppendQuery("$orderby", @orderby, true); } + HttpMessage message = Pipeline.CreateMessage(); + Request request = message.Request; + request.Uri = uri; + request.Method = RequestMethod.Get; + request.Headers.SetValue("Accept", "application/json"); + return message; } - internal RequestUriBuilder CreateCreateEnvironmentRequestUri(string subscriptionId, string resourceGroupName, string name, DevTestLabVmCreationContent content) + internal HttpMessage CreateNextGetBySubscriptionRequest(Uri nextPage, string subscriptionId, string expand, string filter, int? top, string @orderby, RequestContext context) { - 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.DevTestLab/labs/", false); - uri.AppendPath(name, true); - uri.AppendPath("/createEnvironment", false); - uri.AppendQuery("api-version", _apiVersion, true); - return uri; + RawRequestUriBuilder uri = new RawRequestUriBuilder(); + uri.Reset(nextPage); + uri.UpdateQuery("api-version", _apiVersion); + 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 CreateCreateEnvironmentRequest(string subscriptionId, string resourceGroupName, string name, DevTestLabVmCreationContent content) + internal HttpMessage CreateClaimAnyVmRequest(string subscriptionId, string resourceGroupName, string name, RequestContext context) { - var message = _pipeline.CreateMessage(); - var request = message.Request; - request.Method = RequestMethod.Post; - var uri = new RawRequestUriBuilder(); + RawRequestUriBuilder uri = new RawRequestUriBuilder(); uri.Reset(_endpoint); uri.AppendPath("/subscriptions/", false); uri.AppendPath(subscriptionId, true); @@ -778,75 +226,18 @@ internal HttpMessage CreateCreateEnvironmentRequest(string subscriptionId, strin uri.AppendPath(resourceGroupName, true); uri.AppendPath("/providers/Microsoft.DevTestLab/labs/", false); uri.AppendPath(name, true); - uri.AppendPath("/createEnvironment", false); + uri.AppendPath("/claimAnyVm", false); 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 content0 = new Utf8JsonRequestContent(); - content0.JsonWriter.WriteObjectValue(content, ModelSerializationExtensions.WireOptions); - request.Content = content0; - _userAgent.Apply(message); + request.Method = RequestMethod.Post; return message; } - /// Create virtual machines in a lab. This operation can take a while to complete. - /// The subscription ID. - /// The name of the resource group. - /// The name of the lab. - /// Properties for creating a 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 CreateEnvironmentAsync(string subscriptionId, string resourceGroupName, string name, DevTestLabVmCreationContent content, CancellationToken cancellationToken = default) - { - Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); - Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); - Argument.AssertNotNullOrEmpty(name, nameof(name)); - Argument.AssertNotNull(content, nameof(content)); - - using var message = CreateCreateEnvironmentRequest(subscriptionId, resourceGroupName, name, content); - await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); - switch (message.Response.Status) - { - case 200: - case 202: - return message.Response; - default: - throw new RequestFailedException(message.Response); - } - } - - /// Create virtual machines in a lab. This operation can take a while to complete. - /// The subscription ID. - /// The name of the resource group. - /// The name of the lab. - /// Properties for creating a virtual machine. - /// The cancellation token to use. - /// , , or is null. - /// , or is an empty string, and was expected to be non-empty. - public Response CreateEnvironment(string subscriptionId, string resourceGroupName, string name, DevTestLabVmCreationContent content, CancellationToken cancellationToken = default) - { - Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); - Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); - Argument.AssertNotNullOrEmpty(name, nameof(name)); - Argument.AssertNotNull(content, nameof(content)); - - using var message = CreateCreateEnvironmentRequest(subscriptionId, resourceGroupName, name, content); - _pipeline.Send(message, cancellationToken); - switch (message.Response.Status) - { - case 200: - case 202: - return message.Response; - default: - throw new RequestFailedException(message.Response); - } - } - - internal RequestUriBuilder CreateExportResourceUsageRequestUri(string subscriptionId, string resourceGroupName, string name, DevTestLabExportResourceUsageContent content) + internal HttpMessage CreateCreateEnvironmentRequest(string subscriptionId, string resourceGroupName, string name, RequestContent content, RequestContext context) { - var uri = new RawRequestUriBuilder(); + RawRequestUriBuilder uri = new RawRequestUriBuilder(); uri.Reset(_endpoint); uri.AppendPath("/subscriptions/", false); uri.AppendPath(subscriptionId, true); @@ -854,17 +245,20 @@ internal RequestUriBuilder CreateExportResourceUsageRequestUri(string subscripti uri.AppendPath(resourceGroupName, true); uri.AppendPath("/providers/Microsoft.DevTestLab/labs/", false); uri.AppendPath(name, true); - uri.AppendPath("/exportResourceUsage", false); + uri.AppendPath("/createEnvironment", false); uri.AppendQuery("api-version", _apiVersion, true); - return uri; + HttpMessage message = Pipeline.CreateMessage(); + Request request = message.Request; + request.Uri = uri; + request.Method = RequestMethod.Post; + request.Headers.SetValue("Content-Type", "application/json"); + request.Content = content; + return message; } - internal HttpMessage CreateExportResourceUsageRequest(string subscriptionId, string resourceGroupName, string name, DevTestLabExportResourceUsageContent content) + internal HttpMessage CreateExportResourceUsageRequest(string subscriptionId, string resourceGroupName, string name, RequestContent content, RequestContext context) { - var message = _pipeline.CreateMessage(); - var request = message.Request; - request.Method = RequestMethod.Post; - var uri = new RawRequestUriBuilder(); + RawRequestUriBuilder uri = new RawRequestUriBuilder(); uri.Reset(_endpoint); uri.AppendPath("/subscriptions/", false); uri.AppendPath(subscriptionId, true); @@ -874,91 +268,18 @@ internal HttpMessage CreateExportResourceUsageRequest(string subscriptionId, str uri.AppendPath(name, true); uri.AppendPath("/exportResourceUsage", false); 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 content0 = new Utf8JsonRequestContent(); - content0.JsonWriter.WriteObjectValue(content, ModelSerializationExtensions.WireOptions); - request.Content = content0; - _userAgent.Apply(message); + request.Method = RequestMethod.Post; + request.Headers.SetValue("Content-Type", "application/json"); + request.Content = content; return message; } - /// Exports the lab resource usage into a storage account This operation can take a while to complete. - /// The subscription ID. - /// The name of the resource group. - /// The name of the lab. - /// The parameters of the export operation. - /// The cancellation token to use. - /// , , or is null. - /// , or is an empty string, and was expected to be non-empty. - public async Task ExportResourceUsageAsync(string subscriptionId, string resourceGroupName, string name, DevTestLabExportResourceUsageContent content, CancellationToken cancellationToken = default) + internal HttpMessage CreateGenerateUploadUriRequest(string subscriptionId, string resourceGroupName, string name, RequestContent content, RequestContext context) { - Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); - Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); - Argument.AssertNotNullOrEmpty(name, nameof(name)); - Argument.AssertNotNull(content, nameof(content)); - - using var message = CreateExportResourceUsageRequest(subscriptionId, resourceGroupName, name, content); - await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); - switch (message.Response.Status) - { - case 200: - case 202: - return message.Response; - default: - throw new RequestFailedException(message.Response); - } - } - - /// Exports the lab resource usage into a storage account This operation can take a while to complete. - /// The subscription ID. - /// The name of the resource group. - /// The name of the lab. - /// The parameters of the export operation. - /// The cancellation token to use. - /// , , or is null. - /// , or is an empty string, and was expected to be non-empty. - public Response ExportResourceUsage(string subscriptionId, string resourceGroupName, string name, DevTestLabExportResourceUsageContent content, CancellationToken cancellationToken = default) - { - Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); - Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); - Argument.AssertNotNullOrEmpty(name, nameof(name)); - Argument.AssertNotNull(content, nameof(content)); - - using var message = CreateExportResourceUsageRequest(subscriptionId, resourceGroupName, name, content); - _pipeline.Send(message, cancellationToken); - switch (message.Response.Status) - { - case 200: - case 202: - return message.Response; - default: - throw new RequestFailedException(message.Response); - } - } - - internal RequestUriBuilder CreateGenerateUploadUriRequestUri(string subscriptionId, string resourceGroupName, string name, DevTestLabGenerateUploadUriContent content) - { - 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.DevTestLab/labs/", false); - uri.AppendPath(name, true); - uri.AppendPath("/generateUploadUri", false); - uri.AppendQuery("api-version", _apiVersion, true); - return uri; - } - - internal HttpMessage CreateGenerateUploadUriRequest(string subscriptionId, string resourceGroupName, string name, DevTestLabGenerateUploadUriContent content) - { - var message = _pipeline.CreateMessage(); - var request = message.Request; - request.Method = RequestMethod.Post; - var uri = new RawRequestUriBuilder(); + RawRequestUriBuilder uri = new RawRequestUriBuilder(); uri.Reset(_endpoint); uri.AppendPath("/subscriptions/", false); uri.AppendPath(subscriptionId, true); @@ -968,99 +289,19 @@ internal HttpMessage CreateGenerateUploadUriRequest(string subscriptionId, strin uri.AppendPath(name, true); uri.AppendPath("/generateUploadUri", false); 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 content0 = new Utf8JsonRequestContent(); - content0.JsonWriter.WriteObjectValue(content, ModelSerializationExtensions.WireOptions); - request.Content = content0; - _userAgent.Apply(message); + request.Method = RequestMethod.Post; + request.Headers.SetValue("Content-Type", "application/json"); + request.Headers.SetValue("Accept", "application/json"); + request.Content = content; return message; } - /// Generate a URI for uploading custom disk images to a Lab. - /// The subscription ID. - /// The name of the resource group. - /// The name of the lab. - /// Properties for generating an upload URI. - /// The cancellation token to use. - /// , , or is null. - /// , or is an empty string, and was expected to be non-empty. - public async Task> GenerateUploadUriAsync(string subscriptionId, string resourceGroupName, string name, DevTestLabGenerateUploadUriContent content, CancellationToken cancellationToken = default) - { - Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); - Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); - Argument.AssertNotNullOrEmpty(name, nameof(name)); - Argument.AssertNotNull(content, nameof(content)); - - using var message = CreateGenerateUploadUriRequest(subscriptionId, resourceGroupName, name, content); - await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); - switch (message.Response.Status) - { - case 200: - { - DevTestLabGenerateUploadUriResult value = default; - using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, ModelSerializationExtensions.JsonDocumentOptions, cancellationToken).ConfigureAwait(false); - value = DevTestLabGenerateUploadUriResult.DeserializeDevTestLabGenerateUploadUriResult(document.RootElement); - return Response.FromValue(value, message.Response); - } - default: - throw new RequestFailedException(message.Response); - } - } - - /// Generate a URI for uploading custom disk images to a Lab. - /// The subscription ID. - /// The name of the resource group. - /// The name of the lab. - /// Properties for generating an upload URI. - /// The cancellation token to use. - /// , , or is null. - /// , or is an empty string, and was expected to be non-empty. - public Response GenerateUploadUri(string subscriptionId, string resourceGroupName, string name, DevTestLabGenerateUploadUriContent content, CancellationToken cancellationToken = default) - { - Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); - Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); - Argument.AssertNotNullOrEmpty(name, nameof(name)); - Argument.AssertNotNull(content, nameof(content)); - - using var message = CreateGenerateUploadUriRequest(subscriptionId, resourceGroupName, name, content); - _pipeline.Send(message, cancellationToken); - switch (message.Response.Status) - { - case 200: - { - DevTestLabGenerateUploadUriResult value = default; - using var document = JsonDocument.Parse(message.Response.ContentStream, ModelSerializationExtensions.JsonDocumentOptions); - value = DevTestLabGenerateUploadUriResult.DeserializeDevTestLabGenerateUploadUriResult(document.RootElement); - return Response.FromValue(value, message.Response); - } - default: - throw new RequestFailedException(message.Response); - } - } - - internal RequestUriBuilder CreateImportVmRequestUri(string subscriptionId, string resourceGroupName, string name, DevTestLabImportVmContent content) + internal HttpMessage CreateImportVmRequest(string subscriptionId, string resourceGroupName, string name, RequestContent content, RequestContext context) { - 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.DevTestLab/labs/", false); - uri.AppendPath(name, true); - uri.AppendPath("/importVirtualMachine", false); - uri.AppendQuery("api-version", _apiVersion, true); - return uri; - } - - internal HttpMessage CreateImportVmRequest(string subscriptionId, string resourceGroupName, string name, DevTestLabImportVmContent content) - { - var message = _pipeline.CreateMessage(); - var request = message.Request; - request.Method = RequestMethod.Post; - var uri = new RawRequestUriBuilder(); + RawRequestUriBuilder uri = new RawRequestUriBuilder(); uri.Reset(_endpoint); uri.AppendPath("/subscriptions/", false); uri.AppendPath(subscriptionId, true); @@ -1070,91 +311,18 @@ internal HttpMessage CreateImportVmRequest(string subscriptionId, string resourc uri.AppendPath(name, true); uri.AppendPath("/importVirtualMachine", false); 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 content0 = new Utf8JsonRequestContent(); - content0.JsonWriter.WriteObjectValue(content, ModelSerializationExtensions.WireOptions); - request.Content = content0; - _userAgent.Apply(message); + request.Method = RequestMethod.Post; + request.Headers.SetValue("Content-Type", "application/json"); + request.Content = content; return message; } - /// Import a virtual machine into a different lab. This operation can take a while to complete. - /// The subscription ID. - /// The name of the resource group. - /// The name of the lab. - /// This represents the payload required to import a virtual machine from a different lab into the current one. - /// The cancellation token to use. - /// , , or is null. - /// , or is an empty string, and was expected to be non-empty. - public async Task ImportVmAsync(string subscriptionId, string resourceGroupName, string name, DevTestLabImportVmContent content, CancellationToken cancellationToken = default) + internal HttpMessage CreateGetDevTestLabVhdsRequest(string subscriptionId, string resourceGroupName, string name, RequestContext context) { - Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); - Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); - Argument.AssertNotNullOrEmpty(name, nameof(name)); - Argument.AssertNotNull(content, nameof(content)); - - using var message = CreateImportVmRequest(subscriptionId, resourceGroupName, name, content); - await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); - switch (message.Response.Status) - { - case 200: - case 202: - return message.Response; - default: - throw new RequestFailedException(message.Response); - } - } - - /// Import a virtual machine into a different lab. This operation can take a while to complete. - /// The subscription ID. - /// The name of the resource group. - /// The name of the lab. - /// This represents the payload required to import a virtual machine from a different lab into the current one. - /// The cancellation token to use. - /// , , or is null. - /// , or is an empty string, and was expected to be non-empty. - public Response ImportVm(string subscriptionId, string resourceGroupName, string name, DevTestLabImportVmContent content, CancellationToken cancellationToken = default) - { - Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); - Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); - Argument.AssertNotNullOrEmpty(name, nameof(name)); - Argument.AssertNotNull(content, nameof(content)); - - using var message = CreateImportVmRequest(subscriptionId, resourceGroupName, name, content); - _pipeline.Send(message, cancellationToken); - switch (message.Response.Status) - { - case 200: - case 202: - return message.Response; - default: - throw new RequestFailedException(message.Response); - } - } - - internal RequestUriBuilder CreateListVhdsRequestUri(string subscriptionId, string resourceGroupName, string name) - { - 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.DevTestLab/labs/", false); - uri.AppendPath(name, true); - uri.AppendPath("/listVhds", false); - uri.AppendQuery("api-version", _apiVersion, true); - return uri; - } - - internal HttpMessage CreateListVhdsRequest(string subscriptionId, string resourceGroupName, string name) - { - var message = _pipeline.CreateMessage(); - var request = message.Request; - request.Method = RequestMethod.Post; - var uri = new RawRequestUriBuilder(); + RawRequestUriBuilder uri = new RawRequestUriBuilder(); uri.Reset(_endpoint); uri.AppendPath("/subscriptions/", false); uri.AppendPath(subscriptionId, true); @@ -1164,324 +332,25 @@ internal HttpMessage CreateListVhdsRequest(string subscriptionId, string resourc uri.AppendPath(name, true); uri.AppendPath("/listVhds", 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 disk images available for custom image creation. - /// The subscription ID. - /// The name of the resource group. - /// The name of the lab. - /// The cancellation token to use. - /// , or is null. - /// , or is an empty string, and was expected to be non-empty. - public async Task> ListVhdsAsync(string subscriptionId, string resourceGroupName, string name, CancellationToken cancellationToken = default) - { - Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); - Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); - Argument.AssertNotNullOrEmpty(name, nameof(name)); - - using var message = CreateListVhdsRequest(subscriptionId, resourceGroupName, name); - await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); - switch (message.Response.Status) - { - case 200: - { - LabVhdList value = default; - using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, ModelSerializationExtensions.JsonDocumentOptions, cancellationToken).ConfigureAwait(false); - value = LabVhdList.DeserializeLabVhdList(document.RootElement); - return Response.FromValue(value, message.Response); - } - default: - throw new RequestFailedException(message.Response); - } - } - - /// List disk images available for custom image creation. - /// The subscription ID. - /// The name of the resource group. - /// The name of the lab. - /// The cancellation token to use. - /// , or is null. - /// , or is an empty string, and was expected to be non-empty. - public Response ListVhds(string subscriptionId, string resourceGroupName, string name, CancellationToken cancellationToken = default) - { - Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); - Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); - Argument.AssertNotNullOrEmpty(name, nameof(name)); - - using var message = CreateListVhdsRequest(subscriptionId, resourceGroupName, name); - _pipeline.Send(message, cancellationToken); - switch (message.Response.Status) - { - case 200: - { - LabVhdList value = default; - using var document = JsonDocument.Parse(message.Response.ContentStream, ModelSerializationExtensions.JsonDocumentOptions); - value = LabVhdList.DeserializeLabVhdList(document.RootElement); - return Response.FromValue(value, message.Response); - } - default: - throw new RequestFailedException(message.Response); - } - } - - internal RequestUriBuilder CreateListBySubscriptionNextPageRequestUri(string nextLink, string subscriptionId, string expand, string filter, int? top, string orderby) - { - var uri = new RawRequestUriBuilder(); - uri.Reset(_endpoint); - uri.AppendRawNextLink(nextLink, false); - return uri; - } - - internal HttpMessage CreateListBySubscriptionNextPageRequest(string nextLink, string subscriptionId, string expand, string filter, int? top, string orderby) - { - var message = _pipeline.CreateMessage(); - var request = message.Request; - request.Method = RequestMethod.Get; - var uri = new RawRequestUriBuilder(); - uri.Reset(_endpoint); - uri.AppendRawNextLink(nextLink, false); - request.Uri = uri; - request.Headers.Add("Accept", "application/json"); - _userAgent.Apply(message); - return message; - } - - /// List labs in a subscription. - /// The URL to the next page of results. - /// The subscription ID. - /// Specify the $expand query. Example: 'properties($select=defaultStorageAccount)'. - /// The filter to apply to the operation. Example: '$filter=contains(name,'myName'). - /// The maximum number of resources to return from the operation. Example: '$top=10'. - /// The ordering expression for the results, using OData notation. Example: '$orderby=name desc'. - /// The cancellation token to use. - /// or is null. - /// is an empty string, and was expected to be non-empty. - public async Task> ListBySubscriptionNextPageAsync(string nextLink, string subscriptionId, string expand = null, string filter = null, int? top = null, string orderby = null, CancellationToken cancellationToken = default) - { - Argument.AssertNotNull(nextLink, nameof(nextLink)); - Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); - - using var message = CreateListBySubscriptionNextPageRequest(nextLink, subscriptionId, expand, filter, top, orderby); - await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); - switch (message.Response.Status) - { - case 200: - { - LabList value = default; - using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, ModelSerializationExtensions.JsonDocumentOptions, cancellationToken).ConfigureAwait(false); - value = LabList.DeserializeLabList(document.RootElement); - return Response.FromValue(value, message.Response); - } - default: - throw new RequestFailedException(message.Response); - } - } - - /// List labs in a subscription. - /// The URL to the next page of results. - /// The subscription ID. - /// Specify the $expand query. Example: 'properties($select=defaultStorageAccount)'. - /// The filter to apply to the operation. Example: '$filter=contains(name,'myName'). - /// The maximum number of resources to return from the operation. Example: '$top=10'. - /// The ordering expression for the results, using OData notation. Example: '$orderby=name desc'. - /// The cancellation token to use. - /// or is null. - /// is an empty string, and was expected to be non-empty. - public Response ListBySubscriptionNextPage(string nextLink, string subscriptionId, string expand = null, string filter = null, int? top = null, string orderby = null, CancellationToken cancellationToken = default) - { - Argument.AssertNotNull(nextLink, nameof(nextLink)); - Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); - - using var message = CreateListBySubscriptionNextPageRequest(nextLink, subscriptionId, expand, filter, top, orderby); - _pipeline.Send(message, cancellationToken); - switch (message.Response.Status) - { - case 200: - { - LabList value = default; - using var document = JsonDocument.Parse(message.Response.ContentStream, ModelSerializationExtensions.JsonDocumentOptions); - value = LabList.DeserializeLabList(document.RootElement); - return Response.FromValue(value, message.Response); - } - default: - throw new RequestFailedException(message.Response); - } - } - - internal RequestUriBuilder CreateListByResourceGroupNextPageRequestUri(string nextLink, string subscriptionId, string resourceGroupName, string expand, string filter, int? top, string orderby) - { - var uri = new RawRequestUriBuilder(); - uri.Reset(_endpoint); - uri.AppendRawNextLink(nextLink, false); - return uri; - } - - internal HttpMessage CreateListByResourceGroupNextPageRequest(string nextLink, string subscriptionId, string resourceGroupName, string expand, string filter, int? top, string orderby) - { - 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.Method = RequestMethod.Post; + request.Headers.SetValue("Accept", "application/json"); return message; } - /// List labs in a resource group. - /// The URL to the next page of results. - /// The subscription ID. - /// The name of the resource group. - /// Specify the $expand query. Example: 'properties($select=defaultStorageAccount)'. - /// The filter to apply to the operation. Example: '$filter=contains(name,'myName'). - /// The maximum number of resources to return from the operation. Example: '$top=10'. - /// The ordering expression for the results, using OData notation. Example: '$orderby=name desc'. - /// The cancellation token to use. - /// , or is null. - /// or is an empty string, and was expected to be non-empty. - public async Task> ListByResourceGroupNextPageAsync(string nextLink, string subscriptionId, string resourceGroupName, string expand = null, string filter = null, int? top = null, string orderby = null, CancellationToken cancellationToken = default) - { - Argument.AssertNotNull(nextLink, nameof(nextLink)); - Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); - Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); - - using var message = CreateListByResourceGroupNextPageRequest(nextLink, subscriptionId, resourceGroupName, expand, filter, top, orderby); - await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); - switch (message.Response.Status) - { - case 200: - { - LabList value = default; - using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, ModelSerializationExtensions.JsonDocumentOptions, cancellationToken).ConfigureAwait(false); - value = LabList.DeserializeLabList(document.RootElement); - return Response.FromValue(value, message.Response); - } - default: - throw new RequestFailedException(message.Response); - } - } - - /// List labs in a resource group. - /// The URL to the next page of results. - /// The subscription ID. - /// The name of the resource group. - /// Specify the $expand query. Example: 'properties($select=defaultStorageAccount)'. - /// The filter to apply to the operation. Example: '$filter=contains(name,'myName'). - /// The maximum number of resources to return from the operation. Example: '$top=10'. - /// The ordering expression for the results, using OData notation. Example: '$orderby=name desc'. - /// The cancellation token to use. - /// , or is null. - /// or is an empty string, and was expected to be non-empty. - public Response ListByResourceGroupNextPage(string nextLink, string subscriptionId, string resourceGroupName, string expand = null, string filter = null, int? top = null, string orderby = null, CancellationToken cancellationToken = default) - { - Argument.AssertNotNull(nextLink, nameof(nextLink)); - Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); - Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); - - using var message = CreateListByResourceGroupNextPageRequest(nextLink, subscriptionId, resourceGroupName, expand, filter, top, orderby); - _pipeline.Send(message, cancellationToken); - switch (message.Response.Status) - { - case 200: - { - LabList value = default; - using var document = JsonDocument.Parse(message.Response.ContentStream, ModelSerializationExtensions.JsonDocumentOptions); - value = LabList.DeserializeLabList(document.RootElement); - return Response.FromValue(value, message.Response); - } - default: - throw new RequestFailedException(message.Response); - } - } - - internal RequestUriBuilder CreateListVhdsNextPageRequestUri(string nextLink, string subscriptionId, string resourceGroupName, string name) + internal HttpMessage CreateNextGetDevTestLabVhdsRequest(Uri nextPage, string subscriptionId, string resourceGroupName, string name, RequestContext context) { - var uri = new RawRequestUriBuilder(); - uri.Reset(_endpoint); - uri.AppendRawNextLink(nextLink, false); - return uri; - } - - internal HttpMessage CreateListVhdsNextPageRequest(string nextLink, string subscriptionId, string resourceGroupName, string name) - { - 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); + uri.UpdateQuery("api-version", _apiVersion); + HttpMessage message = Pipeline.CreateMessage(); + Request request = message.Request; request.Uri = uri; - request.Headers.Add("Accept", "application/json"); - _userAgent.Apply(message); + request.Method = RequestMethod.Post; + request.Headers.SetValue("Accept", "application/json"); return message; } - - /// List disk images available for custom image creation. - /// The URL to the next page of results. - /// The subscription ID. - /// The name of the resource group. - /// The name of the lab. - /// The cancellation token to use. - /// , , or is null. - /// , or is an empty string, and was expected to be non-empty. - public async Task> ListVhdsNextPageAsync(string nextLink, string subscriptionId, string resourceGroupName, string name, CancellationToken cancellationToken = default) - { - Argument.AssertNotNull(nextLink, nameof(nextLink)); - Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); - Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); - Argument.AssertNotNullOrEmpty(name, nameof(name)); - - using var message = CreateListVhdsNextPageRequest(nextLink, subscriptionId, resourceGroupName, name); - await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); - switch (message.Response.Status) - { - case 200: - { - LabVhdList value = default; - using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, ModelSerializationExtensions.JsonDocumentOptions, cancellationToken).ConfigureAwait(false); - value = LabVhdList.DeserializeLabVhdList(document.RootElement); - return Response.FromValue(value, message.Response); - } - default: - throw new RequestFailedException(message.Response); - } - } - - /// List disk images available for custom image creation. - /// The URL to the next page of results. - /// The subscription ID. - /// The name of the resource group. - /// The name of the lab. - /// The cancellation token to use. - /// , , or is null. - /// , or is an empty string, and was expected to be non-empty. - public Response ListVhdsNextPage(string nextLink, string subscriptionId, string resourceGroupName, string name, CancellationToken cancellationToken = default) - { - Argument.AssertNotNull(nextLink, nameof(nextLink)); - Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); - Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); - Argument.AssertNotNullOrEmpty(name, nameof(name)); - - using var message = CreateListVhdsNextPageRequest(nextLink, subscriptionId, resourceGroupName, name); - _pipeline.Send(message, cancellationToken); - switch (message.Response.Status) - { - case 200: - { - LabVhdList value = default; - using var document = JsonDocument.Parse(message.Response.ContentStream, ModelSerializationExtensions.JsonDocumentOptions); - value = LabVhdList.DeserializeLabVhdList(document.RootElement); - return Response.FromValue(value, message.Response); - } - default: - throw new RequestFailedException(message.Response); - } - } } } diff --git a/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/RestOperations/NotificationChannelsRestOperations.cs b/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/RestOperations/NotificationChannelsRestOperations.cs index 88582ec8320f..58f12a437e06 100644 --- a/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/RestOperations/NotificationChannelsRestOperations.cs +++ b/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/RestOperations/NotificationChannelsRestOperations.cs @@ -6,173 +6,44 @@ #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.DevTestLabs.Models; namespace Azure.ResourceManager.DevTestLabs { - internal partial class NotificationChannelsRestOperations + internal partial class NotificationChannels { - private readonly TelemetryDetails _userAgent; - private readonly HttpPipeline _pipeline; private readonly Uri _endpoint; private readonly string _apiVersion; - /// Initializes a new instance of NotificationChannelsRestOperations. - /// The HTTP pipeline for sending and receiving REST requests and responses. - /// The application id to use for user agent. - /// server parameter. - /// Api Version. - /// or is null. - public NotificationChannelsRestOperations(HttpPipeline pipeline, string applicationId, Uri endpoint = null, string apiVersion = default) + /// Initializes a new instance of NotificationChannels for mocking. + protected NotificationChannels() { - _pipeline = pipeline ?? throw new ArgumentNullException(nameof(pipeline)); - _endpoint = endpoint ?? new Uri("https://management.azure.com"); - _apiVersion = apiVersion ?? "2018-09-15"; - _userAgent = new TelemetryDetails(GetType().Assembly, applicationId); } - internal RequestUriBuilder CreateListRequestUri(string subscriptionId, string resourceGroupName, string labName, string expand, string filter, int? top, string orderby) + /// Initializes a new instance of NotificationChannels. + /// 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 NotificationChannels(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.DevTestLab/labs/", false); - uri.AppendPath(labName, true); - uri.AppendPath("/notificationchannels", false); - if (expand != null) - { - uri.AppendQuery("$expand", expand, true); - } - if (filter != null) - { - uri.AppendQuery("$filter", filter, true); - } - if (top != null) - { - uri.AppendQuery("$top", top.Value, true); - } - if (orderby != null) - { - uri.AppendQuery("$orderby", orderby, true); - } - uri.AppendQuery("api-version", _apiVersion, true); - return uri; + ClientDiagnostics = clientDiagnostics; + _endpoint = endpoint; + Pipeline = pipeline; + _apiVersion = apiVersion; } - internal HttpMessage CreateListRequest(string subscriptionId, string resourceGroupName, string labName, string expand, string filter, int? top, string orderby) - { - 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.DevTestLab/labs/", false); - uri.AppendPath(labName, true); - uri.AppendPath("/notificationchannels", false); - if (expand != null) - { - uri.AppendQuery("$expand", expand, true); - } - if (filter != null) - { - uri.AppendQuery("$filter", filter, true); - } - if (top != null) - { - uri.AppendQuery("$top", top.Value, true); - } - if (orderby != null) - { - uri.AppendQuery("$orderby", orderby, true); - } - uri.AppendQuery("api-version", _apiVersion, true); - request.Uri = uri; - request.Headers.Add("Accept", "application/json"); - _userAgent.Apply(message); - return message; - } + /// The HTTP pipeline for sending and receiving REST requests and responses. + public virtual HttpPipeline Pipeline { get; } - /// List notification channels in a given lab. - /// The subscription ID. - /// The name of the resource group. - /// The name of the lab. - /// Specify the $expand query. Example: 'properties($select=webHookUrl)'. - /// The filter to apply to the operation. Example: '$filter=contains(name,'myName'). - /// The maximum number of resources to return from the operation. Example: '$top=10'. - /// The ordering expression for the results, using OData notation. Example: '$orderby=name desc'. - /// The cancellation token to use. - /// , or is null. - /// , or is an empty string, and was expected to be non-empty. - public async Task> ListAsync(string subscriptionId, string resourceGroupName, string labName, string expand = null, string filter = null, int? top = null, string orderby = null, CancellationToken cancellationToken = default) - { - Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); - Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); - Argument.AssertNotNullOrEmpty(labName, nameof(labName)); + /// The ClientDiagnostics is used to provide tracing support for the client library. + internal ClientDiagnostics ClientDiagnostics { get; } - using var message = CreateListRequest(subscriptionId, resourceGroupName, labName, expand, filter, top, orderby); - await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); - switch (message.Response.Status) - { - case 200: - { - NotificationChannelList value = default; - using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, ModelSerializationExtensions.JsonDocumentOptions, cancellationToken).ConfigureAwait(false); - value = NotificationChannelList.DeserializeNotificationChannelList(document.RootElement); - return Response.FromValue(value, message.Response); - } - default: - throw new RequestFailedException(message.Response); - } - } - - /// List notification channels in a given lab. - /// The subscription ID. - /// The name of the resource group. - /// The name of the lab. - /// Specify the $expand query. Example: 'properties($select=webHookUrl)'. - /// The filter to apply to the operation. Example: '$filter=contains(name,'myName'). - /// The maximum number of resources to return from the operation. Example: '$top=10'. - /// The ordering expression for the results, using OData notation. Example: '$orderby=name desc'. - /// The cancellation token to use. - /// , or is null. - /// , or is an empty string, and was expected to be non-empty. - public Response List(string subscriptionId, string resourceGroupName, string labName, string expand = null, string filter = null, int? top = null, string orderby = null, CancellationToken cancellationToken = default) + internal HttpMessage CreateGetRequest(string subscriptionId, string resourceGroupName, string labName, string name, string expand, RequestContext context) { - Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); - Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); - Argument.AssertNotNullOrEmpty(labName, nameof(labName)); - - using var message = CreateListRequest(subscriptionId, resourceGroupName, labName, expand, filter, top, orderby); - _pipeline.Send(message, cancellationToken); - switch (message.Response.Status) - { - case 200: - { - NotificationChannelList value = default; - using var document = JsonDocument.Parse(message.Response.ContentStream, ModelSerializationExtensions.JsonDocumentOptions); - value = NotificationChannelList.DeserializeNotificationChannelList(document.RootElement); - return Response.FromValue(value, message.Response); - } - default: - throw new RequestFailedException(message.Response); - } - } - - internal RequestUriBuilder CreateGetRequestUri(string subscriptionId, string resourceGroupName, string labName, string name, string expand) - { - var uri = new RawRequestUriBuilder(); + RawRequestUriBuilder uri = new RawRequestUriBuilder(); uri.Reset(_endpoint); uri.AppendPath("/subscriptions/", false); uri.AppendPath(subscriptionId, true); @@ -182,111 +53,22 @@ internal RequestUriBuilder CreateGetRequestUri(string subscriptionId, string res uri.AppendPath(labName, true); uri.AppendPath("/notificationchannels/", false); uri.AppendPath(name, true); - if (expand != null) - { - uri.AppendQuery("$expand", expand, true); - } uri.AppendQuery("api-version", _apiVersion, true); - return uri; - } - - internal HttpMessage CreateGetRequest(string subscriptionId, string resourceGroupName, string labName, string name, string expand) - { - 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.DevTestLab/labs/", false); - uri.AppendPath(labName, true); - uri.AppendPath("/notificationchannels/", false); - uri.AppendPath(name, true); if (expand != null) { uri.AppendQuery("$expand", expand, 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 notification channel. - /// The subscription ID. - /// The name of the resource group. - /// The name of the lab. - /// The name of the notification channel. - /// Specify the $expand query. Example: 'properties($select=webHookUrl)'. - /// 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 labName, string name, string expand = null, CancellationToken cancellationToken = default) - { - Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); - Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); - Argument.AssertNotNullOrEmpty(labName, nameof(labName)); - Argument.AssertNotNullOrEmpty(name, nameof(name)); - - using var message = CreateGetRequest(subscriptionId, resourceGroupName, labName, name, expand); - await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); - switch (message.Response.Status) - { - case 200: - { - DevTestLabNotificationChannelData value = default; - using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, ModelSerializationExtensions.JsonDocumentOptions, cancellationToken).ConfigureAwait(false); - value = DevTestLabNotificationChannelData.DeserializeDevTestLabNotificationChannelData(document.RootElement); - return Response.FromValue(value, message.Response); - } - case 404: - return Response.FromValue((DevTestLabNotificationChannelData)null, message.Response); - default: - throw new RequestFailedException(message.Response); - } - } - - /// Get notification channel. - /// The subscription ID. - /// The name of the resource group. - /// The name of the lab. - /// The name of the notification channel. - /// Specify the $expand query. Example: 'properties($select=webHookUrl)'. - /// 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 labName, string name, string expand = null, CancellationToken cancellationToken = default) - { - Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); - Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); - Argument.AssertNotNullOrEmpty(labName, nameof(labName)); - Argument.AssertNotNullOrEmpty(name, nameof(name)); - - using var message = CreateGetRequest(subscriptionId, resourceGroupName, labName, name, expand); - _pipeline.Send(message, cancellationToken); - switch (message.Response.Status) - { - case 200: - { - DevTestLabNotificationChannelData value = default; - using var document = JsonDocument.Parse(message.Response.ContentStream, ModelSerializationExtensions.JsonDocumentOptions); - value = DevTestLabNotificationChannelData.DeserializeDevTestLabNotificationChannelData(document.RootElement); - return Response.FromValue(value, message.Response); - } - case 404: - return Response.FromValue((DevTestLabNotificationChannelData)null, message.Response); - default: - throw new RequestFailedException(message.Response); - } - } - - internal RequestUriBuilder CreateCreateOrUpdateRequestUri(string subscriptionId, string resourceGroupName, string labName, string name, DevTestLabNotificationChannelData data) + internal HttpMessage CreateCreateOrUpdateRequest(string subscriptionId, string resourceGroupName, string labName, string name, RequestContent content, RequestContext context) { - var uri = new RawRequestUriBuilder(); + RawRequestUriBuilder uri = new RawRequestUriBuilder(); uri.Reset(_endpoint); uri.AppendPath("/subscriptions/", false); uri.AppendPath(subscriptionId, true); @@ -297,15 +79,19 @@ internal RequestUriBuilder CreateCreateOrUpdateRequestUri(string subscriptionId, uri.AppendPath("/notificationchannels/", false); uri.AppendPath(name, true); uri.AppendQuery("api-version", _apiVersion, true); - return uri; + HttpMessage message = Pipeline.CreateMessage(); + Request request = message.Request; + request.Uri = uri; + request.Method = RequestMethod.Put; + request.Headers.SetValue("Content-Type", "application/json"); + request.Headers.SetValue("Accept", "application/json"); + request.Content = content; + return message; } - internal HttpMessage CreateCreateOrUpdateRequest(string subscriptionId, string resourceGroupName, string labName, string name, DevTestLabNotificationChannelData data) + internal HttpMessage CreateUpdateRequest(string subscriptionId, string resourceGroupName, string labName, string name, 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); @@ -316,87 +102,19 @@ internal HttpMessage CreateCreateOrUpdateRequest(string subscriptionId, string r uri.AppendPath("/notificationchannels/", false); uri.AppendPath(name, 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.Patch; + request.Headers.SetValue("Content-Type", "application/json"); + request.Headers.SetValue("Accept", "application/json"); request.Content = content; - _userAgent.Apply(message); return message; } - /// Create or replace an existing notification channel. - /// The subscription ID. - /// The name of the resource group. - /// The name of the lab. - /// The name of the notification channel. - /// A notification. - /// 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 labName, string name, DevTestLabNotificationChannelData data, CancellationToken cancellationToken = default) + internal HttpMessage CreateDeleteRequest(string subscriptionId, string resourceGroupName, string labName, string name, RequestContext context) { - Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); - Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); - Argument.AssertNotNullOrEmpty(labName, nameof(labName)); - Argument.AssertNotNullOrEmpty(name, nameof(name)); - Argument.AssertNotNull(data, nameof(data)); - - using var message = CreateCreateOrUpdateRequest(subscriptionId, resourceGroupName, labName, name, data); - await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); - switch (message.Response.Status) - { - case 200: - case 201: - { - DevTestLabNotificationChannelData value = default; - using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, ModelSerializationExtensions.JsonDocumentOptions, cancellationToken).ConfigureAwait(false); - value = DevTestLabNotificationChannelData.DeserializeDevTestLabNotificationChannelData(document.RootElement); - return Response.FromValue(value, message.Response); - } - default: - throw new RequestFailedException(message.Response); - } - } - - /// Create or replace an existing notification channel. - /// The subscription ID. - /// The name of the resource group. - /// The name of the lab. - /// The name of the notification channel. - /// A notification. - /// 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 labName, string name, DevTestLabNotificationChannelData data, CancellationToken cancellationToken = default) - { - Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); - Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); - Argument.AssertNotNullOrEmpty(labName, nameof(labName)); - Argument.AssertNotNullOrEmpty(name, nameof(name)); - Argument.AssertNotNull(data, nameof(data)); - - using var message = CreateCreateOrUpdateRequest(subscriptionId, resourceGroupName, labName, name, data); - _pipeline.Send(message, cancellationToken); - switch (message.Response.Status) - { - case 200: - case 201: - { - DevTestLabNotificationChannelData value = default; - using var document = JsonDocument.Parse(message.Response.ContentStream, ModelSerializationExtensions.JsonDocumentOptions); - value = DevTestLabNotificationChannelData.DeserializeDevTestLabNotificationChannelData(document.RootElement); - return Response.FromValue(value, message.Response); - } - default: - throw new RequestFailedException(message.Response); - } - } - - internal RequestUriBuilder CreateDeleteRequestUri(string subscriptionId, string resourceGroupName, string labName, string name) - { - var uri = new RawRequestUriBuilder(); + RawRequestUriBuilder uri = new RawRequestUriBuilder(); uri.Reset(_endpoint); uri.AppendPath("/subscriptions/", false); uri.AppendPath(subscriptionId, true); @@ -407,15 +125,16 @@ internal RequestUriBuilder CreateDeleteRequestUri(string subscriptionId, string uri.AppendPath("/notificationchannels/", false); uri.AppendPath(name, true); uri.AppendQuery("api-version", _apiVersion, true); - return uri; + HttpMessage message = Pipeline.CreateMessage(); + Request request = message.Request; + request.Uri = uri; + request.Method = RequestMethod.Delete; + return message; } - internal HttpMessage CreateDeleteRequest(string subscriptionId, string resourceGroupName, string labName, string name) + internal HttpMessage CreateGetAllRequest(string subscriptionId, string resourceGroupName, string labName, string expand, string filter, int? top, string @orderby, RequestContext context) { - var message = _pipeline.CreateMessage(); - var request = message.Request; - request.Method = RequestMethod.Delete; - var uri = new RawRequestUriBuilder(); + RawRequestUriBuilder uri = new RawRequestUriBuilder(); uri.Reset(_endpoint); uri.AppendPath("/subscriptions/", false); uri.AppendPath(subscriptionId, true); @@ -423,200 +142,48 @@ internal HttpMessage CreateDeleteRequest(string subscriptionId, string resourceG uri.AppendPath(resourceGroupName, true); uri.AppendPath("/providers/Microsoft.DevTestLab/labs/", false); uri.AppendPath(labName, true); - uri.AppendPath("/notificationchannels/", false); - uri.AppendPath(name, true); + uri.AppendPath("/notificationchannels", false); uri.AppendQuery("api-version", _apiVersion, true); - request.Uri = uri; - request.Headers.Add("Accept", "application/json"); - _userAgent.Apply(message); - return message; - } - - /// Delete notification channel. - /// The subscription ID. - /// The name of the resource group. - /// The name of the lab. - /// The name of the notification channel. - /// 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 labName, string name, CancellationToken cancellationToken = default) - { - Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); - Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); - Argument.AssertNotNullOrEmpty(labName, nameof(labName)); - Argument.AssertNotNullOrEmpty(name, nameof(name)); - - using var message = CreateDeleteRequest(subscriptionId, resourceGroupName, labName, name); - await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); - switch (message.Response.Status) + if (expand != null) { - case 200: - case 204: - return message.Response; - default: - throw new RequestFailedException(message.Response); + uri.AppendQuery("$expand", expand, true); } - } - - /// Delete notification channel. - /// The subscription ID. - /// The name of the resource group. - /// The name of the lab. - /// The name of the notification channel. - /// 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 labName, string name, CancellationToken cancellationToken = default) - { - Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); - Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); - Argument.AssertNotNullOrEmpty(labName, nameof(labName)); - Argument.AssertNotNullOrEmpty(name, nameof(name)); - - using var message = CreateDeleteRequest(subscriptionId, resourceGroupName, labName, name); - _pipeline.Send(message, cancellationToken); - switch (message.Response.Status) + if (filter != null) { - case 200: - case 204: - return message.Response; - default: - throw new RequestFailedException(message.Response); + uri.AppendQuery("$filter", filter, true); } - } - - internal RequestUriBuilder CreateUpdateRequestUri(string subscriptionId, string resourceGroupName, string labName, string name, DevTestLabNotificationChannelPatch 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.DevTestLab/labs/", false); - uri.AppendPath(labName, true); - uri.AppendPath("/notificationchannels/", false); - uri.AppendPath(name, true); - uri.AppendQuery("api-version", _apiVersion, true); - return uri; - } - - internal HttpMessage CreateUpdateRequest(string subscriptionId, string resourceGroupName, string labName, string name, DevTestLabNotificationChannelPatch patch) - { - var message = _pipeline.CreateMessage(); - var request = message.Request; - request.Method = RequestMethod.Patch; - var uri = new RawRequestUriBuilder(); - uri.Reset(_endpoint); - uri.AppendPath("/subscriptions/", false); - uri.AppendPath(subscriptionId, true); - uri.AppendPath("/resourceGroups/", false); - uri.AppendPath(resourceGroupName, true); - uri.AppendPath("/providers/Microsoft.DevTestLab/labs/", false); - uri.AppendPath(labName, true); - uri.AppendPath("/notificationchannels/", false); - uri.AppendPath(name, true); - uri.AppendQuery("api-version", _apiVersion, true); - request.Uri = uri; - request.Headers.Add("Accept", "application/json"); - request.Headers.Add("Content-Type", "application/json"); - var content = new Utf8JsonRequestContent(); - content.JsonWriter.WriteObjectValue(patch, ModelSerializationExtensions.WireOptions); - request.Content = content; - _userAgent.Apply(message); - return message; - } - - /// Allows modifying tags of notification channels. All other properties will be ignored. - /// The subscription ID. - /// The name of the resource group. - /// The name of the lab. - /// The name of the notification channel. - /// A notification. - /// 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 labName, string name, DevTestLabNotificationChannelPatch patch, CancellationToken cancellationToken = default) - { - Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); - Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); - Argument.AssertNotNullOrEmpty(labName, nameof(labName)); - Argument.AssertNotNullOrEmpty(name, nameof(name)); - Argument.AssertNotNull(patch, nameof(patch)); - - using var message = CreateUpdateRequest(subscriptionId, resourceGroupName, labName, name, patch); - await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); - switch (message.Response.Status) + if (top != null) { - case 200: - { - DevTestLabNotificationChannelData value = default; - using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, ModelSerializationExtensions.JsonDocumentOptions, cancellationToken).ConfigureAwait(false); - value = DevTestLabNotificationChannelData.DeserializeDevTestLabNotificationChannelData(document.RootElement); - return Response.FromValue(value, message.Response); - } - default: - throw new RequestFailedException(message.Response); + uri.AppendQuery("$top", TypeFormatters.ConvertToString(top), true); } - } - - /// Allows modifying tags of notification channels. All other properties will be ignored. - /// The subscription ID. - /// The name of the resource group. - /// The name of the lab. - /// The name of the notification channel. - /// A notification. - /// 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 labName, string name, DevTestLabNotificationChannelPatch patch, CancellationToken cancellationToken = default) - { - Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); - Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); - Argument.AssertNotNullOrEmpty(labName, nameof(labName)); - Argument.AssertNotNullOrEmpty(name, nameof(name)); - Argument.AssertNotNull(patch, nameof(patch)); - - using var message = CreateUpdateRequest(subscriptionId, resourceGroupName, labName, name, patch); - _pipeline.Send(message, cancellationToken); - switch (message.Response.Status) + if (@orderby != null) { - case 200: - { - DevTestLabNotificationChannelData value = default; - using var document = JsonDocument.Parse(message.Response.ContentStream, ModelSerializationExtensions.JsonDocumentOptions); - value = DevTestLabNotificationChannelData.DeserializeDevTestLabNotificationChannelData(document.RootElement); - return Response.FromValue(value, message.Response); - } - default: - throw new RequestFailedException(message.Response); + uri.AppendQuery("$orderby", @orderby, true); } + HttpMessage message = Pipeline.CreateMessage(); + Request request = message.Request; + request.Uri = uri; + request.Method = RequestMethod.Get; + request.Headers.SetValue("Accept", "application/json"); + return message; } - internal RequestUriBuilder CreateNotifyRequestUri(string subscriptionId, string resourceGroupName, string labName, string name, DevTestLabNotificationChannelNotifyContent content) + internal HttpMessage CreateNextGetAllRequest(Uri nextPage, string subscriptionId, string resourceGroupName, string labName, string expand, string filter, int? top, string @orderby, RequestContext context) { - 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.DevTestLab/labs/", false); - uri.AppendPath(labName, true); - uri.AppendPath("/notificationchannels/", false); - uri.AppendPath(name, true); - uri.AppendPath("/notify", false); - uri.AppendQuery("api-version", _apiVersion, true); - return uri; + RawRequestUriBuilder uri = new RawRequestUriBuilder(); + uri.Reset(nextPage); + uri.UpdateQuery("api-version", _apiVersion); + 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 CreateNotifyRequest(string subscriptionId, string resourceGroupName, string labName, string name, DevTestLabNotificationChannelNotifyContent content) + internal HttpMessage CreateNotifyRequest(string subscriptionId, string resourceGroupName, string labName, string name, RequestContent content, RequestContext context) { - var message = _pipeline.CreateMessage(); - var request = message.Request; - request.Method = RequestMethod.Post; - var uri = new RawRequestUriBuilder(); + RawRequestUriBuilder uri = new RawRequestUriBuilder(); uri.Reset(_endpoint); uri.AppendPath("/subscriptions/", false); uri.AppendPath(subscriptionId, true); @@ -628,162 +195,13 @@ internal HttpMessage CreateNotifyRequest(string subscriptionId, string resourceG uri.AppendPath(name, true); uri.AppendPath("/notify", false); 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 content0 = new Utf8JsonRequestContent(); - content0.JsonWriter.WriteObjectValue(content, ModelSerializationExtensions.WireOptions); - request.Content = content0; - _userAgent.Apply(message); - return message; - } - - /// Send notification to provided channel. - /// The subscription ID. - /// The name of the resource group. - /// The name of the lab. - /// The name of the notification channel. - /// Properties for generating a Notification. - /// The cancellation token to use. - /// , , , or is null. - /// , , or is an empty string, and was expected to be non-empty. - public async Task NotifyAsync(string subscriptionId, string resourceGroupName, string labName, string name, DevTestLabNotificationChannelNotifyContent content, CancellationToken cancellationToken = default) - { - Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); - Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); - Argument.AssertNotNullOrEmpty(labName, nameof(labName)); - Argument.AssertNotNullOrEmpty(name, nameof(name)); - Argument.AssertNotNull(content, nameof(content)); - - using var message = CreateNotifyRequest(subscriptionId, resourceGroupName, labName, name, content); - await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); - switch (message.Response.Status) - { - case 200: - return message.Response; - default: - throw new RequestFailedException(message.Response); - } - } - - /// Send notification to provided channel. - /// The subscription ID. - /// The name of the resource group. - /// The name of the lab. - /// The name of the notification channel. - /// Properties for generating a Notification. - /// The cancellation token to use. - /// , , , or is null. - /// , , or is an empty string, and was expected to be non-empty. - public Response Notify(string subscriptionId, string resourceGroupName, string labName, string name, DevTestLabNotificationChannelNotifyContent content, CancellationToken cancellationToken = default) - { - Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); - Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); - Argument.AssertNotNullOrEmpty(labName, nameof(labName)); - Argument.AssertNotNullOrEmpty(name, nameof(name)); - Argument.AssertNotNull(content, nameof(content)); - - using var message = CreateNotifyRequest(subscriptionId, resourceGroupName, labName, name, content); - _pipeline.Send(message, cancellationToken); - switch (message.Response.Status) - { - case 200: - return message.Response; - default: - throw new RequestFailedException(message.Response); - } - } - - internal RequestUriBuilder CreateListNextPageRequestUri(string nextLink, string subscriptionId, string resourceGroupName, string labName, string expand, string filter, int? top, string orderby) - { - var uri = new RawRequestUriBuilder(); - uri.Reset(_endpoint); - uri.AppendRawNextLink(nextLink, false); - return uri; - } - - internal HttpMessage CreateListNextPageRequest(string nextLink, string subscriptionId, string resourceGroupName, string labName, string expand, string filter, int? top, string orderby) - { - 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.Method = RequestMethod.Post; + request.Headers.SetValue("Content-Type", "application/json"); + request.Content = content; return message; } - - /// List notification channels in a given lab. - /// The URL to the next page of results. - /// The subscription ID. - /// The name of the resource group. - /// The name of the lab. - /// Specify the $expand query. Example: 'properties($select=webHookUrl)'. - /// The filter to apply to the operation. Example: '$filter=contains(name,'myName'). - /// The maximum number of resources to return from the operation. Example: '$top=10'. - /// The ordering expression for the results, using OData notation. Example: '$orderby=name desc'. - /// The cancellation token to use. - /// , , or is null. - /// , or is an empty string, and was expected to be non-empty. - public async Task> ListNextPageAsync(string nextLink, string subscriptionId, string resourceGroupName, string labName, string expand = null, string filter = null, int? top = null, string orderby = null, CancellationToken cancellationToken = default) - { - Argument.AssertNotNull(nextLink, nameof(nextLink)); - Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); - Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); - Argument.AssertNotNullOrEmpty(labName, nameof(labName)); - - using var message = CreateListNextPageRequest(nextLink, subscriptionId, resourceGroupName, labName, expand, filter, top, orderby); - await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); - switch (message.Response.Status) - { - case 200: - { - NotificationChannelList value = default; - using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, ModelSerializationExtensions.JsonDocumentOptions, cancellationToken).ConfigureAwait(false); - value = NotificationChannelList.DeserializeNotificationChannelList(document.RootElement); - return Response.FromValue(value, message.Response); - } - default: - throw new RequestFailedException(message.Response); - } - } - - /// List notification channels in a given lab. - /// The URL to the next page of results. - /// The subscription ID. - /// The name of the resource group. - /// The name of the lab. - /// Specify the $expand query. Example: 'properties($select=webHookUrl)'. - /// The filter to apply to the operation. Example: '$filter=contains(name,'myName'). - /// The maximum number of resources to return from the operation. Example: '$top=10'. - /// The ordering expression for the results, using OData notation. Example: '$orderby=name desc'. - /// The cancellation token to use. - /// , , or is null. - /// , or is an empty string, and was expected to be non-empty. - public Response ListNextPage(string nextLink, string subscriptionId, string resourceGroupName, string labName, string expand = null, string filter = null, int? top = null, string orderby = null, CancellationToken cancellationToken = default) - { - Argument.AssertNotNull(nextLink, nameof(nextLink)); - Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); - Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); - Argument.AssertNotNullOrEmpty(labName, nameof(labName)); - - using var message = CreateListNextPageRequest(nextLink, subscriptionId, resourceGroupName, labName, expand, filter, top, orderby); - _pipeline.Send(message, cancellationToken); - switch (message.Response.Status) - { - case 200: - { - NotificationChannelList value = default; - using var document = JsonDocument.Parse(message.Response.ContentStream, ModelSerializationExtensions.JsonDocumentOptions); - value = NotificationChannelList.DeserializeNotificationChannelList(document.RootElement); - return Response.FromValue(value, message.Response); - } - default: - throw new RequestFailedException(message.Response); - } - } } } diff --git a/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/RestOperations/PoliciesRestOperations.cs b/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/RestOperations/PoliciesRestOperations.cs index 7b23f485469b..2e470c46fe7d 100644 --- a/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/RestOperations/PoliciesRestOperations.cs +++ b/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/RestOperations/PoliciesRestOperations.cs @@ -6,181 +6,44 @@ #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.DevTestLabs.Models; namespace Azure.ResourceManager.DevTestLabs { - internal partial class PoliciesRestOperations + internal partial class Policies { - private readonly TelemetryDetails _userAgent; - private readonly HttpPipeline _pipeline; private readonly Uri _endpoint; private readonly string _apiVersion; - /// Initializes a new instance of PoliciesRestOperations. - /// The HTTP pipeline for sending and receiving REST requests and responses. - /// The application id to use for user agent. - /// server parameter. - /// Api Version. - /// or is null. - public PoliciesRestOperations(HttpPipeline pipeline, string applicationId, Uri endpoint = null, string apiVersion = default) - { - _pipeline = pipeline ?? throw new ArgumentNullException(nameof(pipeline)); - _endpoint = endpoint ?? new Uri("https://management.azure.com"); - _apiVersion = apiVersion ?? "2018-09-15"; - _userAgent = new TelemetryDetails(GetType().Assembly, applicationId); - } - - internal RequestUriBuilder CreateListRequestUri(string subscriptionId, string resourceGroupName, string labName, string policySetName, string expand, string filter, int? top, string orderby) + /// Initializes a new instance of Policies for mocking. + protected Policies() { - 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.DevTestLab/labs/", false); - uri.AppendPath(labName, true); - uri.AppendPath("/policysets/", false); - uri.AppendPath(policySetName, true); - uri.AppendPath("/policies", false); - if (expand != null) - { - uri.AppendQuery("$expand", expand, true); - } - if (filter != null) - { - uri.AppendQuery("$filter", filter, true); - } - if (top != null) - { - uri.AppendQuery("$top", top.Value, true); - } - if (orderby != null) - { - uri.AppendQuery("$orderby", orderby, true); - } - uri.AppendQuery("api-version", _apiVersion, true); - return uri; - } - - internal HttpMessage CreateListRequest(string subscriptionId, string resourceGroupName, string labName, string policySetName, string expand, string filter, int? top, string orderby) - { - 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.DevTestLab/labs/", false); - uri.AppendPath(labName, true); - uri.AppendPath("/policysets/", false); - uri.AppendPath(policySetName, true); - uri.AppendPath("/policies", false); - if (expand != null) - { - uri.AppendQuery("$expand", expand, true); - } - if (filter != null) - { - uri.AppendQuery("$filter", filter, true); - } - if (top != null) - { - uri.AppendQuery("$top", top.Value, true); - } - if (orderby != null) - { - uri.AppendQuery("$orderby", orderby, true); - } - uri.AppendQuery("api-version", _apiVersion, true); - request.Uri = uri; - request.Headers.Add("Accept", "application/json"); - _userAgent.Apply(message); - return message; } - /// List policies in a given policy set. - /// The subscription ID. - /// The name of the resource group. - /// The name of the lab. - /// The name of the policy set. - /// Specify the $expand query. Example: 'properties($select=description)'. - /// The filter to apply to the operation. Example: '$filter=contains(name,'myName'). - /// The maximum number of resources to return from the operation. Example: '$top=10'. - /// The ordering expression for the results, using OData notation. Example: '$orderby=name desc'. - /// The cancellation token to use. - /// , , or is null. - /// , , or is an empty string, and was expected to be non-empty. - public async Task> ListAsync(string subscriptionId, string resourceGroupName, string labName, string policySetName, string expand = null, string filter = null, int? top = null, string orderby = null, CancellationToken cancellationToken = default) + /// Initializes a new instance of Policies. + /// 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 Policies(ClientDiagnostics clientDiagnostics, HttpPipeline pipeline, Uri endpoint, string apiVersion) { - Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); - Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); - Argument.AssertNotNullOrEmpty(labName, nameof(labName)); - Argument.AssertNotNullOrEmpty(policySetName, nameof(policySetName)); - - using var message = CreateListRequest(subscriptionId, resourceGroupName, labName, policySetName, expand, filter, top, orderby); - await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); - switch (message.Response.Status) - { - case 200: - { - PolicyList value = default; - using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, ModelSerializationExtensions.JsonDocumentOptions, cancellationToken).ConfigureAwait(false); - value = PolicyList.DeserializePolicyList(document.RootElement); - return Response.FromValue(value, message.Response); - } - default: - throw new RequestFailedException(message.Response); - } + ClientDiagnostics = clientDiagnostics; + _endpoint = endpoint; + Pipeline = pipeline; + _apiVersion = apiVersion; } - /// List policies in a given policy set. - /// The subscription ID. - /// The name of the resource group. - /// The name of the lab. - /// The name of the policy set. - /// Specify the $expand query. Example: 'properties($select=description)'. - /// The filter to apply to the operation. Example: '$filter=contains(name,'myName'). - /// The maximum number of resources to return from the operation. Example: '$top=10'. - /// The ordering expression for the results, using OData notation. Example: '$orderby=name desc'. - /// The cancellation token to use. - /// , , or is null. - /// , , or is an empty string, and was expected to be non-empty. - public Response List(string subscriptionId, string resourceGroupName, string labName, string policySetName, string expand = null, string filter = null, int? top = null, string orderby = null, CancellationToken cancellationToken = default) - { - Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); - Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); - Argument.AssertNotNullOrEmpty(labName, nameof(labName)); - Argument.AssertNotNullOrEmpty(policySetName, nameof(policySetName)); + /// The HTTP pipeline for sending and receiving REST requests and responses. + public virtual HttpPipeline Pipeline { get; } - using var message = CreateListRequest(subscriptionId, resourceGroupName, labName, policySetName, expand, filter, top, orderby); - _pipeline.Send(message, cancellationToken); - switch (message.Response.Status) - { - case 200: - { - PolicyList value = default; - using var document = JsonDocument.Parse(message.Response.ContentStream, ModelSerializationExtensions.JsonDocumentOptions); - value = PolicyList.DeserializePolicyList(document.RootElement); - return Response.FromValue(value, 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 CreateGetRequestUri(string subscriptionId, string resourceGroupName, string labName, string policySetName, string name, string expand) + internal HttpMessage CreateGetRequest(string subscriptionId, string resourceGroupName, string labName, string policySetName, string name, string expand, RequestContext context) { - var uri = new RawRequestUriBuilder(); + RawRequestUriBuilder uri = new RawRequestUriBuilder(); uri.Reset(_endpoint); uri.AppendPath("/subscriptions/", false); uri.AppendPath(subscriptionId, true); @@ -192,117 +55,22 @@ internal RequestUriBuilder CreateGetRequestUri(string subscriptionId, string res uri.AppendPath(policySetName, true); uri.AppendPath("/policies/", false); uri.AppendPath(name, true); - if (expand != null) - { - uri.AppendQuery("$expand", expand, true); - } uri.AppendQuery("api-version", _apiVersion, true); - return uri; - } - - internal HttpMessage CreateGetRequest(string subscriptionId, string resourceGroupName, string labName, string policySetName, string name, string expand) - { - 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.DevTestLab/labs/", false); - uri.AppendPath(labName, true); - uri.AppendPath("/policysets/", false); - uri.AppendPath(policySetName, true); - uri.AppendPath("/policies/", false); - uri.AppendPath(name, true); if (expand != null) { uri.AppendQuery("$expand", expand, 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 policy. - /// The subscription ID. - /// The name of the resource group. - /// The name of the lab. - /// The name of the policy set. - /// The name of the policy. - /// Specify the $expand query. Example: 'properties($select=description)'. - /// 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 labName, string policySetName, string name, string expand = null, CancellationToken cancellationToken = default) + internal HttpMessage CreateCreateOrUpdateRequest(string subscriptionId, string resourceGroupName, string labName, string policySetName, string name, RequestContent content, RequestContext context) { - Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); - Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); - Argument.AssertNotNullOrEmpty(labName, nameof(labName)); - Argument.AssertNotNullOrEmpty(policySetName, nameof(policySetName)); - Argument.AssertNotNullOrEmpty(name, nameof(name)); - - using var message = CreateGetRequest(subscriptionId, resourceGroupName, labName, policySetName, name, expand); - await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); - switch (message.Response.Status) - { - case 200: - { - DevTestLabPolicyData value = default; - using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, ModelSerializationExtensions.JsonDocumentOptions, cancellationToken).ConfigureAwait(false); - value = DevTestLabPolicyData.DeserializeDevTestLabPolicyData(document.RootElement); - return Response.FromValue(value, message.Response); - } - case 404: - return Response.FromValue((DevTestLabPolicyData)null, message.Response); - default: - throw new RequestFailedException(message.Response); - } - } - - /// Get policy. - /// The subscription ID. - /// The name of the resource group. - /// The name of the lab. - /// The name of the policy set. - /// The name of the policy. - /// Specify the $expand query. Example: 'properties($select=description)'. - /// 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 labName, string policySetName, string name, string expand = null, CancellationToken cancellationToken = default) - { - Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); - Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); - Argument.AssertNotNullOrEmpty(labName, nameof(labName)); - Argument.AssertNotNullOrEmpty(policySetName, nameof(policySetName)); - Argument.AssertNotNullOrEmpty(name, nameof(name)); - - using var message = CreateGetRequest(subscriptionId, resourceGroupName, labName, policySetName, name, expand); - _pipeline.Send(message, cancellationToken); - switch (message.Response.Status) - { - case 200: - { - DevTestLabPolicyData value = default; - using var document = JsonDocument.Parse(message.Response.ContentStream, ModelSerializationExtensions.JsonDocumentOptions); - value = DevTestLabPolicyData.DeserializeDevTestLabPolicyData(document.RootElement); - return Response.FromValue(value, message.Response); - } - case 404: - return Response.FromValue((DevTestLabPolicyData)null, message.Response); - default: - throw new RequestFailedException(message.Response); - } - } - - internal RequestUriBuilder CreateCreateOrUpdateRequestUri(string subscriptionId, string resourceGroupName, string labName, string policySetName, string name, DevTestLabPolicyData data) - { - var uri = new RawRequestUriBuilder(); + RawRequestUriBuilder uri = new RawRequestUriBuilder(); uri.Reset(_endpoint); uri.AppendPath("/subscriptions/", false); uri.AppendPath(subscriptionId, true); @@ -315,15 +83,19 @@ internal RequestUriBuilder CreateCreateOrUpdateRequestUri(string subscriptionId, uri.AppendPath("/policies/", false); uri.AppendPath(name, true); uri.AppendQuery("api-version", _apiVersion, true); - return uri; + HttpMessage message = Pipeline.CreateMessage(); + Request request = message.Request; + request.Uri = uri; + request.Method = RequestMethod.Put; + request.Headers.SetValue("Content-Type", "application/json"); + request.Headers.SetValue("Accept", "application/json"); + request.Content = content; + return message; } - internal HttpMessage CreateCreateOrUpdateRequest(string subscriptionId, string resourceGroupName, string labName, string policySetName, string name, DevTestLabPolicyData data) + internal HttpMessage CreateUpdateRequest(string subscriptionId, string resourceGroupName, string labName, string policySetName, string name, 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); @@ -336,91 +108,19 @@ internal HttpMessage CreateCreateOrUpdateRequest(string subscriptionId, string r uri.AppendPath("/policies/", false); uri.AppendPath(name, 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.Patch; + request.Headers.SetValue("Content-Type", "application/json"); + request.Headers.SetValue("Accept", "application/json"); request.Content = content; - _userAgent.Apply(message); return message; } - /// Create or replace an existing policy. - /// The subscription ID. - /// The name of the resource group. - /// The name of the lab. - /// The name of the policy set. - /// The name of the policy. - /// A Policy. - /// 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 labName, string policySetName, string name, DevTestLabPolicyData data, CancellationToken cancellationToken = default) - { - Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); - Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); - Argument.AssertNotNullOrEmpty(labName, nameof(labName)); - Argument.AssertNotNullOrEmpty(policySetName, nameof(policySetName)); - Argument.AssertNotNullOrEmpty(name, nameof(name)); - Argument.AssertNotNull(data, nameof(data)); - - using var message = CreateCreateOrUpdateRequest(subscriptionId, resourceGroupName, labName, policySetName, name, data); - await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); - switch (message.Response.Status) - { - case 200: - case 201: - { - DevTestLabPolicyData value = default; - using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, ModelSerializationExtensions.JsonDocumentOptions, cancellationToken).ConfigureAwait(false); - value = DevTestLabPolicyData.DeserializeDevTestLabPolicyData(document.RootElement); - return Response.FromValue(value, message.Response); - } - default: - throw new RequestFailedException(message.Response); - } - } - - /// Create or replace an existing policy. - /// The subscription ID. - /// The name of the resource group. - /// The name of the lab. - /// The name of the policy set. - /// The name of the policy. - /// A Policy. - /// 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 labName, string policySetName, string name, DevTestLabPolicyData data, CancellationToken cancellationToken = default) - { - Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); - Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); - Argument.AssertNotNullOrEmpty(labName, nameof(labName)); - Argument.AssertNotNullOrEmpty(policySetName, nameof(policySetName)); - Argument.AssertNotNullOrEmpty(name, nameof(name)); - Argument.AssertNotNull(data, nameof(data)); - - using var message = CreateCreateOrUpdateRequest(subscriptionId, resourceGroupName, labName, policySetName, name, data); - _pipeline.Send(message, cancellationToken); - switch (message.Response.Status) - { - case 200: - case 201: - { - DevTestLabPolicyData value = default; - using var document = JsonDocument.Parse(message.Response.ContentStream, ModelSerializationExtensions.JsonDocumentOptions); - value = DevTestLabPolicyData.DeserializeDevTestLabPolicyData(document.RootElement); - return Response.FromValue(value, message.Response); - } - default: - throw new RequestFailedException(message.Response); - } - } - - internal RequestUriBuilder CreateDeleteRequestUri(string subscriptionId, string resourceGroupName, string labName, string policySetName, string name) + internal HttpMessage CreateDeleteRequest(string subscriptionId, string resourceGroupName, string labName, string policySetName, string name, RequestContext context) { - var uri = new RawRequestUriBuilder(); + RawRequestUriBuilder uri = new RawRequestUriBuilder(); uri.Reset(_endpoint); uri.AppendPath("/subscriptions/", false); uri.AppendPath(subscriptionId, true); @@ -433,15 +133,16 @@ internal RequestUriBuilder CreateDeleteRequestUri(string subscriptionId, string uri.AppendPath("/policies/", false); uri.AppendPath(name, true); uri.AppendQuery("api-version", _apiVersion, true); - return uri; + HttpMessage message = Pipeline.CreateMessage(); + Request request = message.Request; + request.Uri = uri; + request.Method = RequestMethod.Delete; + return message; } - internal HttpMessage CreateDeleteRequest(string subscriptionId, string resourceGroupName, string labName, string policySetName, string name) + internal HttpMessage CreateGetAllRequest(string subscriptionId, string resourceGroupName, string labName, string policySetName, string expand, string filter, int? top, string @orderby, RequestContext context) { - var message = _pipeline.CreateMessage(); - var request = message.Request; - request.Method = RequestMethod.Delete; - var uri = new RawRequestUriBuilder(); + RawRequestUriBuilder uri = new RawRequestUriBuilder(); uri.Reset(_endpoint); uri.AppendPath("/subscriptions/", false); uri.AppendPath(subscriptionId, true); @@ -451,283 +152,43 @@ internal HttpMessage CreateDeleteRequest(string subscriptionId, string resourceG uri.AppendPath(labName, true); uri.AppendPath("/policysets/", false); uri.AppendPath(policySetName, true); - uri.AppendPath("/policies/", false); - uri.AppendPath(name, true); + uri.AppendPath("/policies", false); uri.AppendQuery("api-version", _apiVersion, true); - request.Uri = uri; - request.Headers.Add("Accept", "application/json"); - _userAgent.Apply(message); - return message; - } - - /// Delete policy. - /// The subscription ID. - /// The name of the resource group. - /// The name of the lab. - /// The name of the policy set. - /// The name of the policy. - /// 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 labName, string policySetName, string name, CancellationToken cancellationToken = default) - { - Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); - Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); - Argument.AssertNotNullOrEmpty(labName, nameof(labName)); - Argument.AssertNotNullOrEmpty(policySetName, nameof(policySetName)); - Argument.AssertNotNullOrEmpty(name, nameof(name)); - - using var message = CreateDeleteRequest(subscriptionId, resourceGroupName, labName, policySetName, name); - await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); - switch (message.Response.Status) + if (expand != null) { - case 200: - case 204: - return message.Response; - default: - throw new RequestFailedException(message.Response); + uri.AppendQuery("$expand", expand, true); } - } - - /// Delete policy. - /// The subscription ID. - /// The name of the resource group. - /// The name of the lab. - /// The name of the policy set. - /// The name of the policy. - /// 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 labName, string policySetName, string name, CancellationToken cancellationToken = default) - { - Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); - Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); - Argument.AssertNotNullOrEmpty(labName, nameof(labName)); - Argument.AssertNotNullOrEmpty(policySetName, nameof(policySetName)); - Argument.AssertNotNullOrEmpty(name, nameof(name)); - - using var message = CreateDeleteRequest(subscriptionId, resourceGroupName, labName, policySetName, name); - _pipeline.Send(message, cancellationToken); - switch (message.Response.Status) + if (filter != null) { - case 200: - case 204: - return message.Response; - default: - throw new RequestFailedException(message.Response); + uri.AppendQuery("$filter", filter, true); } - } - - internal RequestUriBuilder CreateUpdateRequestUri(string subscriptionId, string resourceGroupName, string labName, string policySetName, string name, DevTestLabPolicyPatch 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.DevTestLab/labs/", false); - uri.AppendPath(labName, true); - uri.AppendPath("/policysets/", false); - uri.AppendPath(policySetName, true); - uri.AppendPath("/policies/", false); - uri.AppendPath(name, true); - uri.AppendQuery("api-version", _apiVersion, true); - return uri; - } - - internal HttpMessage CreateUpdateRequest(string subscriptionId, string resourceGroupName, string labName, string policySetName, string name, DevTestLabPolicyPatch patch) - { - var message = _pipeline.CreateMessage(); - var request = message.Request; - request.Method = RequestMethod.Patch; - var uri = new RawRequestUriBuilder(); - uri.Reset(_endpoint); - uri.AppendPath("/subscriptions/", false); - uri.AppendPath(subscriptionId, true); - uri.AppendPath("/resourceGroups/", false); - uri.AppendPath(resourceGroupName, true); - uri.AppendPath("/providers/Microsoft.DevTestLab/labs/", false); - uri.AppendPath(labName, true); - uri.AppendPath("/policysets/", false); - uri.AppendPath(policySetName, true); - uri.AppendPath("/policies/", false); - uri.AppendPath(name, true); - uri.AppendQuery("api-version", _apiVersion, true); - request.Uri = uri; - request.Headers.Add("Accept", "application/json"); - request.Headers.Add("Content-Type", "application/json"); - var content = new Utf8JsonRequestContent(); - content.JsonWriter.WriteObjectValue(patch, ModelSerializationExtensions.WireOptions); - request.Content = content; - _userAgent.Apply(message); - return message; - } - - /// Allows modifying tags of policies. All other properties will be ignored. - /// The subscription ID. - /// The name of the resource group. - /// The name of the lab. - /// The name of the policy set. - /// The name of the policy. - /// A Policy. - /// 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 labName, string policySetName, string name, DevTestLabPolicyPatch patch, CancellationToken cancellationToken = default) - { - Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); - Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); - Argument.AssertNotNullOrEmpty(labName, nameof(labName)); - Argument.AssertNotNullOrEmpty(policySetName, nameof(policySetName)); - Argument.AssertNotNullOrEmpty(name, nameof(name)); - Argument.AssertNotNull(patch, nameof(patch)); - - using var message = CreateUpdateRequest(subscriptionId, resourceGroupName, labName, policySetName, name, patch); - await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); - switch (message.Response.Status) + if (top != null) { - case 200: - { - DevTestLabPolicyData value = default; - using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, ModelSerializationExtensions.JsonDocumentOptions, cancellationToken).ConfigureAwait(false); - value = DevTestLabPolicyData.DeserializeDevTestLabPolicyData(document.RootElement); - return Response.FromValue(value, message.Response); - } - default: - throw new RequestFailedException(message.Response); + uri.AppendQuery("$top", TypeFormatters.ConvertToString(top), true); } - } - - /// Allows modifying tags of policies. All other properties will be ignored. - /// The subscription ID. - /// The name of the resource group. - /// The name of the lab. - /// The name of the policy set. - /// The name of the policy. - /// A Policy. - /// 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 labName, string policySetName, string name, DevTestLabPolicyPatch patch, CancellationToken cancellationToken = default) - { - Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); - Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); - Argument.AssertNotNullOrEmpty(labName, nameof(labName)); - Argument.AssertNotNullOrEmpty(policySetName, nameof(policySetName)); - Argument.AssertNotNullOrEmpty(name, nameof(name)); - Argument.AssertNotNull(patch, nameof(patch)); - - using var message = CreateUpdateRequest(subscriptionId, resourceGroupName, labName, policySetName, name, patch); - _pipeline.Send(message, cancellationToken); - switch (message.Response.Status) + if (@orderby != null) { - case 200: - { - DevTestLabPolicyData value = default; - using var document = JsonDocument.Parse(message.Response.ContentStream, ModelSerializationExtensions.JsonDocumentOptions); - value = DevTestLabPolicyData.DeserializeDevTestLabPolicyData(document.RootElement); - return Response.FromValue(value, message.Response); - } - default: - throw new RequestFailedException(message.Response); + uri.AppendQuery("$orderby", @orderby, true); } - } - - internal RequestUriBuilder CreateListNextPageRequestUri(string nextLink, string subscriptionId, string resourceGroupName, string labName, string policySetName, string expand, string filter, int? top, string orderby) - { - var uri = new RawRequestUriBuilder(); - uri.Reset(_endpoint); - uri.AppendRawNextLink(nextLink, false); - return uri; - } - - internal HttpMessage CreateListNextPageRequest(string nextLink, string subscriptionId, string resourceGroupName, string labName, string policySetName, string expand, string filter, int? top, string orderby) - { - var message = _pipeline.CreateMessage(); - var request = message.Request; - request.Method = RequestMethod.Get; - var uri = new RawRequestUriBuilder(); - uri.Reset(_endpoint); - uri.AppendRawNextLink(nextLink, false); + 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 policies in a given policy set. - /// The URL to the next page of results. - /// The subscription ID. - /// The name of the resource group. - /// The name of the lab. - /// The name of the policy set. - /// Specify the $expand query. Example: 'properties($select=description)'. - /// The filter to apply to the operation. Example: '$filter=contains(name,'myName'). - /// The maximum number of resources to return from the operation. Example: '$top=10'. - /// The ordering expression for the results, using OData notation. Example: '$orderby=name desc'. - /// The cancellation token to use. - /// , , , or is null. - /// , , or is an empty string, and was expected to be non-empty. - public async Task> ListNextPageAsync(string nextLink, string subscriptionId, string resourceGroupName, string labName, string policySetName, string expand = null, string filter = null, int? top = null, string orderby = null, CancellationToken cancellationToken = default) + internal HttpMessage CreateNextGetAllRequest(Uri nextPage, string subscriptionId, string resourceGroupName, string labName, string policySetName, string expand, string filter, int? top, string @orderby, RequestContext context) { - Argument.AssertNotNull(nextLink, nameof(nextLink)); - Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); - Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); - Argument.AssertNotNullOrEmpty(labName, nameof(labName)); - Argument.AssertNotNullOrEmpty(policySetName, nameof(policySetName)); - - using var message = CreateListNextPageRequest(nextLink, subscriptionId, resourceGroupName, labName, policySetName, expand, filter, top, orderby); - await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); - switch (message.Response.Status) - { - case 200: - { - PolicyList value = default; - using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, ModelSerializationExtensions.JsonDocumentOptions, cancellationToken).ConfigureAwait(false); - value = PolicyList.DeserializePolicyList(document.RootElement); - return Response.FromValue(value, message.Response); - } - default: - throw new RequestFailedException(message.Response); - } - } - - /// List policies in a given policy set. - /// The URL to the next page of results. - /// The subscription ID. - /// The name of the resource group. - /// The name of the lab. - /// The name of the policy set. - /// Specify the $expand query. Example: 'properties($select=description)'. - /// The filter to apply to the operation. Example: '$filter=contains(name,'myName'). - /// The maximum number of resources to return from the operation. Example: '$top=10'. - /// The ordering expression for the results, using OData notation. Example: '$orderby=name desc'. - /// The cancellation token to use. - /// , , , or is null. - /// , , or is an empty string, and was expected to be non-empty. - public Response ListNextPage(string nextLink, string subscriptionId, string resourceGroupName, string labName, string policySetName, string expand = null, string filter = null, int? top = null, string orderby = null, CancellationToken cancellationToken = default) - { - Argument.AssertNotNull(nextLink, nameof(nextLink)); - Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); - Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); - Argument.AssertNotNullOrEmpty(labName, nameof(labName)); - Argument.AssertNotNullOrEmpty(policySetName, nameof(policySetName)); - - using var message = CreateListNextPageRequest(nextLink, subscriptionId, resourceGroupName, labName, policySetName, expand, filter, top, orderby); - _pipeline.Send(message, cancellationToken); - switch (message.Response.Status) - { - case 200: - { - PolicyList value = default; - using var document = JsonDocument.Parse(message.Response.ContentStream, ModelSerializationExtensions.JsonDocumentOptions); - value = PolicyList.DeserializePolicyList(document.RootElement); - return Response.FromValue(value, message.Response); - } - default: - throw new RequestFailedException(message.Response); - } + RawRequestUriBuilder uri = new RawRequestUriBuilder(); + uri.Reset(nextPage); + uri.UpdateQuery("api-version", _apiVersion); + HttpMessage message = Pipeline.CreateMessage(); + Request request = message.Request; + request.Uri = uri; + request.Method = RequestMethod.Get; + request.Headers.SetValue("Accept", "application/json"); + return message; } } } diff --git a/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/RestOperations/PolicySetsRestOperations.cs b/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/RestOperations/PolicySetsRestOperations.cs index 852c53dbfc41..1df851f3936e 100644 --- a/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/RestOperations/PolicySetsRestOperations.cs +++ b/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/RestOperations/PolicySetsRestOperations.cs @@ -6,59 +6,44 @@ #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.DevTestLabs.Models; namespace Azure.ResourceManager.DevTestLabs { - internal partial class PolicySetsRestOperations + internal partial class PolicySets { - private readonly TelemetryDetails _userAgent; - private readonly HttpPipeline _pipeline; private readonly Uri _endpoint; private readonly string _apiVersion; - /// Initializes a new instance of PolicySetsRestOperations. - /// The HTTP pipeline for sending and receiving REST requests and responses. - /// The application id to use for user agent. - /// server parameter. - /// Api Version. - /// or is null. - public PolicySetsRestOperations(HttpPipeline pipeline, string applicationId, Uri endpoint = null, string apiVersion = default) + /// Initializes a new instance of PolicySets for mocking. + protected PolicySets() { - _pipeline = pipeline ?? throw new ArgumentNullException(nameof(pipeline)); - _endpoint = endpoint ?? new Uri("https://management.azure.com"); - _apiVersion = apiVersion ?? "2018-09-15"; - _userAgent = new TelemetryDetails(GetType().Assembly, applicationId); } - internal RequestUriBuilder CreateEvaluatePoliciesRequestUri(string subscriptionId, string resourceGroupName, string labName, string name, DevTestLabEvaluatePoliciesContent content) + /// Initializes a new instance of PolicySets. + /// 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 PolicySets(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.DevTestLab/labs/", false); - uri.AppendPath(labName, true); - uri.AppendPath("/policysets/", false); - uri.AppendPath(name, true); - uri.AppendPath("/evaluatePolicies", false); - uri.AppendQuery("api-version", _apiVersion, true); - return uri; + ClientDiagnostics = clientDiagnostics; + _endpoint = endpoint; + Pipeline = pipeline; + _apiVersion = apiVersion; } - internal HttpMessage CreateEvaluatePoliciesRequest(string subscriptionId, string resourceGroupName, string labName, string name, DevTestLabEvaluatePoliciesContent content) + /// 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 CreateEvaluatePoliciesRequest(string subscriptionId, string resourceGroupName, string labName, string name, RequestContent content, RequestContext context) { - var message = _pipeline.CreateMessage(); - var request = message.Request; - request.Method = RequestMethod.Post; - var uri = new RawRequestUriBuilder(); + RawRequestUriBuilder uri = new RawRequestUriBuilder(); uri.Reset(_endpoint); uri.AppendPath("/subscriptions/", false); uri.AppendPath(subscriptionId, true); @@ -70,80 +55,14 @@ internal HttpMessage CreateEvaluatePoliciesRequest(string subscriptionId, string uri.AppendPath(name, true); uri.AppendPath("/evaluatePolicies", false); 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 content0 = new Utf8JsonRequestContent(); - content0.JsonWriter.WriteObjectValue(content, ModelSerializationExtensions.WireOptions); - request.Content = content0; - _userAgent.Apply(message); + request.Method = RequestMethod.Post; + request.Headers.SetValue("Content-Type", "application/json"); + request.Headers.SetValue("Accept", "application/json"); + request.Content = content; return message; } - - /// Evaluates lab policy. - /// The subscription ID. - /// The name of the resource group. - /// The name of the lab. - /// The name of the policy set. - /// Request body for evaluating a policy set. - /// The cancellation token to use. - /// , , , or is null. - /// , , or is an empty string, and was expected to be non-empty. - public async Task> EvaluatePoliciesAsync(string subscriptionId, string resourceGroupName, string labName, string name, DevTestLabEvaluatePoliciesContent content, CancellationToken cancellationToken = default) - { - Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); - Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); - Argument.AssertNotNullOrEmpty(labName, nameof(labName)); - Argument.AssertNotNullOrEmpty(name, nameof(name)); - Argument.AssertNotNull(content, nameof(content)); - - using var message = CreateEvaluatePoliciesRequest(subscriptionId, resourceGroupName, labName, name, content); - await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); - switch (message.Response.Status) - { - case 200: - { - DevTestLabEvaluatePoliciesResult value = default; - using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, ModelSerializationExtensions.JsonDocumentOptions, cancellationToken).ConfigureAwait(false); - value = DevTestLabEvaluatePoliciesResult.DeserializeDevTestLabEvaluatePoliciesResult(document.RootElement); - return Response.FromValue(value, message.Response); - } - default: - throw new RequestFailedException(message.Response); - } - } - - /// Evaluates lab policy. - /// The subscription ID. - /// The name of the resource group. - /// The name of the lab. - /// The name of the policy set. - /// Request body for evaluating a policy set. - /// The cancellation token to use. - /// , , , or is null. - /// , , or is an empty string, and was expected to be non-empty. - public Response EvaluatePolicies(string subscriptionId, string resourceGroupName, string labName, string name, DevTestLabEvaluatePoliciesContent content, CancellationToken cancellationToken = default) - { - Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); - Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); - Argument.AssertNotNullOrEmpty(labName, nameof(labName)); - Argument.AssertNotNullOrEmpty(name, nameof(name)); - Argument.AssertNotNull(content, nameof(content)); - - using var message = CreateEvaluatePoliciesRequest(subscriptionId, resourceGroupName, labName, name, content); - _pipeline.Send(message, cancellationToken); - switch (message.Response.Status) - { - case 200: - { - DevTestLabEvaluatePoliciesResult value = default; - using var document = JsonDocument.Parse(message.Response.ContentStream, ModelSerializationExtensions.JsonDocumentOptions); - value = DevTestLabEvaluatePoliciesResult.DeserializeDevTestLabEvaluatePoliciesResult(document.RootElement); - return Response.FromValue(value, message.Response); - } - default: - throw new RequestFailedException(message.Response); - } - } } } diff --git a/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/RestOperations/SchedulesRestOperations.cs b/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/RestOperations/SchedulesRestOperations.cs deleted file mode 100644 index 43ba8d6f0cae..000000000000 --- a/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/RestOperations/SchedulesRestOperations.cs +++ /dev/null @@ -1,973 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System; -using System.Text.Json; -using System.Threading; -using System.Threading.Tasks; -using Azure.Core; -using Azure.Core.Pipeline; -using Azure.ResourceManager.DevTestLabs.Models; - -namespace Azure.ResourceManager.DevTestLabs -{ - internal partial class SchedulesRestOperations - { - private readonly TelemetryDetails _userAgent; - private readonly HttpPipeline _pipeline; - private readonly Uri _endpoint; - private readonly string _apiVersion; - - /// Initializes a new instance of SchedulesRestOperations. - /// The HTTP pipeline for sending and receiving REST requests and responses. - /// The application id to use for user agent. - /// server parameter. - /// Api Version. - /// or is null. - public SchedulesRestOperations(HttpPipeline pipeline, string applicationId, Uri endpoint = null, string apiVersion = default) - { - _pipeline = pipeline ?? throw new ArgumentNullException(nameof(pipeline)); - _endpoint = endpoint ?? new Uri("https://management.azure.com"); - _apiVersion = apiVersion ?? "2018-09-15"; - _userAgent = new TelemetryDetails(GetType().Assembly, applicationId); - } - - internal RequestUriBuilder CreateListRequestUri(string subscriptionId, string resourceGroupName, string labName, string expand, string filter, int? top, string orderby) - { - 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.DevTestLab/labs/", false); - uri.AppendPath(labName, true); - uri.AppendPath("/schedules", false); - if (expand != null) - { - uri.AppendQuery("$expand", expand, true); - } - if (filter != null) - { - uri.AppendQuery("$filter", filter, true); - } - if (top != null) - { - uri.AppendQuery("$top", top.Value, true); - } - if (orderby != null) - { - uri.AppendQuery("$orderby", orderby, true); - } - uri.AppendQuery("api-version", _apiVersion, true); - return uri; - } - - internal HttpMessage CreateListRequest(string subscriptionId, string resourceGroupName, string labName, string expand, string filter, int? top, string orderby) - { - 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.DevTestLab/labs/", false); - uri.AppendPath(labName, true); - uri.AppendPath("/schedules", false); - if (expand != null) - { - uri.AppendQuery("$expand", expand, true); - } - if (filter != null) - { - uri.AppendQuery("$filter", filter, true); - } - if (top != null) - { - uri.AppendQuery("$top", top.Value, true); - } - if (orderby != null) - { - uri.AppendQuery("$orderby", orderby, true); - } - uri.AppendQuery("api-version", _apiVersion, true); - request.Uri = uri; - request.Headers.Add("Accept", "application/json"); - _userAgent.Apply(message); - return message; - } - - /// List schedules in a given lab. - /// The subscription ID. - /// The name of the resource group. - /// The name of the lab. - /// Specify the $expand query. Example: 'properties($select=status)'. - /// The filter to apply to the operation. Example: '$filter=contains(name,'myName'). - /// The maximum number of resources to return from the operation. Example: '$top=10'. - /// The ordering expression for the results, using OData notation. Example: '$orderby=name desc'. - /// The cancellation token to use. - /// , or is null. - /// , or is an empty string, and was expected to be non-empty. - public async Task> ListAsync(string subscriptionId, string resourceGroupName, string labName, string expand = null, string filter = null, int? top = null, string orderby = null, CancellationToken cancellationToken = default) - { - Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); - Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); - Argument.AssertNotNullOrEmpty(labName, nameof(labName)); - - using var message = CreateListRequest(subscriptionId, resourceGroupName, labName, expand, filter, top, orderby); - await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); - switch (message.Response.Status) - { - case 200: - { - ScheduleList value = default; - using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, ModelSerializationExtensions.JsonDocumentOptions, cancellationToken).ConfigureAwait(false); - value = ScheduleList.DeserializeScheduleList(document.RootElement); - return Response.FromValue(value, message.Response); - } - default: - throw new RequestFailedException(message.Response); - } - } - - /// List schedules in a given lab. - /// The subscription ID. - /// The name of the resource group. - /// The name of the lab. - /// Specify the $expand query. Example: 'properties($select=status)'. - /// The filter to apply to the operation. Example: '$filter=contains(name,'myName'). - /// The maximum number of resources to return from the operation. Example: '$top=10'. - /// The ordering expression for the results, using OData notation. Example: '$orderby=name desc'. - /// The cancellation token to use. - /// , or is null. - /// , or is an empty string, and was expected to be non-empty. - public Response List(string subscriptionId, string resourceGroupName, string labName, string expand = null, string filter = null, int? top = null, string orderby = null, CancellationToken cancellationToken = default) - { - Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); - Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); - Argument.AssertNotNullOrEmpty(labName, nameof(labName)); - - using var message = CreateListRequest(subscriptionId, resourceGroupName, labName, expand, filter, top, orderby); - _pipeline.Send(message, cancellationToken); - switch (message.Response.Status) - { - case 200: - { - ScheduleList value = default; - using var document = JsonDocument.Parse(message.Response.ContentStream, ModelSerializationExtensions.JsonDocumentOptions); - value = ScheduleList.DeserializeScheduleList(document.RootElement); - return Response.FromValue(value, message.Response); - } - default: - throw new RequestFailedException(message.Response); - } - } - - internal RequestUriBuilder CreateGetRequestUri(string subscriptionId, string resourceGroupName, string labName, string name, string expand) - { - 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.DevTestLab/labs/", false); - uri.AppendPath(labName, true); - uri.AppendPath("/schedules/", false); - uri.AppendPath(name, true); - if (expand != null) - { - uri.AppendQuery("$expand", expand, true); - } - uri.AppendQuery("api-version", _apiVersion, true); - return uri; - } - - internal HttpMessage CreateGetRequest(string subscriptionId, string resourceGroupName, string labName, string name, string expand) - { - 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.DevTestLab/labs/", false); - uri.AppendPath(labName, true); - uri.AppendPath("/schedules/", false); - uri.AppendPath(name, true); - if (expand != null) - { - uri.AppendQuery("$expand", expand, true); - } - uri.AppendQuery("api-version", _apiVersion, true); - request.Uri = uri; - request.Headers.Add("Accept", "application/json"); - _userAgent.Apply(message); - return message; - } - - /// Get schedule. - /// The subscription ID. - /// The name of the resource group. - /// The name of the lab. - /// The name of the schedule. - /// Specify the $expand query. Example: 'properties($select=status)'. - /// 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 labName, string name, string expand = null, CancellationToken cancellationToken = default) - { - Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); - Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); - Argument.AssertNotNullOrEmpty(labName, nameof(labName)); - Argument.AssertNotNullOrEmpty(name, nameof(name)); - - using var message = CreateGetRequest(subscriptionId, resourceGroupName, labName, name, expand); - await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); - switch (message.Response.Status) - { - case 200: - { - DevTestLabScheduleData value = default; - using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, ModelSerializationExtensions.JsonDocumentOptions, cancellationToken).ConfigureAwait(false); - value = DevTestLabScheduleData.DeserializeDevTestLabScheduleData(document.RootElement); - return Response.FromValue(value, message.Response); - } - case 404: - return Response.FromValue((DevTestLabScheduleData)null, message.Response); - default: - throw new RequestFailedException(message.Response); - } - } - - /// Get schedule. - /// The subscription ID. - /// The name of the resource group. - /// The name of the lab. - /// The name of the schedule. - /// Specify the $expand query. Example: 'properties($select=status)'. - /// 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 labName, string name, string expand = null, CancellationToken cancellationToken = default) - { - Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); - Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); - Argument.AssertNotNullOrEmpty(labName, nameof(labName)); - Argument.AssertNotNullOrEmpty(name, nameof(name)); - - using var message = CreateGetRequest(subscriptionId, resourceGroupName, labName, name, expand); - _pipeline.Send(message, cancellationToken); - switch (message.Response.Status) - { - case 200: - { - DevTestLabScheduleData value = default; - using var document = JsonDocument.Parse(message.Response.ContentStream, ModelSerializationExtensions.JsonDocumentOptions); - value = DevTestLabScheduleData.DeserializeDevTestLabScheduleData(document.RootElement); - return Response.FromValue(value, message.Response); - } - case 404: - return Response.FromValue((DevTestLabScheduleData)null, message.Response); - default: - throw new RequestFailedException(message.Response); - } - } - - internal RequestUriBuilder CreateCreateOrUpdateRequestUri(string subscriptionId, string resourceGroupName, string labName, string name, DevTestLabScheduleData data) - { - var uri = new RawRequestUriBuilder(); - uri.Reset(_endpoint); - uri.AppendPath("/subscriptions/", false); - uri.AppendPath(subscriptionId, true); - uri.AppendPath("/resourceGroups/", false); - uri.AppendPath(resourceGroupName, true); - uri.AppendPath("/providers/Microsoft.DevTestLab/labs/", false); - uri.AppendPath(labName, true); - uri.AppendPath("/schedules/", false); - uri.AppendPath(name, true); - uri.AppendQuery("api-version", _apiVersion, true); - return uri; - } - - internal HttpMessage CreateCreateOrUpdateRequest(string subscriptionId, string resourceGroupName, string labName, string name, DevTestLabScheduleData data) - { - var message = _pipeline.CreateMessage(); - var request = message.Request; - request.Method = RequestMethod.Put; - var uri = new RawRequestUriBuilder(); - uri.Reset(_endpoint); - uri.AppendPath("/subscriptions/", false); - uri.AppendPath(subscriptionId, true); - uri.AppendPath("/resourceGroups/", false); - uri.AppendPath(resourceGroupName, true); - uri.AppendPath("/providers/Microsoft.DevTestLab/labs/", false); - uri.AppendPath(labName, true); - uri.AppendPath("/schedules/", false); - uri.AppendPath(name, true); - uri.AppendQuery("api-version", _apiVersion, true); - request.Uri = uri; - request.Headers.Add("Accept", "application/json"); - request.Headers.Add("Content-Type", "application/json"); - var content = new Utf8JsonRequestContent(); - content.JsonWriter.WriteObjectValue(data, ModelSerializationExtensions.WireOptions); - request.Content = content; - _userAgent.Apply(message); - return message; - } - - /// Create or replace an existing schedule. - /// The subscription ID. - /// The name of the resource group. - /// The name of the lab. - /// The name of the schedule. - /// A schedule. - /// 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 labName, string name, DevTestLabScheduleData data, CancellationToken cancellationToken = default) - { - Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); - Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); - Argument.AssertNotNullOrEmpty(labName, nameof(labName)); - Argument.AssertNotNullOrEmpty(name, nameof(name)); - Argument.AssertNotNull(data, nameof(data)); - - using var message = CreateCreateOrUpdateRequest(subscriptionId, resourceGroupName, labName, name, data); - await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); - switch (message.Response.Status) - { - case 200: - case 201: - { - DevTestLabScheduleData value = default; - using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, ModelSerializationExtensions.JsonDocumentOptions, cancellationToken).ConfigureAwait(false); - value = DevTestLabScheduleData.DeserializeDevTestLabScheduleData(document.RootElement); - return Response.FromValue(value, message.Response); - } - default: - throw new RequestFailedException(message.Response); - } - } - - /// Create or replace an existing schedule. - /// The subscription ID. - /// The name of the resource group. - /// The name of the lab. - /// The name of the schedule. - /// A schedule. - /// 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 labName, string name, DevTestLabScheduleData data, CancellationToken cancellationToken = default) - { - Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); - Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); - Argument.AssertNotNullOrEmpty(labName, nameof(labName)); - Argument.AssertNotNullOrEmpty(name, nameof(name)); - Argument.AssertNotNull(data, nameof(data)); - - using var message = CreateCreateOrUpdateRequest(subscriptionId, resourceGroupName, labName, name, data); - _pipeline.Send(message, cancellationToken); - switch (message.Response.Status) - { - case 200: - case 201: - { - DevTestLabScheduleData value = default; - using var document = JsonDocument.Parse(message.Response.ContentStream, ModelSerializationExtensions.JsonDocumentOptions); - value = DevTestLabScheduleData.DeserializeDevTestLabScheduleData(document.RootElement); - return Response.FromValue(value, message.Response); - } - default: - throw new RequestFailedException(message.Response); - } - } - - internal RequestUriBuilder CreateDeleteRequestUri(string subscriptionId, string resourceGroupName, string labName, string name) - { - 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.DevTestLab/labs/", false); - uri.AppendPath(labName, true); - uri.AppendPath("/schedules/", false); - uri.AppendPath(name, true); - uri.AppendQuery("api-version", _apiVersion, true); - return uri; - } - - internal HttpMessage CreateDeleteRequest(string subscriptionId, string resourceGroupName, string labName, string name) - { - 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("/resourceGroups/", false); - uri.AppendPath(resourceGroupName, true); - uri.AppendPath("/providers/Microsoft.DevTestLab/labs/", false); - uri.AppendPath(labName, true); - uri.AppendPath("/schedules/", false); - uri.AppendPath(name, true); - uri.AppendQuery("api-version", _apiVersion, true); - request.Uri = uri; - request.Headers.Add("Accept", "application/json"); - _userAgent.Apply(message); - return message; - } - - /// Delete schedule. - /// The subscription ID. - /// The name of the resource group. - /// The name of the lab. - /// The name of the schedule. - /// 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 labName, string name, CancellationToken cancellationToken = default) - { - Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); - Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); - Argument.AssertNotNullOrEmpty(labName, nameof(labName)); - Argument.AssertNotNullOrEmpty(name, nameof(name)); - - using var message = CreateDeleteRequest(subscriptionId, resourceGroupName, labName, name); - await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); - switch (message.Response.Status) - { - case 200: - case 204: - return message.Response; - default: - throw new RequestFailedException(message.Response); - } - } - - /// Delete schedule. - /// The subscription ID. - /// The name of the resource group. - /// The name of the lab. - /// The name of the schedule. - /// 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 labName, string name, CancellationToken cancellationToken = default) - { - Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); - Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); - Argument.AssertNotNullOrEmpty(labName, nameof(labName)); - Argument.AssertNotNullOrEmpty(name, nameof(name)); - - using var message = CreateDeleteRequest(subscriptionId, resourceGroupName, labName, name); - _pipeline.Send(message, cancellationToken); - switch (message.Response.Status) - { - case 200: - case 204: - return message.Response; - default: - throw new RequestFailedException(message.Response); - } - } - - internal RequestUriBuilder CreateUpdateRequestUri(string subscriptionId, string resourceGroupName, string labName, string name, DevTestLabSchedulePatch 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.DevTestLab/labs/", false); - uri.AppendPath(labName, true); - uri.AppendPath("/schedules/", false); - uri.AppendPath(name, true); - uri.AppendQuery("api-version", _apiVersion, true); - return uri; - } - - internal HttpMessage CreateUpdateRequest(string subscriptionId, string resourceGroupName, string labName, string name, DevTestLabSchedulePatch patch) - { - var message = _pipeline.CreateMessage(); - var request = message.Request; - request.Method = RequestMethod.Patch; - var uri = new RawRequestUriBuilder(); - uri.Reset(_endpoint); - uri.AppendPath("/subscriptions/", false); - uri.AppendPath(subscriptionId, true); - uri.AppendPath("/resourceGroups/", false); - uri.AppendPath(resourceGroupName, true); - uri.AppendPath("/providers/Microsoft.DevTestLab/labs/", false); - uri.AppendPath(labName, true); - uri.AppendPath("/schedules/", false); - uri.AppendPath(name, true); - uri.AppendQuery("api-version", _apiVersion, true); - request.Uri = uri; - request.Headers.Add("Accept", "application/json"); - request.Headers.Add("Content-Type", "application/json"); - var content = new Utf8JsonRequestContent(); - content.JsonWriter.WriteObjectValue(patch, ModelSerializationExtensions.WireOptions); - request.Content = content; - _userAgent.Apply(message); - return message; - } - - /// Allows modifying tags of schedules. All other properties will be ignored. - /// The subscription ID. - /// The name of the resource group. - /// The name of the lab. - /// The name of the schedule. - /// A schedule. - /// 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 labName, string name, DevTestLabSchedulePatch patch, CancellationToken cancellationToken = default) - { - Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); - Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); - Argument.AssertNotNullOrEmpty(labName, nameof(labName)); - Argument.AssertNotNullOrEmpty(name, nameof(name)); - Argument.AssertNotNull(patch, nameof(patch)); - - using var message = CreateUpdateRequest(subscriptionId, resourceGroupName, labName, name, patch); - await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); - switch (message.Response.Status) - { - case 200: - { - DevTestLabScheduleData value = default; - using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, ModelSerializationExtensions.JsonDocumentOptions, cancellationToken).ConfigureAwait(false); - value = DevTestLabScheduleData.DeserializeDevTestLabScheduleData(document.RootElement); - return Response.FromValue(value, message.Response); - } - default: - throw new RequestFailedException(message.Response); - } - } - - /// Allows modifying tags of schedules. All other properties will be ignored. - /// The subscription ID. - /// The name of the resource group. - /// The name of the lab. - /// The name of the schedule. - /// A schedule. - /// 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 labName, string name, DevTestLabSchedulePatch patch, CancellationToken cancellationToken = default) - { - Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); - Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); - Argument.AssertNotNullOrEmpty(labName, nameof(labName)); - Argument.AssertNotNullOrEmpty(name, nameof(name)); - Argument.AssertNotNull(patch, nameof(patch)); - - using var message = CreateUpdateRequest(subscriptionId, resourceGroupName, labName, name, patch); - _pipeline.Send(message, cancellationToken); - switch (message.Response.Status) - { - case 200: - { - DevTestLabScheduleData value = default; - using var document = JsonDocument.Parse(message.Response.ContentStream, ModelSerializationExtensions.JsonDocumentOptions); - value = DevTestLabScheduleData.DeserializeDevTestLabScheduleData(document.RootElement); - return Response.FromValue(value, message.Response); - } - default: - throw new RequestFailedException(message.Response); - } - } - - internal RequestUriBuilder CreateExecuteRequestUri(string subscriptionId, string resourceGroupName, string labName, string name) - { - 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.DevTestLab/labs/", false); - uri.AppendPath(labName, true); - uri.AppendPath("/schedules/", false); - uri.AppendPath(name, true); - uri.AppendPath("/execute", false); - uri.AppendQuery("api-version", _apiVersion, true); - return uri; - } - - internal HttpMessage CreateExecuteRequest(string subscriptionId, string resourceGroupName, string labName, string name) - { - var message = _pipeline.CreateMessage(); - var request = message.Request; - request.Method = RequestMethod.Post; - var uri = new RawRequestUriBuilder(); - uri.Reset(_endpoint); - uri.AppendPath("/subscriptions/", false); - uri.AppendPath(subscriptionId, true); - uri.AppendPath("/resourceGroups/", false); - uri.AppendPath(resourceGroupName, true); - uri.AppendPath("/providers/Microsoft.DevTestLab/labs/", false); - uri.AppendPath(labName, true); - uri.AppendPath("/schedules/", false); - uri.AppendPath(name, true); - uri.AppendPath("/execute", false); - uri.AppendQuery("api-version", _apiVersion, true); - request.Uri = uri; - request.Headers.Add("Accept", "application/json"); - _userAgent.Apply(message); - return message; - } - - /// Execute a schedule. This operation can take a while to complete. - /// The subscription ID. - /// The name of the resource group. - /// The name of the lab. - /// The name of the schedule. - /// The cancellation token to use. - /// , , or is null. - /// , , or is an empty string, and was expected to be non-empty. - public async Task ExecuteAsync(string subscriptionId, string resourceGroupName, string labName, string name, CancellationToken cancellationToken = default) - { - Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); - Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); - Argument.AssertNotNullOrEmpty(labName, nameof(labName)); - Argument.AssertNotNullOrEmpty(name, nameof(name)); - - using var message = CreateExecuteRequest(subscriptionId, resourceGroupName, labName, name); - await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); - switch (message.Response.Status) - { - case 200: - case 202: - return message.Response; - default: - throw new RequestFailedException(message.Response); - } - } - - /// Execute a schedule. This operation can take a while to complete. - /// The subscription ID. - /// The name of the resource group. - /// The name of the lab. - /// The name of the schedule. - /// The cancellation token to use. - /// , , or is null. - /// , , or is an empty string, and was expected to be non-empty. - public Response Execute(string subscriptionId, string resourceGroupName, string labName, string name, CancellationToken cancellationToken = default) - { - Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); - Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); - Argument.AssertNotNullOrEmpty(labName, nameof(labName)); - Argument.AssertNotNullOrEmpty(name, nameof(name)); - - using var message = CreateExecuteRequest(subscriptionId, resourceGroupName, labName, name); - _pipeline.Send(message, cancellationToken); - switch (message.Response.Status) - { - case 200: - case 202: - return message.Response; - default: - throw new RequestFailedException(message.Response); - } - } - - internal RequestUriBuilder CreateListApplicableRequestUri(string subscriptionId, string resourceGroupName, string labName, string name) - { - 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.DevTestLab/labs/", false); - uri.AppendPath(labName, true); - uri.AppendPath("/schedules/", false); - uri.AppendPath(name, true); - uri.AppendPath("/listApplicable", false); - uri.AppendQuery("api-version", _apiVersion, true); - return uri; - } - - internal HttpMessage CreateListApplicableRequest(string subscriptionId, string resourceGroupName, string labName, string name) - { - var message = _pipeline.CreateMessage(); - var request = message.Request; - request.Method = RequestMethod.Post; - var uri = new RawRequestUriBuilder(); - uri.Reset(_endpoint); - uri.AppendPath("/subscriptions/", false); - uri.AppendPath(subscriptionId, true); - uri.AppendPath("/resourceGroups/", false); - uri.AppendPath(resourceGroupName, true); - uri.AppendPath("/providers/Microsoft.DevTestLab/labs/", false); - uri.AppendPath(labName, true); - uri.AppendPath("/schedules/", false); - uri.AppendPath(name, true); - uri.AppendPath("/listApplicable", false); - uri.AppendQuery("api-version", _apiVersion, true); - request.Uri = uri; - request.Headers.Add("Accept", "application/json"); - _userAgent.Apply(message); - return message; - } - - /// Lists all applicable schedules. - /// The subscription ID. - /// The name of the resource group. - /// The name of the lab. - /// The name of the schedule. - /// The cancellation token to use. - /// , , or is null. - /// , , or is an empty string, and was expected to be non-empty. - public async Task> ListApplicableAsync(string subscriptionId, string resourceGroupName, string labName, string name, CancellationToken cancellationToken = default) - { - Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); - Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); - Argument.AssertNotNullOrEmpty(labName, nameof(labName)); - Argument.AssertNotNullOrEmpty(name, nameof(name)); - - using var message = CreateListApplicableRequest(subscriptionId, resourceGroupName, labName, name); - await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); - switch (message.Response.Status) - { - case 200: - { - ScheduleList value = default; - using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, ModelSerializationExtensions.JsonDocumentOptions, cancellationToken).ConfigureAwait(false); - value = ScheduleList.DeserializeScheduleList(document.RootElement); - return Response.FromValue(value, message.Response); - } - default: - throw new RequestFailedException(message.Response); - } - } - - /// Lists all applicable schedules. - /// The subscription ID. - /// The name of the resource group. - /// The name of the lab. - /// The name of the schedule. - /// The cancellation token to use. - /// , , or is null. - /// , , or is an empty string, and was expected to be non-empty. - public Response ListApplicable(string subscriptionId, string resourceGroupName, string labName, string name, CancellationToken cancellationToken = default) - { - Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); - Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); - Argument.AssertNotNullOrEmpty(labName, nameof(labName)); - Argument.AssertNotNullOrEmpty(name, nameof(name)); - - using var message = CreateListApplicableRequest(subscriptionId, resourceGroupName, labName, name); - _pipeline.Send(message, cancellationToken); - switch (message.Response.Status) - { - case 200: - { - ScheduleList value = default; - using var document = JsonDocument.Parse(message.Response.ContentStream, ModelSerializationExtensions.JsonDocumentOptions); - value = ScheduleList.DeserializeScheduleList(document.RootElement); - return Response.FromValue(value, message.Response); - } - default: - throw new RequestFailedException(message.Response); - } - } - - internal RequestUriBuilder CreateListNextPageRequestUri(string nextLink, string subscriptionId, string resourceGroupName, string labName, string expand, string filter, int? top, string orderby) - { - var uri = new RawRequestUriBuilder(); - uri.Reset(_endpoint); - uri.AppendRawNextLink(nextLink, false); - return uri; - } - - internal HttpMessage CreateListNextPageRequest(string nextLink, string subscriptionId, string resourceGroupName, string labName, string expand, string filter, int? top, string orderby) - { - var message = _pipeline.CreateMessage(); - var request = message.Request; - request.Method = RequestMethod.Get; - var uri = new RawRequestUriBuilder(); - uri.Reset(_endpoint); - uri.AppendRawNextLink(nextLink, false); - request.Uri = uri; - request.Headers.Add("Accept", "application/json"); - _userAgent.Apply(message); - return message; - } - - /// List schedules in a given lab. - /// The URL to the next page of results. - /// The subscription ID. - /// The name of the resource group. - /// The name of the lab. - /// Specify the $expand query. Example: 'properties($select=status)'. - /// The filter to apply to the operation. Example: '$filter=contains(name,'myName'). - /// The maximum number of resources to return from the operation. Example: '$top=10'. - /// The ordering expression for the results, using OData notation. Example: '$orderby=name desc'. - /// The cancellation token to use. - /// , , or is null. - /// , or is an empty string, and was expected to be non-empty. - public async Task> ListNextPageAsync(string nextLink, string subscriptionId, string resourceGroupName, string labName, string expand = null, string filter = null, int? top = null, string orderby = null, CancellationToken cancellationToken = default) - { - Argument.AssertNotNull(nextLink, nameof(nextLink)); - Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); - Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); - Argument.AssertNotNullOrEmpty(labName, nameof(labName)); - - using var message = CreateListNextPageRequest(nextLink, subscriptionId, resourceGroupName, labName, expand, filter, top, orderby); - await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); - switch (message.Response.Status) - { - case 200: - { - ScheduleList value = default; - using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, ModelSerializationExtensions.JsonDocumentOptions, cancellationToken).ConfigureAwait(false); - value = ScheduleList.DeserializeScheduleList(document.RootElement); - return Response.FromValue(value, message.Response); - } - default: - throw new RequestFailedException(message.Response); - } - } - - /// List schedules in a given lab. - /// The URL to the next page of results. - /// The subscription ID. - /// The name of the resource group. - /// The name of the lab. - /// Specify the $expand query. Example: 'properties($select=status)'. - /// The filter to apply to the operation. Example: '$filter=contains(name,'myName'). - /// The maximum number of resources to return from the operation. Example: '$top=10'. - /// The ordering expression for the results, using OData notation. Example: '$orderby=name desc'. - /// The cancellation token to use. - /// , , or is null. - /// , or is an empty string, and was expected to be non-empty. - public Response ListNextPage(string nextLink, string subscriptionId, string resourceGroupName, string labName, string expand = null, string filter = null, int? top = null, string orderby = null, CancellationToken cancellationToken = default) - { - Argument.AssertNotNull(nextLink, nameof(nextLink)); - Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); - Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); - Argument.AssertNotNullOrEmpty(labName, nameof(labName)); - - using var message = CreateListNextPageRequest(nextLink, subscriptionId, resourceGroupName, labName, expand, filter, top, orderby); - _pipeline.Send(message, cancellationToken); - switch (message.Response.Status) - { - case 200: - { - ScheduleList value = default; - using var document = JsonDocument.Parse(message.Response.ContentStream, ModelSerializationExtensions.JsonDocumentOptions); - value = ScheduleList.DeserializeScheduleList(document.RootElement); - return Response.FromValue(value, message.Response); - } - default: - throw new RequestFailedException(message.Response); - } - } - - internal RequestUriBuilder CreateListApplicableNextPageRequestUri(string nextLink, string subscriptionId, string resourceGroupName, string labName, string name) - { - var uri = new RawRequestUriBuilder(); - uri.Reset(_endpoint); - uri.AppendRawNextLink(nextLink, false); - return uri; - } - - internal HttpMessage CreateListApplicableNextPageRequest(string nextLink, string subscriptionId, string resourceGroupName, string labName, string name) - { - var message = _pipeline.CreateMessage(); - var request = message.Request; - request.Method = RequestMethod.Get; - var uri = new RawRequestUriBuilder(); - uri.Reset(_endpoint); - uri.AppendRawNextLink(nextLink, false); - request.Uri = uri; - request.Headers.Add("Accept", "application/json"); - _userAgent.Apply(message); - return message; - } - - /// Lists all applicable schedules. - /// The URL to the next page of results. - /// The subscription ID. - /// The name of the resource group. - /// The name of the lab. - /// The name of the schedule. - /// The cancellation token to use. - /// , , , or is null. - /// , , or is an empty string, and was expected to be non-empty. - public async Task> ListApplicableNextPageAsync(string nextLink, string subscriptionId, string resourceGroupName, string labName, string name, CancellationToken cancellationToken = default) - { - Argument.AssertNotNull(nextLink, nameof(nextLink)); - Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); - Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); - Argument.AssertNotNullOrEmpty(labName, nameof(labName)); - Argument.AssertNotNullOrEmpty(name, nameof(name)); - - using var message = CreateListApplicableNextPageRequest(nextLink, subscriptionId, resourceGroupName, labName, name); - await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); - switch (message.Response.Status) - { - case 200: - { - ScheduleList value = default; - using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, ModelSerializationExtensions.JsonDocumentOptions, cancellationToken).ConfigureAwait(false); - value = ScheduleList.DeserializeScheduleList(document.RootElement); - return Response.FromValue(value, message.Response); - } - default: - throw new RequestFailedException(message.Response); - } - } - - /// Lists all applicable schedules. - /// The URL to the next page of results. - /// The subscription ID. - /// The name of the resource group. - /// The name of the lab. - /// The name of the schedule. - /// The cancellation token to use. - /// , , , or is null. - /// , , or is an empty string, and was expected to be non-empty. - public Response ListApplicableNextPage(string nextLink, string subscriptionId, string resourceGroupName, string labName, string name, CancellationToken cancellationToken = default) - { - Argument.AssertNotNull(nextLink, nameof(nextLink)); - Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); - Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); - Argument.AssertNotNullOrEmpty(labName, nameof(labName)); - Argument.AssertNotNullOrEmpty(name, nameof(name)); - - using var message = CreateListApplicableNextPageRequest(nextLink, subscriptionId, resourceGroupName, labName, name); - _pipeline.Send(message, cancellationToken); - switch (message.Response.Status) - { - case 200: - { - ScheduleList value = default; - using var document = JsonDocument.Parse(message.Response.ContentStream, ModelSerializationExtensions.JsonDocumentOptions); - value = ScheduleList.DeserializeScheduleList(document.RootElement); - return Response.FromValue(value, message.Response); - } - default: - throw new RequestFailedException(message.Response); - } - } - } -} diff --git a/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/RestOperations/SecretsRestOperations.cs b/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/RestOperations/SecretsRestOperations.cs index aead3e3b96ed..6126f8e43194 100644 --- a/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/RestOperations/SecretsRestOperations.cs +++ b/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/RestOperations/SecretsRestOperations.cs @@ -6,181 +6,44 @@ #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.DevTestLabs.Models; namespace Azure.ResourceManager.DevTestLabs { - internal partial class SecretsRestOperations + internal partial class Secrets { - private readonly TelemetryDetails _userAgent; - private readonly HttpPipeline _pipeline; private readonly Uri _endpoint; private readonly string _apiVersion; - /// Initializes a new instance of SecretsRestOperations. - /// The HTTP pipeline for sending and receiving REST requests and responses. - /// The application id to use for user agent. - /// server parameter. - /// Api Version. - /// or is null. - public SecretsRestOperations(HttpPipeline pipeline, string applicationId, Uri endpoint = null, string apiVersion = default) - { - _pipeline = pipeline ?? throw new ArgumentNullException(nameof(pipeline)); - _endpoint = endpoint ?? new Uri("https://management.azure.com"); - _apiVersion = apiVersion ?? "2018-09-15"; - _userAgent = new TelemetryDetails(GetType().Assembly, applicationId); - } - - internal RequestUriBuilder CreateListRequestUri(string subscriptionId, string resourceGroupName, string labName, string userName, string expand, string filter, int? top, string orderby) + /// Initializes a new instance of Secrets for mocking. + protected Secrets() { - 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.DevTestLab/labs/", false); - uri.AppendPath(labName, true); - uri.AppendPath("/users/", false); - uri.AppendPath(userName, true); - uri.AppendPath("/secrets", false); - if (expand != null) - { - uri.AppendQuery("$expand", expand, true); - } - if (filter != null) - { - uri.AppendQuery("$filter", filter, true); - } - if (top != null) - { - uri.AppendQuery("$top", top.Value, true); - } - if (orderby != null) - { - uri.AppendQuery("$orderby", orderby, true); - } - uri.AppendQuery("api-version", _apiVersion, true); - return uri; - } - - internal HttpMessage CreateListRequest(string subscriptionId, string resourceGroupName, string labName, string userName, string expand, string filter, int? top, string orderby) - { - 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.DevTestLab/labs/", false); - uri.AppendPath(labName, true); - uri.AppendPath("/users/", false); - uri.AppendPath(userName, true); - uri.AppendPath("/secrets", false); - if (expand != null) - { - uri.AppendQuery("$expand", expand, true); - } - if (filter != null) - { - uri.AppendQuery("$filter", filter, true); - } - if (top != null) - { - uri.AppendQuery("$top", top.Value, true); - } - if (orderby != null) - { - uri.AppendQuery("$orderby", orderby, true); - } - uri.AppendQuery("api-version", _apiVersion, true); - request.Uri = uri; - request.Headers.Add("Accept", "application/json"); - _userAgent.Apply(message); - return message; } - /// List secrets in a given user profile. - /// The subscription ID. - /// The name of the resource group. - /// The name of the lab. - /// The name of the user profile. - /// Specify the $expand query. Example: 'properties($select=value)'. - /// The filter to apply to the operation. Example: '$filter=contains(name,'myName'). - /// The maximum number of resources to return from the operation. Example: '$top=10'. - /// The ordering expression for the results, using OData notation. Example: '$orderby=name desc'. - /// The cancellation token to use. - /// , , or is null. - /// , , or is an empty string, and was expected to be non-empty. - public async Task> ListAsync(string subscriptionId, string resourceGroupName, string labName, string userName, string expand = null, string filter = null, int? top = null, string orderby = null, CancellationToken cancellationToken = default) + /// Initializes a new instance of Secrets. + /// 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 Secrets(ClientDiagnostics clientDiagnostics, HttpPipeline pipeline, Uri endpoint, string apiVersion) { - Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); - Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); - Argument.AssertNotNullOrEmpty(labName, nameof(labName)); - Argument.AssertNotNullOrEmpty(userName, nameof(userName)); - - using var message = CreateListRequest(subscriptionId, resourceGroupName, labName, userName, expand, filter, top, orderby); - await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); - switch (message.Response.Status) - { - case 200: - { - SecretList value = default; - using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, ModelSerializationExtensions.JsonDocumentOptions, cancellationToken).ConfigureAwait(false); - value = SecretList.DeserializeSecretList(document.RootElement); - return Response.FromValue(value, message.Response); - } - default: - throw new RequestFailedException(message.Response); - } + ClientDiagnostics = clientDiagnostics; + _endpoint = endpoint; + Pipeline = pipeline; + _apiVersion = apiVersion; } - /// List secrets in a given user profile. - /// The subscription ID. - /// The name of the resource group. - /// The name of the lab. - /// The name of the user profile. - /// Specify the $expand query. Example: 'properties($select=value)'. - /// The filter to apply to the operation. Example: '$filter=contains(name,'myName'). - /// The maximum number of resources to return from the operation. Example: '$top=10'. - /// The ordering expression for the results, using OData notation. Example: '$orderby=name desc'. - /// The cancellation token to use. - /// , , or is null. - /// , , or is an empty string, and was expected to be non-empty. - public Response List(string subscriptionId, string resourceGroupName, string labName, string userName, string expand = null, string filter = null, int? top = null, string orderby = null, CancellationToken cancellationToken = default) - { - Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); - Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); - Argument.AssertNotNullOrEmpty(labName, nameof(labName)); - Argument.AssertNotNullOrEmpty(userName, nameof(userName)); + /// The HTTP pipeline for sending and receiving REST requests and responses. + public virtual HttpPipeline Pipeline { get; } - using var message = CreateListRequest(subscriptionId, resourceGroupName, labName, userName, expand, filter, top, orderby); - _pipeline.Send(message, cancellationToken); - switch (message.Response.Status) - { - case 200: - { - SecretList value = default; - using var document = JsonDocument.Parse(message.Response.ContentStream, ModelSerializationExtensions.JsonDocumentOptions); - value = SecretList.DeserializeSecretList(document.RootElement); - return Response.FromValue(value, 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 CreateGetRequestUri(string subscriptionId, string resourceGroupName, string labName, string userName, string name, string expand) + internal HttpMessage CreateGetRequest(string subscriptionId, string resourceGroupName, string labName, string userName, string name, string expand, RequestContext context) { - var uri = new RawRequestUriBuilder(); + RawRequestUriBuilder uri = new RawRequestUriBuilder(); uri.Reset(_endpoint); uri.AppendPath("/subscriptions/", false); uri.AppendPath(subscriptionId, true); @@ -192,117 +55,22 @@ internal RequestUriBuilder CreateGetRequestUri(string subscriptionId, string res uri.AppendPath(userName, true); uri.AppendPath("/secrets/", false); uri.AppendPath(name, true); - if (expand != null) - { - uri.AppendQuery("$expand", expand, true); - } uri.AppendQuery("api-version", _apiVersion, true); - return uri; - } - - internal HttpMessage CreateGetRequest(string subscriptionId, string resourceGroupName, string labName, string userName, string name, string expand) - { - 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.DevTestLab/labs/", false); - uri.AppendPath(labName, true); - uri.AppendPath("/users/", false); - uri.AppendPath(userName, true); - uri.AppendPath("/secrets/", false); - uri.AppendPath(name, true); if (expand != null) { uri.AppendQuery("$expand", expand, 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 secret. - /// The subscription ID. - /// The name of the resource group. - /// The name of the lab. - /// The name of the user profile. - /// The name of the secret. - /// Specify the $expand query. Example: 'properties($select=value)'. - /// 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 labName, string userName, string name, string expand = null, CancellationToken cancellationToken = default) + internal HttpMessage CreateCreateOrUpdateRequest(string subscriptionId, string resourceGroupName, string labName, string userName, string name, RequestContent content, RequestContext context) { - Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); - Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); - Argument.AssertNotNullOrEmpty(labName, nameof(labName)); - Argument.AssertNotNullOrEmpty(userName, nameof(userName)); - Argument.AssertNotNullOrEmpty(name, nameof(name)); - - using var message = CreateGetRequest(subscriptionId, resourceGroupName, labName, userName, name, expand); - await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); - switch (message.Response.Status) - { - case 200: - { - DevTestLabSecretData value = default; - using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, ModelSerializationExtensions.JsonDocumentOptions, cancellationToken).ConfigureAwait(false); - value = DevTestLabSecretData.DeserializeDevTestLabSecretData(document.RootElement); - return Response.FromValue(value, message.Response); - } - case 404: - return Response.FromValue((DevTestLabSecretData)null, message.Response); - default: - throw new RequestFailedException(message.Response); - } - } - - /// Get secret. - /// The subscription ID. - /// The name of the resource group. - /// The name of the lab. - /// The name of the user profile. - /// The name of the secret. - /// Specify the $expand query. Example: 'properties($select=value)'. - /// 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 labName, string userName, string name, string expand = null, CancellationToken cancellationToken = default) - { - Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); - Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); - Argument.AssertNotNullOrEmpty(labName, nameof(labName)); - Argument.AssertNotNullOrEmpty(userName, nameof(userName)); - Argument.AssertNotNullOrEmpty(name, nameof(name)); - - using var message = CreateGetRequest(subscriptionId, resourceGroupName, labName, userName, name, expand); - _pipeline.Send(message, cancellationToken); - switch (message.Response.Status) - { - case 200: - { - DevTestLabSecretData value = default; - using var document = JsonDocument.Parse(message.Response.ContentStream, ModelSerializationExtensions.JsonDocumentOptions); - value = DevTestLabSecretData.DeserializeDevTestLabSecretData(document.RootElement); - return Response.FromValue(value, message.Response); - } - case 404: - return Response.FromValue((DevTestLabSecretData)null, message.Response); - default: - throw new RequestFailedException(message.Response); - } - } - - internal RequestUriBuilder CreateCreateOrUpdateRequestUri(string subscriptionId, string resourceGroupName, string labName, string userName, string name, DevTestLabSecretData data) - { - var uri = new RawRequestUriBuilder(); + RawRequestUriBuilder uri = new RawRequestUriBuilder(); uri.Reset(_endpoint); uri.AppendPath("/subscriptions/", false); uri.AppendPath(subscriptionId, true); @@ -315,15 +83,19 @@ internal RequestUriBuilder CreateCreateOrUpdateRequestUri(string subscriptionId, uri.AppendPath("/secrets/", false); uri.AppendPath(name, true); uri.AppendQuery("api-version", _apiVersion, true); - return uri; + HttpMessage message = Pipeline.CreateMessage(); + Request request = message.Request; + request.Uri = uri; + request.Method = RequestMethod.Put; + request.Headers.SetValue("Content-Type", "application/json"); + request.Headers.SetValue("Accept", "application/json"); + request.Content = content; + return message; } - internal HttpMessage CreateCreateOrUpdateRequest(string subscriptionId, string resourceGroupName, string labName, string userName, string name, DevTestLabSecretData data) + internal HttpMessage CreateUpdateRequest(string subscriptionId, string resourceGroupName, string labName, string userName, string name, 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); @@ -336,81 +108,19 @@ internal HttpMessage CreateCreateOrUpdateRequest(string subscriptionId, string r uri.AppendPath("/secrets/", false); uri.AppendPath(name, 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.Patch; + request.Headers.SetValue("Content-Type", "application/json"); + request.Headers.SetValue("Accept", "application/json"); request.Content = content; - _userAgent.Apply(message); return message; } - /// Create or replace an existing secret. This operation can take a while to complete. - /// The subscription ID. - /// The name of the resource group. - /// The name of the lab. - /// The name of the user profile. - /// The name of the secret. - /// A secret. - /// 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 labName, string userName, string name, DevTestLabSecretData data, CancellationToken cancellationToken = default) - { - Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); - Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); - Argument.AssertNotNullOrEmpty(labName, nameof(labName)); - Argument.AssertNotNullOrEmpty(userName, nameof(userName)); - Argument.AssertNotNullOrEmpty(name, nameof(name)); - Argument.AssertNotNull(data, nameof(data)); - - using var message = CreateCreateOrUpdateRequest(subscriptionId, resourceGroupName, labName, userName, name, data); - await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); - switch (message.Response.Status) - { - case 200: - case 201: - return message.Response; - default: - throw new RequestFailedException(message.Response); - } - } - - /// Create or replace an existing secret. This operation can take a while to complete. - /// The subscription ID. - /// The name of the resource group. - /// The name of the lab. - /// The name of the user profile. - /// The name of the secret. - /// A secret. - /// 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 labName, string userName, string name, DevTestLabSecretData data, CancellationToken cancellationToken = default) - { - Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); - Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); - Argument.AssertNotNullOrEmpty(labName, nameof(labName)); - Argument.AssertNotNullOrEmpty(userName, nameof(userName)); - Argument.AssertNotNullOrEmpty(name, nameof(name)); - Argument.AssertNotNull(data, nameof(data)); - - using var message = CreateCreateOrUpdateRequest(subscriptionId, resourceGroupName, labName, userName, name, 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 labName, string userName, string name) + internal HttpMessage CreateDeleteRequest(string subscriptionId, string resourceGroupName, string labName, string userName, string name, RequestContext context) { - var uri = new RawRequestUriBuilder(); + RawRequestUriBuilder uri = new RawRequestUriBuilder(); uri.Reset(_endpoint); uri.AppendPath("/subscriptions/", false); uri.AppendPath(subscriptionId, true); @@ -423,15 +133,16 @@ internal RequestUriBuilder CreateDeleteRequestUri(string subscriptionId, string uri.AppendPath("/secrets/", false); uri.AppendPath(name, true); uri.AppendQuery("api-version", _apiVersion, true); - return uri; + HttpMessage message = Pipeline.CreateMessage(); + Request request = message.Request; + request.Uri = uri; + request.Method = RequestMethod.Delete; + return message; } - internal HttpMessage CreateDeleteRequest(string subscriptionId, string resourceGroupName, string labName, string userName, string name) + internal HttpMessage CreateGetAllRequest(string subscriptionId, string resourceGroupName, string labName, string userName, string expand, string filter, int? top, string @orderby, RequestContext context) { - var message = _pipeline.CreateMessage(); - var request = message.Request; - request.Method = RequestMethod.Delete; - var uri = new RawRequestUriBuilder(); + RawRequestUriBuilder uri = new RawRequestUriBuilder(); uri.Reset(_endpoint); uri.AppendPath("/subscriptions/", false); uri.AppendPath(subscriptionId, true); @@ -441,283 +152,43 @@ internal HttpMessage CreateDeleteRequest(string subscriptionId, string resourceG uri.AppendPath(labName, true); uri.AppendPath("/users/", false); uri.AppendPath(userName, true); - uri.AppendPath("/secrets/", false); - uri.AppendPath(name, true); + uri.AppendPath("/secrets", false); uri.AppendQuery("api-version", _apiVersion, true); - request.Uri = uri; - request.Headers.Add("Accept", "application/json"); - _userAgent.Apply(message); - return message; - } - - /// Delete secret. - /// The subscription ID. - /// The name of the resource group. - /// The name of the lab. - /// The name of the user profile. - /// The name of the secret. - /// 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 labName, string userName, string name, CancellationToken cancellationToken = default) - { - Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); - Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); - Argument.AssertNotNullOrEmpty(labName, nameof(labName)); - Argument.AssertNotNullOrEmpty(userName, nameof(userName)); - Argument.AssertNotNullOrEmpty(name, nameof(name)); - - using var message = CreateDeleteRequest(subscriptionId, resourceGroupName, labName, userName, name); - await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); - switch (message.Response.Status) + if (expand != null) { - case 200: - case 204: - return message.Response; - default: - throw new RequestFailedException(message.Response); + uri.AppendQuery("$expand", expand, true); } - } - - /// Delete secret. - /// The subscription ID. - /// The name of the resource group. - /// The name of the lab. - /// The name of the user profile. - /// The name of the secret. - /// 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 labName, string userName, string name, CancellationToken cancellationToken = default) - { - Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); - Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); - Argument.AssertNotNullOrEmpty(labName, nameof(labName)); - Argument.AssertNotNullOrEmpty(userName, nameof(userName)); - Argument.AssertNotNullOrEmpty(name, nameof(name)); - - using var message = CreateDeleteRequest(subscriptionId, resourceGroupName, labName, userName, name); - _pipeline.Send(message, cancellationToken); - switch (message.Response.Status) + if (filter != null) { - case 200: - case 204: - return message.Response; - default: - throw new RequestFailedException(message.Response); + uri.AppendQuery("$filter", filter, true); } - } - - internal RequestUriBuilder CreateUpdateRequestUri(string subscriptionId, string resourceGroupName, string labName, string userName, string name, DevTestLabSecretPatch 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.DevTestLab/labs/", false); - uri.AppendPath(labName, true); - uri.AppendPath("/users/", false); - uri.AppendPath(userName, true); - uri.AppendPath("/secrets/", false); - uri.AppendPath(name, true); - uri.AppendQuery("api-version", _apiVersion, true); - return uri; - } - - internal HttpMessage CreateUpdateRequest(string subscriptionId, string resourceGroupName, string labName, string userName, string name, DevTestLabSecretPatch patch) - { - var message = _pipeline.CreateMessage(); - var request = message.Request; - request.Method = RequestMethod.Patch; - var uri = new RawRequestUriBuilder(); - uri.Reset(_endpoint); - uri.AppendPath("/subscriptions/", false); - uri.AppendPath(subscriptionId, true); - uri.AppendPath("/resourceGroups/", false); - uri.AppendPath(resourceGroupName, true); - uri.AppendPath("/providers/Microsoft.DevTestLab/labs/", false); - uri.AppendPath(labName, true); - uri.AppendPath("/users/", false); - uri.AppendPath(userName, true); - uri.AppendPath("/secrets/", false); - uri.AppendPath(name, true); - uri.AppendQuery("api-version", _apiVersion, true); - request.Uri = uri; - request.Headers.Add("Accept", "application/json"); - request.Headers.Add("Content-Type", "application/json"); - var content = new Utf8JsonRequestContent(); - content.JsonWriter.WriteObjectValue(patch, ModelSerializationExtensions.WireOptions); - request.Content = content; - _userAgent.Apply(message); - return message; - } - - /// Allows modifying tags of secrets. All other properties will be ignored. - /// The subscription ID. - /// The name of the resource group. - /// The name of the lab. - /// The name of the user profile. - /// The name of the secret. - /// A secret. - /// 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 labName, string userName, string name, DevTestLabSecretPatch patch, CancellationToken cancellationToken = default) - { - Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); - Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); - Argument.AssertNotNullOrEmpty(labName, nameof(labName)); - Argument.AssertNotNullOrEmpty(userName, nameof(userName)); - Argument.AssertNotNullOrEmpty(name, nameof(name)); - Argument.AssertNotNull(patch, nameof(patch)); - - using var message = CreateUpdateRequest(subscriptionId, resourceGroupName, labName, userName, name, patch); - await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); - switch (message.Response.Status) + if (top != null) { - case 200: - { - DevTestLabSecretData value = default; - using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, ModelSerializationExtensions.JsonDocumentOptions, cancellationToken).ConfigureAwait(false); - value = DevTestLabSecretData.DeserializeDevTestLabSecretData(document.RootElement); - return Response.FromValue(value, message.Response); - } - default: - throw new RequestFailedException(message.Response); + uri.AppendQuery("$top", TypeFormatters.ConvertToString(top), true); } - } - - /// Allows modifying tags of secrets. All other properties will be ignored. - /// The subscription ID. - /// The name of the resource group. - /// The name of the lab. - /// The name of the user profile. - /// The name of the secret. - /// A secret. - /// 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 labName, string userName, string name, DevTestLabSecretPatch patch, CancellationToken cancellationToken = default) - { - Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); - Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); - Argument.AssertNotNullOrEmpty(labName, nameof(labName)); - Argument.AssertNotNullOrEmpty(userName, nameof(userName)); - Argument.AssertNotNullOrEmpty(name, nameof(name)); - Argument.AssertNotNull(patch, nameof(patch)); - - using var message = CreateUpdateRequest(subscriptionId, resourceGroupName, labName, userName, name, patch); - _pipeline.Send(message, cancellationToken); - switch (message.Response.Status) + if (@orderby != null) { - case 200: - { - DevTestLabSecretData value = default; - using var document = JsonDocument.Parse(message.Response.ContentStream, ModelSerializationExtensions.JsonDocumentOptions); - value = DevTestLabSecretData.DeserializeDevTestLabSecretData(document.RootElement); - return Response.FromValue(value, message.Response); - } - default: - throw new RequestFailedException(message.Response); + uri.AppendQuery("$orderby", @orderby, true); } - } - - internal RequestUriBuilder CreateListNextPageRequestUri(string nextLink, string subscriptionId, string resourceGroupName, string labName, string userName, string expand, string filter, int? top, string orderby) - { - var uri = new RawRequestUriBuilder(); - uri.Reset(_endpoint); - uri.AppendRawNextLink(nextLink, false); - return uri; - } - - internal HttpMessage CreateListNextPageRequest(string nextLink, string subscriptionId, string resourceGroupName, string labName, string userName, string expand, string filter, int? top, string orderby) - { - var message = _pipeline.CreateMessage(); - var request = message.Request; - request.Method = RequestMethod.Get; - var uri = new RawRequestUriBuilder(); - uri.Reset(_endpoint); - uri.AppendRawNextLink(nextLink, false); + 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 secrets in a given user profile. - /// The URL to the next page of results. - /// The subscription ID. - /// The name of the resource group. - /// The name of the lab. - /// The name of the user profile. - /// Specify the $expand query. Example: 'properties($select=value)'. - /// The filter to apply to the operation. Example: '$filter=contains(name,'myName'). - /// The maximum number of resources to return from the operation. Example: '$top=10'. - /// The ordering expression for the results, using OData notation. Example: '$orderby=name desc'. - /// The cancellation token to use. - /// , , , or is null. - /// , , or is an empty string, and was expected to be non-empty. - public async Task> ListNextPageAsync(string nextLink, string subscriptionId, string resourceGroupName, string labName, string userName, string expand = null, string filter = null, int? top = null, string orderby = null, CancellationToken cancellationToken = default) + internal HttpMessage CreateNextGetAllRequest(Uri nextPage, string subscriptionId, string resourceGroupName, string labName, string userName, string expand, string filter, int? top, string @orderby, RequestContext context) { - Argument.AssertNotNull(nextLink, nameof(nextLink)); - Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); - Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); - Argument.AssertNotNullOrEmpty(labName, nameof(labName)); - Argument.AssertNotNullOrEmpty(userName, nameof(userName)); - - using var message = CreateListNextPageRequest(nextLink, subscriptionId, resourceGroupName, labName, userName, expand, filter, top, orderby); - await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); - switch (message.Response.Status) - { - case 200: - { - SecretList value = default; - using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, ModelSerializationExtensions.JsonDocumentOptions, cancellationToken).ConfigureAwait(false); - value = SecretList.DeserializeSecretList(document.RootElement); - return Response.FromValue(value, message.Response); - } - default: - throw new RequestFailedException(message.Response); - } - } - - /// List secrets in a given user profile. - /// The URL to the next page of results. - /// The subscription ID. - /// The name of the resource group. - /// The name of the lab. - /// The name of the user profile. - /// Specify the $expand query. Example: 'properties($select=value)'. - /// The filter to apply to the operation. Example: '$filter=contains(name,'myName'). - /// The maximum number of resources to return from the operation. Example: '$top=10'. - /// The ordering expression for the results, using OData notation. Example: '$orderby=name desc'. - /// The cancellation token to use. - /// , , , or is null. - /// , , or is an empty string, and was expected to be non-empty. - public Response ListNextPage(string nextLink, string subscriptionId, string resourceGroupName, string labName, string userName, string expand = null, string filter = null, int? top = null, string orderby = null, CancellationToken cancellationToken = default) - { - Argument.AssertNotNull(nextLink, nameof(nextLink)); - Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); - Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); - Argument.AssertNotNullOrEmpty(labName, nameof(labName)); - Argument.AssertNotNullOrEmpty(userName, nameof(userName)); - - using var message = CreateListNextPageRequest(nextLink, subscriptionId, resourceGroupName, labName, userName, expand, filter, top, orderby); - _pipeline.Send(message, cancellationToken); - switch (message.Response.Status) - { - case 200: - { - SecretList value = default; - using var document = JsonDocument.Parse(message.Response.ContentStream, ModelSerializationExtensions.JsonDocumentOptions); - value = SecretList.DeserializeSecretList(document.RootElement); - return Response.FromValue(value, message.Response); - } - default: - throw new RequestFailedException(message.Response); - } + RawRequestUriBuilder uri = new RawRequestUriBuilder(); + uri.Reset(nextPage); + uri.UpdateQuery("api-version", _apiVersion); + HttpMessage message = Pipeline.CreateMessage(); + Request request = message.Request; + request.Uri = uri; + request.Method = RequestMethod.Get; + request.Headers.SetValue("Accept", "application/json"); + return message; } } } diff --git a/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/RestOperations/ServiceFabricSchedulesRestOperations.cs b/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/RestOperations/ServiceFabricSchedulesRestOperations.cs deleted file mode 100644 index bc7a27b8456f..000000000000 --- a/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/RestOperations/ServiceFabricSchedulesRestOperations.cs +++ /dev/null @@ -1,887 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System; -using System.Text.Json; -using System.Threading; -using System.Threading.Tasks; -using Azure.Core; -using Azure.Core.Pipeline; -using Azure.ResourceManager.DevTestLabs.Models; - -namespace Azure.ResourceManager.DevTestLabs -{ - internal partial class ServiceFabricSchedulesRestOperations - { - private readonly TelemetryDetails _userAgent; - private readonly HttpPipeline _pipeline; - private readonly Uri _endpoint; - private readonly string _apiVersion; - - /// Initializes a new instance of ServiceFabricSchedulesRestOperations. - /// The HTTP pipeline for sending and receiving REST requests and responses. - /// The application id to use for user agent. - /// server parameter. - /// Api Version. - /// or is null. - public ServiceFabricSchedulesRestOperations(HttpPipeline pipeline, string applicationId, Uri endpoint = null, string apiVersion = default) - { - _pipeline = pipeline ?? throw new ArgumentNullException(nameof(pipeline)); - _endpoint = endpoint ?? new Uri("https://management.azure.com"); - _apiVersion = apiVersion ?? "2018-09-15"; - _userAgent = new TelemetryDetails(GetType().Assembly, applicationId); - } - - internal RequestUriBuilder CreateListRequestUri(string subscriptionId, string resourceGroupName, string labName, string userName, string serviceFabricName, string expand, string filter, int? top, string orderby) - { - 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.DevTestLab/labs/", false); - uri.AppendPath(labName, true); - uri.AppendPath("/users/", false); - uri.AppendPath(userName, true); - uri.AppendPath("/servicefabrics/", false); - uri.AppendPath(serviceFabricName, true); - uri.AppendPath("/schedules", false); - if (expand != null) - { - uri.AppendQuery("$expand", expand, true); - } - if (filter != null) - { - uri.AppendQuery("$filter", filter, true); - } - if (top != null) - { - uri.AppendQuery("$top", top.Value, true); - } - if (orderby != null) - { - uri.AppendQuery("$orderby", orderby, true); - } - uri.AppendQuery("api-version", _apiVersion, true); - return uri; - } - - internal HttpMessage CreateListRequest(string subscriptionId, string resourceGroupName, string labName, string userName, string serviceFabricName, string expand, string filter, int? top, string orderby) - { - 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.DevTestLab/labs/", false); - uri.AppendPath(labName, true); - uri.AppendPath("/users/", false); - uri.AppendPath(userName, true); - uri.AppendPath("/servicefabrics/", false); - uri.AppendPath(serviceFabricName, true); - uri.AppendPath("/schedules", false); - if (expand != null) - { - uri.AppendQuery("$expand", expand, true); - } - if (filter != null) - { - uri.AppendQuery("$filter", filter, true); - } - if (top != null) - { - uri.AppendQuery("$top", top.Value, true); - } - if (orderby != null) - { - uri.AppendQuery("$orderby", orderby, true); - } - uri.AppendQuery("api-version", _apiVersion, true); - request.Uri = uri; - request.Headers.Add("Accept", "application/json"); - _userAgent.Apply(message); - return message; - } - - /// List schedules in a given service fabric. - /// The subscription ID. - /// The name of the resource group. - /// The name of the lab. - /// The name of the user profile. - /// The name of the service fabric. - /// Specify the $expand query. Example: 'properties($select=status)'. - /// The filter to apply to the operation. Example: '$filter=contains(name,'myName'). - /// The maximum number of resources to return from the operation. Example: '$top=10'. - /// The ordering expression for the results, using OData notation. Example: '$orderby=name desc'. - /// The cancellation token to use. - /// , , , or is null. - /// , , , or is an empty string, and was expected to be non-empty. - public async Task> ListAsync(string subscriptionId, string resourceGroupName, string labName, string userName, string serviceFabricName, string expand = null, string filter = null, int? top = null, string orderby = null, CancellationToken cancellationToken = default) - { - Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); - Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); - Argument.AssertNotNullOrEmpty(labName, nameof(labName)); - Argument.AssertNotNullOrEmpty(userName, nameof(userName)); - Argument.AssertNotNullOrEmpty(serviceFabricName, nameof(serviceFabricName)); - - using var message = CreateListRequest(subscriptionId, resourceGroupName, labName, userName, serviceFabricName, expand, filter, top, orderby); - await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); - switch (message.Response.Status) - { - case 200: - { - ScheduleList value = default; - using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, ModelSerializationExtensions.JsonDocumentOptions, cancellationToken).ConfigureAwait(false); - value = ScheduleList.DeserializeScheduleList(document.RootElement); - return Response.FromValue(value, message.Response); - } - default: - throw new RequestFailedException(message.Response); - } - } - - /// List schedules in a given service fabric. - /// The subscription ID. - /// The name of the resource group. - /// The name of the lab. - /// The name of the user profile. - /// The name of the service fabric. - /// Specify the $expand query. Example: 'properties($select=status)'. - /// The filter to apply to the operation. Example: '$filter=contains(name,'myName'). - /// The maximum number of resources to return from the operation. Example: '$top=10'. - /// The ordering expression for the results, using OData notation. Example: '$orderby=name desc'. - /// The cancellation token to use. - /// , , , or is null. - /// , , , or is an empty string, and was expected to be non-empty. - public Response List(string subscriptionId, string resourceGroupName, string labName, string userName, string serviceFabricName, string expand = null, string filter = null, int? top = null, string orderby = null, CancellationToken cancellationToken = default) - { - Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); - Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); - Argument.AssertNotNullOrEmpty(labName, nameof(labName)); - Argument.AssertNotNullOrEmpty(userName, nameof(userName)); - Argument.AssertNotNullOrEmpty(serviceFabricName, nameof(serviceFabricName)); - - using var message = CreateListRequest(subscriptionId, resourceGroupName, labName, userName, serviceFabricName, expand, filter, top, orderby); - _pipeline.Send(message, cancellationToken); - switch (message.Response.Status) - { - case 200: - { - ScheduleList value = default; - using var document = JsonDocument.Parse(message.Response.ContentStream, ModelSerializationExtensions.JsonDocumentOptions); - value = ScheduleList.DeserializeScheduleList(document.RootElement); - return Response.FromValue(value, message.Response); - } - default: - throw new RequestFailedException(message.Response); - } - } - - internal RequestUriBuilder CreateGetRequestUri(string subscriptionId, string resourceGroupName, string labName, string userName, string serviceFabricName, string name, string expand) - { - 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.DevTestLab/labs/", false); - uri.AppendPath(labName, true); - uri.AppendPath("/users/", false); - uri.AppendPath(userName, true); - uri.AppendPath("/servicefabrics/", false); - uri.AppendPath(serviceFabricName, true); - uri.AppendPath("/schedules/", false); - uri.AppendPath(name, true); - if (expand != null) - { - uri.AppendQuery("$expand", expand, true); - } - uri.AppendQuery("api-version", _apiVersion, true); - return uri; - } - - internal HttpMessage CreateGetRequest(string subscriptionId, string resourceGroupName, string labName, string userName, string serviceFabricName, string name, string expand) - { - 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.DevTestLab/labs/", false); - uri.AppendPath(labName, true); - uri.AppendPath("/users/", false); - uri.AppendPath(userName, true); - uri.AppendPath("/servicefabrics/", false); - uri.AppendPath(serviceFabricName, true); - uri.AppendPath("/schedules/", false); - uri.AppendPath(name, true); - if (expand != null) - { - uri.AppendQuery("$expand", expand, true); - } - uri.AppendQuery("api-version", _apiVersion, true); - request.Uri = uri; - request.Headers.Add("Accept", "application/json"); - _userAgent.Apply(message); - return message; - } - - /// Get schedule. - /// The subscription ID. - /// The name of the resource group. - /// The name of the lab. - /// The name of the user profile. - /// The name of the service fabric. - /// The name of the schedule. - /// Specify the $expand query. Example: 'properties($select=status)'. - /// 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 labName, string userName, string serviceFabricName, string name, string expand = null, CancellationToken cancellationToken = default) - { - Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); - Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); - Argument.AssertNotNullOrEmpty(labName, nameof(labName)); - Argument.AssertNotNullOrEmpty(userName, nameof(userName)); - Argument.AssertNotNullOrEmpty(serviceFabricName, nameof(serviceFabricName)); - Argument.AssertNotNullOrEmpty(name, nameof(name)); - - using var message = CreateGetRequest(subscriptionId, resourceGroupName, labName, userName, serviceFabricName, name, expand); - await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); - switch (message.Response.Status) - { - case 200: - { - DevTestLabScheduleData value = default; - using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, ModelSerializationExtensions.JsonDocumentOptions, cancellationToken).ConfigureAwait(false); - value = DevTestLabScheduleData.DeserializeDevTestLabScheduleData(document.RootElement); - return Response.FromValue(value, message.Response); - } - case 404: - return Response.FromValue((DevTestLabScheduleData)null, message.Response); - default: - throw new RequestFailedException(message.Response); - } - } - - /// Get schedule. - /// The subscription ID. - /// The name of the resource group. - /// The name of the lab. - /// The name of the user profile. - /// The name of the service fabric. - /// The name of the schedule. - /// Specify the $expand query. Example: 'properties($select=status)'. - /// 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 labName, string userName, string serviceFabricName, string name, string expand = null, CancellationToken cancellationToken = default) - { - Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); - Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); - Argument.AssertNotNullOrEmpty(labName, nameof(labName)); - Argument.AssertNotNullOrEmpty(userName, nameof(userName)); - Argument.AssertNotNullOrEmpty(serviceFabricName, nameof(serviceFabricName)); - Argument.AssertNotNullOrEmpty(name, nameof(name)); - - using var message = CreateGetRequest(subscriptionId, resourceGroupName, labName, userName, serviceFabricName, name, expand); - _pipeline.Send(message, cancellationToken); - switch (message.Response.Status) - { - case 200: - { - DevTestLabScheduleData value = default; - using var document = JsonDocument.Parse(message.Response.ContentStream, ModelSerializationExtensions.JsonDocumentOptions); - value = DevTestLabScheduleData.DeserializeDevTestLabScheduleData(document.RootElement); - return Response.FromValue(value, message.Response); - } - case 404: - return Response.FromValue((DevTestLabScheduleData)null, message.Response); - default: - throw new RequestFailedException(message.Response); - } - } - - internal RequestUriBuilder CreateCreateOrUpdateRequestUri(string subscriptionId, string resourceGroupName, string labName, string userName, string serviceFabricName, string name, DevTestLabScheduleData data) - { - var uri = new RawRequestUriBuilder(); - uri.Reset(_endpoint); - uri.AppendPath("/subscriptions/", false); - uri.AppendPath(subscriptionId, true); - uri.AppendPath("/resourceGroups/", false); - uri.AppendPath(resourceGroupName, true); - uri.AppendPath("/providers/Microsoft.DevTestLab/labs/", false); - uri.AppendPath(labName, true); - uri.AppendPath("/users/", false); - uri.AppendPath(userName, true); - uri.AppendPath("/servicefabrics/", false); - uri.AppendPath(serviceFabricName, true); - uri.AppendPath("/schedules/", false); - uri.AppendPath(name, true); - uri.AppendQuery("api-version", _apiVersion, true); - return uri; - } - - internal HttpMessage CreateCreateOrUpdateRequest(string subscriptionId, string resourceGroupName, string labName, string userName, string serviceFabricName, string name, DevTestLabScheduleData data) - { - var message = _pipeline.CreateMessage(); - var request = message.Request; - request.Method = RequestMethod.Put; - var uri = new RawRequestUriBuilder(); - uri.Reset(_endpoint); - uri.AppendPath("/subscriptions/", false); - uri.AppendPath(subscriptionId, true); - uri.AppendPath("/resourceGroups/", false); - uri.AppendPath(resourceGroupName, true); - uri.AppendPath("/providers/Microsoft.DevTestLab/labs/", false); - uri.AppendPath(labName, true); - uri.AppendPath("/users/", false); - uri.AppendPath(userName, true); - uri.AppendPath("/servicefabrics/", false); - uri.AppendPath(serviceFabricName, true); - uri.AppendPath("/schedules/", false); - uri.AppendPath(name, true); - uri.AppendQuery("api-version", _apiVersion, true); - request.Uri = uri; - request.Headers.Add("Accept", "application/json"); - request.Headers.Add("Content-Type", "application/json"); - var content = new Utf8JsonRequestContent(); - content.JsonWriter.WriteObjectValue(data, ModelSerializationExtensions.WireOptions); - request.Content = content; - _userAgent.Apply(message); - return message; - } - - /// Create or replace an existing schedule. - /// The subscription ID. - /// The name of the resource group. - /// The name of the lab. - /// The name of the user profile. - /// The name of the service fabric. - /// The name of the schedule. - /// A schedule. - /// 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 labName, string userName, string serviceFabricName, string name, DevTestLabScheduleData data, CancellationToken cancellationToken = default) - { - Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); - Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); - Argument.AssertNotNullOrEmpty(labName, nameof(labName)); - Argument.AssertNotNullOrEmpty(userName, nameof(userName)); - Argument.AssertNotNullOrEmpty(serviceFabricName, nameof(serviceFabricName)); - Argument.AssertNotNullOrEmpty(name, nameof(name)); - Argument.AssertNotNull(data, nameof(data)); - - using var message = CreateCreateOrUpdateRequest(subscriptionId, resourceGroupName, labName, userName, serviceFabricName, name, data); - await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); - switch (message.Response.Status) - { - case 200: - case 201: - { - DevTestLabScheduleData value = default; - using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, ModelSerializationExtensions.JsonDocumentOptions, cancellationToken).ConfigureAwait(false); - value = DevTestLabScheduleData.DeserializeDevTestLabScheduleData(document.RootElement); - return Response.FromValue(value, message.Response); - } - default: - throw new RequestFailedException(message.Response); - } - } - - /// Create or replace an existing schedule. - /// The subscription ID. - /// The name of the resource group. - /// The name of the lab. - /// The name of the user profile. - /// The name of the service fabric. - /// The name of the schedule. - /// A schedule. - /// 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 labName, string userName, string serviceFabricName, string name, DevTestLabScheduleData data, CancellationToken cancellationToken = default) - { - Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); - Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); - Argument.AssertNotNullOrEmpty(labName, nameof(labName)); - Argument.AssertNotNullOrEmpty(userName, nameof(userName)); - Argument.AssertNotNullOrEmpty(serviceFabricName, nameof(serviceFabricName)); - Argument.AssertNotNullOrEmpty(name, nameof(name)); - Argument.AssertNotNull(data, nameof(data)); - - using var message = CreateCreateOrUpdateRequest(subscriptionId, resourceGroupName, labName, userName, serviceFabricName, name, data); - _pipeline.Send(message, cancellationToken); - switch (message.Response.Status) - { - case 200: - case 201: - { - DevTestLabScheduleData value = default; - using var document = JsonDocument.Parse(message.Response.ContentStream, ModelSerializationExtensions.JsonDocumentOptions); - value = DevTestLabScheduleData.DeserializeDevTestLabScheduleData(document.RootElement); - return Response.FromValue(value, message.Response); - } - default: - throw new RequestFailedException(message.Response); - } - } - - internal RequestUriBuilder CreateDeleteRequestUri(string subscriptionId, string resourceGroupName, string labName, string userName, string serviceFabricName, string name) - { - 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.DevTestLab/labs/", false); - uri.AppendPath(labName, true); - uri.AppendPath("/users/", false); - uri.AppendPath(userName, true); - uri.AppendPath("/servicefabrics/", false); - uri.AppendPath(serviceFabricName, true); - uri.AppendPath("/schedules/", false); - uri.AppendPath(name, true); - uri.AppendQuery("api-version", _apiVersion, true); - return uri; - } - - internal HttpMessage CreateDeleteRequest(string subscriptionId, string resourceGroupName, string labName, string userName, string serviceFabricName, string name) - { - 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("/resourceGroups/", false); - uri.AppendPath(resourceGroupName, true); - uri.AppendPath("/providers/Microsoft.DevTestLab/labs/", false); - uri.AppendPath(labName, true); - uri.AppendPath("/users/", false); - uri.AppendPath(userName, true); - uri.AppendPath("/servicefabrics/", false); - uri.AppendPath(serviceFabricName, true); - uri.AppendPath("/schedules/", false); - uri.AppendPath(name, true); - uri.AppendQuery("api-version", _apiVersion, true); - request.Uri = uri; - request.Headers.Add("Accept", "application/json"); - _userAgent.Apply(message); - return message; - } - - /// Delete schedule. - /// The subscription ID. - /// The name of the resource group. - /// The name of the lab. - /// The name of the user profile. - /// The name of the service fabric. - /// The name of the schedule. - /// 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 labName, string userName, string serviceFabricName, string name, CancellationToken cancellationToken = default) - { - Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); - Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); - Argument.AssertNotNullOrEmpty(labName, nameof(labName)); - Argument.AssertNotNullOrEmpty(userName, nameof(userName)); - Argument.AssertNotNullOrEmpty(serviceFabricName, nameof(serviceFabricName)); - Argument.AssertNotNullOrEmpty(name, nameof(name)); - - using var message = CreateDeleteRequest(subscriptionId, resourceGroupName, labName, userName, serviceFabricName, name); - await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); - switch (message.Response.Status) - { - case 200: - case 204: - return message.Response; - default: - throw new RequestFailedException(message.Response); - } - } - - /// Delete schedule. - /// The subscription ID. - /// The name of the resource group. - /// The name of the lab. - /// The name of the user profile. - /// The name of the service fabric. - /// The name of the schedule. - /// 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 labName, string userName, string serviceFabricName, string name, CancellationToken cancellationToken = default) - { - Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); - Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); - Argument.AssertNotNullOrEmpty(labName, nameof(labName)); - Argument.AssertNotNullOrEmpty(userName, nameof(userName)); - Argument.AssertNotNullOrEmpty(serviceFabricName, nameof(serviceFabricName)); - Argument.AssertNotNullOrEmpty(name, nameof(name)); - - using var message = CreateDeleteRequest(subscriptionId, resourceGroupName, labName, userName, serviceFabricName, name); - _pipeline.Send(message, cancellationToken); - switch (message.Response.Status) - { - case 200: - case 204: - return message.Response; - default: - throw new RequestFailedException(message.Response); - } - } - - internal RequestUriBuilder CreateUpdateRequestUri(string subscriptionId, string resourceGroupName, string labName, string userName, string serviceFabricName, string name, DevTestLabSchedulePatch 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.DevTestLab/labs/", false); - uri.AppendPath(labName, true); - uri.AppendPath("/users/", false); - uri.AppendPath(userName, true); - uri.AppendPath("/servicefabrics/", false); - uri.AppendPath(serviceFabricName, true); - uri.AppendPath("/schedules/", false); - uri.AppendPath(name, true); - uri.AppendQuery("api-version", _apiVersion, true); - return uri; - } - - internal HttpMessage CreateUpdateRequest(string subscriptionId, string resourceGroupName, string labName, string userName, string serviceFabricName, string name, DevTestLabSchedulePatch patch) - { - var message = _pipeline.CreateMessage(); - var request = message.Request; - request.Method = RequestMethod.Patch; - var uri = new RawRequestUriBuilder(); - uri.Reset(_endpoint); - uri.AppendPath("/subscriptions/", false); - uri.AppendPath(subscriptionId, true); - uri.AppendPath("/resourceGroups/", false); - uri.AppendPath(resourceGroupName, true); - uri.AppendPath("/providers/Microsoft.DevTestLab/labs/", false); - uri.AppendPath(labName, true); - uri.AppendPath("/users/", false); - uri.AppendPath(userName, true); - uri.AppendPath("/servicefabrics/", false); - uri.AppendPath(serviceFabricName, true); - uri.AppendPath("/schedules/", false); - uri.AppendPath(name, true); - uri.AppendQuery("api-version", _apiVersion, true); - request.Uri = uri; - request.Headers.Add("Accept", "application/json"); - request.Headers.Add("Content-Type", "application/json"); - var content = new Utf8JsonRequestContent(); - content.JsonWriter.WriteObjectValue(patch, ModelSerializationExtensions.WireOptions); - request.Content = content; - _userAgent.Apply(message); - return message; - } - - /// Allows modifying tags of schedules. All other properties will be ignored. - /// The subscription ID. - /// The name of the resource group. - /// The name of the lab. - /// The name of the user profile. - /// The name of the service fabric. - /// The name of the schedule. - /// A schedule. - /// 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 labName, string userName, string serviceFabricName, string name, DevTestLabSchedulePatch patch, CancellationToken cancellationToken = default) - { - Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); - Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); - Argument.AssertNotNullOrEmpty(labName, nameof(labName)); - Argument.AssertNotNullOrEmpty(userName, nameof(userName)); - Argument.AssertNotNullOrEmpty(serviceFabricName, nameof(serviceFabricName)); - Argument.AssertNotNullOrEmpty(name, nameof(name)); - Argument.AssertNotNull(patch, nameof(patch)); - - using var message = CreateUpdateRequest(subscriptionId, resourceGroupName, labName, userName, serviceFabricName, name, patch); - await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); - switch (message.Response.Status) - { - case 200: - { - DevTestLabScheduleData value = default; - using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, ModelSerializationExtensions.JsonDocumentOptions, cancellationToken).ConfigureAwait(false); - value = DevTestLabScheduleData.DeserializeDevTestLabScheduleData(document.RootElement); - return Response.FromValue(value, message.Response); - } - default: - throw new RequestFailedException(message.Response); - } - } - - /// Allows modifying tags of schedules. All other properties will be ignored. - /// The subscription ID. - /// The name of the resource group. - /// The name of the lab. - /// The name of the user profile. - /// The name of the service fabric. - /// The name of the schedule. - /// A schedule. - /// 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 labName, string userName, string serviceFabricName, string name, DevTestLabSchedulePatch patch, CancellationToken cancellationToken = default) - { - Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); - Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); - Argument.AssertNotNullOrEmpty(labName, nameof(labName)); - Argument.AssertNotNullOrEmpty(userName, nameof(userName)); - Argument.AssertNotNullOrEmpty(serviceFabricName, nameof(serviceFabricName)); - Argument.AssertNotNullOrEmpty(name, nameof(name)); - Argument.AssertNotNull(patch, nameof(patch)); - - using var message = CreateUpdateRequest(subscriptionId, resourceGroupName, labName, userName, serviceFabricName, name, patch); - _pipeline.Send(message, cancellationToken); - switch (message.Response.Status) - { - case 200: - { - DevTestLabScheduleData value = default; - using var document = JsonDocument.Parse(message.Response.ContentStream, ModelSerializationExtensions.JsonDocumentOptions); - value = DevTestLabScheduleData.DeserializeDevTestLabScheduleData(document.RootElement); - return Response.FromValue(value, message.Response); - } - default: - throw new RequestFailedException(message.Response); - } - } - - internal RequestUriBuilder CreateExecuteRequestUri(string subscriptionId, string resourceGroupName, string labName, string userName, string serviceFabricName, string name) - { - 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.DevTestLab/labs/", false); - uri.AppendPath(labName, true); - uri.AppendPath("/users/", false); - uri.AppendPath(userName, true); - uri.AppendPath("/servicefabrics/", false); - uri.AppendPath(serviceFabricName, true); - uri.AppendPath("/schedules/", false); - uri.AppendPath(name, true); - uri.AppendPath("/execute", false); - uri.AppendQuery("api-version", _apiVersion, true); - return uri; - } - - internal HttpMessage CreateExecuteRequest(string subscriptionId, string resourceGroupName, string labName, string userName, string serviceFabricName, string name) - { - var message = _pipeline.CreateMessage(); - var request = message.Request; - request.Method = RequestMethod.Post; - var uri = new RawRequestUriBuilder(); - uri.Reset(_endpoint); - uri.AppendPath("/subscriptions/", false); - uri.AppendPath(subscriptionId, true); - uri.AppendPath("/resourceGroups/", false); - uri.AppendPath(resourceGroupName, true); - uri.AppendPath("/providers/Microsoft.DevTestLab/labs/", false); - uri.AppendPath(labName, true); - uri.AppendPath("/users/", false); - uri.AppendPath(userName, true); - uri.AppendPath("/servicefabrics/", false); - uri.AppendPath(serviceFabricName, true); - uri.AppendPath("/schedules/", false); - uri.AppendPath(name, true); - uri.AppendPath("/execute", false); - uri.AppendQuery("api-version", _apiVersion, true); - request.Uri = uri; - request.Headers.Add("Accept", "application/json"); - _userAgent.Apply(message); - return message; - } - - /// Execute a schedule. This operation can take a while to complete. - /// The subscription ID. - /// The name of the resource group. - /// The name of the lab. - /// The name of the user profile. - /// The name of the service fabric. - /// The name of the schedule. - /// The cancellation token to use. - /// , , , , or is null. - /// , , , , or is an empty string, and was expected to be non-empty. - public async Task ExecuteAsync(string subscriptionId, string resourceGroupName, string labName, string userName, string serviceFabricName, string name, CancellationToken cancellationToken = default) - { - Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); - Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); - Argument.AssertNotNullOrEmpty(labName, nameof(labName)); - Argument.AssertNotNullOrEmpty(userName, nameof(userName)); - Argument.AssertNotNullOrEmpty(serviceFabricName, nameof(serviceFabricName)); - Argument.AssertNotNullOrEmpty(name, nameof(name)); - - using var message = CreateExecuteRequest(subscriptionId, resourceGroupName, labName, userName, serviceFabricName, name); - await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); - switch (message.Response.Status) - { - case 200: - case 202: - return message.Response; - default: - throw new RequestFailedException(message.Response); - } - } - - /// Execute a schedule. This operation can take a while to complete. - /// The subscription ID. - /// The name of the resource group. - /// The name of the lab. - /// The name of the user profile. - /// The name of the service fabric. - /// The name of the schedule. - /// The cancellation token to use. - /// , , , , or is null. - /// , , , , or is an empty string, and was expected to be non-empty. - public Response Execute(string subscriptionId, string resourceGroupName, string labName, string userName, string serviceFabricName, string name, CancellationToken cancellationToken = default) - { - Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); - Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); - Argument.AssertNotNullOrEmpty(labName, nameof(labName)); - Argument.AssertNotNullOrEmpty(userName, nameof(userName)); - Argument.AssertNotNullOrEmpty(serviceFabricName, nameof(serviceFabricName)); - Argument.AssertNotNullOrEmpty(name, nameof(name)); - - using var message = CreateExecuteRequest(subscriptionId, resourceGroupName, labName, userName, serviceFabricName, name); - _pipeline.Send(message, cancellationToken); - switch (message.Response.Status) - { - case 200: - case 202: - return message.Response; - default: - throw new RequestFailedException(message.Response); - } - } - - internal RequestUriBuilder CreateListNextPageRequestUri(string nextLink, string subscriptionId, string resourceGroupName, string labName, string userName, string serviceFabricName, string expand, string filter, int? top, string orderby) - { - var uri = new RawRequestUriBuilder(); - uri.Reset(_endpoint); - uri.AppendRawNextLink(nextLink, false); - return uri; - } - - internal HttpMessage CreateListNextPageRequest(string nextLink, string subscriptionId, string resourceGroupName, string labName, string userName, string serviceFabricName, string expand, string filter, int? top, string orderby) - { - var message = _pipeline.CreateMessage(); - var request = message.Request; - request.Method = RequestMethod.Get; - var uri = new RawRequestUriBuilder(); - uri.Reset(_endpoint); - uri.AppendRawNextLink(nextLink, false); - request.Uri = uri; - request.Headers.Add("Accept", "application/json"); - _userAgent.Apply(message); - return message; - } - - /// List schedules in a given service fabric. - /// The URL to the next page of results. - /// The subscription ID. - /// The name of the resource group. - /// The name of the lab. - /// The name of the user profile. - /// The name of the service fabric. - /// Specify the $expand query. Example: 'properties($select=status)'. - /// The filter to apply to the operation. Example: '$filter=contains(name,'myName'). - /// The maximum number of resources to return from the operation. Example: '$top=10'. - /// The ordering expression for the results, using OData notation. Example: '$orderby=name desc'. - /// The cancellation token to use. - /// , , , , or is null. - /// , , , or is an empty string, and was expected to be non-empty. - public async Task> ListNextPageAsync(string nextLink, string subscriptionId, string resourceGroupName, string labName, string userName, string serviceFabricName, string expand = null, string filter = null, int? top = null, string orderby = null, CancellationToken cancellationToken = default) - { - Argument.AssertNotNull(nextLink, nameof(nextLink)); - Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); - Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); - Argument.AssertNotNullOrEmpty(labName, nameof(labName)); - Argument.AssertNotNullOrEmpty(userName, nameof(userName)); - Argument.AssertNotNullOrEmpty(serviceFabricName, nameof(serviceFabricName)); - - using var message = CreateListNextPageRequest(nextLink, subscriptionId, resourceGroupName, labName, userName, serviceFabricName, expand, filter, top, orderby); - await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); - switch (message.Response.Status) - { - case 200: - { - ScheduleList value = default; - using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, ModelSerializationExtensions.JsonDocumentOptions, cancellationToken).ConfigureAwait(false); - value = ScheduleList.DeserializeScheduleList(document.RootElement); - return Response.FromValue(value, message.Response); - } - default: - throw new RequestFailedException(message.Response); - } - } - - /// List schedules in a given service fabric. - /// The URL to the next page of results. - /// The subscription ID. - /// The name of the resource group. - /// The name of the lab. - /// The name of the user profile. - /// The name of the service fabric. - /// Specify the $expand query. Example: 'properties($select=status)'. - /// The filter to apply to the operation. Example: '$filter=contains(name,'myName'). - /// The maximum number of resources to return from the operation. Example: '$top=10'. - /// The ordering expression for the results, using OData notation. Example: '$orderby=name desc'. - /// The cancellation token to use. - /// , , , , or is null. - /// , , , or is an empty string, and was expected to be non-empty. - public Response ListNextPage(string nextLink, string subscriptionId, string resourceGroupName, string labName, string userName, string serviceFabricName, string expand = null, string filter = null, int? top = null, string orderby = null, CancellationToken cancellationToken = default) - { - Argument.AssertNotNull(nextLink, nameof(nextLink)); - Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); - Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); - Argument.AssertNotNullOrEmpty(labName, nameof(labName)); - Argument.AssertNotNullOrEmpty(userName, nameof(userName)); - Argument.AssertNotNullOrEmpty(serviceFabricName, nameof(serviceFabricName)); - - using var message = CreateListNextPageRequest(nextLink, subscriptionId, resourceGroupName, labName, userName, serviceFabricName, expand, filter, top, orderby); - _pipeline.Send(message, cancellationToken); - switch (message.Response.Status) - { - case 200: - { - ScheduleList value = default; - using var document = JsonDocument.Parse(message.Response.ContentStream, ModelSerializationExtensions.JsonDocumentOptions); - value = ScheduleList.DeserializeScheduleList(document.RootElement); - return Response.FromValue(value, message.Response); - } - default: - throw new RequestFailedException(message.Response); - } - } - } -} diff --git a/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/RestOperations/ServiceFabricsRestOperations.cs b/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/RestOperations/ServiceFabricsRestOperations.cs index f68eb8b19b26..b9b39ab89176 100644 --- a/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/RestOperations/ServiceFabricsRestOperations.cs +++ b/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/RestOperations/ServiceFabricsRestOperations.cs @@ -6,181 +6,44 @@ #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.DevTestLabs.Models; namespace Azure.ResourceManager.DevTestLabs { - internal partial class ServiceFabricsRestOperations + internal partial class ServiceFabrics { - private readonly TelemetryDetails _userAgent; - private readonly HttpPipeline _pipeline; private readonly Uri _endpoint; private readonly string _apiVersion; - /// Initializes a new instance of ServiceFabricsRestOperations. - /// The HTTP pipeline for sending and receiving REST requests and responses. - /// The application id to use for user agent. - /// server parameter. - /// Api Version. - /// or is null. - public ServiceFabricsRestOperations(HttpPipeline pipeline, string applicationId, Uri endpoint = null, string apiVersion = default) + /// Initializes a new instance of ServiceFabrics for mocking. + protected ServiceFabrics() { - _pipeline = pipeline ?? throw new ArgumentNullException(nameof(pipeline)); - _endpoint = endpoint ?? new Uri("https://management.azure.com"); - _apiVersion = apiVersion ?? "2018-09-15"; - _userAgent = new TelemetryDetails(GetType().Assembly, applicationId); - } - - internal RequestUriBuilder CreateListRequestUri(string subscriptionId, string resourceGroupName, string labName, string userName, string expand, string filter, int? top, string orderby) - { - 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.DevTestLab/labs/", false); - uri.AppendPath(labName, true); - uri.AppendPath("/users/", false); - uri.AppendPath(userName, true); - uri.AppendPath("/servicefabrics", false); - if (expand != null) - { - uri.AppendQuery("$expand", expand, true); - } - if (filter != null) - { - uri.AppendQuery("$filter", filter, true); - } - if (top != null) - { - uri.AppendQuery("$top", top.Value, true); - } - if (orderby != null) - { - uri.AppendQuery("$orderby", orderby, true); - } - uri.AppendQuery("api-version", _apiVersion, true); - return uri; } - internal HttpMessage CreateListRequest(string subscriptionId, string resourceGroupName, string labName, string userName, string expand, string filter, int? top, string orderby) - { - 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.DevTestLab/labs/", false); - uri.AppendPath(labName, true); - uri.AppendPath("/users/", false); - uri.AppendPath(userName, true); - uri.AppendPath("/servicefabrics", false); - if (expand != null) - { - uri.AppendQuery("$expand", expand, true); - } - if (filter != null) - { - uri.AppendQuery("$filter", filter, true); - } - if (top != null) - { - uri.AppendQuery("$top", top.Value, true); - } - if (orderby != null) - { - uri.AppendQuery("$orderby", orderby, true); - } - uri.AppendQuery("api-version", _apiVersion, true); - request.Uri = uri; - request.Headers.Add("Accept", "application/json"); - _userAgent.Apply(message); - return message; - } - - /// List service fabrics in a given user profile. - /// The subscription ID. - /// The name of the resource group. - /// The name of the lab. - /// The name of the user profile. - /// Specify the $expand query. Example: 'properties($expand=applicableSchedule)'. - /// The filter to apply to the operation. Example: '$filter=contains(name,'myName'). - /// The maximum number of resources to return from the operation. Example: '$top=10'. - /// The ordering expression for the results, using OData notation. Example: '$orderby=name desc'. - /// The cancellation token to use. - /// , , or is null. - /// , , or is an empty string, and was expected to be non-empty. - public async Task> ListAsync(string subscriptionId, string resourceGroupName, string labName, string userName, string expand = null, string filter = null, int? top = null, string orderby = null, CancellationToken cancellationToken = default) + /// Initializes a new instance of ServiceFabrics. + /// 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 ServiceFabrics(ClientDiagnostics clientDiagnostics, HttpPipeline pipeline, Uri endpoint, string apiVersion) { - Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); - Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); - Argument.AssertNotNullOrEmpty(labName, nameof(labName)); - Argument.AssertNotNullOrEmpty(userName, nameof(userName)); - - using var message = CreateListRequest(subscriptionId, resourceGroupName, labName, userName, expand, filter, top, orderby); - await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); - switch (message.Response.Status) - { - case 200: - { - ServiceFabricList value = default; - using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, ModelSerializationExtensions.JsonDocumentOptions, cancellationToken).ConfigureAwait(false); - value = ServiceFabricList.DeserializeServiceFabricList(document.RootElement); - return Response.FromValue(value, message.Response); - } - default: - throw new RequestFailedException(message.Response); - } + ClientDiagnostics = clientDiagnostics; + _endpoint = endpoint; + Pipeline = pipeline; + _apiVersion = apiVersion; } - /// List service fabrics in a given user profile. - /// The subscription ID. - /// The name of the resource group. - /// The name of the lab. - /// The name of the user profile. - /// Specify the $expand query. Example: 'properties($expand=applicableSchedule)'. - /// The filter to apply to the operation. Example: '$filter=contains(name,'myName'). - /// The maximum number of resources to return from the operation. Example: '$top=10'. - /// The ordering expression for the results, using OData notation. Example: '$orderby=name desc'. - /// The cancellation token to use. - /// , , or is null. - /// , , or is an empty string, and was expected to be non-empty. - public Response List(string subscriptionId, string resourceGroupName, string labName, string userName, string expand = null, string filter = null, int? top = null, string orderby = null, CancellationToken cancellationToken = default) - { - Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); - Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); - Argument.AssertNotNullOrEmpty(labName, nameof(labName)); - Argument.AssertNotNullOrEmpty(userName, nameof(userName)); + /// The HTTP pipeline for sending and receiving REST requests and responses. + public virtual HttpPipeline Pipeline { get; } - using var message = CreateListRequest(subscriptionId, resourceGroupName, labName, userName, expand, filter, top, orderby); - _pipeline.Send(message, cancellationToken); - switch (message.Response.Status) - { - case 200: - { - ServiceFabricList value = default; - using var document = JsonDocument.Parse(message.Response.ContentStream, ModelSerializationExtensions.JsonDocumentOptions); - value = ServiceFabricList.DeserializeServiceFabricList(document.RootElement); - return Response.FromValue(value, 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 CreateGetRequestUri(string subscriptionId, string resourceGroupName, string labName, string userName, string name, string expand) + internal HttpMessage CreateGetRequest(string subscriptionId, string resourceGroupName, string labName, string userName, string name, string expand, RequestContext context) { - var uri = new RawRequestUriBuilder(); + RawRequestUriBuilder uri = new RawRequestUriBuilder(); uri.Reset(_endpoint); uri.AppendPath("/subscriptions/", false); uri.AppendPath(subscriptionId, true); @@ -192,117 +55,22 @@ internal RequestUriBuilder CreateGetRequestUri(string subscriptionId, string res uri.AppendPath(userName, true); uri.AppendPath("/servicefabrics/", false); uri.AppendPath(name, true); - if (expand != null) - { - uri.AppendQuery("$expand", expand, true); - } uri.AppendQuery("api-version", _apiVersion, true); - return uri; - } - - internal HttpMessage CreateGetRequest(string subscriptionId, string resourceGroupName, string labName, string userName, string name, string expand) - { - 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.DevTestLab/labs/", false); - uri.AppendPath(labName, true); - uri.AppendPath("/users/", false); - uri.AppendPath(userName, true); - uri.AppendPath("/servicefabrics/", false); - uri.AppendPath(name, true); if (expand != null) { uri.AppendQuery("$expand", expand, 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 service fabric. - /// The subscription ID. - /// The name of the resource group. - /// The name of the lab. - /// The name of the user profile. - /// The name of the service fabric. - /// Specify the $expand query. Example: 'properties($expand=applicableSchedule)'. - /// 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 labName, string userName, string name, string expand = null, CancellationToken cancellationToken = default) + internal HttpMessage CreateCreateOrUpdateRequest(string subscriptionId, string resourceGroupName, string labName, string userName, string name, RequestContent content, RequestContext context) { - Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); - Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); - Argument.AssertNotNullOrEmpty(labName, nameof(labName)); - Argument.AssertNotNullOrEmpty(userName, nameof(userName)); - Argument.AssertNotNullOrEmpty(name, nameof(name)); - - using var message = CreateGetRequest(subscriptionId, resourceGroupName, labName, userName, name, expand); - await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); - switch (message.Response.Status) - { - case 200: - { - DevTestLabServiceFabricData value = default; - using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, ModelSerializationExtensions.JsonDocumentOptions, cancellationToken).ConfigureAwait(false); - value = DevTestLabServiceFabricData.DeserializeDevTestLabServiceFabricData(document.RootElement); - return Response.FromValue(value, message.Response); - } - case 404: - return Response.FromValue((DevTestLabServiceFabricData)null, message.Response); - default: - throw new RequestFailedException(message.Response); - } - } - - /// Get service fabric. - /// The subscription ID. - /// The name of the resource group. - /// The name of the lab. - /// The name of the user profile. - /// The name of the service fabric. - /// Specify the $expand query. Example: 'properties($expand=applicableSchedule)'. - /// 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 labName, string userName, string name, string expand = null, CancellationToken cancellationToken = default) - { - Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); - Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); - Argument.AssertNotNullOrEmpty(labName, nameof(labName)); - Argument.AssertNotNullOrEmpty(userName, nameof(userName)); - Argument.AssertNotNullOrEmpty(name, nameof(name)); - - using var message = CreateGetRequest(subscriptionId, resourceGroupName, labName, userName, name, expand); - _pipeline.Send(message, cancellationToken); - switch (message.Response.Status) - { - case 200: - { - DevTestLabServiceFabricData value = default; - using var document = JsonDocument.Parse(message.Response.ContentStream, ModelSerializationExtensions.JsonDocumentOptions); - value = DevTestLabServiceFabricData.DeserializeDevTestLabServiceFabricData(document.RootElement); - return Response.FromValue(value, message.Response); - } - case 404: - return Response.FromValue((DevTestLabServiceFabricData)null, message.Response); - default: - throw new RequestFailedException(message.Response); - } - } - - internal RequestUriBuilder CreateCreateOrUpdateRequestUri(string subscriptionId, string resourceGroupName, string labName, string userName, string name, DevTestLabServiceFabricData data) - { - var uri = new RawRequestUriBuilder(); + RawRequestUriBuilder uri = new RawRequestUriBuilder(); uri.Reset(_endpoint); uri.AppendPath("/subscriptions/", false); uri.AppendPath(subscriptionId, true); @@ -315,15 +83,19 @@ internal RequestUriBuilder CreateCreateOrUpdateRequestUri(string subscriptionId, uri.AppendPath("/servicefabrics/", false); uri.AppendPath(name, true); uri.AppendQuery("api-version", _apiVersion, true); - return uri; + HttpMessage message = Pipeline.CreateMessage(); + Request request = message.Request; + request.Uri = uri; + request.Method = RequestMethod.Put; + request.Headers.SetValue("Content-Type", "application/json"); + request.Headers.SetValue("Accept", "application/json"); + request.Content = content; + return message; } - internal HttpMessage CreateCreateOrUpdateRequest(string subscriptionId, string resourceGroupName, string labName, string userName, string name, DevTestLabServiceFabricData data) + internal HttpMessage CreateUpdateRequest(string subscriptionId, string resourceGroupName, string labName, string userName, string name, 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); @@ -336,81 +108,19 @@ internal HttpMessage CreateCreateOrUpdateRequest(string subscriptionId, string r uri.AppendPath("/servicefabrics/", false); uri.AppendPath(name, 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.Patch; + request.Headers.SetValue("Content-Type", "application/json"); + request.Headers.SetValue("Accept", "application/json"); request.Content = content; - _userAgent.Apply(message); return message; } - /// Create or replace an existing service fabric. This operation can take a while to complete. - /// The subscription ID. - /// The name of the resource group. - /// The name of the lab. - /// The name of the user profile. - /// The name of the service fabric. - /// A Service Fabric. - /// 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 labName, string userName, string name, DevTestLabServiceFabricData data, CancellationToken cancellationToken = default) - { - Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); - Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); - Argument.AssertNotNullOrEmpty(labName, nameof(labName)); - Argument.AssertNotNullOrEmpty(userName, nameof(userName)); - Argument.AssertNotNullOrEmpty(name, nameof(name)); - Argument.AssertNotNull(data, nameof(data)); - - using var message = CreateCreateOrUpdateRequest(subscriptionId, resourceGroupName, labName, userName, name, data); - await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); - switch (message.Response.Status) - { - case 200: - case 201: - return message.Response; - default: - throw new RequestFailedException(message.Response); - } - } - - /// Create or replace an existing service fabric. This operation can take a while to complete. - /// The subscription ID. - /// The name of the resource group. - /// The name of the lab. - /// The name of the user profile. - /// The name of the service fabric. - /// A Service Fabric. - /// 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 labName, string userName, string name, DevTestLabServiceFabricData data, CancellationToken cancellationToken = default) - { - Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); - Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); - Argument.AssertNotNullOrEmpty(labName, nameof(labName)); - Argument.AssertNotNullOrEmpty(userName, nameof(userName)); - Argument.AssertNotNullOrEmpty(name, nameof(name)); - Argument.AssertNotNull(data, nameof(data)); - - using var message = CreateCreateOrUpdateRequest(subscriptionId, resourceGroupName, labName, userName, name, 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 labName, string userName, string name) + internal HttpMessage CreateDeleteRequest(string subscriptionId, string resourceGroupName, string labName, string userName, string name, RequestContext context) { - var uri = new RawRequestUriBuilder(); + RawRequestUriBuilder uri = new RawRequestUriBuilder(); uri.Reset(_endpoint); uri.AppendPath("/subscriptions/", false); uri.AppendPath(subscriptionId, true); @@ -423,15 +133,16 @@ internal RequestUriBuilder CreateDeleteRequestUri(string subscriptionId, string uri.AppendPath("/servicefabrics/", false); uri.AppendPath(name, true); uri.AppendQuery("api-version", _apiVersion, true); - return uri; + HttpMessage message = Pipeline.CreateMessage(); + Request request = message.Request; + request.Uri = uri; + request.Method = RequestMethod.Delete; + return message; } - internal HttpMessage CreateDeleteRequest(string subscriptionId, string resourceGroupName, string labName, string userName, string name) + internal HttpMessage CreateGetAllRequest(string subscriptionId, string resourceGroupName, string labName, string userName, string expand, string filter, int? top, string @orderby, RequestContext context) { - var message = _pipeline.CreateMessage(); - var request = message.Request; - request.Method = RequestMethod.Delete; - var uri = new RawRequestUriBuilder(); + RawRequestUriBuilder uri = new RawRequestUriBuilder(); uri.Reset(_endpoint); uri.AppendPath("/subscriptions/", false); uri.AppendPath(subscriptionId, true); @@ -441,216 +152,48 @@ internal HttpMessage CreateDeleteRequest(string subscriptionId, string resourceG uri.AppendPath(labName, true); uri.AppendPath("/users/", false); uri.AppendPath(userName, true); - uri.AppendPath("/servicefabrics/", false); - uri.AppendPath(name, true); + uri.AppendPath("/servicefabrics", false); uri.AppendQuery("api-version", _apiVersion, true); - request.Uri = uri; - request.Headers.Add("Accept", "application/json"); - _userAgent.Apply(message); - return message; - } - - /// Delete service fabric. This operation can take a while to complete. - /// The subscription ID. - /// The name of the resource group. - /// The name of the lab. - /// The name of the user profile. - /// The name of the service fabric. - /// 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 labName, string userName, string name, CancellationToken cancellationToken = default) - { - Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); - Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); - Argument.AssertNotNullOrEmpty(labName, nameof(labName)); - Argument.AssertNotNullOrEmpty(userName, nameof(userName)); - Argument.AssertNotNullOrEmpty(name, nameof(name)); - - using var message = CreateDeleteRequest(subscriptionId, resourceGroupName, labName, userName, name); - await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); - switch (message.Response.Status) + if (expand != null) { - case 200: - case 202: - case 204: - return message.Response; - default: - throw new RequestFailedException(message.Response); + uri.AppendQuery("$expand", expand, true); } - } - - /// Delete service fabric. This operation can take a while to complete. - /// The subscription ID. - /// The name of the resource group. - /// The name of the lab. - /// The name of the user profile. - /// The name of the service fabric. - /// 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 labName, string userName, string name, CancellationToken cancellationToken = default) - { - Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); - Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); - Argument.AssertNotNullOrEmpty(labName, nameof(labName)); - Argument.AssertNotNullOrEmpty(userName, nameof(userName)); - Argument.AssertNotNullOrEmpty(name, nameof(name)); - - using var message = CreateDeleteRequest(subscriptionId, resourceGroupName, labName, userName, name); - _pipeline.Send(message, cancellationToken); - switch (message.Response.Status) + if (filter != null) { - case 200: - case 202: - case 204: - return message.Response; - default: - throw new RequestFailedException(message.Response); + uri.AppendQuery("$filter", filter, true); } - } - - internal RequestUriBuilder CreateUpdateRequestUri(string subscriptionId, string resourceGroupName, string labName, string userName, string name, DevTestLabServiceFabricPatch 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.DevTestLab/labs/", false); - uri.AppendPath(labName, true); - uri.AppendPath("/users/", false); - uri.AppendPath(userName, true); - uri.AppendPath("/servicefabrics/", false); - uri.AppendPath(name, true); - uri.AppendQuery("api-version", _apiVersion, true); - return uri; - } - - internal HttpMessage CreateUpdateRequest(string subscriptionId, string resourceGroupName, string labName, string userName, string name, DevTestLabServiceFabricPatch patch) - { - var message = _pipeline.CreateMessage(); - var request = message.Request; - request.Method = RequestMethod.Patch; - var uri = new RawRequestUriBuilder(); - uri.Reset(_endpoint); - uri.AppendPath("/subscriptions/", false); - uri.AppendPath(subscriptionId, true); - uri.AppendPath("/resourceGroups/", false); - uri.AppendPath(resourceGroupName, true); - uri.AppendPath("/providers/Microsoft.DevTestLab/labs/", false); - uri.AppendPath(labName, true); - uri.AppendPath("/users/", false); - uri.AppendPath(userName, true); - uri.AppendPath("/servicefabrics/", false); - uri.AppendPath(name, true); - uri.AppendQuery("api-version", _apiVersion, true); - request.Uri = uri; - request.Headers.Add("Accept", "application/json"); - request.Headers.Add("Content-Type", "application/json"); - var content = new Utf8JsonRequestContent(); - content.JsonWriter.WriteObjectValue(patch, ModelSerializationExtensions.WireOptions); - request.Content = content; - _userAgent.Apply(message); - return message; - } - - /// Allows modifying tags of service fabrics. All other properties will be ignored. - /// The subscription ID. - /// The name of the resource group. - /// The name of the lab. - /// The name of the user profile. - /// The name of the service fabric. - /// A Service Fabric. - /// 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 labName, string userName, string name, DevTestLabServiceFabricPatch patch, CancellationToken cancellationToken = default) - { - Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); - Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); - Argument.AssertNotNullOrEmpty(labName, nameof(labName)); - Argument.AssertNotNullOrEmpty(userName, nameof(userName)); - Argument.AssertNotNullOrEmpty(name, nameof(name)); - Argument.AssertNotNull(patch, nameof(patch)); - - using var message = CreateUpdateRequest(subscriptionId, resourceGroupName, labName, userName, name, patch); - await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); - switch (message.Response.Status) + if (top != null) { - case 200: - { - DevTestLabServiceFabricData value = default; - using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, ModelSerializationExtensions.JsonDocumentOptions, cancellationToken).ConfigureAwait(false); - value = DevTestLabServiceFabricData.DeserializeDevTestLabServiceFabricData(document.RootElement); - return Response.FromValue(value, message.Response); - } - default: - throw new RequestFailedException(message.Response); + uri.AppendQuery("$top", TypeFormatters.ConvertToString(top), true); } - } - - /// Allows modifying tags of service fabrics. All other properties will be ignored. - /// The subscription ID. - /// The name of the resource group. - /// The name of the lab. - /// The name of the user profile. - /// The name of the service fabric. - /// A Service Fabric. - /// 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 labName, string userName, string name, DevTestLabServiceFabricPatch patch, CancellationToken cancellationToken = default) - { - Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); - Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); - Argument.AssertNotNullOrEmpty(labName, nameof(labName)); - Argument.AssertNotNullOrEmpty(userName, nameof(userName)); - Argument.AssertNotNullOrEmpty(name, nameof(name)); - Argument.AssertNotNull(patch, nameof(patch)); - - using var message = CreateUpdateRequest(subscriptionId, resourceGroupName, labName, userName, name, patch); - _pipeline.Send(message, cancellationToken); - switch (message.Response.Status) + if (@orderby != null) { - case 200: - { - DevTestLabServiceFabricData value = default; - using var document = JsonDocument.Parse(message.Response.ContentStream, ModelSerializationExtensions.JsonDocumentOptions); - value = DevTestLabServiceFabricData.DeserializeDevTestLabServiceFabricData(document.RootElement); - return Response.FromValue(value, message.Response); - } - default: - throw new RequestFailedException(message.Response); + uri.AppendQuery("$orderby", @orderby, true); } + HttpMessage message = Pipeline.CreateMessage(); + Request request = message.Request; + request.Uri = uri; + request.Method = RequestMethod.Get; + request.Headers.SetValue("Accept", "application/json"); + return message; } - internal RequestUriBuilder CreateListApplicableSchedulesRequestUri(string subscriptionId, string resourceGroupName, string labName, string userName, string name) + internal HttpMessage CreateNextGetAllRequest(Uri nextPage, string subscriptionId, string resourceGroupName, string labName, string userName, string expand, string filter, int? top, string @orderby, RequestContext context) { - 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.DevTestLab/labs/", false); - uri.AppendPath(labName, true); - uri.AppendPath("/users/", false); - uri.AppendPath(userName, true); - uri.AppendPath("/servicefabrics/", false); - uri.AppendPath(name, true); - uri.AppendPath("/listApplicableSchedules", false); - uri.AppendQuery("api-version", _apiVersion, true); - return uri; + RawRequestUriBuilder uri = new RawRequestUriBuilder(); + uri.Reset(nextPage); + uri.UpdateQuery("api-version", _apiVersion); + 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 CreateListApplicableSchedulesRequest(string subscriptionId, string resourceGroupName, string labName, string userName, string name) + internal HttpMessage CreateGetApplicableSchedulesRequest(string subscriptionId, string resourceGroupName, string labName, string userName, string name, RequestContext context) { - var message = _pipeline.CreateMessage(); - var request = message.Request; - request.Method = RequestMethod.Post; - var uri = new RawRequestUriBuilder(); + RawRequestUriBuilder uri = new RawRequestUriBuilder(); uri.Reset(_endpoint); uri.AppendPath("/subscriptions/", false); uri.AppendPath(subscriptionId, true); @@ -664,103 +207,17 @@ internal HttpMessage CreateListApplicableSchedulesRequest(string subscriptionId, uri.AppendPath(name, true); uri.AppendPath("/listApplicableSchedules", 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.Post; + request.Headers.SetValue("Accept", "application/json"); return message; } - /// Lists the applicable start/stop schedules, if any. - /// The subscription ID. - /// The name of the resource group. - /// The name of the lab. - /// The name of the user profile. - /// The name of the service fabric. - /// The cancellation token to use. - /// , , , or is null. - /// , , , or is an empty string, and was expected to be non-empty. - public async Task> ListApplicableSchedulesAsync(string subscriptionId, string resourceGroupName, string labName, string userName, string name, CancellationToken cancellationToken = default) - { - Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); - Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); - Argument.AssertNotNullOrEmpty(labName, nameof(labName)); - Argument.AssertNotNullOrEmpty(userName, nameof(userName)); - Argument.AssertNotNullOrEmpty(name, nameof(name)); - - using var message = CreateListApplicableSchedulesRequest(subscriptionId, resourceGroupName, labName, userName, name); - await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); - switch (message.Response.Status) - { - case 200: - { - DevTestLabApplicableSchedule value = default; - using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, ModelSerializationExtensions.JsonDocumentOptions, cancellationToken).ConfigureAwait(false); - value = DevTestLabApplicableSchedule.DeserializeDevTestLabApplicableSchedule(document.RootElement); - return Response.FromValue(value, message.Response); - } - default: - throw new RequestFailedException(message.Response); - } - } - - /// Lists the applicable start/stop schedules, if any. - /// The subscription ID. - /// The name of the resource group. - /// The name of the lab. - /// The name of the user profile. - /// The name of the service fabric. - /// The cancellation token to use. - /// , , , or is null. - /// , , , or is an empty string, and was expected to be non-empty. - public Response ListApplicableSchedules(string subscriptionId, string resourceGroupName, string labName, string userName, string name, CancellationToken cancellationToken = default) - { - Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); - Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); - Argument.AssertNotNullOrEmpty(labName, nameof(labName)); - Argument.AssertNotNullOrEmpty(userName, nameof(userName)); - Argument.AssertNotNullOrEmpty(name, nameof(name)); - - using var message = CreateListApplicableSchedulesRequest(subscriptionId, resourceGroupName, labName, userName, name); - _pipeline.Send(message, cancellationToken); - switch (message.Response.Status) - { - case 200: - { - DevTestLabApplicableSchedule value = default; - using var document = JsonDocument.Parse(message.Response.ContentStream, ModelSerializationExtensions.JsonDocumentOptions); - value = DevTestLabApplicableSchedule.DeserializeDevTestLabApplicableSchedule(document.RootElement); - return Response.FromValue(value, message.Response); - } - default: - throw new RequestFailedException(message.Response); - } - } - - internal RequestUriBuilder CreateStartRequestUri(string subscriptionId, string resourceGroupName, string labName, string userName, string name) - { - 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.DevTestLab/labs/", false); - uri.AppendPath(labName, true); - uri.AppendPath("/users/", false); - uri.AppendPath(userName, true); - uri.AppendPath("/servicefabrics/", false); - uri.AppendPath(name, true); - uri.AppendPath("/start", false); - uri.AppendQuery("api-version", _apiVersion, true); - return uri; - } - - internal HttpMessage CreateStartRequest(string subscriptionId, string resourceGroupName, string labName, string userName, string name) + internal HttpMessage CreateStartRequest(string subscriptionId, string resourceGroupName, string labName, string userName, string name, RequestContext context) { - var message = _pipeline.CreateMessage(); - var request = message.Request; - request.Method = RequestMethod.Post; - var uri = new RawRequestUriBuilder(); + RawRequestUriBuilder uri = new RawRequestUriBuilder(); uri.Reset(_endpoint); uri.AppendPath("/subscriptions/", false); uri.AppendPath(subscriptionId, true); @@ -774,95 +231,16 @@ internal HttpMessage CreateStartRequest(string subscriptionId, string resourceGr uri.AppendPath(name, true); uri.AppendPath("/start", 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.Post; return message; } - /// Start a service fabric. This operation can take a while to complete. - /// The subscription ID. - /// The name of the resource group. - /// The name of the lab. - /// The name of the user profile. - /// The name of the service fabric. - /// The cancellation token to use. - /// , , , or is null. - /// , , , or is an empty string, and was expected to be non-empty. - public async Task StartAsync(string subscriptionId, string resourceGroupName, string labName, string userName, string name, CancellationToken cancellationToken = default) - { - Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); - Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); - Argument.AssertNotNullOrEmpty(labName, nameof(labName)); - Argument.AssertNotNullOrEmpty(userName, nameof(userName)); - Argument.AssertNotNullOrEmpty(name, nameof(name)); - - using var message = CreateStartRequest(subscriptionId, resourceGroupName, labName, userName, name); - await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); - switch (message.Response.Status) - { - case 200: - case 202: - return message.Response; - default: - throw new RequestFailedException(message.Response); - } - } - - /// Start a service fabric. This operation can take a while to complete. - /// The subscription ID. - /// The name of the resource group. - /// The name of the lab. - /// The name of the user profile. - /// The name of the service fabric. - /// The cancellation token to use. - /// , , , or is null. - /// , , , or is an empty string, and was expected to be non-empty. - public Response Start(string subscriptionId, string resourceGroupName, string labName, string userName, string name, CancellationToken cancellationToken = default) - { - Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); - Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); - Argument.AssertNotNullOrEmpty(labName, nameof(labName)); - Argument.AssertNotNullOrEmpty(userName, nameof(userName)); - Argument.AssertNotNullOrEmpty(name, nameof(name)); - - using var message = CreateStartRequest(subscriptionId, resourceGroupName, labName, userName, name); - _pipeline.Send(message, cancellationToken); - switch (message.Response.Status) - { - case 200: - case 202: - return message.Response; - default: - throw new RequestFailedException(message.Response); - } - } - - internal RequestUriBuilder CreateStopRequestUri(string subscriptionId, string resourceGroupName, string labName, string userName, string name) - { - 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.DevTestLab/labs/", false); - uri.AppendPath(labName, true); - uri.AppendPath("/users/", false); - uri.AppendPath(userName, true); - uri.AppendPath("/servicefabrics/", false); - uri.AppendPath(name, true); - uri.AppendPath("/stop", false); - uri.AppendQuery("api-version", _apiVersion, true); - return uri; - } - - internal HttpMessage CreateStopRequest(string subscriptionId, string resourceGroupName, string labName, string userName, string name) + internal HttpMessage CreateStopRequest(string subscriptionId, string resourceGroupName, string labName, string userName, string name, RequestContext context) { - var message = _pipeline.CreateMessage(); - var request = message.Request; - request.Method = RequestMethod.Post; - var uri = new RawRequestUriBuilder(); + RawRequestUriBuilder uri = new RawRequestUriBuilder(); uri.Reset(_endpoint); uri.AppendPath("/subscriptions/", false); uri.AppendPath(subscriptionId, true); @@ -876,164 +254,11 @@ internal HttpMessage CreateStopRequest(string subscriptionId, string resourceGro uri.AppendPath(name, true); uri.AppendPath("/stop", 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; - } - - /// Stop a service fabric This operation can take a while to complete. - /// The subscription ID. - /// The name of the resource group. - /// The name of the lab. - /// The name of the user profile. - /// The name of the service fabric. - /// The cancellation token to use. - /// , , , or is null. - /// , , , or is an empty string, and was expected to be non-empty. - public async Task StopAsync(string subscriptionId, string resourceGroupName, string labName, string userName, string name, CancellationToken cancellationToken = default) - { - Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); - Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); - Argument.AssertNotNullOrEmpty(labName, nameof(labName)); - Argument.AssertNotNullOrEmpty(userName, nameof(userName)); - Argument.AssertNotNullOrEmpty(name, nameof(name)); - - using var message = CreateStopRequest(subscriptionId, resourceGroupName, labName, userName, name); - await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); - switch (message.Response.Status) - { - case 200: - case 202: - return message.Response; - default: - throw new RequestFailedException(message.Response); - } - } - - /// Stop a service fabric This operation can take a while to complete. - /// The subscription ID. - /// The name of the resource group. - /// The name of the lab. - /// The name of the user profile. - /// The name of the service fabric. - /// The cancellation token to use. - /// , , , or is null. - /// , , , or is an empty string, and was expected to be non-empty. - public Response Stop(string subscriptionId, string resourceGroupName, string labName, string userName, string name, CancellationToken cancellationToken = default) - { - Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); - Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); - Argument.AssertNotNullOrEmpty(labName, nameof(labName)); - Argument.AssertNotNullOrEmpty(userName, nameof(userName)); - Argument.AssertNotNullOrEmpty(name, nameof(name)); - - using var message = CreateStopRequest(subscriptionId, resourceGroupName, labName, userName, name); - _pipeline.Send(message, cancellationToken); - switch (message.Response.Status) - { - case 200: - case 202: - return message.Response; - default: - throw new RequestFailedException(message.Response); - } - } - - internal RequestUriBuilder CreateListNextPageRequestUri(string nextLink, string subscriptionId, string resourceGroupName, string labName, string userName, string expand, string filter, int? top, string orderby) - { - var uri = new RawRequestUriBuilder(); - uri.Reset(_endpoint); - uri.AppendRawNextLink(nextLink, false); - return uri; - } - - internal HttpMessage CreateListNextPageRequest(string nextLink, string subscriptionId, string resourceGroupName, string labName, string userName, string expand, string filter, int? top, string orderby) - { - 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.Method = RequestMethod.Post; return message; } - - /// List service fabrics in a given user profile. - /// The URL to the next page of results. - /// The subscription ID. - /// The name of the resource group. - /// The name of the lab. - /// The name of the user profile. - /// Specify the $expand query. Example: 'properties($expand=applicableSchedule)'. - /// The filter to apply to the operation. Example: '$filter=contains(name,'myName'). - /// The maximum number of resources to return from the operation. Example: '$top=10'. - /// The ordering expression for the results, using OData notation. Example: '$orderby=name desc'. - /// The cancellation token to use. - /// , , , or is null. - /// , , or is an empty string, and was expected to be non-empty. - public async Task> ListNextPageAsync(string nextLink, string subscriptionId, string resourceGroupName, string labName, string userName, string expand = null, string filter = null, int? top = null, string orderby = null, CancellationToken cancellationToken = default) - { - Argument.AssertNotNull(nextLink, nameof(nextLink)); - Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); - Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); - Argument.AssertNotNullOrEmpty(labName, nameof(labName)); - Argument.AssertNotNullOrEmpty(userName, nameof(userName)); - - using var message = CreateListNextPageRequest(nextLink, subscriptionId, resourceGroupName, labName, userName, expand, filter, top, orderby); - await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); - switch (message.Response.Status) - { - case 200: - { - ServiceFabricList value = default; - using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, ModelSerializationExtensions.JsonDocumentOptions, cancellationToken).ConfigureAwait(false); - value = ServiceFabricList.DeserializeServiceFabricList(document.RootElement); - return Response.FromValue(value, message.Response); - } - default: - throw new RequestFailedException(message.Response); - } - } - - /// List service fabrics in a given user profile. - /// The URL to the next page of results. - /// The subscription ID. - /// The name of the resource group. - /// The name of the lab. - /// The name of the user profile. - /// Specify the $expand query. Example: 'properties($expand=applicableSchedule)'. - /// The filter to apply to the operation. Example: '$filter=contains(name,'myName'). - /// The maximum number of resources to return from the operation. Example: '$top=10'. - /// The ordering expression for the results, using OData notation. Example: '$orderby=name desc'. - /// The cancellation token to use. - /// , , , or is null. - /// , , or is an empty string, and was expected to be non-empty. - public Response ListNextPage(string nextLink, string subscriptionId, string resourceGroupName, string labName, string userName, string expand = null, string filter = null, int? top = null, string orderby = null, CancellationToken cancellationToken = default) - { - Argument.AssertNotNull(nextLink, nameof(nextLink)); - Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); - Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); - Argument.AssertNotNullOrEmpty(labName, nameof(labName)); - Argument.AssertNotNullOrEmpty(userName, nameof(userName)); - - using var message = CreateListNextPageRequest(nextLink, subscriptionId, resourceGroupName, labName, userName, expand, filter, top, orderby); - _pipeline.Send(message, cancellationToken); - switch (message.Response.Status) - { - case 200: - { - ServiceFabricList value = default; - using var document = JsonDocument.Parse(message.Response.ContentStream, ModelSerializationExtensions.JsonDocumentOptions); - value = ServiceFabricList.DeserializeServiceFabricList(document.RootElement); - return Response.FromValue(value, message.Response); - } - default: - throw new RequestFailedException(message.Response); - } - } } } diff --git a/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/RestOperations/ServiceRunnersRestOperations.cs b/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/RestOperations/ServiceRunnersRestOperations.cs index 3befbeb44d26..68feaf847240 100644 --- a/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/RestOperations/ServiceRunnersRestOperations.cs +++ b/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/RestOperations/ServiceRunnersRestOperations.cs @@ -6,142 +6,44 @@ #nullable disable using System; -using System.Text.Json; -using System.Threading; -using System.Threading.Tasks; +using Azure; using Azure.Core; using Azure.Core.Pipeline; namespace Azure.ResourceManager.DevTestLabs { - internal partial class ServiceRunnersRestOperations + internal partial class ServiceRunners { - private readonly TelemetryDetails _userAgent; - private readonly HttpPipeline _pipeline; private readonly Uri _endpoint; private readonly string _apiVersion; - /// Initializes a new instance of ServiceRunnersRestOperations. - /// The HTTP pipeline for sending and receiving REST requests and responses. - /// The application id to use for user agent. - /// server parameter. - /// Api Version. - /// or is null. - public ServiceRunnersRestOperations(HttpPipeline pipeline, string applicationId, Uri endpoint = null, string apiVersion = default) + /// Initializes a new instance of ServiceRunners for mocking. + protected ServiceRunners() { - _pipeline = pipeline ?? throw new ArgumentNullException(nameof(pipeline)); - _endpoint = endpoint ?? new Uri("https://management.azure.com"); - _apiVersion = apiVersion ?? "2018-09-15"; - _userAgent = new TelemetryDetails(GetType().Assembly, applicationId); - } - - internal RequestUriBuilder CreateGetRequestUri(string subscriptionId, string resourceGroupName, string labName, string name) - { - 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.DevTestLab/labs/", false); - uri.AppendPath(labName, true); - uri.AppendPath("/servicerunners/", false); - uri.AppendPath(name, true); - uri.AppendQuery("api-version", _apiVersion, true); - return uri; } - internal HttpMessage CreateGetRequest(string subscriptionId, string resourceGroupName, string labName, string name) - { - 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.DevTestLab/labs/", false); - uri.AppendPath(labName, true); - uri.AppendPath("/servicerunners/", false); - uri.AppendPath(name, true); - uri.AppendQuery("api-version", _apiVersion, true); - request.Uri = uri; - request.Headers.Add("Accept", "application/json"); - _userAgent.Apply(message); - return message; - } - - /// Get service runner. - /// The subscription ID. - /// The name of the resource group. - /// The name of the lab. - /// The name of the service runner. - /// 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 labName, string name, CancellationToken cancellationToken = default) + /// Initializes a new instance of ServiceRunners. + /// 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 ServiceRunners(ClientDiagnostics clientDiagnostics, HttpPipeline pipeline, Uri endpoint, string apiVersion) { - Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); - Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); - Argument.AssertNotNullOrEmpty(labName, nameof(labName)); - Argument.AssertNotNullOrEmpty(name, nameof(name)); - - using var message = CreateGetRequest(subscriptionId, resourceGroupName, labName, name); - await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); - switch (message.Response.Status) - { - case 200: - { - DevTestLabServiceRunnerData value = default; - using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, ModelSerializationExtensions.JsonDocumentOptions, cancellationToken).ConfigureAwait(false); - value = DevTestLabServiceRunnerData.DeserializeDevTestLabServiceRunnerData(document.RootElement); - return Response.FromValue(value, message.Response); - } - case 404: - return Response.FromValue((DevTestLabServiceRunnerData)null, message.Response); - default: - throw new RequestFailedException(message.Response); - } + ClientDiagnostics = clientDiagnostics; + _endpoint = endpoint; + Pipeline = pipeline; + _apiVersion = apiVersion; } - /// Get service runner. - /// The subscription ID. - /// The name of the resource group. - /// The name of the lab. - /// The name of the service runner. - /// 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 labName, string name, CancellationToken cancellationToken = default) - { - Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); - Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); - Argument.AssertNotNullOrEmpty(labName, nameof(labName)); - Argument.AssertNotNullOrEmpty(name, nameof(name)); + /// The HTTP pipeline for sending and receiving REST requests and responses. + public virtual HttpPipeline Pipeline { get; } - using var message = CreateGetRequest(subscriptionId, resourceGroupName, labName, name); - _pipeline.Send(message, cancellationToken); - switch (message.Response.Status) - { - case 200: - { - DevTestLabServiceRunnerData value = default; - using var document = JsonDocument.Parse(message.Response.ContentStream, ModelSerializationExtensions.JsonDocumentOptions); - value = DevTestLabServiceRunnerData.DeserializeDevTestLabServiceRunnerData(document.RootElement); - return Response.FromValue(value, message.Response); - } - case 404: - return Response.FromValue((DevTestLabServiceRunnerData)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 labName, string name, DevTestLabServiceRunnerData data) + internal HttpMessage CreateGetRequest(string subscriptionId, string resourceGroupName, string labName, string name, RequestContext context) { - var uri = new RawRequestUriBuilder(); + RawRequestUriBuilder uri = new RawRequestUriBuilder(); uri.Reset(_endpoint); uri.AppendPath("/subscriptions/", false); uri.AppendPath(subscriptionId, true); @@ -152,15 +54,17 @@ internal RequestUriBuilder CreateCreateOrUpdateRequestUri(string subscriptionId, uri.AppendPath("/servicerunners/", false); uri.AppendPath(name, 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 labName, string name, DevTestLabServiceRunnerData data) + internal HttpMessage CreateCreateOrUpdateRequest(string subscriptionId, string resourceGroupName, string labName, string name, 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); @@ -171,106 +75,19 @@ internal HttpMessage CreateCreateOrUpdateRequest(string subscriptionId, string r uri.AppendPath("/servicerunners/", false); uri.AppendPath(name, 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 or replace an existing service runner. - /// The subscription ID. - /// The name of the resource group. - /// The name of the lab. - /// The name of the service runner. - /// A container for a managed identity to execute DevTest lab services. - /// 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 labName, string name, DevTestLabServiceRunnerData data, CancellationToken cancellationToken = default) - { - Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); - Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); - Argument.AssertNotNullOrEmpty(labName, nameof(labName)); - Argument.AssertNotNullOrEmpty(name, nameof(name)); - Argument.AssertNotNull(data, nameof(data)); - - using var message = CreateCreateOrUpdateRequest(subscriptionId, resourceGroupName, labName, name, data); - await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); - switch (message.Response.Status) - { - case 200: - case 201: - { - DevTestLabServiceRunnerData value = default; - using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, ModelSerializationExtensions.JsonDocumentOptions, cancellationToken).ConfigureAwait(false); - value = DevTestLabServiceRunnerData.DeserializeDevTestLabServiceRunnerData(document.RootElement); - return Response.FromValue(value, message.Response); - } - default: - throw new RequestFailedException(message.Response); - } - } - - /// Create or replace an existing service runner. - /// The subscription ID. - /// The name of the resource group. - /// The name of the lab. - /// The name of the service runner. - /// A container for a managed identity to execute DevTest lab services. - /// 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 labName, string name, DevTestLabServiceRunnerData data, CancellationToken cancellationToken = default) - { - Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); - Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); - Argument.AssertNotNullOrEmpty(labName, nameof(labName)); - Argument.AssertNotNullOrEmpty(name, nameof(name)); - Argument.AssertNotNull(data, nameof(data)); - - using var message = CreateCreateOrUpdateRequest(subscriptionId, resourceGroupName, labName, name, data); - _pipeline.Send(message, cancellationToken); - switch (message.Response.Status) - { - case 200: - case 201: - { - DevTestLabServiceRunnerData value = default; - using var document = JsonDocument.Parse(message.Response.ContentStream, ModelSerializationExtensions.JsonDocumentOptions); - value = DevTestLabServiceRunnerData.DeserializeDevTestLabServiceRunnerData(document.RootElement); - return Response.FromValue(value, message.Response); - } - default: - throw new RequestFailedException(message.Response); - } - } - - internal RequestUriBuilder CreateDeleteRequestUri(string subscriptionId, string resourceGroupName, string labName, string name) + internal HttpMessage CreateDeleteRequest(string subscriptionId, string resourceGroupName, string labName, string name, RequestContext context) { - 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.DevTestLab/labs/", false); - uri.AppendPath(labName, true); - uri.AppendPath("/servicerunners/", false); - uri.AppendPath(name, true); - uri.AppendQuery("api-version", _apiVersion, true); - return uri; - } - - internal HttpMessage CreateDeleteRequest(string subscriptionId, string resourceGroupName, string labName, string name) - { - var message = _pipeline.CreateMessage(); - var request = message.Request; - request.Method = RequestMethod.Delete; - var uri = new RawRequestUriBuilder(); + RawRequestUriBuilder uri = new RawRequestUriBuilder(); uri.Reset(_endpoint); uri.AppendPath("/subscriptions/", false); uri.AppendPath(subscriptionId, true); @@ -281,64 +98,11 @@ internal HttpMessage CreateDeleteRequest(string subscriptionId, string resourceG uri.AppendPath("/servicerunners/", false); uri.AppendPath(name, 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.Delete; return message; } - - /// Delete service runner. - /// The subscription ID. - /// The name of the resource group. - /// The name of the lab. - /// The name of the service runner. - /// 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 labName, string name, CancellationToken cancellationToken = default) - { - Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); - Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); - Argument.AssertNotNullOrEmpty(labName, nameof(labName)); - Argument.AssertNotNullOrEmpty(name, nameof(name)); - - using var message = CreateDeleteRequest(subscriptionId, resourceGroupName, labName, name); - await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); - switch (message.Response.Status) - { - case 200: - case 204: - return message.Response; - default: - throw new RequestFailedException(message.Response); - } - } - - /// Delete service runner. - /// The subscription ID. - /// The name of the resource group. - /// The name of the lab. - /// The name of the service runner. - /// 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 labName, string name, CancellationToken cancellationToken = default) - { - Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); - Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); - Argument.AssertNotNullOrEmpty(labName, nameof(labName)); - Argument.AssertNotNullOrEmpty(name, nameof(name)); - - using var message = CreateDeleteRequest(subscriptionId, resourceGroupName, labName, name); - _pipeline.Send(message, cancellationToken); - switch (message.Response.Status) - { - case 200: - case 204: - return message.Response; - default: - throw new RequestFailedException(message.Response); - } - } } } diff --git a/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/RestOperations/UsersRestOperations.cs b/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/RestOperations/UsersRestOperations.cs index dd552122b119..a690acb0f9f2 100644 --- a/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/RestOperations/UsersRestOperations.cs +++ b/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/RestOperations/UsersRestOperations.cs @@ -6,173 +6,44 @@ #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.DevTestLabs.Models; namespace Azure.ResourceManager.DevTestLabs { - internal partial class UsersRestOperations + internal partial class Users { - private readonly TelemetryDetails _userAgent; - private readonly HttpPipeline _pipeline; private readonly Uri _endpoint; private readonly string _apiVersion; - /// Initializes a new instance of UsersRestOperations. - /// The HTTP pipeline for sending and receiving REST requests and responses. - /// The application id to use for user agent. - /// server parameter. - /// Api Version. - /// or is null. - public UsersRestOperations(HttpPipeline pipeline, string applicationId, Uri endpoint = null, string apiVersion = default) + /// Initializes a new instance of Users for mocking. + protected Users() { - _pipeline = pipeline ?? throw new ArgumentNullException(nameof(pipeline)); - _endpoint = endpoint ?? new Uri("https://management.azure.com"); - _apiVersion = apiVersion ?? "2018-09-15"; - _userAgent = new TelemetryDetails(GetType().Assembly, applicationId); } - internal RequestUriBuilder CreateListRequestUri(string subscriptionId, string resourceGroupName, string labName, string expand, string filter, int? top, string orderby) - { - 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.DevTestLab/labs/", false); - uri.AppendPath(labName, true); - uri.AppendPath("/users", false); - if (expand != null) - { - uri.AppendQuery("$expand", expand, true); - } - if (filter != null) - { - uri.AppendQuery("$filter", filter, true); - } - if (top != null) - { - uri.AppendQuery("$top", top.Value, true); - } - if (orderby != null) - { - uri.AppendQuery("$orderby", orderby, true); - } - uri.AppendQuery("api-version", _apiVersion, true); - return uri; - } - - internal HttpMessage CreateListRequest(string subscriptionId, string resourceGroupName, string labName, string expand, string filter, int? top, string orderby) - { - 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.DevTestLab/labs/", false); - uri.AppendPath(labName, true); - uri.AppendPath("/users", false); - if (expand != null) - { - uri.AppendQuery("$expand", expand, true); - } - if (filter != null) - { - uri.AppendQuery("$filter", filter, true); - } - if (top != null) - { - uri.AppendQuery("$top", top.Value, true); - } - if (orderby != null) - { - uri.AppendQuery("$orderby", orderby, true); - } - uri.AppendQuery("api-version", _apiVersion, true); - request.Uri = uri; - request.Headers.Add("Accept", "application/json"); - _userAgent.Apply(message); - return message; - } - - /// List user profiles in a given lab. - /// The subscription ID. - /// The name of the resource group. - /// The name of the lab. - /// Specify the $expand query. Example: 'properties($select=identity)'. - /// The filter to apply to the operation. Example: '$filter=contains(name,'myName'). - /// The maximum number of resources to return from the operation. Example: '$top=10'. - /// The ordering expression for the results, using OData notation. Example: '$orderby=name desc'. - /// The cancellation token to use. - /// , or is null. - /// , or is an empty string, and was expected to be non-empty. - public async Task> ListAsync(string subscriptionId, string resourceGroupName, string labName, string expand = null, string filter = null, int? top = null, string orderby = null, CancellationToken cancellationToken = default) + /// Initializes a new instance of Users. + /// 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 Users(ClientDiagnostics clientDiagnostics, HttpPipeline pipeline, Uri endpoint, string apiVersion) { - Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); - Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); - Argument.AssertNotNullOrEmpty(labName, nameof(labName)); - - using var message = CreateListRequest(subscriptionId, resourceGroupName, labName, expand, filter, top, orderby); - await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); - switch (message.Response.Status) - { - case 200: - { - UserList value = default; - using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, ModelSerializationExtensions.JsonDocumentOptions, cancellationToken).ConfigureAwait(false); - value = UserList.DeserializeUserList(document.RootElement); - return Response.FromValue(value, message.Response); - } - default: - throw new RequestFailedException(message.Response); - } + ClientDiagnostics = clientDiagnostics; + _endpoint = endpoint; + Pipeline = pipeline; + _apiVersion = apiVersion; } - /// List user profiles in a given lab. - /// The subscription ID. - /// The name of the resource group. - /// The name of the lab. - /// Specify the $expand query. Example: 'properties($select=identity)'. - /// The filter to apply to the operation. Example: '$filter=contains(name,'myName'). - /// The maximum number of resources to return from the operation. Example: '$top=10'. - /// The ordering expression for the results, using OData notation. Example: '$orderby=name desc'. - /// The cancellation token to use. - /// , or is null. - /// , or is an empty string, and was expected to be non-empty. - public Response List(string subscriptionId, string resourceGroupName, string labName, string expand = null, string filter = null, int? top = null, string orderby = null, CancellationToken cancellationToken = default) - { - Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); - Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); - Argument.AssertNotNullOrEmpty(labName, nameof(labName)); + /// The HTTP pipeline for sending and receiving REST requests and responses. + public virtual HttpPipeline Pipeline { get; } - using var message = CreateListRequest(subscriptionId, resourceGroupName, labName, expand, filter, top, orderby); - _pipeline.Send(message, cancellationToken); - switch (message.Response.Status) - { - case 200: - { - UserList value = default; - using var document = JsonDocument.Parse(message.Response.ContentStream, ModelSerializationExtensions.JsonDocumentOptions); - value = UserList.DeserializeUserList(document.RootElement); - return Response.FromValue(value, 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 CreateGetRequestUri(string subscriptionId, string resourceGroupName, string labName, string name, string expand) + internal HttpMessage CreateGetRequest(string subscriptionId, string resourceGroupName, string labName, string name, string expand, RequestContext context) { - var uri = new RawRequestUriBuilder(); + RawRequestUriBuilder uri = new RawRequestUriBuilder(); uri.Reset(_endpoint); uri.AppendPath("/subscriptions/", false); uri.AppendPath(subscriptionId, true); @@ -182,111 +53,22 @@ internal RequestUriBuilder CreateGetRequestUri(string subscriptionId, string res uri.AppendPath(labName, true); uri.AppendPath("/users/", false); uri.AppendPath(name, true); - if (expand != null) - { - uri.AppendQuery("$expand", expand, true); - } uri.AppendQuery("api-version", _apiVersion, true); - return uri; - } - - internal HttpMessage CreateGetRequest(string subscriptionId, string resourceGroupName, string labName, string name, string expand) - { - 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.DevTestLab/labs/", false); - uri.AppendPath(labName, true); - uri.AppendPath("/users/", false); - uri.AppendPath(name, true); if (expand != null) { uri.AppendQuery("$expand", expand, 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 user profile. - /// The subscription ID. - /// The name of the resource group. - /// The name of the lab. - /// The name of the user profile. - /// Specify the $expand query. Example: 'properties($select=identity)'. - /// 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 labName, string name, string expand = null, CancellationToken cancellationToken = default) - { - Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); - Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); - Argument.AssertNotNullOrEmpty(labName, nameof(labName)); - Argument.AssertNotNullOrEmpty(name, nameof(name)); - - using var message = CreateGetRequest(subscriptionId, resourceGroupName, labName, name, expand); - await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); - switch (message.Response.Status) - { - case 200: - { - DevTestLabUserData value = default; - using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, ModelSerializationExtensions.JsonDocumentOptions, cancellationToken).ConfigureAwait(false); - value = DevTestLabUserData.DeserializeDevTestLabUserData(document.RootElement); - return Response.FromValue(value, message.Response); - } - case 404: - return Response.FromValue((DevTestLabUserData)null, message.Response); - default: - throw new RequestFailedException(message.Response); - } - } - - /// Get user profile. - /// The subscription ID. - /// The name of the resource group. - /// The name of the lab. - /// The name of the user profile. - /// Specify the $expand query. Example: 'properties($select=identity)'. - /// 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 labName, string name, string expand = null, CancellationToken cancellationToken = default) - { - Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); - Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); - Argument.AssertNotNullOrEmpty(labName, nameof(labName)); - Argument.AssertNotNullOrEmpty(name, nameof(name)); - - using var message = CreateGetRequest(subscriptionId, resourceGroupName, labName, name, expand); - _pipeline.Send(message, cancellationToken); - switch (message.Response.Status) - { - case 200: - { - DevTestLabUserData value = default; - using var document = JsonDocument.Parse(message.Response.ContentStream, ModelSerializationExtensions.JsonDocumentOptions); - value = DevTestLabUserData.DeserializeDevTestLabUserData(document.RootElement); - return Response.FromValue(value, message.Response); - } - case 404: - return Response.FromValue((DevTestLabUserData)null, message.Response); - default: - throw new RequestFailedException(message.Response); - } - } - - internal RequestUriBuilder CreateCreateOrUpdateRequestUri(string subscriptionId, string resourceGroupName, string labName, string name, DevTestLabUserData data) + internal HttpMessage CreateCreateOrUpdateRequest(string subscriptionId, string resourceGroupName, string labName, string name, RequestContent content, RequestContext context) { - var uri = new RawRequestUriBuilder(); + RawRequestUriBuilder uri = new RawRequestUriBuilder(); uri.Reset(_endpoint); uri.AppendPath("/subscriptions/", false); uri.AppendPath(subscriptionId, true); @@ -297,15 +79,19 @@ internal RequestUriBuilder CreateCreateOrUpdateRequestUri(string subscriptionId, uri.AppendPath("/users/", false); uri.AppendPath(name, true); uri.AppendQuery("api-version", _apiVersion, true); - return uri; + HttpMessage message = Pipeline.CreateMessage(); + Request request = message.Request; + request.Uri = uri; + request.Method = RequestMethod.Put; + request.Headers.SetValue("Content-Type", "application/json"); + request.Headers.SetValue("Accept", "application/json"); + request.Content = content; + return message; } - internal HttpMessage CreateCreateOrUpdateRequest(string subscriptionId, string resourceGroupName, string labName, string name, DevTestLabUserData data) + internal HttpMessage CreateUpdateRequest(string subscriptionId, string resourceGroupName, string labName, string name, 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); @@ -316,77 +102,19 @@ internal HttpMessage CreateCreateOrUpdateRequest(string subscriptionId, string r uri.AppendPath("/users/", false); uri.AppendPath(name, 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.Patch; + request.Headers.SetValue("Content-Type", "application/json"); + request.Headers.SetValue("Accept", "application/json"); request.Content = content; - _userAgent.Apply(message); return message; } - /// Create or replace an existing user profile. This operation can take a while to complete. - /// The subscription ID. - /// The name of the resource group. - /// The name of the lab. - /// The name of the user profile. - /// Profile of a lab user. - /// 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 labName, string name, DevTestLabUserData data, CancellationToken cancellationToken = default) - { - Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); - Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); - Argument.AssertNotNullOrEmpty(labName, nameof(labName)); - Argument.AssertNotNullOrEmpty(name, nameof(name)); - Argument.AssertNotNull(data, nameof(data)); - - using var message = CreateCreateOrUpdateRequest(subscriptionId, resourceGroupName, labName, name, data); - await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); - switch (message.Response.Status) - { - case 200: - case 201: - return message.Response; - default: - throw new RequestFailedException(message.Response); - } - } - - /// Create or replace an existing user profile. This operation can take a while to complete. - /// The subscription ID. - /// The name of the resource group. - /// The name of the lab. - /// The name of the user profile. - /// Profile of a lab user. - /// 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 labName, string name, DevTestLabUserData data, CancellationToken cancellationToken = default) - { - Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); - Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); - Argument.AssertNotNullOrEmpty(labName, nameof(labName)); - Argument.AssertNotNullOrEmpty(name, nameof(name)); - Argument.AssertNotNull(data, nameof(data)); - - using var message = CreateCreateOrUpdateRequest(subscriptionId, resourceGroupName, labName, name, 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 labName, string name) + internal HttpMessage CreateDeleteRequest(string subscriptionId, string resourceGroupName, string labName, string name, RequestContext context) { - var uri = new RawRequestUriBuilder(); + RawRequestUriBuilder uri = new RawRequestUriBuilder(); uri.Reset(_endpoint); uri.AppendPath("/subscriptions/", false); uri.AppendPath(subscriptionId, true); @@ -397,15 +125,16 @@ internal RequestUriBuilder CreateDeleteRequestUri(string subscriptionId, string uri.AppendPath("/users/", false); uri.AppendPath(name, true); uri.AppendQuery("api-version", _apiVersion, true); - return uri; + HttpMessage message = Pipeline.CreateMessage(); + Request request = message.Request; + request.Uri = uri; + request.Method = RequestMethod.Delete; + return message; } - internal HttpMessage CreateDeleteRequest(string subscriptionId, string resourceGroupName, string labName, string name) + internal HttpMessage CreateGetAllRequest(string subscriptionId, string resourceGroupName, string labName, string expand, string filter, int? top, string @orderby, RequestContext context) { - var message = _pipeline.CreateMessage(); - var request = message.Request; - request.Method = RequestMethod.Delete; - var uri = new RawRequestUriBuilder(); + RawRequestUriBuilder uri = new RawRequestUriBuilder(); uri.Reset(_endpoint); uri.AppendPath("/subscriptions/", false); uri.AppendPath(subscriptionId, true); @@ -413,269 +142,43 @@ internal HttpMessage CreateDeleteRequest(string subscriptionId, string resourceG uri.AppendPath(resourceGroupName, true); uri.AppendPath("/providers/Microsoft.DevTestLab/labs/", false); uri.AppendPath(labName, true); - uri.AppendPath("/users/", false); - uri.AppendPath(name, true); + uri.AppendPath("/users", false); uri.AppendQuery("api-version", _apiVersion, true); - request.Uri = uri; - request.Headers.Add("Accept", "application/json"); - _userAgent.Apply(message); - return message; - } - - /// Delete user profile. This operation can take a while to complete. - /// The subscription ID. - /// The name of the resource group. - /// The name of the lab. - /// The name of the user profile. - /// 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 labName, string name, CancellationToken cancellationToken = default) - { - Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); - Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); - Argument.AssertNotNullOrEmpty(labName, nameof(labName)); - Argument.AssertNotNullOrEmpty(name, nameof(name)); - - using var message = CreateDeleteRequest(subscriptionId, resourceGroupName, labName, name); - await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); - switch (message.Response.Status) + if (expand != null) { - case 200: - case 202: - case 204: - return message.Response; - default: - throw new RequestFailedException(message.Response); + uri.AppendQuery("$expand", expand, true); } - } - - /// Delete user profile. This operation can take a while to complete. - /// The subscription ID. - /// The name of the resource group. - /// The name of the lab. - /// The name of the user profile. - /// 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 labName, string name, CancellationToken cancellationToken = default) - { - Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); - Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); - Argument.AssertNotNullOrEmpty(labName, nameof(labName)); - Argument.AssertNotNullOrEmpty(name, nameof(name)); - - using var message = CreateDeleteRequest(subscriptionId, resourceGroupName, labName, name); - _pipeline.Send(message, cancellationToken); - switch (message.Response.Status) + if (filter != null) { - case 200: - case 202: - case 204: - return message.Response; - default: - throw new RequestFailedException(message.Response); + uri.AppendQuery("$filter", filter, true); } - } - - internal RequestUriBuilder CreateUpdateRequestUri(string subscriptionId, string resourceGroupName, string labName, string name, DevTestLabUserPatch 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.DevTestLab/labs/", false); - uri.AppendPath(labName, true); - uri.AppendPath("/users/", false); - uri.AppendPath(name, true); - uri.AppendQuery("api-version", _apiVersion, true); - return uri; - } - - internal HttpMessage CreateUpdateRequest(string subscriptionId, string resourceGroupName, string labName, string name, DevTestLabUserPatch patch) - { - var message = _pipeline.CreateMessage(); - var request = message.Request; - request.Method = RequestMethod.Patch; - var uri = new RawRequestUriBuilder(); - uri.Reset(_endpoint); - uri.AppendPath("/subscriptions/", false); - uri.AppendPath(subscriptionId, true); - uri.AppendPath("/resourceGroups/", false); - uri.AppendPath(resourceGroupName, true); - uri.AppendPath("/providers/Microsoft.DevTestLab/labs/", false); - uri.AppendPath(labName, true); - uri.AppendPath("/users/", false); - uri.AppendPath(name, true); - uri.AppendQuery("api-version", _apiVersion, true); - request.Uri = uri; - request.Headers.Add("Accept", "application/json"); - request.Headers.Add("Content-Type", "application/json"); - var content = new Utf8JsonRequestContent(); - content.JsonWriter.WriteObjectValue(patch, ModelSerializationExtensions.WireOptions); - request.Content = content; - _userAgent.Apply(message); - return message; - } - - /// Allows modifying tags of user profiles. All other properties will be ignored. - /// The subscription ID. - /// The name of the resource group. - /// The name of the lab. - /// The name of the user profile. - /// Profile of a lab user. - /// 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 labName, string name, DevTestLabUserPatch patch, CancellationToken cancellationToken = default) - { - Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); - Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); - Argument.AssertNotNullOrEmpty(labName, nameof(labName)); - Argument.AssertNotNullOrEmpty(name, nameof(name)); - Argument.AssertNotNull(patch, nameof(patch)); - - using var message = CreateUpdateRequest(subscriptionId, resourceGroupName, labName, name, patch); - await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); - switch (message.Response.Status) + if (top != null) { - case 200: - { - DevTestLabUserData value = default; - using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, ModelSerializationExtensions.JsonDocumentOptions, cancellationToken).ConfigureAwait(false); - value = DevTestLabUserData.DeserializeDevTestLabUserData(document.RootElement); - return Response.FromValue(value, message.Response); - } - default: - throw new RequestFailedException(message.Response); + uri.AppendQuery("$top", TypeFormatters.ConvertToString(top), true); } - } - - /// Allows modifying tags of user profiles. All other properties will be ignored. - /// The subscription ID. - /// The name of the resource group. - /// The name of the lab. - /// The name of the user profile. - /// Profile of a lab user. - /// 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 labName, string name, DevTestLabUserPatch patch, CancellationToken cancellationToken = default) - { - Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); - Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); - Argument.AssertNotNullOrEmpty(labName, nameof(labName)); - Argument.AssertNotNullOrEmpty(name, nameof(name)); - Argument.AssertNotNull(patch, nameof(patch)); - - using var message = CreateUpdateRequest(subscriptionId, resourceGroupName, labName, name, patch); - _pipeline.Send(message, cancellationToken); - switch (message.Response.Status) + if (@orderby != null) { - case 200: - { - DevTestLabUserData value = default; - using var document = JsonDocument.Parse(message.Response.ContentStream, ModelSerializationExtensions.JsonDocumentOptions); - value = DevTestLabUserData.DeserializeDevTestLabUserData(document.RootElement); - return Response.FromValue(value, message.Response); - } - default: - throw new RequestFailedException(message.Response); + uri.AppendQuery("$orderby", @orderby, true); } - } - - internal RequestUriBuilder CreateListNextPageRequestUri(string nextLink, string subscriptionId, string resourceGroupName, string labName, string expand, string filter, int? top, string orderby) - { - var uri = new RawRequestUriBuilder(); - uri.Reset(_endpoint); - uri.AppendRawNextLink(nextLink, false); - return uri; - } - - internal HttpMessage CreateListNextPageRequest(string nextLink, string subscriptionId, string resourceGroupName, string labName, string expand, string filter, int? top, string orderby) - { - var message = _pipeline.CreateMessage(); - var request = message.Request; - request.Method = RequestMethod.Get; - var uri = new RawRequestUriBuilder(); - uri.Reset(_endpoint); - uri.AppendRawNextLink(nextLink, false); + 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 user profiles in a given lab. - /// The URL to the next page of results. - /// The subscription ID. - /// The name of the resource group. - /// The name of the lab. - /// Specify the $expand query. Example: 'properties($select=identity)'. - /// The filter to apply to the operation. Example: '$filter=contains(name,'myName'). - /// The maximum number of resources to return from the operation. Example: '$top=10'. - /// The ordering expression for the results, using OData notation. Example: '$orderby=name desc'. - /// The cancellation token to use. - /// , , or is null. - /// , or is an empty string, and was expected to be non-empty. - public async Task> ListNextPageAsync(string nextLink, string subscriptionId, string resourceGroupName, string labName, string expand = null, string filter = null, int? top = null, string orderby = null, CancellationToken cancellationToken = default) + internal HttpMessage CreateNextGetAllRequest(Uri nextPage, string subscriptionId, string resourceGroupName, string labName, string expand, string filter, int? top, string @orderby, RequestContext context) { - Argument.AssertNotNull(nextLink, nameof(nextLink)); - Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); - Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); - Argument.AssertNotNullOrEmpty(labName, nameof(labName)); - - using var message = CreateListNextPageRequest(nextLink, subscriptionId, resourceGroupName, labName, expand, filter, top, orderby); - await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); - switch (message.Response.Status) - { - case 200: - { - UserList value = default; - using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, ModelSerializationExtensions.JsonDocumentOptions, cancellationToken).ConfigureAwait(false); - value = UserList.DeserializeUserList(document.RootElement); - return Response.FromValue(value, message.Response); - } - default: - throw new RequestFailedException(message.Response); - } - } - - /// List user profiles in a given lab. - /// The URL to the next page of results. - /// The subscription ID. - /// The name of the resource group. - /// The name of the lab. - /// Specify the $expand query. Example: 'properties($select=identity)'. - /// The filter to apply to the operation. Example: '$filter=contains(name,'myName'). - /// The maximum number of resources to return from the operation. Example: '$top=10'. - /// The ordering expression for the results, using OData notation. Example: '$orderby=name desc'. - /// The cancellation token to use. - /// , , or is null. - /// , or is an empty string, and was expected to be non-empty. - public Response ListNextPage(string nextLink, string subscriptionId, string resourceGroupName, string labName, string expand = null, string filter = null, int? top = null, string orderby = null, CancellationToken cancellationToken = default) - { - Argument.AssertNotNull(nextLink, nameof(nextLink)); - Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); - Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); - Argument.AssertNotNullOrEmpty(labName, nameof(labName)); - - using var message = CreateListNextPageRequest(nextLink, subscriptionId, resourceGroupName, labName, expand, filter, top, orderby); - _pipeline.Send(message, cancellationToken); - switch (message.Response.Status) - { - case 200: - { - UserList value = default; - using var document = JsonDocument.Parse(message.Response.ContentStream, ModelSerializationExtensions.JsonDocumentOptions); - value = UserList.DeserializeUserList(document.RootElement); - return Response.FromValue(value, message.Response); - } - default: - throw new RequestFailedException(message.Response); - } + RawRequestUriBuilder uri = new RawRequestUriBuilder(); + uri.Reset(nextPage); + uri.UpdateQuery("api-version", _apiVersion); + HttpMessage message = Pipeline.CreateMessage(); + Request request = message.Request; + request.Uri = uri; + request.Method = RequestMethod.Get; + request.Headers.SetValue("Accept", "application/json"); + return message; } } } diff --git a/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/RestOperations/VirtualMachineSchedulesRestOperations.cs b/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/RestOperations/VirtualMachineSchedulesRestOperations.cs deleted file mode 100644 index 1636ef085b30..000000000000 --- a/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/RestOperations/VirtualMachineSchedulesRestOperations.cs +++ /dev/null @@ -1,835 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System; -using System.Text.Json; -using System.Threading; -using System.Threading.Tasks; -using Azure.Core; -using Azure.Core.Pipeline; -using Azure.ResourceManager.DevTestLabs.Models; - -namespace Azure.ResourceManager.DevTestLabs -{ - internal partial class VirtualMachineSchedulesRestOperations - { - private readonly TelemetryDetails _userAgent; - private readonly HttpPipeline _pipeline; - private readonly Uri _endpoint; - private readonly string _apiVersion; - - /// Initializes a new instance of VirtualMachineSchedulesRestOperations. - /// The HTTP pipeline for sending and receiving REST requests and responses. - /// The application id to use for user agent. - /// server parameter. - /// Api Version. - /// or is null. - public VirtualMachineSchedulesRestOperations(HttpPipeline pipeline, string applicationId, Uri endpoint = null, string apiVersion = default) - { - _pipeline = pipeline ?? throw new ArgumentNullException(nameof(pipeline)); - _endpoint = endpoint ?? new Uri("https://management.azure.com"); - _apiVersion = apiVersion ?? "2018-09-15"; - _userAgent = new TelemetryDetails(GetType().Assembly, applicationId); - } - - internal RequestUriBuilder CreateListRequestUri(string subscriptionId, string resourceGroupName, string labName, string vmName, string expand, string filter, int? top, string orderby) - { - 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.DevTestLab/labs/", false); - uri.AppendPath(labName, true); - uri.AppendPath("/virtualmachines/", false); - uri.AppendPath(vmName, true); - uri.AppendPath("/schedules", false); - if (expand != null) - { - uri.AppendQuery("$expand", expand, true); - } - if (filter != null) - { - uri.AppendQuery("$filter", filter, true); - } - if (top != null) - { - uri.AppendQuery("$top", top.Value, true); - } - if (orderby != null) - { - uri.AppendQuery("$orderby", orderby, true); - } - uri.AppendQuery("api-version", _apiVersion, true); - return uri; - } - - internal HttpMessage CreateListRequest(string subscriptionId, string resourceGroupName, string labName, string vmName, string expand, string filter, int? top, string orderby) - { - 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.DevTestLab/labs/", false); - uri.AppendPath(labName, true); - uri.AppendPath("/virtualmachines/", false); - uri.AppendPath(vmName, true); - uri.AppendPath("/schedules", false); - if (expand != null) - { - uri.AppendQuery("$expand", expand, true); - } - if (filter != null) - { - uri.AppendQuery("$filter", filter, true); - } - if (top != null) - { - uri.AppendQuery("$top", top.Value, true); - } - if (orderby != null) - { - uri.AppendQuery("$orderby", orderby, true); - } - uri.AppendQuery("api-version", _apiVersion, true); - request.Uri = uri; - request.Headers.Add("Accept", "application/json"); - _userAgent.Apply(message); - return message; - } - - /// List schedules in a given virtual machine. - /// The subscription ID. - /// The name of the resource group. - /// The name of the lab. - /// The name of the virtual machine. - /// Specify the $expand query. Example: 'properties($select=status)'. - /// The filter to apply to the operation. Example: '$filter=contains(name,'myName'). - /// The maximum number of resources to return from the operation. Example: '$top=10'. - /// The ordering expression for the results, using OData notation. Example: '$orderby=name desc'. - /// The cancellation token to use. - /// , , or is null. - /// , , or is an empty string, and was expected to be non-empty. - public async Task> ListAsync(string subscriptionId, string resourceGroupName, string labName, string vmName, string expand = null, string filter = null, int? top = null, string orderby = null, CancellationToken cancellationToken = default) - { - Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); - Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); - Argument.AssertNotNullOrEmpty(labName, nameof(labName)); - Argument.AssertNotNullOrEmpty(vmName, nameof(vmName)); - - using var message = CreateListRequest(subscriptionId, resourceGroupName, labName, vmName, expand, filter, top, orderby); - await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); - switch (message.Response.Status) - { - case 200: - { - ScheduleList value = default; - using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, ModelSerializationExtensions.JsonDocumentOptions, cancellationToken).ConfigureAwait(false); - value = ScheduleList.DeserializeScheduleList(document.RootElement); - return Response.FromValue(value, message.Response); - } - default: - throw new RequestFailedException(message.Response); - } - } - - /// List schedules in a given virtual machine. - /// The subscription ID. - /// The name of the resource group. - /// The name of the lab. - /// The name of the virtual machine. - /// Specify the $expand query. Example: 'properties($select=status)'. - /// The filter to apply to the operation. Example: '$filter=contains(name,'myName'). - /// The maximum number of resources to return from the operation. Example: '$top=10'. - /// The ordering expression for the results, using OData notation. Example: '$orderby=name desc'. - /// The cancellation token to use. - /// , , or is null. - /// , , or is an empty string, and was expected to be non-empty. - public Response List(string subscriptionId, string resourceGroupName, string labName, string vmName, string expand = null, string filter = null, int? top = null, string orderby = null, CancellationToken cancellationToken = default) - { - Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); - Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); - Argument.AssertNotNullOrEmpty(labName, nameof(labName)); - Argument.AssertNotNullOrEmpty(vmName, nameof(vmName)); - - using var message = CreateListRequest(subscriptionId, resourceGroupName, labName, vmName, expand, filter, top, orderby); - _pipeline.Send(message, cancellationToken); - switch (message.Response.Status) - { - case 200: - { - ScheduleList value = default; - using var document = JsonDocument.Parse(message.Response.ContentStream, ModelSerializationExtensions.JsonDocumentOptions); - value = ScheduleList.DeserializeScheduleList(document.RootElement); - return Response.FromValue(value, message.Response); - } - default: - throw new RequestFailedException(message.Response); - } - } - - internal RequestUriBuilder CreateGetRequestUri(string subscriptionId, string resourceGroupName, string labName, string vmName, string name, string expand) - { - 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.DevTestLab/labs/", false); - uri.AppendPath(labName, true); - uri.AppendPath("/virtualmachines/", false); - uri.AppendPath(vmName, true); - uri.AppendPath("/schedules/", false); - uri.AppendPath(name, true); - if (expand != null) - { - uri.AppendQuery("$expand", expand, true); - } - uri.AppendQuery("api-version", _apiVersion, true); - return uri; - } - - internal HttpMessage CreateGetRequest(string subscriptionId, string resourceGroupName, string labName, string vmName, string name, string expand) - { - 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.DevTestLab/labs/", false); - uri.AppendPath(labName, true); - uri.AppendPath("/virtualmachines/", false); - uri.AppendPath(vmName, true); - uri.AppendPath("/schedules/", false); - uri.AppendPath(name, true); - if (expand != null) - { - uri.AppendQuery("$expand", expand, true); - } - uri.AppendQuery("api-version", _apiVersion, true); - request.Uri = uri; - request.Headers.Add("Accept", "application/json"); - _userAgent.Apply(message); - return message; - } - - /// Get schedule. - /// The subscription ID. - /// The name of the resource group. - /// The name of the lab. - /// The name of the virtual machine. - /// The name of the schedule. - /// Specify the $expand query. Example: 'properties($select=status)'. - /// 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 labName, string vmName, string name, string expand = null, CancellationToken cancellationToken = default) - { - Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); - Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); - Argument.AssertNotNullOrEmpty(labName, nameof(labName)); - Argument.AssertNotNullOrEmpty(vmName, nameof(vmName)); - Argument.AssertNotNullOrEmpty(name, nameof(name)); - - using var message = CreateGetRequest(subscriptionId, resourceGroupName, labName, vmName, name, expand); - await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); - switch (message.Response.Status) - { - case 200: - { - DevTestLabScheduleData value = default; - using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, ModelSerializationExtensions.JsonDocumentOptions, cancellationToken).ConfigureAwait(false); - value = DevTestLabScheduleData.DeserializeDevTestLabScheduleData(document.RootElement); - return Response.FromValue(value, message.Response); - } - case 404: - return Response.FromValue((DevTestLabScheduleData)null, message.Response); - default: - throw new RequestFailedException(message.Response); - } - } - - /// Get schedule. - /// The subscription ID. - /// The name of the resource group. - /// The name of the lab. - /// The name of the virtual machine. - /// The name of the schedule. - /// Specify the $expand query. Example: 'properties($select=status)'. - /// 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 labName, string vmName, string name, string expand = null, CancellationToken cancellationToken = default) - { - Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); - Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); - Argument.AssertNotNullOrEmpty(labName, nameof(labName)); - Argument.AssertNotNullOrEmpty(vmName, nameof(vmName)); - Argument.AssertNotNullOrEmpty(name, nameof(name)); - - using var message = CreateGetRequest(subscriptionId, resourceGroupName, labName, vmName, name, expand); - _pipeline.Send(message, cancellationToken); - switch (message.Response.Status) - { - case 200: - { - DevTestLabScheduleData value = default; - using var document = JsonDocument.Parse(message.Response.ContentStream, ModelSerializationExtensions.JsonDocumentOptions); - value = DevTestLabScheduleData.DeserializeDevTestLabScheduleData(document.RootElement); - return Response.FromValue(value, message.Response); - } - case 404: - return Response.FromValue((DevTestLabScheduleData)null, message.Response); - default: - throw new RequestFailedException(message.Response); - } - } - - internal RequestUriBuilder CreateCreateOrUpdateRequestUri(string subscriptionId, string resourceGroupName, string labName, string vmName, string name, DevTestLabScheduleData data) - { - var uri = new RawRequestUriBuilder(); - uri.Reset(_endpoint); - uri.AppendPath("/subscriptions/", false); - uri.AppendPath(subscriptionId, true); - uri.AppendPath("/resourceGroups/", false); - uri.AppendPath(resourceGroupName, true); - uri.AppendPath("/providers/Microsoft.DevTestLab/labs/", false); - uri.AppendPath(labName, true); - uri.AppendPath("/virtualmachines/", false); - uri.AppendPath(vmName, true); - uri.AppendPath("/schedules/", false); - uri.AppendPath(name, true); - uri.AppendQuery("api-version", _apiVersion, true); - return uri; - } - - internal HttpMessage CreateCreateOrUpdateRequest(string subscriptionId, string resourceGroupName, string labName, string vmName, string name, DevTestLabScheduleData data) - { - var message = _pipeline.CreateMessage(); - var request = message.Request; - request.Method = RequestMethod.Put; - var uri = new RawRequestUriBuilder(); - uri.Reset(_endpoint); - uri.AppendPath("/subscriptions/", false); - uri.AppendPath(subscriptionId, true); - uri.AppendPath("/resourceGroups/", false); - uri.AppendPath(resourceGroupName, true); - uri.AppendPath("/providers/Microsoft.DevTestLab/labs/", false); - uri.AppendPath(labName, true); - uri.AppendPath("/virtualmachines/", false); - uri.AppendPath(vmName, true); - uri.AppendPath("/schedules/", false); - uri.AppendPath(name, true); - uri.AppendQuery("api-version", _apiVersion, true); - request.Uri = uri; - request.Headers.Add("Accept", "application/json"); - request.Headers.Add("Content-Type", "application/json"); - var content = new Utf8JsonRequestContent(); - content.JsonWriter.WriteObjectValue(data, ModelSerializationExtensions.WireOptions); - request.Content = content; - _userAgent.Apply(message); - return message; - } - - /// Create or replace an existing schedule. - /// The subscription ID. - /// The name of the resource group. - /// The name of the lab. - /// The name of the virtual machine. - /// The name of the schedule. - /// A schedule. - /// 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 labName, string vmName, string name, DevTestLabScheduleData data, CancellationToken cancellationToken = default) - { - Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); - Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); - Argument.AssertNotNullOrEmpty(labName, nameof(labName)); - Argument.AssertNotNullOrEmpty(vmName, nameof(vmName)); - Argument.AssertNotNullOrEmpty(name, nameof(name)); - Argument.AssertNotNull(data, nameof(data)); - - using var message = CreateCreateOrUpdateRequest(subscriptionId, resourceGroupName, labName, vmName, name, data); - await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); - switch (message.Response.Status) - { - case 200: - case 201: - { - DevTestLabScheduleData value = default; - using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, ModelSerializationExtensions.JsonDocumentOptions, cancellationToken).ConfigureAwait(false); - value = DevTestLabScheduleData.DeserializeDevTestLabScheduleData(document.RootElement); - return Response.FromValue(value, message.Response); - } - default: - throw new RequestFailedException(message.Response); - } - } - - /// Create or replace an existing schedule. - /// The subscription ID. - /// The name of the resource group. - /// The name of the lab. - /// The name of the virtual machine. - /// The name of the schedule. - /// A schedule. - /// 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 labName, string vmName, string name, DevTestLabScheduleData data, CancellationToken cancellationToken = default) - { - Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); - Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); - Argument.AssertNotNullOrEmpty(labName, nameof(labName)); - Argument.AssertNotNullOrEmpty(vmName, nameof(vmName)); - Argument.AssertNotNullOrEmpty(name, nameof(name)); - Argument.AssertNotNull(data, nameof(data)); - - using var message = CreateCreateOrUpdateRequest(subscriptionId, resourceGroupName, labName, vmName, name, data); - _pipeline.Send(message, cancellationToken); - switch (message.Response.Status) - { - case 200: - case 201: - { - DevTestLabScheduleData value = default; - using var document = JsonDocument.Parse(message.Response.ContentStream, ModelSerializationExtensions.JsonDocumentOptions); - value = DevTestLabScheduleData.DeserializeDevTestLabScheduleData(document.RootElement); - return Response.FromValue(value, message.Response); - } - default: - throw new RequestFailedException(message.Response); - } - } - - internal RequestUriBuilder CreateDeleteRequestUri(string subscriptionId, string resourceGroupName, string labName, string vmName, string name) - { - 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.DevTestLab/labs/", false); - uri.AppendPath(labName, true); - uri.AppendPath("/virtualmachines/", false); - uri.AppendPath(vmName, true); - uri.AppendPath("/schedules/", false); - uri.AppendPath(name, true); - uri.AppendQuery("api-version", _apiVersion, true); - return uri; - } - - internal HttpMessage CreateDeleteRequest(string subscriptionId, string resourceGroupName, string labName, string vmName, string name) - { - 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("/resourceGroups/", false); - uri.AppendPath(resourceGroupName, true); - uri.AppendPath("/providers/Microsoft.DevTestLab/labs/", false); - uri.AppendPath(labName, true); - uri.AppendPath("/virtualmachines/", false); - uri.AppendPath(vmName, true); - uri.AppendPath("/schedules/", false); - uri.AppendPath(name, true); - uri.AppendQuery("api-version", _apiVersion, true); - request.Uri = uri; - request.Headers.Add("Accept", "application/json"); - _userAgent.Apply(message); - return message; - } - - /// Delete schedule. - /// The subscription ID. - /// The name of the resource group. - /// The name of the lab. - /// The name of the virtual machine. - /// The name of the schedule. - /// 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 labName, string vmName, string name, CancellationToken cancellationToken = default) - { - Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); - Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); - Argument.AssertNotNullOrEmpty(labName, nameof(labName)); - Argument.AssertNotNullOrEmpty(vmName, nameof(vmName)); - Argument.AssertNotNullOrEmpty(name, nameof(name)); - - using var message = CreateDeleteRequest(subscriptionId, resourceGroupName, labName, vmName, name); - await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); - switch (message.Response.Status) - { - case 200: - case 204: - return message.Response; - default: - throw new RequestFailedException(message.Response); - } - } - - /// Delete schedule. - /// The subscription ID. - /// The name of the resource group. - /// The name of the lab. - /// The name of the virtual machine. - /// The name of the schedule. - /// 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 labName, string vmName, string name, CancellationToken cancellationToken = default) - { - Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); - Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); - Argument.AssertNotNullOrEmpty(labName, nameof(labName)); - Argument.AssertNotNullOrEmpty(vmName, nameof(vmName)); - Argument.AssertNotNullOrEmpty(name, nameof(name)); - - using var message = CreateDeleteRequest(subscriptionId, resourceGroupName, labName, vmName, name); - _pipeline.Send(message, cancellationToken); - switch (message.Response.Status) - { - case 200: - case 204: - return message.Response; - default: - throw new RequestFailedException(message.Response); - } - } - - internal RequestUriBuilder CreateUpdateRequestUri(string subscriptionId, string resourceGroupName, string labName, string vmName, string name, DevTestLabSchedulePatch 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.DevTestLab/labs/", false); - uri.AppendPath(labName, true); - uri.AppendPath("/virtualmachines/", false); - uri.AppendPath(vmName, true); - uri.AppendPath("/schedules/", false); - uri.AppendPath(name, true); - uri.AppendQuery("api-version", _apiVersion, true); - return uri; - } - - internal HttpMessage CreateUpdateRequest(string subscriptionId, string resourceGroupName, string labName, string vmName, string name, DevTestLabSchedulePatch patch) - { - var message = _pipeline.CreateMessage(); - var request = message.Request; - request.Method = RequestMethod.Patch; - var uri = new RawRequestUriBuilder(); - uri.Reset(_endpoint); - uri.AppendPath("/subscriptions/", false); - uri.AppendPath(subscriptionId, true); - uri.AppendPath("/resourceGroups/", false); - uri.AppendPath(resourceGroupName, true); - uri.AppendPath("/providers/Microsoft.DevTestLab/labs/", false); - uri.AppendPath(labName, true); - uri.AppendPath("/virtualmachines/", false); - uri.AppendPath(vmName, true); - uri.AppendPath("/schedules/", false); - uri.AppendPath(name, true); - uri.AppendQuery("api-version", _apiVersion, true); - request.Uri = uri; - request.Headers.Add("Accept", "application/json"); - request.Headers.Add("Content-Type", "application/json"); - var content = new Utf8JsonRequestContent(); - content.JsonWriter.WriteObjectValue(patch, ModelSerializationExtensions.WireOptions); - request.Content = content; - _userAgent.Apply(message); - return message; - } - - /// Allows modifying tags of schedules. All other properties will be ignored. - /// The subscription ID. - /// The name of the resource group. - /// The name of the lab. - /// The name of the virtual machine. - /// The name of the schedule. - /// A schedule. - /// 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 labName, string vmName, string name, DevTestLabSchedulePatch patch, CancellationToken cancellationToken = default) - { - Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); - Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); - Argument.AssertNotNullOrEmpty(labName, nameof(labName)); - Argument.AssertNotNullOrEmpty(vmName, nameof(vmName)); - Argument.AssertNotNullOrEmpty(name, nameof(name)); - Argument.AssertNotNull(patch, nameof(patch)); - - using var message = CreateUpdateRequest(subscriptionId, resourceGroupName, labName, vmName, name, patch); - await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); - switch (message.Response.Status) - { - case 200: - { - DevTestLabScheduleData value = default; - using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, ModelSerializationExtensions.JsonDocumentOptions, cancellationToken).ConfigureAwait(false); - value = DevTestLabScheduleData.DeserializeDevTestLabScheduleData(document.RootElement); - return Response.FromValue(value, message.Response); - } - default: - throw new RequestFailedException(message.Response); - } - } - - /// Allows modifying tags of schedules. All other properties will be ignored. - /// The subscription ID. - /// The name of the resource group. - /// The name of the lab. - /// The name of the virtual machine. - /// The name of the schedule. - /// A schedule. - /// 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 labName, string vmName, string name, DevTestLabSchedulePatch patch, CancellationToken cancellationToken = default) - { - Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); - Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); - Argument.AssertNotNullOrEmpty(labName, nameof(labName)); - Argument.AssertNotNullOrEmpty(vmName, nameof(vmName)); - Argument.AssertNotNullOrEmpty(name, nameof(name)); - Argument.AssertNotNull(patch, nameof(patch)); - - using var message = CreateUpdateRequest(subscriptionId, resourceGroupName, labName, vmName, name, patch); - _pipeline.Send(message, cancellationToken); - switch (message.Response.Status) - { - case 200: - { - DevTestLabScheduleData value = default; - using var document = JsonDocument.Parse(message.Response.ContentStream, ModelSerializationExtensions.JsonDocumentOptions); - value = DevTestLabScheduleData.DeserializeDevTestLabScheduleData(document.RootElement); - return Response.FromValue(value, message.Response); - } - default: - throw new RequestFailedException(message.Response); - } - } - - internal RequestUriBuilder CreateExecuteRequestUri(string subscriptionId, string resourceGroupName, string labName, string vmName, string name) - { - 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.DevTestLab/labs/", false); - uri.AppendPath(labName, true); - uri.AppendPath("/virtualmachines/", false); - uri.AppendPath(vmName, true); - uri.AppendPath("/schedules/", false); - uri.AppendPath(name, true); - uri.AppendPath("/execute", false); - uri.AppendQuery("api-version", _apiVersion, true); - return uri; - } - - internal HttpMessage CreateExecuteRequest(string subscriptionId, string resourceGroupName, string labName, string vmName, string name) - { - var message = _pipeline.CreateMessage(); - var request = message.Request; - request.Method = RequestMethod.Post; - var uri = new RawRequestUriBuilder(); - uri.Reset(_endpoint); - uri.AppendPath("/subscriptions/", false); - uri.AppendPath(subscriptionId, true); - uri.AppendPath("/resourceGroups/", false); - uri.AppendPath(resourceGroupName, true); - uri.AppendPath("/providers/Microsoft.DevTestLab/labs/", false); - uri.AppendPath(labName, true); - uri.AppendPath("/virtualmachines/", false); - uri.AppendPath(vmName, true); - uri.AppendPath("/schedules/", false); - uri.AppendPath(name, true); - uri.AppendPath("/execute", false); - uri.AppendQuery("api-version", _apiVersion, true); - request.Uri = uri; - request.Headers.Add("Accept", "application/json"); - _userAgent.Apply(message); - return message; - } - - /// Execute a schedule. This operation can take a while to complete. - /// The subscription ID. - /// The name of the resource group. - /// The name of the lab. - /// The name of the virtual machine. - /// The name of the schedule. - /// The cancellation token to use. - /// , , , or is null. - /// , , , or is an empty string, and was expected to be non-empty. - public async Task ExecuteAsync(string subscriptionId, string resourceGroupName, string labName, string vmName, string name, CancellationToken cancellationToken = default) - { - Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); - Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); - Argument.AssertNotNullOrEmpty(labName, nameof(labName)); - Argument.AssertNotNullOrEmpty(vmName, nameof(vmName)); - Argument.AssertNotNullOrEmpty(name, nameof(name)); - - using var message = CreateExecuteRequest(subscriptionId, resourceGroupName, labName, vmName, name); - await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); - switch (message.Response.Status) - { - case 200: - case 202: - return message.Response; - default: - throw new RequestFailedException(message.Response); - } - } - - /// Execute a schedule. This operation can take a while to complete. - /// The subscription ID. - /// The name of the resource group. - /// The name of the lab. - /// The name of the virtual machine. - /// The name of the schedule. - /// The cancellation token to use. - /// , , , or is null. - /// , , , or is an empty string, and was expected to be non-empty. - public Response Execute(string subscriptionId, string resourceGroupName, string labName, string vmName, string name, CancellationToken cancellationToken = default) - { - Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); - Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); - Argument.AssertNotNullOrEmpty(labName, nameof(labName)); - Argument.AssertNotNullOrEmpty(vmName, nameof(vmName)); - Argument.AssertNotNullOrEmpty(name, nameof(name)); - - using var message = CreateExecuteRequest(subscriptionId, resourceGroupName, labName, vmName, name); - _pipeline.Send(message, cancellationToken); - switch (message.Response.Status) - { - case 200: - case 202: - return message.Response; - default: - throw new RequestFailedException(message.Response); - } - } - - internal RequestUriBuilder CreateListNextPageRequestUri(string nextLink, string subscriptionId, string resourceGroupName, string labName, string vmName, string expand, string filter, int? top, string orderby) - { - var uri = new RawRequestUriBuilder(); - uri.Reset(_endpoint); - uri.AppendRawNextLink(nextLink, false); - return uri; - } - - internal HttpMessage CreateListNextPageRequest(string nextLink, string subscriptionId, string resourceGroupName, string labName, string vmName, string expand, string filter, int? top, string orderby) - { - var message = _pipeline.CreateMessage(); - var request = message.Request; - request.Method = RequestMethod.Get; - var uri = new RawRequestUriBuilder(); - uri.Reset(_endpoint); - uri.AppendRawNextLink(nextLink, false); - request.Uri = uri; - request.Headers.Add("Accept", "application/json"); - _userAgent.Apply(message); - return message; - } - - /// List schedules in a given virtual machine. - /// The URL to the next page of results. - /// The subscription ID. - /// The name of the resource group. - /// The name of the lab. - /// The name of the virtual machine. - /// Specify the $expand query. Example: 'properties($select=status)'. - /// The filter to apply to the operation. Example: '$filter=contains(name,'myName'). - /// The maximum number of resources to return from the operation. Example: '$top=10'. - /// The ordering expression for the results, using OData notation. Example: '$orderby=name desc'. - /// The cancellation token to use. - /// , , , or is null. - /// , , or is an empty string, and was expected to be non-empty. - public async Task> ListNextPageAsync(string nextLink, string subscriptionId, string resourceGroupName, string labName, string vmName, string expand = null, string filter = null, int? top = null, string orderby = null, CancellationToken cancellationToken = default) - { - Argument.AssertNotNull(nextLink, nameof(nextLink)); - Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); - Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); - Argument.AssertNotNullOrEmpty(labName, nameof(labName)); - Argument.AssertNotNullOrEmpty(vmName, nameof(vmName)); - - using var message = CreateListNextPageRequest(nextLink, subscriptionId, resourceGroupName, labName, vmName, expand, filter, top, orderby); - await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); - switch (message.Response.Status) - { - case 200: - { - ScheduleList value = default; - using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, ModelSerializationExtensions.JsonDocumentOptions, cancellationToken).ConfigureAwait(false); - value = ScheduleList.DeserializeScheduleList(document.RootElement); - return Response.FromValue(value, message.Response); - } - default: - throw new RequestFailedException(message.Response); - } - } - - /// List schedules in a given virtual machine. - /// The URL to the next page of results. - /// The subscription ID. - /// The name of the resource group. - /// The name of the lab. - /// The name of the virtual machine. - /// Specify the $expand query. Example: 'properties($select=status)'. - /// The filter to apply to the operation. Example: '$filter=contains(name,'myName'). - /// The maximum number of resources to return from the operation. Example: '$top=10'. - /// The ordering expression for the results, using OData notation. Example: '$orderby=name desc'. - /// The cancellation token to use. - /// , , , or is null. - /// , , or is an empty string, and was expected to be non-empty. - public Response ListNextPage(string nextLink, string subscriptionId, string resourceGroupName, string labName, string vmName, string expand = null, string filter = null, int? top = null, string orderby = null, CancellationToken cancellationToken = default) - { - Argument.AssertNotNull(nextLink, nameof(nextLink)); - Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); - Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); - Argument.AssertNotNullOrEmpty(labName, nameof(labName)); - Argument.AssertNotNullOrEmpty(vmName, nameof(vmName)); - - using var message = CreateListNextPageRequest(nextLink, subscriptionId, resourceGroupName, labName, vmName, expand, filter, top, orderby); - _pipeline.Send(message, cancellationToken); - switch (message.Response.Status) - { - case 200: - { - ScheduleList value = default; - using var document = JsonDocument.Parse(message.Response.ContentStream, ModelSerializationExtensions.JsonDocumentOptions); - value = ScheduleList.DeserializeScheduleList(document.RootElement); - return Response.FromValue(value, message.Response); - } - default: - throw new RequestFailedException(message.Response); - } - } - } -} diff --git a/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/RestOperations/VirtualMachinesRestOperations.cs b/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/RestOperations/VirtualMachinesRestOperations.cs index a884c8fe12fa..9c6199461a87 100644 --- a/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/RestOperations/VirtualMachinesRestOperations.cs +++ b/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/RestOperations/VirtualMachinesRestOperations.cs @@ -6,73 +6,44 @@ #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.DevTestLabs.Models; namespace Azure.ResourceManager.DevTestLabs { - internal partial class VirtualMachinesRestOperations + internal partial class VirtualMachines { - private readonly TelemetryDetails _userAgent; - private readonly HttpPipeline _pipeline; private readonly Uri _endpoint; private readonly string _apiVersion; - /// Initializes a new instance of VirtualMachinesRestOperations. - /// The HTTP pipeline for sending and receiving REST requests and responses. - /// The application id to use for user agent. - /// server parameter. - /// Api Version. - /// or is null. - public VirtualMachinesRestOperations(HttpPipeline pipeline, string applicationId, Uri endpoint = null, string apiVersion = default) + /// Initializes a new instance of VirtualMachines for mocking. + protected VirtualMachines() { - _pipeline = pipeline ?? throw new ArgumentNullException(nameof(pipeline)); - _endpoint = endpoint ?? new Uri("https://management.azure.com"); - _apiVersion = apiVersion ?? "2018-09-15"; - _userAgent = new TelemetryDetails(GetType().Assembly, applicationId); } - internal RequestUriBuilder CreateListRequestUri(string subscriptionId, string resourceGroupName, string labName, string expand, string filter, int? top, string orderby) + /// Initializes a new instance of VirtualMachines. + /// 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 VirtualMachines(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.DevTestLab/labs/", false); - uri.AppendPath(labName, true); - uri.AppendPath("/virtualmachines", false); - if (expand != null) - { - uri.AppendQuery("$expand", expand, true); - } - if (filter != null) - { - uri.AppendQuery("$filter", filter, true); - } - if (top != null) - { - uri.AppendQuery("$top", top.Value, true); - } - if (orderby != null) - { - uri.AppendQuery("$orderby", orderby, true); - } - uri.AppendQuery("api-version", _apiVersion, true); - return uri; + ClientDiagnostics = clientDiagnostics; + _endpoint = endpoint; + Pipeline = pipeline; + _apiVersion = apiVersion; } - internal HttpMessage CreateListRequest(string subscriptionId, string resourceGroupName, string labName, string expand, string filter, int? top, string orderby) + /// 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(string subscriptionId, string resourceGroupName, string labName, string name, string expand, 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); @@ -80,99 +51,24 @@ internal HttpMessage CreateListRequest(string subscriptionId, string resourceGro uri.AppendPath(resourceGroupName, true); uri.AppendPath("/providers/Microsoft.DevTestLab/labs/", false); uri.AppendPath(labName, true); - uri.AppendPath("/virtualmachines", false); + uri.AppendPath("/virtualmachines/", false); + uri.AppendPath(name, true); + uri.AppendQuery("api-version", _apiVersion, true); if (expand != null) { uri.AppendQuery("$expand", expand, true); } - if (filter != null) - { - uri.AppendQuery("$filter", filter, true); - } - if (top != null) - { - uri.AppendQuery("$top", top.Value, true); - } - if (orderby != null) - { - uri.AppendQuery("$orderby", orderby, 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; } - /// List virtual machines in a given lab. - /// The subscription ID. - /// The name of the resource group. - /// The name of the lab. - /// Specify the $expand query. Example: 'properties($expand=artifacts,computeVm,networkInterface,applicableSchedule)'. - /// The filter to apply to the operation. Example: '$filter=contains(name,'myName'). - /// The maximum number of resources to return from the operation. Example: '$top=10'. - /// The ordering expression for the results, using OData notation. Example: '$orderby=name desc'. - /// The cancellation token to use. - /// , or is null. - /// , or is an empty string, and was expected to be non-empty. - public async Task> ListAsync(string subscriptionId, string resourceGroupName, string labName, string expand = null, string filter = null, int? top = null, string orderby = null, CancellationToken cancellationToken = default) - { - Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); - Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); - Argument.AssertNotNullOrEmpty(labName, nameof(labName)); - - using var message = CreateListRequest(subscriptionId, resourceGroupName, labName, expand, filter, top, orderby); - await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); - switch (message.Response.Status) - { - case 200: - { - LabVmList value = default; - using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, ModelSerializationExtensions.JsonDocumentOptions, cancellationToken).ConfigureAwait(false); - value = LabVmList.DeserializeLabVmList(document.RootElement); - return Response.FromValue(value, message.Response); - } - default: - throw new RequestFailedException(message.Response); - } - } - - /// List virtual machines in a given lab. - /// The subscription ID. - /// The name of the resource group. - /// The name of the lab. - /// Specify the $expand query. Example: 'properties($expand=artifacts,computeVm,networkInterface,applicableSchedule)'. - /// The filter to apply to the operation. Example: '$filter=contains(name,'myName'). - /// The maximum number of resources to return from the operation. Example: '$top=10'. - /// The ordering expression for the results, using OData notation. Example: '$orderby=name desc'. - /// The cancellation token to use. - /// , or is null. - /// , or is an empty string, and was expected to be non-empty. - public Response List(string subscriptionId, string resourceGroupName, string labName, string expand = null, string filter = null, int? top = null, string orderby = null, CancellationToken cancellationToken = default) + internal HttpMessage CreateCreateOrUpdateRequest(string subscriptionId, string resourceGroupName, string labName, string name, RequestContent content, RequestContext context) { - Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); - Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); - Argument.AssertNotNullOrEmpty(labName, nameof(labName)); - - using var message = CreateListRequest(subscriptionId, resourceGroupName, labName, expand, filter, top, orderby); - _pipeline.Send(message, cancellationToken); - switch (message.Response.Status) - { - case 200: - { - LabVmList value = default; - using var document = JsonDocument.Parse(message.Response.ContentStream, ModelSerializationExtensions.JsonDocumentOptions); - value = LabVmList.DeserializeLabVmList(document.RootElement); - return Response.FromValue(value, message.Response); - } - default: - throw new RequestFailedException(message.Response); - } - } - - internal RequestUriBuilder CreateGetRequestUri(string subscriptionId, string resourceGroupName, string labName, string name, string expand) - { - var uri = new RawRequestUriBuilder(); + RawRequestUriBuilder uri = new RawRequestUriBuilder(); uri.Reset(_endpoint); uri.AppendPath("/subscriptions/", false); uri.AppendPath(subscriptionId, true); @@ -182,20 +78,20 @@ internal RequestUriBuilder CreateGetRequestUri(string subscriptionId, string res uri.AppendPath(labName, true); uri.AppendPath("/virtualmachines/", false); uri.AppendPath(name, true); - if (expand != null) - { - uri.AppendQuery("$expand", expand, true); - } uri.AppendQuery("api-version", _apiVersion, true); - return uri; + HttpMessage message = Pipeline.CreateMessage(); + Request request = message.Request; + request.Uri = uri; + request.Method = RequestMethod.Put; + request.Headers.SetValue("Content-Type", "application/json"); + request.Headers.SetValue("Accept", "application/json"); + request.Content = content; + return message; } - internal HttpMessage CreateGetRequest(string subscriptionId, string resourceGroupName, string labName, string name, string expand) + internal HttpMessage CreateUpdateRequest(string subscriptionId, string resourceGroupName, string labName, string name, RequestContent content, 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); @@ -205,88 +101,20 @@ internal HttpMessage CreateGetRequest(string subscriptionId, string resourceGrou uri.AppendPath(labName, true); uri.AppendPath("/virtualmachines/", false); uri.AppendPath(name, true); - if (expand != null) - { - uri.AppendQuery("$expand", expand, 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.Patch; + request.Headers.SetValue("Content-Type", "application/json"); + request.Headers.SetValue("Accept", "application/json"); + request.Content = content; return message; } - /// Get virtual machine. - /// The subscription ID. - /// The name of the resource group. - /// The name of the lab. - /// The name of the virtual machine. - /// Specify the $expand query. Example: 'properties($expand=artifacts,computeVm,networkInterface,applicableSchedule)'. - /// 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 labName, string name, string expand = null, CancellationToken cancellationToken = default) - { - Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); - Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); - Argument.AssertNotNullOrEmpty(labName, nameof(labName)); - Argument.AssertNotNullOrEmpty(name, nameof(name)); - - using var message = CreateGetRequest(subscriptionId, resourceGroupName, labName, name, expand); - await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); - switch (message.Response.Status) - { - case 200: - { - DevTestLabVmData value = default; - using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, ModelSerializationExtensions.JsonDocumentOptions, cancellationToken).ConfigureAwait(false); - value = DevTestLabVmData.DeserializeDevTestLabVmData(document.RootElement); - return Response.FromValue(value, message.Response); - } - case 404: - return Response.FromValue((DevTestLabVmData)null, message.Response); - default: - throw new RequestFailedException(message.Response); - } - } - - /// Get virtual machine. - /// The subscription ID. - /// The name of the resource group. - /// The name of the lab. - /// The name of the virtual machine. - /// Specify the $expand query. Example: 'properties($expand=artifacts,computeVm,networkInterface,applicableSchedule)'. - /// 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 labName, string name, string expand = null, CancellationToken cancellationToken = default) - { - Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); - Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); - Argument.AssertNotNullOrEmpty(labName, nameof(labName)); - Argument.AssertNotNullOrEmpty(name, nameof(name)); - - using var message = CreateGetRequest(subscriptionId, resourceGroupName, labName, name, expand); - _pipeline.Send(message, cancellationToken); - switch (message.Response.Status) - { - case 200: - { - DevTestLabVmData value = default; - using var document = JsonDocument.Parse(message.Response.ContentStream, ModelSerializationExtensions.JsonDocumentOptions); - value = DevTestLabVmData.DeserializeDevTestLabVmData(document.RootElement); - return Response.FromValue(value, message.Response); - } - case 404: - return Response.FromValue((DevTestLabVmData)null, message.Response); - default: - throw new RequestFailedException(message.Response); - } - } - - internal RequestUriBuilder CreateCreateOrUpdateRequestUri(string subscriptionId, string resourceGroupName, string labName, string name, DevTestLabVmData data) + internal HttpMessage CreateDeleteRequest(string subscriptionId, string resourceGroupName, string labName, string name, RequestContext context) { - var uri = new RawRequestUriBuilder(); + RawRequestUriBuilder uri = new RawRequestUriBuilder(); uri.Reset(_endpoint); uri.AppendPath("/subscriptions/", false); uri.AppendPath(subscriptionId, true); @@ -297,15 +125,16 @@ internal RequestUriBuilder CreateCreateOrUpdateRequestUri(string subscriptionId, uri.AppendPath("/virtualmachines/", false); uri.AppendPath(name, true); uri.AppendQuery("api-version", _apiVersion, true); - return uri; + HttpMessage message = Pipeline.CreateMessage(); + Request request = message.Request; + request.Uri = uri; + request.Method = RequestMethod.Delete; + return message; } - internal HttpMessage CreateCreateOrUpdateRequest(string subscriptionId, string resourceGroupName, string labName, string name, DevTestLabVmData data) + internal HttpMessage CreateGetAllRequest(string subscriptionId, string resourceGroupName, string labName, string expand, string filter, int? top, string @orderby, 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); @@ -313,99 +142,48 @@ internal HttpMessage CreateCreateOrUpdateRequest(string subscriptionId, string r uri.AppendPath(resourceGroupName, true); uri.AppendPath("/providers/Microsoft.DevTestLab/labs/", false); uri.AppendPath(labName, true); - uri.AppendPath("/virtualmachines/", false); - uri.AppendPath(name, true); + uri.AppendPath("/virtualmachines", false); uri.AppendQuery("api-version", _apiVersion, true); - request.Uri = uri; - request.Headers.Add("Accept", "application/json"); - request.Headers.Add("Content-Type", "application/json"); - var content = new Utf8JsonRequestContent(); - content.JsonWriter.WriteObjectValue(data, ModelSerializationExtensions.WireOptions); - request.Content = content; - _userAgent.Apply(message); - return message; - } - - /// Create or replace an existing virtual machine. This operation can take a while to complete. - /// The subscription ID. - /// The name of the resource group. - /// The name of the lab. - /// The name of the virtual machine. - /// A 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 CreateOrUpdateAsync(string subscriptionId, string resourceGroupName, string labName, string name, DevTestLabVmData data, CancellationToken cancellationToken = default) - { - Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); - Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); - Argument.AssertNotNullOrEmpty(labName, nameof(labName)); - Argument.AssertNotNullOrEmpty(name, nameof(name)); - Argument.AssertNotNull(data, nameof(data)); - - using var message = CreateCreateOrUpdateRequest(subscriptionId, resourceGroupName, labName, name, data); - await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); - switch (message.Response.Status) + if (expand != null) { - case 200: - case 201: - return message.Response; - default: - throw new RequestFailedException(message.Response); + uri.AppendQuery("$expand", expand, true); } - } - - /// Create or replace an existing virtual machine. This operation can take a while to complete. - /// The subscription ID. - /// The name of the resource group. - /// The name of the lab. - /// The name of the virtual machine. - /// A virtual machine. - /// 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 labName, string name, DevTestLabVmData data, CancellationToken cancellationToken = default) - { - Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); - Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); - Argument.AssertNotNullOrEmpty(labName, nameof(labName)); - Argument.AssertNotNullOrEmpty(name, nameof(name)); - Argument.AssertNotNull(data, nameof(data)); - - using var message = CreateCreateOrUpdateRequest(subscriptionId, resourceGroupName, labName, name, data); - _pipeline.Send(message, cancellationToken); - switch (message.Response.Status) + if (filter != null) + { + uri.AppendQuery("$filter", filter, true); + } + if (top != null) + { + uri.AppendQuery("$top", TypeFormatters.ConvertToString(top), true); + } + if (@orderby != null) { - case 200: - case 201: - return message.Response; - default: - throw new RequestFailedException(message.Response); + uri.AppendQuery("$orderby", @orderby, true); } + HttpMessage message = Pipeline.CreateMessage(); + Request request = message.Request; + request.Uri = uri; + request.Method = RequestMethod.Get; + request.Headers.SetValue("Accept", "application/json"); + return message; } - internal RequestUriBuilder CreateDeleteRequestUri(string subscriptionId, string resourceGroupName, string labName, string name) + internal HttpMessage CreateNextGetAllRequest(Uri nextPage, string subscriptionId, string resourceGroupName, string labName, string expand, string filter, int? top, string @orderby, RequestContext context) { - 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.DevTestLab/labs/", false); - uri.AppendPath(labName, true); - uri.AppendPath("/virtualmachines/", false); - uri.AppendPath(name, true); - uri.AppendQuery("api-version", _apiVersion, true); - return uri; + RawRequestUriBuilder uri = new RawRequestUriBuilder(); + uri.Reset(nextPage); + uri.UpdateQuery("api-version", _apiVersion); + 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 CreateDeleteRequest(string subscriptionId, string resourceGroupName, string labName, string name) + internal HttpMessage CreateAddDataDiskRequest(string subscriptionId, string resourceGroupName, string labName, string name, RequestContent content, RequestContext context) { - var message = _pipeline.CreateMessage(); - var request = message.Request; - request.Method = RequestMethod.Delete; - var uri = new RawRequestUriBuilder(); + RawRequestUriBuilder uri = new RawRequestUriBuilder(); uri.Reset(_endpoint); uri.AppendPath("/subscriptions/", false); uri.AppendPath(subscriptionId, true); @@ -415,72 +193,20 @@ internal HttpMessage CreateDeleteRequest(string subscriptionId, string resourceG uri.AppendPath(labName, true); uri.AppendPath("/virtualmachines/", false); uri.AppendPath(name, true); + uri.AppendPath("/addDataDisk", 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.Post; + request.Headers.SetValue("Content-Type", "application/json"); + request.Content = content; return message; } - /// Delete virtual machine. This operation can take a while to complete. - /// The subscription ID. - /// The name of the resource group. - /// The name of the lab. - /// The name of the 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 DeleteAsync(string subscriptionId, string resourceGroupName, string labName, string name, CancellationToken cancellationToken = default) + internal HttpMessage CreateApplyArtifactsRequest(string subscriptionId, string resourceGroupName, string labName, string name, RequestContent content, RequestContext context) { - Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); - Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); - Argument.AssertNotNullOrEmpty(labName, nameof(labName)); - Argument.AssertNotNullOrEmpty(name, nameof(name)); - - using var message = CreateDeleteRequest(subscriptionId, resourceGroupName, labName, name); - await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); - switch (message.Response.Status) - { - case 200: - case 202: - case 204: - return message.Response; - default: - throw new RequestFailedException(message.Response); - } - } - - /// Delete virtual machine. This operation can take a while to complete. - /// The subscription ID. - /// The name of the resource group. - /// The name of the lab. - /// The name of the virtual machine. - /// 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 labName, string name, CancellationToken cancellationToken = default) - { - Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); - Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); - Argument.AssertNotNullOrEmpty(labName, nameof(labName)); - Argument.AssertNotNullOrEmpty(name, nameof(name)); - - using var message = CreateDeleteRequest(subscriptionId, resourceGroupName, labName, name); - _pipeline.Send(message, cancellationToken); - switch (message.Response.Status) - { - case 200: - case 202: - case 204: - return message.Response; - default: - throw new RequestFailedException(message.Response); - } - } - - internal RequestUriBuilder CreateUpdateRequestUri(string subscriptionId, string resourceGroupName, string labName, string name, DevTestLabVmPatch patch) - { - var uri = new RawRequestUriBuilder(); + RawRequestUriBuilder uri = new RawRequestUriBuilder(); uri.Reset(_endpoint); uri.AppendPath("/subscriptions/", false); uri.AppendPath(subscriptionId, true); @@ -490,16 +216,20 @@ internal RequestUriBuilder CreateUpdateRequestUri(string subscriptionId, string uri.AppendPath(labName, true); uri.AppendPath("/virtualmachines/", false); uri.AppendPath(name, true); + uri.AppendPath("/applyArtifacts", false); uri.AppendQuery("api-version", _apiVersion, true); - return uri; + HttpMessage message = Pipeline.CreateMessage(); + Request request = message.Request; + request.Uri = uri; + request.Method = RequestMethod.Post; + request.Headers.SetValue("Content-Type", "application/json"); + request.Content = content; + return message; } - internal HttpMessage CreateUpdateRequest(string subscriptionId, string resourceGroupName, string labName, string name, DevTestLabVmPatch patch) + internal HttpMessage CreateClaimRequest(string subscriptionId, string resourceGroupName, string labName, string name, RequestContext context) { - 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); @@ -509,86 +239,18 @@ internal HttpMessage CreateUpdateRequest(string subscriptionId, string resourceG uri.AppendPath(labName, true); uri.AppendPath("/virtualmachines/", false); uri.AppendPath(name, true); + uri.AppendPath("/claim", false); 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.Content = content; - _userAgent.Apply(message); + request.Method = RequestMethod.Post; return message; } - /// Allows modifying tags of virtual machines. All other properties will be ignored. - /// The subscription ID. - /// The name of the resource group. - /// The name of the lab. - /// The name of the virtual machine. - /// A 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> UpdateAsync(string subscriptionId, string resourceGroupName, string labName, string name, DevTestLabVmPatch patch, CancellationToken cancellationToken = default) - { - Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); - Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); - Argument.AssertNotNullOrEmpty(labName, nameof(labName)); - Argument.AssertNotNullOrEmpty(name, nameof(name)); - Argument.AssertNotNull(patch, nameof(patch)); - - using var message = CreateUpdateRequest(subscriptionId, resourceGroupName, labName, name, patch); - await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); - switch (message.Response.Status) - { - case 200: - { - DevTestLabVmData value = default; - using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, ModelSerializationExtensions.JsonDocumentOptions, cancellationToken).ConfigureAwait(false); - value = DevTestLabVmData.DeserializeDevTestLabVmData(document.RootElement); - return Response.FromValue(value, message.Response); - } - default: - throw new RequestFailedException(message.Response); - } - } - - /// Allows modifying tags of virtual machines. All other properties will be ignored. - /// The subscription ID. - /// The name of the resource group. - /// The name of the lab. - /// The name of the virtual machine. - /// A virtual machine. - /// 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 labName, string name, DevTestLabVmPatch patch, CancellationToken cancellationToken = default) - { - Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); - Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); - Argument.AssertNotNullOrEmpty(labName, nameof(labName)); - Argument.AssertNotNullOrEmpty(name, nameof(name)); - Argument.AssertNotNull(patch, nameof(patch)); - - using var message = CreateUpdateRequest(subscriptionId, resourceGroupName, labName, name, patch); - _pipeline.Send(message, cancellationToken); - switch (message.Response.Status) - { - case 200: - { - DevTestLabVmData value = default; - using var document = JsonDocument.Parse(message.Response.ContentStream, ModelSerializationExtensions.JsonDocumentOptions); - value = DevTestLabVmData.DeserializeDevTestLabVmData(document.RootElement); - return Response.FromValue(value, message.Response); - } - default: - throw new RequestFailedException(message.Response); - } - } - - internal RequestUriBuilder CreateAddDataDiskRequestUri(string subscriptionId, string resourceGroupName, string labName, string name, DevTestLabDataDiskProperties dataDiskProperties) + internal HttpMessage CreateDetachDataDiskRequest(string subscriptionId, string resourceGroupName, string labName, string name, RequestContent content, RequestContext context) { - var uri = new RawRequestUriBuilder(); + RawRequestUriBuilder uri = new RawRequestUriBuilder(); uri.Reset(_endpoint); uri.AppendPath("/subscriptions/", false); uri.AppendPath(subscriptionId, true); @@ -598,17 +260,20 @@ internal RequestUriBuilder CreateAddDataDiskRequestUri(string subscriptionId, st uri.AppendPath(labName, true); uri.AppendPath("/virtualmachines/", false); uri.AppendPath(name, true); - uri.AppendPath("/addDataDisk", false); + uri.AppendPath("/detachDataDisk", false); uri.AppendQuery("api-version", _apiVersion, true); - return uri; + HttpMessage message = Pipeline.CreateMessage(); + Request request = message.Request; + request.Uri = uri; + request.Method = RequestMethod.Post; + request.Headers.SetValue("Content-Type", "application/json"); + request.Content = content; + return message; } - internal HttpMessage CreateAddDataDiskRequest(string subscriptionId, string resourceGroupName, string labName, string name, DevTestLabDataDiskProperties dataDiskProperties) + internal HttpMessage CreateGetRdpFileContentsRequest(string subscriptionId, string resourceGroupName, string labName, string name, RequestContext context) { - var message = _pipeline.CreateMessage(); - var request = message.Request; - request.Method = RequestMethod.Post; - var uri = new RawRequestUriBuilder(); + RawRequestUriBuilder uri = new RawRequestUriBuilder(); uri.Reset(_endpoint); uri.AppendPath("/subscriptions/", false); uri.AppendPath(subscriptionId, true); @@ -618,79 +283,19 @@ internal HttpMessage CreateAddDataDiskRequest(string subscriptionId, string reso uri.AppendPath(labName, true); uri.AppendPath("/virtualmachines/", false); uri.AppendPath(name, true); - uri.AppendPath("/addDataDisk", false); + uri.AppendPath("/getRdpFileContents", false); 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(dataDiskProperties, ModelSerializationExtensions.WireOptions); - request.Content = content; - _userAgent.Apply(message); + request.Method = RequestMethod.Post; + request.Headers.SetValue("Accept", "application/json"); return message; } - /// Attach a new or existing data disk to virtual machine. This operation can take a while to complete. - /// The subscription ID. - /// The name of the resource group. - /// The name of the lab. - /// The name of the virtual machine. - /// Request body for adding a new or existing data disk to a 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 AddDataDiskAsync(string subscriptionId, string resourceGroupName, string labName, string name, DevTestLabDataDiskProperties dataDiskProperties, CancellationToken cancellationToken = default) - { - Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); - Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); - Argument.AssertNotNullOrEmpty(labName, nameof(labName)); - Argument.AssertNotNullOrEmpty(name, nameof(name)); - Argument.AssertNotNull(dataDiskProperties, nameof(dataDiskProperties)); - - using var message = CreateAddDataDiskRequest(subscriptionId, resourceGroupName, labName, name, dataDiskProperties); - await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); - switch (message.Response.Status) - { - case 200: - case 202: - return message.Response; - default: - throw new RequestFailedException(message.Response); - } - } - - /// Attach a new or existing data disk to virtual machine. This operation can take a while to complete. - /// The subscription ID. - /// The name of the resource group. - /// The name of the lab. - /// The name of the virtual machine. - /// Request body for adding a new or existing data disk to a virtual machine. - /// The cancellation token to use. - /// , , , or is null. - /// , , or is an empty string, and was expected to be non-empty. - public Response AddDataDisk(string subscriptionId, string resourceGroupName, string labName, string name, DevTestLabDataDiskProperties dataDiskProperties, CancellationToken cancellationToken = default) - { - Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); - Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); - Argument.AssertNotNullOrEmpty(labName, nameof(labName)); - Argument.AssertNotNullOrEmpty(name, nameof(name)); - Argument.AssertNotNull(dataDiskProperties, nameof(dataDiskProperties)); - - using var message = CreateAddDataDiskRequest(subscriptionId, resourceGroupName, labName, name, dataDiskProperties); - _pipeline.Send(message, cancellationToken); - switch (message.Response.Status) - { - case 200: - case 202: - return message.Response; - default: - throw new RequestFailedException(message.Response); - } - } - - internal RequestUriBuilder CreateApplyArtifactsRequestUri(string subscriptionId, string resourceGroupName, string labName, string name, DevTestLabVmApplyArtifactsContent content) + internal HttpMessage CreateGetApplicableSchedulesRequest(string subscriptionId, string resourceGroupName, string labName, string name, RequestContext context) { - var uri = new RawRequestUriBuilder(); + RawRequestUriBuilder uri = new RawRequestUriBuilder(); uri.Reset(_endpoint); uri.AppendPath("/subscriptions/", false); uri.AppendPath(subscriptionId, true); @@ -700,17 +305,19 @@ internal RequestUriBuilder CreateApplyArtifactsRequestUri(string subscriptionId, uri.AppendPath(labName, true); uri.AppendPath("/virtualmachines/", false); uri.AppendPath(name, true); - uri.AppendPath("/applyArtifacts", false); + uri.AppendPath("/listApplicableSchedules", false); uri.AppendQuery("api-version", _apiVersion, true); - return uri; + HttpMessage message = Pipeline.CreateMessage(); + Request request = message.Request; + request.Uri = uri; + request.Method = RequestMethod.Post; + request.Headers.SetValue("Accept", "application/json"); + return message; } - internal HttpMessage CreateApplyArtifactsRequest(string subscriptionId, string resourceGroupName, string labName, string name, DevTestLabVmApplyArtifactsContent content) + internal HttpMessage CreateRedeployRequest(string subscriptionId, string resourceGroupName, string labName, string name, RequestContext context) { - var message = _pipeline.CreateMessage(); - var request = message.Request; - request.Method = RequestMethod.Post; - var uri = new RawRequestUriBuilder(); + RawRequestUriBuilder uri = new RawRequestUriBuilder(); uri.Reset(_endpoint); uri.AppendPath("/subscriptions/", false); uri.AppendPath(subscriptionId, true); @@ -720,79 +327,18 @@ internal HttpMessage CreateApplyArtifactsRequest(string subscriptionId, string r uri.AppendPath(labName, true); uri.AppendPath("/virtualmachines/", false); uri.AppendPath(name, true); - uri.AppendPath("/applyArtifacts", false); + uri.AppendPath("/redeploy", false); 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 content0 = new Utf8JsonRequestContent(); - content0.JsonWriter.WriteObjectValue(content, ModelSerializationExtensions.WireOptions); - request.Content = content0; - _userAgent.Apply(message); + request.Method = RequestMethod.Post; return message; } - /// Apply artifacts to virtual machine. This operation can take a while to complete. - /// The subscription ID. - /// The name of the resource group. - /// The name of the lab. - /// The name of the virtual machine. - /// Request body for applying artifacts to a 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 ApplyArtifactsAsync(string subscriptionId, string resourceGroupName, string labName, string name, DevTestLabVmApplyArtifactsContent content, CancellationToken cancellationToken = default) - { - Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); - Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); - Argument.AssertNotNullOrEmpty(labName, nameof(labName)); - Argument.AssertNotNullOrEmpty(name, nameof(name)); - Argument.AssertNotNull(content, nameof(content)); - - using var message = CreateApplyArtifactsRequest(subscriptionId, resourceGroupName, labName, name, content); - await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); - switch (message.Response.Status) - { - case 200: - case 202: - return message.Response; - default: - throw new RequestFailedException(message.Response); - } - } - - /// Apply artifacts to virtual machine. This operation can take a while to complete. - /// The subscription ID. - /// The name of the resource group. - /// The name of the lab. - /// The name of the virtual machine. - /// Request body for applying artifacts to a virtual machine. - /// The cancellation token to use. - /// , , , or is null. - /// , , or is an empty string, and was expected to be non-empty. - public Response ApplyArtifacts(string subscriptionId, string resourceGroupName, string labName, string name, DevTestLabVmApplyArtifactsContent content, CancellationToken cancellationToken = default) - { - Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); - Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); - Argument.AssertNotNullOrEmpty(labName, nameof(labName)); - Argument.AssertNotNullOrEmpty(name, nameof(name)); - Argument.AssertNotNull(content, nameof(content)); - - using var message = CreateApplyArtifactsRequest(subscriptionId, resourceGroupName, labName, name, content); - _pipeline.Send(message, cancellationToken); - switch (message.Response.Status) - { - case 200: - case 202: - return message.Response; - default: - throw new RequestFailedException(message.Response); - } - } - - internal RequestUriBuilder CreateClaimRequestUri(string subscriptionId, string resourceGroupName, string labName, string name) + internal HttpMessage CreateResizeRequest(string subscriptionId, string resourceGroupName, string labName, string name, RequestContent content, RequestContext context) { - var uri = new RawRequestUriBuilder(); + RawRequestUriBuilder uri = new RawRequestUriBuilder(); uri.Reset(_endpoint); uri.AppendPath("/subscriptions/", false); uri.AppendPath(subscriptionId, true); @@ -802,17 +348,20 @@ internal RequestUriBuilder CreateClaimRequestUri(string subscriptionId, string r uri.AppendPath(labName, true); uri.AppendPath("/virtualmachines/", false); uri.AppendPath(name, true); - uri.AppendPath("/claim", false); + uri.AppendPath("/resize", false); uri.AppendQuery("api-version", _apiVersion, true); - return uri; + HttpMessage message = Pipeline.CreateMessage(); + Request request = message.Request; + request.Uri = uri; + request.Method = RequestMethod.Post; + request.Headers.SetValue("Content-Type", "application/json"); + request.Content = content; + return message; } - internal HttpMessage CreateClaimRequest(string subscriptionId, string resourceGroupName, string labName, string name) + internal HttpMessage CreateRestartRequest(string subscriptionId, string resourceGroupName, string labName, string name, RequestContext context) { - var message = _pipeline.CreateMessage(); - var request = message.Request; - request.Method = RequestMethod.Post; - var uri = new RawRequestUriBuilder(); + RawRequestUriBuilder uri = new RawRequestUriBuilder(); uri.Reset(_endpoint); uri.AppendPath("/subscriptions/", false); uri.AppendPath(subscriptionId, true); @@ -822,71 +371,18 @@ internal HttpMessage CreateClaimRequest(string subscriptionId, string resourceGr uri.AppendPath(labName, true); uri.AppendPath("/virtualmachines/", false); uri.AppendPath(name, true); - uri.AppendPath("/claim", false); + uri.AppendPath("/restart", 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.Post; return message; } - /// Take ownership of an existing virtual machine This operation can take a while to complete. - /// The subscription ID. - /// The name of the resource group. - /// The name of the lab. - /// The name of the 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 ClaimAsync(string subscriptionId, string resourceGroupName, string labName, string name, CancellationToken cancellationToken = default) - { - Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); - Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); - Argument.AssertNotNullOrEmpty(labName, nameof(labName)); - Argument.AssertNotNullOrEmpty(name, nameof(name)); - - using var message = CreateClaimRequest(subscriptionId, resourceGroupName, labName, name); - await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); - switch (message.Response.Status) - { - case 200: - case 202: - return message.Response; - default: - throw new RequestFailedException(message.Response); - } - } - - /// Take ownership of an existing virtual machine This operation can take a while to complete. - /// The subscription ID. - /// The name of the resource group. - /// The name of the lab. - /// The name of the virtual machine. - /// The cancellation token to use. - /// , , or is null. - /// , , or is an empty string, and was expected to be non-empty. - public Response Claim(string subscriptionId, string resourceGroupName, string labName, string name, CancellationToken cancellationToken = default) - { - Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); - Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); - Argument.AssertNotNullOrEmpty(labName, nameof(labName)); - Argument.AssertNotNullOrEmpty(name, nameof(name)); - - using var message = CreateClaimRequest(subscriptionId, resourceGroupName, labName, name); - _pipeline.Send(message, cancellationToken); - switch (message.Response.Status) - { - case 200: - case 202: - return message.Response; - default: - throw new RequestFailedException(message.Response); - } - } - - internal RequestUriBuilder CreateDetachDataDiskRequestUri(string subscriptionId, string resourceGroupName, string labName, string name, DevTestLabVmDetachDataDiskContent content) + internal HttpMessage CreateStartRequest(string subscriptionId, string resourceGroupName, string labName, string name, RequestContext context) { - var uri = new RawRequestUriBuilder(); + RawRequestUriBuilder uri = new RawRequestUriBuilder(); uri.Reset(_endpoint); uri.AppendPath("/subscriptions/", false); uri.AppendPath(subscriptionId, true); @@ -896,17 +392,18 @@ internal RequestUriBuilder CreateDetachDataDiskRequestUri(string subscriptionId, uri.AppendPath(labName, true); uri.AppendPath("/virtualmachines/", false); uri.AppendPath(name, true); - uri.AppendPath("/detachDataDisk", false); + uri.AppendPath("/start", false); uri.AppendQuery("api-version", _apiVersion, true); - return uri; + HttpMessage message = Pipeline.CreateMessage(); + Request request = message.Request; + request.Uri = uri; + request.Method = RequestMethod.Post; + return message; } - internal HttpMessage CreateDetachDataDiskRequest(string subscriptionId, string resourceGroupName, string labName, string name, DevTestLabVmDetachDataDiskContent content) + internal HttpMessage CreateStopRequest(string subscriptionId, string resourceGroupName, string labName, string name, RequestContext context) { - var message = _pipeline.CreateMessage(); - var request = message.Request; - request.Method = RequestMethod.Post; - var uri = new RawRequestUriBuilder(); + RawRequestUriBuilder uri = new RawRequestUriBuilder(); uri.Reset(_endpoint); uri.AppendPath("/subscriptions/", false); uri.AppendPath(subscriptionId, true); @@ -916,79 +413,18 @@ internal HttpMessage CreateDetachDataDiskRequest(string subscriptionId, string r uri.AppendPath(labName, true); uri.AppendPath("/virtualmachines/", false); uri.AppendPath(name, true); - uri.AppendPath("/detachDataDisk", false); + uri.AppendPath("/stop", false); 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 content0 = new Utf8JsonRequestContent(); - content0.JsonWriter.WriteObjectValue(content, ModelSerializationExtensions.WireOptions); - request.Content = content0; - _userAgent.Apply(message); + request.Method = RequestMethod.Post; return message; } - /// Detach the specified disk from the virtual machine. This operation can take a while to complete. - /// The subscription ID. - /// The name of the resource group. - /// The name of the lab. - /// The name of the virtual machine. - /// Request body for detaching data disk from a 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 DetachDataDiskAsync(string subscriptionId, string resourceGroupName, string labName, string name, DevTestLabVmDetachDataDiskContent content, CancellationToken cancellationToken = default) - { - Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); - Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); - Argument.AssertNotNullOrEmpty(labName, nameof(labName)); - Argument.AssertNotNullOrEmpty(name, nameof(name)); - Argument.AssertNotNull(content, nameof(content)); - - using var message = CreateDetachDataDiskRequest(subscriptionId, resourceGroupName, labName, name, content); - await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); - switch (message.Response.Status) - { - case 200: - case 202: - return message.Response; - default: - throw new RequestFailedException(message.Response); - } - } - - /// Detach the specified disk from the virtual machine. This operation can take a while to complete. - /// The subscription ID. - /// The name of the resource group. - /// The name of the lab. - /// The name of the virtual machine. - /// Request body for detaching data disk from a virtual machine. - /// The cancellation token to use. - /// , , , or is null. - /// , , or is an empty string, and was expected to be non-empty. - public Response DetachDataDisk(string subscriptionId, string resourceGroupName, string labName, string name, DevTestLabVmDetachDataDiskContent content, CancellationToken cancellationToken = default) - { - Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); - Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); - Argument.AssertNotNullOrEmpty(labName, nameof(labName)); - Argument.AssertNotNullOrEmpty(name, nameof(name)); - Argument.AssertNotNull(content, nameof(content)); - - using var message = CreateDetachDataDiskRequest(subscriptionId, resourceGroupName, labName, name, content); - _pipeline.Send(message, cancellationToken); - switch (message.Response.Status) - { - case 200: - case 202: - return message.Response; - default: - throw new RequestFailedException(message.Response); - } - } - - internal RequestUriBuilder CreateGetRdpFileContentsRequestUri(string subscriptionId, string resourceGroupName, string labName, string name) + internal HttpMessage CreateTransferDisksRequest(string subscriptionId, string resourceGroupName, string labName, string name, RequestContext context) { - var uri = new RawRequestUriBuilder(); + RawRequestUriBuilder uri = new RawRequestUriBuilder(); uri.Reset(_endpoint); uri.AppendPath("/subscriptions/", false); uri.AppendPath(subscriptionId, true); @@ -998,17 +434,18 @@ internal RequestUriBuilder CreateGetRdpFileContentsRequestUri(string subscriptio uri.AppendPath(labName, true); uri.AppendPath("/virtualmachines/", false); uri.AppendPath(name, true); - uri.AppendPath("/getRdpFileContents", false); + uri.AppendPath("/transferDisks", false); uri.AppendQuery("api-version", _apiVersion, true); - return uri; + HttpMessage message = Pipeline.CreateMessage(); + Request request = message.Request; + request.Uri = uri; + request.Method = RequestMethod.Post; + return message; } - internal HttpMessage CreateGetRdpFileContentsRequest(string subscriptionId, string resourceGroupName, string labName, string name) + internal HttpMessage CreateUnClaimRequest(string subscriptionId, string resourceGroupName, string labName, string name, RequestContext context) { - var message = _pipeline.CreateMessage(); - var request = message.Request; - request.Method = RequestMethod.Post; - var uri = new RawRequestUriBuilder(); + RawRequestUriBuilder uri = new RawRequestUriBuilder(); uri.Reset(_endpoint); uri.AppendPath("/subscriptions/", false); uri.AppendPath(subscriptionId, true); @@ -1018,934 +455,13 @@ internal HttpMessage CreateGetRdpFileContentsRequest(string subscriptionId, stri uri.AppendPath(labName, true); uri.AppendPath("/virtualmachines/", false); uri.AppendPath(name, true); - uri.AppendPath("/getRdpFileContents", false); + uri.AppendPath("/unClaim", 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; - } - - /// Gets a string that represents the contents of the RDP file for the virtual machine. - /// The subscription ID. - /// The name of the resource group. - /// The name of the lab. - /// The name of the 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> GetRdpFileContentsAsync(string subscriptionId, string resourceGroupName, string labName, string name, CancellationToken cancellationToken = default) - { - Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); - Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); - Argument.AssertNotNullOrEmpty(labName, nameof(labName)); - Argument.AssertNotNullOrEmpty(name, nameof(name)); - - using var message = CreateGetRdpFileContentsRequest(subscriptionId, resourceGroupName, labName, name); - await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); - switch (message.Response.Status) - { - case 200: - { - DevTestLabRdpConnection value = default; - using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, ModelSerializationExtensions.JsonDocumentOptions, cancellationToken).ConfigureAwait(false); - value = DevTestLabRdpConnection.DeserializeDevTestLabRdpConnection(document.RootElement); - return Response.FromValue(value, message.Response); - } - default: - throw new RequestFailedException(message.Response); - } - } - - /// Gets a string that represents the contents of the RDP file for the virtual machine. - /// The subscription ID. - /// The name of the resource group. - /// The name of the lab. - /// The name of the virtual machine. - /// The cancellation token to use. - /// , , or is null. - /// , , or is an empty string, and was expected to be non-empty. - public Response GetRdpFileContents(string subscriptionId, string resourceGroupName, string labName, string name, CancellationToken cancellationToken = default) - { - Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); - Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); - Argument.AssertNotNullOrEmpty(labName, nameof(labName)); - Argument.AssertNotNullOrEmpty(name, nameof(name)); - - using var message = CreateGetRdpFileContentsRequest(subscriptionId, resourceGroupName, labName, name); - _pipeline.Send(message, cancellationToken); - switch (message.Response.Status) - { - case 200: - { - DevTestLabRdpConnection value = default; - using var document = JsonDocument.Parse(message.Response.ContentStream, ModelSerializationExtensions.JsonDocumentOptions); - value = DevTestLabRdpConnection.DeserializeDevTestLabRdpConnection(document.RootElement); - return Response.FromValue(value, message.Response); - } - default: - throw new RequestFailedException(message.Response); - } - } - - internal RequestUriBuilder CreateListApplicableSchedulesRequestUri(string subscriptionId, string resourceGroupName, string labName, string name) - { - 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.DevTestLab/labs/", false); - uri.AppendPath(labName, true); - uri.AppendPath("/virtualmachines/", false); - uri.AppendPath(name, true); - uri.AppendPath("/listApplicableSchedules", false); - uri.AppendQuery("api-version", _apiVersion, true); - return uri; - } - - internal HttpMessage CreateListApplicableSchedulesRequest(string subscriptionId, string resourceGroupName, string labName, string name) - { - var message = _pipeline.CreateMessage(); - var request = message.Request; - request.Method = RequestMethod.Post; - var uri = new RawRequestUriBuilder(); - uri.Reset(_endpoint); - uri.AppendPath("/subscriptions/", false); - uri.AppendPath(subscriptionId, true); - uri.AppendPath("/resourceGroups/", false); - uri.AppendPath(resourceGroupName, true); - uri.AppendPath("/providers/Microsoft.DevTestLab/labs/", false); - uri.AppendPath(labName, true); - uri.AppendPath("/virtualmachines/", false); - uri.AppendPath(name, true); - uri.AppendPath("/listApplicableSchedules", false); - uri.AppendQuery("api-version", _apiVersion, true); - request.Uri = uri; - request.Headers.Add("Accept", "application/json"); - _userAgent.Apply(message); - return message; - } - - /// Lists the applicable start/stop schedules, if any. - /// The subscription ID. - /// The name of the resource group. - /// The name of the lab. - /// The name of the 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> ListApplicableSchedulesAsync(string subscriptionId, string resourceGroupName, string labName, string name, CancellationToken cancellationToken = default) - { - Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); - Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); - Argument.AssertNotNullOrEmpty(labName, nameof(labName)); - Argument.AssertNotNullOrEmpty(name, nameof(name)); - - using var message = CreateListApplicableSchedulesRequest(subscriptionId, resourceGroupName, labName, name); - await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); - switch (message.Response.Status) - { - case 200: - { - DevTestLabApplicableSchedule value = default; - using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, ModelSerializationExtensions.JsonDocumentOptions, cancellationToken).ConfigureAwait(false); - value = DevTestLabApplicableSchedule.DeserializeDevTestLabApplicableSchedule(document.RootElement); - return Response.FromValue(value, message.Response); - } - default: - throw new RequestFailedException(message.Response); - } - } - - /// Lists the applicable start/stop schedules, if any. - /// The subscription ID. - /// The name of the resource group. - /// The name of the lab. - /// The name of the virtual machine. - /// The cancellation token to use. - /// , , or is null. - /// , , or is an empty string, and was expected to be non-empty. - public Response ListApplicableSchedules(string subscriptionId, string resourceGroupName, string labName, string name, CancellationToken cancellationToken = default) - { - Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); - Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); - Argument.AssertNotNullOrEmpty(labName, nameof(labName)); - Argument.AssertNotNullOrEmpty(name, nameof(name)); - - using var message = CreateListApplicableSchedulesRequest(subscriptionId, resourceGroupName, labName, name); - _pipeline.Send(message, cancellationToken); - switch (message.Response.Status) - { - case 200: - { - DevTestLabApplicableSchedule value = default; - using var document = JsonDocument.Parse(message.Response.ContentStream, ModelSerializationExtensions.JsonDocumentOptions); - value = DevTestLabApplicableSchedule.DeserializeDevTestLabApplicableSchedule(document.RootElement); - return Response.FromValue(value, message.Response); - } - default: - throw new RequestFailedException(message.Response); - } - } - - internal RequestUriBuilder CreateRedeployRequestUri(string subscriptionId, string resourceGroupName, string labName, string name) - { - 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.DevTestLab/labs/", false); - uri.AppendPath(labName, true); - uri.AppendPath("/virtualmachines/", false); - uri.AppendPath(name, true); - uri.AppendPath("/redeploy", false); - uri.AppendQuery("api-version", _apiVersion, true); - return uri; - } - - internal HttpMessage CreateRedeployRequest(string subscriptionId, string resourceGroupName, string labName, string name) - { - var message = _pipeline.CreateMessage(); - var request = message.Request; - request.Method = RequestMethod.Post; - var uri = new RawRequestUriBuilder(); - uri.Reset(_endpoint); - uri.AppendPath("/subscriptions/", false); - uri.AppendPath(subscriptionId, true); - uri.AppendPath("/resourceGroups/", false); - uri.AppendPath(resourceGroupName, true); - uri.AppendPath("/providers/Microsoft.DevTestLab/labs/", false); - uri.AppendPath(labName, true); - uri.AppendPath("/virtualmachines/", false); - uri.AppendPath(name, true); - uri.AppendPath("/redeploy", false); - uri.AppendQuery("api-version", _apiVersion, true); - request.Uri = uri; - request.Headers.Add("Accept", "application/json"); - _userAgent.Apply(message); - return message; - } - - /// Redeploy a virtual machine This operation can take a while to complete. - /// The subscription ID. - /// The name of the resource group. - /// The name of the lab. - /// The name of the 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 RedeployAsync(string subscriptionId, string resourceGroupName, string labName, string name, CancellationToken cancellationToken = default) - { - Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); - Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); - Argument.AssertNotNullOrEmpty(labName, nameof(labName)); - Argument.AssertNotNullOrEmpty(name, nameof(name)); - - using var message = CreateRedeployRequest(subscriptionId, resourceGroupName, labName, name); - await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); - switch (message.Response.Status) - { - case 200: - case 202: - return message.Response; - default: - throw new RequestFailedException(message.Response); - } - } - - /// Redeploy a virtual machine This operation can take a while to complete. - /// The subscription ID. - /// The name of the resource group. - /// The name of the lab. - /// The name of the virtual machine. - /// The cancellation token to use. - /// , , or is null. - /// , , or is an empty string, and was expected to be non-empty. - public Response Redeploy(string subscriptionId, string resourceGroupName, string labName, string name, CancellationToken cancellationToken = default) - { - Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); - Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); - Argument.AssertNotNullOrEmpty(labName, nameof(labName)); - Argument.AssertNotNullOrEmpty(name, nameof(name)); - - using var message = CreateRedeployRequest(subscriptionId, resourceGroupName, labName, name); - _pipeline.Send(message, cancellationToken); - switch (message.Response.Status) - { - case 200: - case 202: - return message.Response; - default: - throw new RequestFailedException(message.Response); - } - } - - internal RequestUriBuilder CreateResizeRequestUri(string subscriptionId, string resourceGroupName, string labName, string name, DevTestLabVmResizeContent content) - { - 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.DevTestLab/labs/", false); - uri.AppendPath(labName, true); - uri.AppendPath("/virtualmachines/", false); - uri.AppendPath(name, true); - uri.AppendPath("/resize", false); - uri.AppendQuery("api-version", _apiVersion, true); - return uri; - } - - internal HttpMessage CreateResizeRequest(string subscriptionId, string resourceGroupName, string labName, string name, DevTestLabVmResizeContent content) - { - var message = _pipeline.CreateMessage(); - var request = message.Request; - request.Method = RequestMethod.Post; - var uri = new RawRequestUriBuilder(); - uri.Reset(_endpoint); - uri.AppendPath("/subscriptions/", false); - uri.AppendPath(subscriptionId, true); - uri.AppendPath("/resourceGroups/", false); - uri.AppendPath(resourceGroupName, true); - uri.AppendPath("/providers/Microsoft.DevTestLab/labs/", false); - uri.AppendPath(labName, true); - uri.AppendPath("/virtualmachines/", false); - uri.AppendPath(name, true); - uri.AppendPath("/resize", false); - uri.AppendQuery("api-version", _apiVersion, true); - request.Uri = uri; - request.Headers.Add("Accept", "application/json"); - request.Headers.Add("Content-Type", "application/json"); - var content0 = new Utf8JsonRequestContent(); - content0.JsonWriter.WriteObjectValue(content, ModelSerializationExtensions.WireOptions); - request.Content = content0; - _userAgent.Apply(message); - return message; - } - - /// Resize Virtual Machine. This operation can take a while to complete. - /// The subscription ID. - /// The name of the resource group. - /// The name of the lab. - /// The name of the virtual machine. - /// Request body for resizing a 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 ResizeAsync(string subscriptionId, string resourceGroupName, string labName, string name, DevTestLabVmResizeContent content, CancellationToken cancellationToken = default) - { - Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); - Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); - Argument.AssertNotNullOrEmpty(labName, nameof(labName)); - Argument.AssertNotNullOrEmpty(name, nameof(name)); - Argument.AssertNotNull(content, nameof(content)); - - using var message = CreateResizeRequest(subscriptionId, resourceGroupName, labName, name, content); - await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); - switch (message.Response.Status) - { - case 200: - case 202: - return message.Response; - default: - throw new RequestFailedException(message.Response); - } - } - - /// Resize Virtual Machine. This operation can take a while to complete. - /// The subscription ID. - /// The name of the resource group. - /// The name of the lab. - /// The name of the virtual machine. - /// Request body for resizing a virtual machine. - /// The cancellation token to use. - /// , , , or is null. - /// , , or is an empty string, and was expected to be non-empty. - public Response Resize(string subscriptionId, string resourceGroupName, string labName, string name, DevTestLabVmResizeContent content, CancellationToken cancellationToken = default) - { - Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); - Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); - Argument.AssertNotNullOrEmpty(labName, nameof(labName)); - Argument.AssertNotNullOrEmpty(name, nameof(name)); - Argument.AssertNotNull(content, nameof(content)); - - using var message = CreateResizeRequest(subscriptionId, resourceGroupName, labName, name, content); - _pipeline.Send(message, cancellationToken); - switch (message.Response.Status) - { - case 200: - case 202: - return message.Response; - default: - throw new RequestFailedException(message.Response); - } - } - - internal RequestUriBuilder CreateRestartRequestUri(string subscriptionId, string resourceGroupName, string labName, string name) - { - 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.DevTestLab/labs/", false); - uri.AppendPath(labName, true); - uri.AppendPath("/virtualmachines/", false); - uri.AppendPath(name, true); - uri.AppendPath("/restart", false); - uri.AppendQuery("api-version", _apiVersion, true); - return uri; - } - - internal HttpMessage CreateRestartRequest(string subscriptionId, string resourceGroupName, string labName, string name) - { - var message = _pipeline.CreateMessage(); - var request = message.Request; - request.Method = RequestMethod.Post; - var uri = new RawRequestUriBuilder(); - uri.Reset(_endpoint); - uri.AppendPath("/subscriptions/", false); - uri.AppendPath(subscriptionId, true); - uri.AppendPath("/resourceGroups/", false); - uri.AppendPath(resourceGroupName, true); - uri.AppendPath("/providers/Microsoft.DevTestLab/labs/", false); - uri.AppendPath(labName, true); - uri.AppendPath("/virtualmachines/", false); - uri.AppendPath(name, true); - uri.AppendPath("/restart", false); - uri.AppendQuery("api-version", _apiVersion, true); - request.Uri = uri; - request.Headers.Add("Accept", "application/json"); - _userAgent.Apply(message); - return message; - } - - /// Restart a virtual machine. This operation can take a while to complete. - /// The subscription ID. - /// The name of the resource group. - /// The name of the lab. - /// The name of the 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 RestartAsync(string subscriptionId, string resourceGroupName, string labName, string name, CancellationToken cancellationToken = default) - { - Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); - Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); - Argument.AssertNotNullOrEmpty(labName, nameof(labName)); - Argument.AssertNotNullOrEmpty(name, nameof(name)); - - using var message = CreateRestartRequest(subscriptionId, resourceGroupName, labName, name); - await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); - switch (message.Response.Status) - { - case 200: - case 202: - return message.Response; - default: - throw new RequestFailedException(message.Response); - } - } - - /// Restart a virtual machine. This operation can take a while to complete. - /// The subscription ID. - /// The name of the resource group. - /// The name of the lab. - /// The name of the virtual machine. - /// The cancellation token to use. - /// , , or is null. - /// , , or is an empty string, and was expected to be non-empty. - public Response Restart(string subscriptionId, string resourceGroupName, string labName, string name, CancellationToken cancellationToken = default) - { - Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); - Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); - Argument.AssertNotNullOrEmpty(labName, nameof(labName)); - Argument.AssertNotNullOrEmpty(name, nameof(name)); - - using var message = CreateRestartRequest(subscriptionId, resourceGroupName, labName, name); - _pipeline.Send(message, cancellationToken); - switch (message.Response.Status) - { - case 200: - case 202: - return message.Response; - default: - throw new RequestFailedException(message.Response); - } - } - - internal RequestUriBuilder CreateStartRequestUri(string subscriptionId, string resourceGroupName, string labName, string name) - { - 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.DevTestLab/labs/", false); - uri.AppendPath(labName, true); - uri.AppendPath("/virtualmachines/", false); - uri.AppendPath(name, true); - uri.AppendPath("/start", false); - uri.AppendQuery("api-version", _apiVersion, true); - return uri; - } - - internal HttpMessage CreateStartRequest(string subscriptionId, string resourceGroupName, string labName, string name) - { - var message = _pipeline.CreateMessage(); - var request = message.Request; request.Method = RequestMethod.Post; - var uri = new RawRequestUriBuilder(); - uri.Reset(_endpoint); - uri.AppendPath("/subscriptions/", false); - uri.AppendPath(subscriptionId, true); - uri.AppendPath("/resourceGroups/", false); - uri.AppendPath(resourceGroupName, true); - uri.AppendPath("/providers/Microsoft.DevTestLab/labs/", false); - uri.AppendPath(labName, true); - uri.AppendPath("/virtualmachines/", false); - uri.AppendPath(name, true); - uri.AppendPath("/start", false); - uri.AppendQuery("api-version", _apiVersion, true); - request.Uri = uri; - request.Headers.Add("Accept", "application/json"); - _userAgent.Apply(message); return message; } - - /// Start a virtual machine. This operation can take a while to complete. - /// The subscription ID. - /// The name of the resource group. - /// The name of the lab. - /// The name of the 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 StartAsync(string subscriptionId, string resourceGroupName, string labName, string name, CancellationToken cancellationToken = default) - { - Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); - Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); - Argument.AssertNotNullOrEmpty(labName, nameof(labName)); - Argument.AssertNotNullOrEmpty(name, nameof(name)); - - using var message = CreateStartRequest(subscriptionId, resourceGroupName, labName, name); - await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); - switch (message.Response.Status) - { - case 200: - case 202: - return message.Response; - default: - throw new RequestFailedException(message.Response); - } - } - - /// Start a virtual machine. This operation can take a while to complete. - /// The subscription ID. - /// The name of the resource group. - /// The name of the lab. - /// The name of the virtual machine. - /// The cancellation token to use. - /// , , or is null. - /// , , or is an empty string, and was expected to be non-empty. - public Response Start(string subscriptionId, string resourceGroupName, string labName, string name, CancellationToken cancellationToken = default) - { - Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); - Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); - Argument.AssertNotNullOrEmpty(labName, nameof(labName)); - Argument.AssertNotNullOrEmpty(name, nameof(name)); - - using var message = CreateStartRequest(subscriptionId, resourceGroupName, labName, name); - _pipeline.Send(message, cancellationToken); - switch (message.Response.Status) - { - case 200: - case 202: - return message.Response; - default: - throw new RequestFailedException(message.Response); - } - } - - internal RequestUriBuilder CreateStopRequestUri(string subscriptionId, string resourceGroupName, string labName, string name) - { - 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.DevTestLab/labs/", false); - uri.AppendPath(labName, true); - uri.AppendPath("/virtualmachines/", false); - uri.AppendPath(name, true); - uri.AppendPath("/stop", false); - uri.AppendQuery("api-version", _apiVersion, true); - return uri; - } - - internal HttpMessage CreateStopRequest(string subscriptionId, string resourceGroupName, string labName, string name) - { - var message = _pipeline.CreateMessage(); - var request = message.Request; - request.Method = RequestMethod.Post; - var uri = new RawRequestUriBuilder(); - uri.Reset(_endpoint); - uri.AppendPath("/subscriptions/", false); - uri.AppendPath(subscriptionId, true); - uri.AppendPath("/resourceGroups/", false); - uri.AppendPath(resourceGroupName, true); - uri.AppendPath("/providers/Microsoft.DevTestLab/labs/", false); - uri.AppendPath(labName, true); - uri.AppendPath("/virtualmachines/", false); - uri.AppendPath(name, true); - uri.AppendPath("/stop", false); - uri.AppendQuery("api-version", _apiVersion, true); - request.Uri = uri; - request.Headers.Add("Accept", "application/json"); - _userAgent.Apply(message); - return message; - } - - /// Stop a virtual machine This operation can take a while to complete. - /// The subscription ID. - /// The name of the resource group. - /// The name of the lab. - /// The name of the 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 StopAsync(string subscriptionId, string resourceGroupName, string labName, string name, CancellationToken cancellationToken = default) - { - Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); - Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); - Argument.AssertNotNullOrEmpty(labName, nameof(labName)); - Argument.AssertNotNullOrEmpty(name, nameof(name)); - - using var message = CreateStopRequest(subscriptionId, resourceGroupName, labName, name); - await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); - switch (message.Response.Status) - { - case 200: - case 202: - return message.Response; - default: - throw new RequestFailedException(message.Response); - } - } - - /// Stop a virtual machine This operation can take a while to complete. - /// The subscription ID. - /// The name of the resource group. - /// The name of the lab. - /// The name of the virtual machine. - /// The cancellation token to use. - /// , , or is null. - /// , , or is an empty string, and was expected to be non-empty. - public Response Stop(string subscriptionId, string resourceGroupName, string labName, string name, CancellationToken cancellationToken = default) - { - Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); - Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); - Argument.AssertNotNullOrEmpty(labName, nameof(labName)); - Argument.AssertNotNullOrEmpty(name, nameof(name)); - - using var message = CreateStopRequest(subscriptionId, resourceGroupName, labName, name); - _pipeline.Send(message, cancellationToken); - switch (message.Response.Status) - { - case 200: - case 202: - return message.Response; - default: - throw new RequestFailedException(message.Response); - } - } - - internal RequestUriBuilder CreateTransferDisksRequestUri(string subscriptionId, string resourceGroupName, string labName, string name) - { - 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.DevTestLab/labs/", false); - uri.AppendPath(labName, true); - uri.AppendPath("/virtualmachines/", false); - uri.AppendPath(name, true); - uri.AppendPath("/transferDisks", false); - uri.AppendQuery("api-version", _apiVersion, true); - return uri; - } - - internal HttpMessage CreateTransferDisksRequest(string subscriptionId, string resourceGroupName, string labName, string name) - { - var message = _pipeline.CreateMessage(); - var request = message.Request; - request.Method = RequestMethod.Post; - var uri = new RawRequestUriBuilder(); - uri.Reset(_endpoint); - uri.AppendPath("/subscriptions/", false); - uri.AppendPath(subscriptionId, true); - uri.AppendPath("/resourceGroups/", false); - uri.AppendPath(resourceGroupName, true); - uri.AppendPath("/providers/Microsoft.DevTestLab/labs/", false); - uri.AppendPath(labName, true); - uri.AppendPath("/virtualmachines/", false); - uri.AppendPath(name, true); - uri.AppendPath("/transferDisks", false); - uri.AppendQuery("api-version", _apiVersion, true); - request.Uri = uri; - request.Headers.Add("Accept", "application/json"); - _userAgent.Apply(message); - return message; - } - - /// Transfers all data disks attached to the virtual machine to be owned by the current user. This operation can take a while to complete. - /// The subscription ID. - /// The name of the resource group. - /// The name of the lab. - /// The name of the 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 TransferDisksAsync(string subscriptionId, string resourceGroupName, string labName, string name, CancellationToken cancellationToken = default) - { - Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); - Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); - Argument.AssertNotNullOrEmpty(labName, nameof(labName)); - Argument.AssertNotNullOrEmpty(name, nameof(name)); - - using var message = CreateTransferDisksRequest(subscriptionId, resourceGroupName, labName, name); - await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); - switch (message.Response.Status) - { - case 200: - case 202: - return message.Response; - default: - throw new RequestFailedException(message.Response); - } - } - - /// Transfers all data disks attached to the virtual machine to be owned by the current user. This operation can take a while to complete. - /// The subscription ID. - /// The name of the resource group. - /// The name of the lab. - /// The name of the virtual machine. - /// The cancellation token to use. - /// , , or is null. - /// , , or is an empty string, and was expected to be non-empty. - public Response TransferDisks(string subscriptionId, string resourceGroupName, string labName, string name, CancellationToken cancellationToken = default) - { - Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); - Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); - Argument.AssertNotNullOrEmpty(labName, nameof(labName)); - Argument.AssertNotNullOrEmpty(name, nameof(name)); - - using var message = CreateTransferDisksRequest(subscriptionId, resourceGroupName, labName, name); - _pipeline.Send(message, cancellationToken); - switch (message.Response.Status) - { - case 200: - case 202: - return message.Response; - default: - throw new RequestFailedException(message.Response); - } - } - - internal RequestUriBuilder CreateUnClaimRequestUri(string subscriptionId, string resourceGroupName, string labName, string name) - { - 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.DevTestLab/labs/", false); - uri.AppendPath(labName, true); - uri.AppendPath("/virtualmachines/", false); - uri.AppendPath(name, true); - uri.AppendPath("/unClaim", false); - uri.AppendQuery("api-version", _apiVersion, true); - return uri; - } - - internal HttpMessage CreateUnClaimRequest(string subscriptionId, string resourceGroupName, string labName, string name) - { - var message = _pipeline.CreateMessage(); - var request = message.Request; - request.Method = RequestMethod.Post; - var uri = new RawRequestUriBuilder(); - uri.Reset(_endpoint); - uri.AppendPath("/subscriptions/", false); - uri.AppendPath(subscriptionId, true); - uri.AppendPath("/resourceGroups/", false); - uri.AppendPath(resourceGroupName, true); - uri.AppendPath("/providers/Microsoft.DevTestLab/labs/", false); - uri.AppendPath(labName, true); - uri.AppendPath("/virtualmachines/", false); - uri.AppendPath(name, true); - uri.AppendPath("/unClaim", false); - uri.AppendQuery("api-version", _apiVersion, true); - request.Uri = uri; - request.Headers.Add("Accept", "application/json"); - _userAgent.Apply(message); - return message; - } - - /// Release ownership of an existing virtual machine This operation can take a while to complete. - /// The subscription ID. - /// The name of the resource group. - /// The name of the lab. - /// The name of the 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 UnClaimAsync(string subscriptionId, string resourceGroupName, string labName, string name, CancellationToken cancellationToken = default) - { - Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); - Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); - Argument.AssertNotNullOrEmpty(labName, nameof(labName)); - Argument.AssertNotNullOrEmpty(name, nameof(name)); - - using var message = CreateUnClaimRequest(subscriptionId, resourceGroupName, labName, name); - await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); - switch (message.Response.Status) - { - case 200: - case 202: - return message.Response; - default: - throw new RequestFailedException(message.Response); - } - } - - /// Release ownership of an existing virtual machine This operation can take a while to complete. - /// The subscription ID. - /// The name of the resource group. - /// The name of the lab. - /// The name of the virtual machine. - /// The cancellation token to use. - /// , , or is null. - /// , , or is an empty string, and was expected to be non-empty. - public Response UnClaim(string subscriptionId, string resourceGroupName, string labName, string name, CancellationToken cancellationToken = default) - { - Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); - Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); - Argument.AssertNotNullOrEmpty(labName, nameof(labName)); - Argument.AssertNotNullOrEmpty(name, nameof(name)); - - using var message = CreateUnClaimRequest(subscriptionId, resourceGroupName, labName, name); - _pipeline.Send(message, cancellationToken); - switch (message.Response.Status) - { - case 200: - case 202: - return message.Response; - default: - throw new RequestFailedException(message.Response); - } - } - - internal RequestUriBuilder CreateListNextPageRequestUri(string nextLink, string subscriptionId, string resourceGroupName, string labName, string expand, string filter, int? top, string orderby) - { - var uri = new RawRequestUriBuilder(); - uri.Reset(_endpoint); - uri.AppendRawNextLink(nextLink, false); - return uri; - } - - internal HttpMessage CreateListNextPageRequest(string nextLink, string subscriptionId, string resourceGroupName, string labName, string expand, string filter, int? top, string orderby) - { - var message = _pipeline.CreateMessage(); - var request = message.Request; - request.Method = RequestMethod.Get; - var uri = new RawRequestUriBuilder(); - uri.Reset(_endpoint); - uri.AppendRawNextLink(nextLink, false); - request.Uri = uri; - request.Headers.Add("Accept", "application/json"); - _userAgent.Apply(message); - return message; - } - - /// List virtual machines in a given lab. - /// The URL to the next page of results. - /// The subscription ID. - /// The name of the resource group. - /// The name of the lab. - /// Specify the $expand query. Example: 'properties($expand=artifacts,computeVm,networkInterface,applicableSchedule)'. - /// The filter to apply to the operation. Example: '$filter=contains(name,'myName'). - /// The maximum number of resources to return from the operation. Example: '$top=10'. - /// The ordering expression for the results, using OData notation. Example: '$orderby=name desc'. - /// The cancellation token to use. - /// , , or is null. - /// , or is an empty string, and was expected to be non-empty. - public async Task> ListNextPageAsync(string nextLink, string subscriptionId, string resourceGroupName, string labName, string expand = null, string filter = null, int? top = null, string orderby = null, CancellationToken cancellationToken = default) - { - Argument.AssertNotNull(nextLink, nameof(nextLink)); - Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); - Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); - Argument.AssertNotNullOrEmpty(labName, nameof(labName)); - - using var message = CreateListNextPageRequest(nextLink, subscriptionId, resourceGroupName, labName, expand, filter, top, orderby); - await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); - switch (message.Response.Status) - { - case 200: - { - LabVmList value = default; - using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, ModelSerializationExtensions.JsonDocumentOptions, cancellationToken).ConfigureAwait(false); - value = LabVmList.DeserializeLabVmList(document.RootElement); - return Response.FromValue(value, message.Response); - } - default: - throw new RequestFailedException(message.Response); - } - } - - /// List virtual machines in a given lab. - /// The URL to the next page of results. - /// The subscription ID. - /// The name of the resource group. - /// The name of the lab. - /// Specify the $expand query. Example: 'properties($expand=artifacts,computeVm,networkInterface,applicableSchedule)'. - /// The filter to apply to the operation. Example: '$filter=contains(name,'myName'). - /// The maximum number of resources to return from the operation. Example: '$top=10'. - /// The ordering expression for the results, using OData notation. Example: '$orderby=name desc'. - /// The cancellation token to use. - /// , , or is null. - /// , or is an empty string, and was expected to be non-empty. - public Response ListNextPage(string nextLink, string subscriptionId, string resourceGroupName, string labName, string expand = null, string filter = null, int? top = null, string orderby = null, CancellationToken cancellationToken = default) - { - Argument.AssertNotNull(nextLink, nameof(nextLink)); - Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); - Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); - Argument.AssertNotNullOrEmpty(labName, nameof(labName)); - - using var message = CreateListNextPageRequest(nextLink, subscriptionId, resourceGroupName, labName, expand, filter, top, orderby); - _pipeline.Send(message, cancellationToken); - switch (message.Response.Status) - { - case 200: - { - LabVmList value = default; - using var document = JsonDocument.Parse(message.Response.ContentStream, ModelSerializationExtensions.JsonDocumentOptions); - value = LabVmList.DeserializeLabVmList(document.RootElement); - return Response.FromValue(value, message.Response); - } - default: - throw new RequestFailedException(message.Response); - } - } } } diff --git a/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/RestOperations/VirtualNetworksRestOperations.cs b/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/RestOperations/VirtualNetworksRestOperations.cs index d14b82cd6176..9d789d0a745f 100644 --- a/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/RestOperations/VirtualNetworksRestOperations.cs +++ b/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/RestOperations/VirtualNetworksRestOperations.cs @@ -6,173 +6,44 @@ #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.DevTestLabs.Models; namespace Azure.ResourceManager.DevTestLabs { - internal partial class VirtualNetworksRestOperations + internal partial class VirtualNetworks { - private readonly TelemetryDetails _userAgent; - private readonly HttpPipeline _pipeline; private readonly Uri _endpoint; private readonly string _apiVersion; - /// Initializes a new instance of VirtualNetworksRestOperations. - /// The HTTP pipeline for sending and receiving REST requests and responses. - /// The application id to use for user agent. - /// server parameter. - /// Api Version. - /// or is null. - public VirtualNetworksRestOperations(HttpPipeline pipeline, string applicationId, Uri endpoint = null, string apiVersion = default) + /// Initializes a new instance of VirtualNetworks for mocking. + protected VirtualNetworks() { - _pipeline = pipeline ?? throw new ArgumentNullException(nameof(pipeline)); - _endpoint = endpoint ?? new Uri("https://management.azure.com"); - _apiVersion = apiVersion ?? "2018-09-15"; - _userAgent = new TelemetryDetails(GetType().Assembly, applicationId); } - internal RequestUriBuilder CreateListRequestUri(string subscriptionId, string resourceGroupName, string labName, string expand, string filter, int? top, string orderby) - { - 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.DevTestLab/labs/", false); - uri.AppendPath(labName, true); - uri.AppendPath("/virtualnetworks", false); - if (expand != null) - { - uri.AppendQuery("$expand", expand, true); - } - if (filter != null) - { - uri.AppendQuery("$filter", filter, true); - } - if (top != null) - { - uri.AppendQuery("$top", top.Value, true); - } - if (orderby != null) - { - uri.AppendQuery("$orderby", orderby, true); - } - uri.AppendQuery("api-version", _apiVersion, true); - return uri; - } - - internal HttpMessage CreateListRequest(string subscriptionId, string resourceGroupName, string labName, string expand, string filter, int? top, string orderby) - { - 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.DevTestLab/labs/", false); - uri.AppendPath(labName, true); - uri.AppendPath("/virtualnetworks", false); - if (expand != null) - { - uri.AppendQuery("$expand", expand, true); - } - if (filter != null) - { - uri.AppendQuery("$filter", filter, true); - } - if (top != null) - { - uri.AppendQuery("$top", top.Value, true); - } - if (orderby != null) - { - uri.AppendQuery("$orderby", orderby, true); - } - uri.AppendQuery("api-version", _apiVersion, true); - request.Uri = uri; - request.Headers.Add("Accept", "application/json"); - _userAgent.Apply(message); - return message; - } - - /// List virtual networks in a given lab. - /// The subscription ID. - /// The name of the resource group. - /// The name of the lab. - /// Specify the $expand query. Example: 'properties($expand=externalSubnets)'. - /// The filter to apply to the operation. Example: '$filter=contains(name,'myName'). - /// The maximum number of resources to return from the operation. Example: '$top=10'. - /// The ordering expression for the results, using OData notation. Example: '$orderby=name desc'. - /// The cancellation token to use. - /// , or is null. - /// , or is an empty string, and was expected to be non-empty. - public async Task> ListAsync(string subscriptionId, string resourceGroupName, string labName, string expand = null, string filter = null, int? top = null, string orderby = null, CancellationToken cancellationToken = default) + /// Initializes a new instance of VirtualNetworks. + /// 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 VirtualNetworks(ClientDiagnostics clientDiagnostics, HttpPipeline pipeline, Uri endpoint, string apiVersion) { - Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); - Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); - Argument.AssertNotNullOrEmpty(labName, nameof(labName)); - - using var message = CreateListRequest(subscriptionId, resourceGroupName, labName, expand, filter, top, orderby); - await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); - switch (message.Response.Status) - { - case 200: - { - VirtualNetworkList value = default; - using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, ModelSerializationExtensions.JsonDocumentOptions, cancellationToken).ConfigureAwait(false); - value = VirtualNetworkList.DeserializeVirtualNetworkList(document.RootElement); - return Response.FromValue(value, message.Response); - } - default: - throw new RequestFailedException(message.Response); - } + ClientDiagnostics = clientDiagnostics; + _endpoint = endpoint; + Pipeline = pipeline; + _apiVersion = apiVersion; } - /// List virtual networks in a given lab. - /// The subscription ID. - /// The name of the resource group. - /// The name of the lab. - /// Specify the $expand query. Example: 'properties($expand=externalSubnets)'. - /// The filter to apply to the operation. Example: '$filter=contains(name,'myName'). - /// The maximum number of resources to return from the operation. Example: '$top=10'. - /// The ordering expression for the results, using OData notation. Example: '$orderby=name desc'. - /// The cancellation token to use. - /// , or is null. - /// , or is an empty string, and was expected to be non-empty. - public Response List(string subscriptionId, string resourceGroupName, string labName, string expand = null, string filter = null, int? top = null, string orderby = null, CancellationToken cancellationToken = default) - { - Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); - Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); - Argument.AssertNotNullOrEmpty(labName, nameof(labName)); + /// The HTTP pipeline for sending and receiving REST requests and responses. + public virtual HttpPipeline Pipeline { get; } - using var message = CreateListRequest(subscriptionId, resourceGroupName, labName, expand, filter, top, orderby); - _pipeline.Send(message, cancellationToken); - switch (message.Response.Status) - { - case 200: - { - VirtualNetworkList value = default; - using var document = JsonDocument.Parse(message.Response.ContentStream, ModelSerializationExtensions.JsonDocumentOptions); - value = VirtualNetworkList.DeserializeVirtualNetworkList(document.RootElement); - return Response.FromValue(value, 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 CreateGetRequestUri(string subscriptionId, string resourceGroupName, string labName, string name, string expand) + internal HttpMessage CreateGetRequest(string subscriptionId, string resourceGroupName, string labName, string name, string expand, RequestContext context) { - var uri = new RawRequestUriBuilder(); + RawRequestUriBuilder uri = new RawRequestUriBuilder(); uri.Reset(_endpoint); uri.AppendPath("/subscriptions/", false); uri.AppendPath(subscriptionId, true); @@ -182,111 +53,22 @@ internal RequestUriBuilder CreateGetRequestUri(string subscriptionId, string res uri.AppendPath(labName, true); uri.AppendPath("/virtualnetworks/", false); uri.AppendPath(name, true); - if (expand != null) - { - uri.AppendQuery("$expand", expand, true); - } uri.AppendQuery("api-version", _apiVersion, true); - return uri; - } - - internal HttpMessage CreateGetRequest(string subscriptionId, string resourceGroupName, string labName, string name, string expand) - { - 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.DevTestLab/labs/", false); - uri.AppendPath(labName, true); - uri.AppendPath("/virtualnetworks/", false); - uri.AppendPath(name, true); if (expand != null) { uri.AppendQuery("$expand", expand, 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 virtual network. - /// The subscription ID. - /// The name of the resource group. - /// The name of the lab. - /// The name of the virtual network. - /// Specify the $expand query. Example: 'properties($expand=externalSubnets)'. - /// 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 labName, string name, string expand = null, CancellationToken cancellationToken = default) - { - Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); - Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); - Argument.AssertNotNullOrEmpty(labName, nameof(labName)); - Argument.AssertNotNullOrEmpty(name, nameof(name)); - - using var message = CreateGetRequest(subscriptionId, resourceGroupName, labName, name, expand); - await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); - switch (message.Response.Status) - { - case 200: - { - DevTestLabVirtualNetworkData value = default; - using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, ModelSerializationExtensions.JsonDocumentOptions, cancellationToken).ConfigureAwait(false); - value = DevTestLabVirtualNetworkData.DeserializeDevTestLabVirtualNetworkData(document.RootElement); - return Response.FromValue(value, message.Response); - } - case 404: - return Response.FromValue((DevTestLabVirtualNetworkData)null, message.Response); - default: - throw new RequestFailedException(message.Response); - } - } - - /// Get virtual network. - /// The subscription ID. - /// The name of the resource group. - /// The name of the lab. - /// The name of the virtual network. - /// Specify the $expand query. Example: 'properties($expand=externalSubnets)'. - /// 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 labName, string name, string expand = null, CancellationToken cancellationToken = default) - { - Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); - Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); - Argument.AssertNotNullOrEmpty(labName, nameof(labName)); - Argument.AssertNotNullOrEmpty(name, nameof(name)); - - using var message = CreateGetRequest(subscriptionId, resourceGroupName, labName, name, expand); - _pipeline.Send(message, cancellationToken); - switch (message.Response.Status) - { - case 200: - { - DevTestLabVirtualNetworkData value = default; - using var document = JsonDocument.Parse(message.Response.ContentStream, ModelSerializationExtensions.JsonDocumentOptions); - value = DevTestLabVirtualNetworkData.DeserializeDevTestLabVirtualNetworkData(document.RootElement); - return Response.FromValue(value, message.Response); - } - case 404: - return Response.FromValue((DevTestLabVirtualNetworkData)null, message.Response); - default: - throw new RequestFailedException(message.Response); - } - } - - internal RequestUriBuilder CreateCreateOrUpdateRequestUri(string subscriptionId, string resourceGroupName, string labName, string name, DevTestLabVirtualNetworkData data) + internal HttpMessage CreateCreateOrUpdateRequest(string subscriptionId, string resourceGroupName, string labName, string name, RequestContent content, RequestContext context) { - var uri = new RawRequestUriBuilder(); + RawRequestUriBuilder uri = new RawRequestUriBuilder(); uri.Reset(_endpoint); uri.AppendPath("/subscriptions/", false); uri.AppendPath(subscriptionId, true); @@ -297,15 +79,19 @@ internal RequestUriBuilder CreateCreateOrUpdateRequestUri(string subscriptionId, uri.AppendPath("/virtualnetworks/", false); uri.AppendPath(name, true); uri.AppendQuery("api-version", _apiVersion, true); - return uri; + HttpMessage message = Pipeline.CreateMessage(); + Request request = message.Request; + request.Uri = uri; + request.Method = RequestMethod.Put; + request.Headers.SetValue("Content-Type", "application/json"); + request.Headers.SetValue("Accept", "application/json"); + request.Content = content; + return message; } - internal HttpMessage CreateCreateOrUpdateRequest(string subscriptionId, string resourceGroupName, string labName, string name, DevTestLabVirtualNetworkData data) + internal HttpMessage CreateUpdateRequest(string subscriptionId, string resourceGroupName, string labName, string name, 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); @@ -316,77 +102,19 @@ internal HttpMessage CreateCreateOrUpdateRequest(string subscriptionId, string r uri.AppendPath("/virtualnetworks/", false); uri.AppendPath(name, 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.Patch; + request.Headers.SetValue("Content-Type", "application/json"); + request.Headers.SetValue("Accept", "application/json"); request.Content = content; - _userAgent.Apply(message); return message; } - /// Create or replace an existing virtual network. This operation can take a while to complete. - /// The subscription ID. - /// The name of the resource group. - /// The name of the lab. - /// The name of the virtual network. - /// A virtual network. - /// 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 labName, string name, DevTestLabVirtualNetworkData data, CancellationToken cancellationToken = default) - { - Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); - Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); - Argument.AssertNotNullOrEmpty(labName, nameof(labName)); - Argument.AssertNotNullOrEmpty(name, nameof(name)); - Argument.AssertNotNull(data, nameof(data)); - - using var message = CreateCreateOrUpdateRequest(subscriptionId, resourceGroupName, labName, name, data); - await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); - switch (message.Response.Status) - { - case 200: - case 201: - return message.Response; - default: - throw new RequestFailedException(message.Response); - } - } - - /// Create or replace an existing virtual network. This operation can take a while to complete. - /// The subscription ID. - /// The name of the resource group. - /// The name of the lab. - /// The name of the virtual network. - /// A virtual network. - /// 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 labName, string name, DevTestLabVirtualNetworkData data, CancellationToken cancellationToken = default) - { - Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); - Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); - Argument.AssertNotNullOrEmpty(labName, nameof(labName)); - Argument.AssertNotNullOrEmpty(name, nameof(name)); - Argument.AssertNotNull(data, nameof(data)); - - using var message = CreateCreateOrUpdateRequest(subscriptionId, resourceGroupName, labName, name, 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 labName, string name) + internal HttpMessage CreateDeleteRequest(string subscriptionId, string resourceGroupName, string labName, string name, RequestContext context) { - var uri = new RawRequestUriBuilder(); + RawRequestUriBuilder uri = new RawRequestUriBuilder(); uri.Reset(_endpoint); uri.AppendPath("/subscriptions/", false); uri.AppendPath(subscriptionId, true); @@ -397,15 +125,16 @@ internal RequestUriBuilder CreateDeleteRequestUri(string subscriptionId, string uri.AppendPath("/virtualnetworks/", false); uri.AppendPath(name, true); uri.AppendQuery("api-version", _apiVersion, true); - return uri; + HttpMessage message = Pipeline.CreateMessage(); + Request request = message.Request; + request.Uri = uri; + request.Method = RequestMethod.Delete; + return message; } - internal HttpMessage CreateDeleteRequest(string subscriptionId, string resourceGroupName, string labName, string name) + internal HttpMessage CreateGetAllRequest(string subscriptionId, string resourceGroupName, string labName, string expand, string filter, int? top, string @orderby, RequestContext context) { - var message = _pipeline.CreateMessage(); - var request = message.Request; - request.Method = RequestMethod.Delete; - var uri = new RawRequestUriBuilder(); + RawRequestUriBuilder uri = new RawRequestUriBuilder(); uri.Reset(_endpoint); uri.AppendPath("/subscriptions/", false); uri.AppendPath(subscriptionId, true); @@ -413,269 +142,43 @@ internal HttpMessage CreateDeleteRequest(string subscriptionId, string resourceG uri.AppendPath(resourceGroupName, true); uri.AppendPath("/providers/Microsoft.DevTestLab/labs/", false); uri.AppendPath(labName, true); - uri.AppendPath("/virtualnetworks/", false); - uri.AppendPath(name, true); + uri.AppendPath("/virtualnetworks", false); uri.AppendQuery("api-version", _apiVersion, true); - request.Uri = uri; - request.Headers.Add("Accept", "application/json"); - _userAgent.Apply(message); - return message; - } - - /// Delete virtual network. This operation can take a while to complete. - /// The subscription ID. - /// The name of the resource group. - /// The name of the lab. - /// The name of the virtual network. - /// 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 labName, string name, CancellationToken cancellationToken = default) - { - Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); - Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); - Argument.AssertNotNullOrEmpty(labName, nameof(labName)); - Argument.AssertNotNullOrEmpty(name, nameof(name)); - - using var message = CreateDeleteRequest(subscriptionId, resourceGroupName, labName, name); - await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); - switch (message.Response.Status) + if (expand != null) { - case 200: - case 202: - case 204: - return message.Response; - default: - throw new RequestFailedException(message.Response); + uri.AppendQuery("$expand", expand, true); } - } - - /// Delete virtual network. This operation can take a while to complete. - /// The subscription ID. - /// The name of the resource group. - /// The name of the lab. - /// The name of the virtual network. - /// 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 labName, string name, CancellationToken cancellationToken = default) - { - Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); - Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); - Argument.AssertNotNullOrEmpty(labName, nameof(labName)); - Argument.AssertNotNullOrEmpty(name, nameof(name)); - - using var message = CreateDeleteRequest(subscriptionId, resourceGroupName, labName, name); - _pipeline.Send(message, cancellationToken); - switch (message.Response.Status) + if (filter != null) { - case 200: - case 202: - case 204: - return message.Response; - default: - throw new RequestFailedException(message.Response); + uri.AppendQuery("$filter", filter, true); } - } - - internal RequestUriBuilder CreateUpdateRequestUri(string subscriptionId, string resourceGroupName, string labName, string name, DevTestLabVirtualNetworkPatch 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.DevTestLab/labs/", false); - uri.AppendPath(labName, true); - uri.AppendPath("/virtualnetworks/", false); - uri.AppendPath(name, true); - uri.AppendQuery("api-version", _apiVersion, true); - return uri; - } - - internal HttpMessage CreateUpdateRequest(string subscriptionId, string resourceGroupName, string labName, string name, DevTestLabVirtualNetworkPatch patch) - { - var message = _pipeline.CreateMessage(); - var request = message.Request; - request.Method = RequestMethod.Patch; - var uri = new RawRequestUriBuilder(); - uri.Reset(_endpoint); - uri.AppendPath("/subscriptions/", false); - uri.AppendPath(subscriptionId, true); - uri.AppendPath("/resourceGroups/", false); - uri.AppendPath(resourceGroupName, true); - uri.AppendPath("/providers/Microsoft.DevTestLab/labs/", false); - uri.AppendPath(labName, true); - uri.AppendPath("/virtualnetworks/", false); - uri.AppendPath(name, true); - uri.AppendQuery("api-version", _apiVersion, true); - request.Uri = uri; - request.Headers.Add("Accept", "application/json"); - request.Headers.Add("Content-Type", "application/json"); - var content = new Utf8JsonRequestContent(); - content.JsonWriter.WriteObjectValue(patch, ModelSerializationExtensions.WireOptions); - request.Content = content; - _userAgent.Apply(message); - return message; - } - - /// Allows modifying tags of virtual networks. All other properties will be ignored. - /// The subscription ID. - /// The name of the resource group. - /// The name of the lab. - /// The name of the virtual network. - /// A virtual network. - /// 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 labName, string name, DevTestLabVirtualNetworkPatch patch, CancellationToken cancellationToken = default) - { - Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); - Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); - Argument.AssertNotNullOrEmpty(labName, nameof(labName)); - Argument.AssertNotNullOrEmpty(name, nameof(name)); - Argument.AssertNotNull(patch, nameof(patch)); - - using var message = CreateUpdateRequest(subscriptionId, resourceGroupName, labName, name, patch); - await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); - switch (message.Response.Status) + if (top != null) { - case 200: - { - DevTestLabVirtualNetworkData value = default; - using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, ModelSerializationExtensions.JsonDocumentOptions, cancellationToken).ConfigureAwait(false); - value = DevTestLabVirtualNetworkData.DeserializeDevTestLabVirtualNetworkData(document.RootElement); - return Response.FromValue(value, message.Response); - } - default: - throw new RequestFailedException(message.Response); + uri.AppendQuery("$top", TypeFormatters.ConvertToString(top), true); } - } - - /// Allows modifying tags of virtual networks. All other properties will be ignored. - /// The subscription ID. - /// The name of the resource group. - /// The name of the lab. - /// The name of the virtual network. - /// A virtual network. - /// 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 labName, string name, DevTestLabVirtualNetworkPatch patch, CancellationToken cancellationToken = default) - { - Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); - Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); - Argument.AssertNotNullOrEmpty(labName, nameof(labName)); - Argument.AssertNotNullOrEmpty(name, nameof(name)); - Argument.AssertNotNull(patch, nameof(patch)); - - using var message = CreateUpdateRequest(subscriptionId, resourceGroupName, labName, name, patch); - _pipeline.Send(message, cancellationToken); - switch (message.Response.Status) + if (@orderby != null) { - case 200: - { - DevTestLabVirtualNetworkData value = default; - using var document = JsonDocument.Parse(message.Response.ContentStream, ModelSerializationExtensions.JsonDocumentOptions); - value = DevTestLabVirtualNetworkData.DeserializeDevTestLabVirtualNetworkData(document.RootElement); - return Response.FromValue(value, message.Response); - } - default: - throw new RequestFailedException(message.Response); + uri.AppendQuery("$orderby", @orderby, true); } - } - - internal RequestUriBuilder CreateListNextPageRequestUri(string nextLink, string subscriptionId, string resourceGroupName, string labName, string expand, string filter, int? top, string orderby) - { - var uri = new RawRequestUriBuilder(); - uri.Reset(_endpoint); - uri.AppendRawNextLink(nextLink, false); - return uri; - } - - internal HttpMessage CreateListNextPageRequest(string nextLink, string subscriptionId, string resourceGroupName, string labName, string expand, string filter, int? top, string orderby) - { - var message = _pipeline.CreateMessage(); - var request = message.Request; - request.Method = RequestMethod.Get; - var uri = new RawRequestUriBuilder(); - uri.Reset(_endpoint); - uri.AppendRawNextLink(nextLink, false); + 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 virtual networks in a given lab. - /// The URL to the next page of results. - /// The subscription ID. - /// The name of the resource group. - /// The name of the lab. - /// Specify the $expand query. Example: 'properties($expand=externalSubnets)'. - /// The filter to apply to the operation. Example: '$filter=contains(name,'myName'). - /// The maximum number of resources to return from the operation. Example: '$top=10'. - /// The ordering expression for the results, using OData notation. Example: '$orderby=name desc'. - /// The cancellation token to use. - /// , , or is null. - /// , or is an empty string, and was expected to be non-empty. - public async Task> ListNextPageAsync(string nextLink, string subscriptionId, string resourceGroupName, string labName, string expand = null, string filter = null, int? top = null, string orderby = null, CancellationToken cancellationToken = default) + internal HttpMessage CreateNextGetAllRequest(Uri nextPage, string subscriptionId, string resourceGroupName, string labName, string expand, string filter, int? top, string @orderby, RequestContext context) { - Argument.AssertNotNull(nextLink, nameof(nextLink)); - Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); - Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); - Argument.AssertNotNullOrEmpty(labName, nameof(labName)); - - using var message = CreateListNextPageRequest(nextLink, subscriptionId, resourceGroupName, labName, expand, filter, top, orderby); - await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); - switch (message.Response.Status) - { - case 200: - { - VirtualNetworkList value = default; - using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, ModelSerializationExtensions.JsonDocumentOptions, cancellationToken).ConfigureAwait(false); - value = VirtualNetworkList.DeserializeVirtualNetworkList(document.RootElement); - return Response.FromValue(value, message.Response); - } - default: - throw new RequestFailedException(message.Response); - } - } - - /// List virtual networks in a given lab. - /// The URL to the next page of results. - /// The subscription ID. - /// The name of the resource group. - /// The name of the lab. - /// Specify the $expand query. Example: 'properties($expand=externalSubnets)'. - /// The filter to apply to the operation. Example: '$filter=contains(name,'myName'). - /// The maximum number of resources to return from the operation. Example: '$top=10'. - /// The ordering expression for the results, using OData notation. Example: '$orderby=name desc'. - /// The cancellation token to use. - /// , , or is null. - /// , or is an empty string, and was expected to be non-empty. - public Response ListNextPage(string nextLink, string subscriptionId, string resourceGroupName, string labName, string expand = null, string filter = null, int? top = null, string orderby = null, CancellationToken cancellationToken = default) - { - Argument.AssertNotNull(nextLink, nameof(nextLink)); - Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); - Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); - Argument.AssertNotNullOrEmpty(labName, nameof(labName)); - - using var message = CreateListNextPageRequest(nextLink, subscriptionId, resourceGroupName, labName, expand, filter, top, orderby); - _pipeline.Send(message, cancellationToken); - switch (message.Response.Status) - { - case 200: - { - VirtualNetworkList value = default; - using var document = JsonDocument.Parse(message.Response.ContentStream, ModelSerializationExtensions.JsonDocumentOptions); - value = VirtualNetworkList.DeserializeVirtualNetworkList(document.RootElement); - return Response.FromValue(value, message.Response); - } - default: - throw new RequestFailedException(message.Response); - } + RawRequestUriBuilder uri = new RawRequestUriBuilder(); + uri.Reset(nextPage); + uri.UpdateQuery("api-version", _apiVersion); + HttpMessage message = Pipeline.CreateMessage(); + Request request = message.Request; + request.Uri = uri; + request.Method = RequestMethod.Get; + request.Headers.SetValue("Accept", "application/json"); + return message; } } } diff --git a/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/autorest.md b/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/autorest.md deleted file mode 100644 index a9cb2e4d94fb..000000000000 --- a/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/autorest.md +++ /dev/null @@ -1,199 +0,0 @@ -# Generated code configuration - -Run `dotnet build /t:GenerateCode` to generate code. - -``` yaml - -azure-arm: true -csharp: true -library-name: DevTestLabs -namespace: Azure.ResourceManager.DevTestLabs -require: https://github.com/Azure/azure-rest-api-specs/blob/6b08774c89877269e73e11ac3ecbd1bd4e14f5a0/specification/devtestlabs/resource-manager/readme.md -#tag: package-2018-09 -output-folder: $(this-folder)/Generated -clear-output-folder: true -sample-gen: - output-folder: $(this-folder)/../tests/Generated - clear-output-folder: true -skip-csproj: true -modelerfour: - flatten-payloads: false -use-model-reader-writer: true - -list-exception: - - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/costs/{name} - - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/servicerunners/{name} - -format-by-name-rules: - 'tenantId': 'uuid' - 'ETag': 'etag' - 'location': 'azure-location' - '*Uri': 'Uri' - '*Uris': 'Uri' - 'UniqueIdentifier': 'uuid' - -acronym-mapping: - CPU: Cpu - CPUs: Cpus - Os: OS - Ip: IP - Ips: IPs|ips - ID: Id - IDs: Ids - VM: Vm - VMs: Vms - Vmos: VmOS - VMScaleSet: VmScaleSet - DNS: Dns - VPN: Vpn - NAT: Nat - WAN: Wan - Ipv4: IPv4|ipv4 - Ipv6: IPv6|ipv6 - Ipsec: IPsec|ipsec - SSO: Sso - URI: Uri - Etag: ETag|etag - VirtualMachine: Vm - SSD: Ssd - -request-path-to-resource-name: - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/schedules/{name}: DevTestLabSchedule - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/schedules/{name}: DevTestLabGlobalSchedule - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/users/{userName}/servicefabrics/{serviceFabricName}/schedules/{name}: DevTestLabServiceFabricSchedule - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/virtualmachines/{virtualMachineName}/schedules/{name}: DevTestLabVmSchedule - -override-operation-name: - PolicySets_EvaluatePolicies: EvaluatePolicies - -rename-mapping: - ArmTemplate: DevTestLabArmTemplate - Artifact: DevTestLabArtifact - ArtifactSource: DevTestLabArtifactSource - CustomImage: DevTestLabCustomImage - Disk: DevTestLabDisk - DtlEnvironment: DevTestLabEnvironment - Formula: DevTestLabFormula - Lab: DevTestLab - LabCost: DevTestLabCost - Schedule: DevTestLabSchedule - LabVirtualMachine: DevTestLabVm - LabVirtualMachine.properties.computeId: -|arm-id - LabVirtualMachine.properties.labVirtualNetworkId: -|arm-id - LabVirtualMachine.properties.environmentId: -|arm-id - NotificationChannel: DevTestLabNotificationChannel - Policy: DevTestLabPolicy - Secret: DevTestLabSecret - ServiceFabric: DevTestLabServiceFabric - ServiceRunner: DevTestLabServiceRunner - User: DevTestLabUser - VirtualNetwork: DevTestLabVirtualNetwork - ApplicableSchedule: DevTestLabApplicableSchedule - ApplyArtifactsRequest: DevTestLabVmApplyArtifactsContent - ArmTemplateInfo: DevTestLabArmTemplateInfo - ArmTemplateParameterProperties: DevTestLabArmTemplateParameter - ArtifactDeploymentStatusProperties: DevTestLabArtifactDeploymentStatus - ArtifactInstallProperties: DevTestLabArtifactInstallInfo - ArtifactParameterProperties: DevTestLabArtifactParameter - AttachDiskProperties: DevTestLabDiskAttachContent - AttachDiskProperties.leasedByLabVmId: -|arm-id - AttachNewDataDiskOptions: AttachNewDataDiskDetails - TargetCostProperties: DevTestLabTargetCost - CostThresholdProperties: DevTestLabCostThreshold - CostThresholdStatus: DevTestLabCostThresholdStatus - CostType: DevTestLabCostType - LabCostDetailsProperties: DevTestLabCostDetails - CustomImageOsType: DevTestLabCustomImageOsType - CustomImagePropertiesCustom: DevTestLabCustomImageVhd - CustomImagePropertiesFromVm: DevTestLabCustomImageVm - CustomImagePropertiesFromPlan: DevTestLabCustomImagePlan - DataDiskStorageTypeInfo: DevTestLabDataDiskStorageTypeInfo - StorageType: DevTestLabStorageType - DataDiskProperties: DevTestLabDataDiskProperties - DataDiskProperties.existingLabDiskId: -|arm-id - DetachDataDiskProperties: DevTestLabVmDetachDataDiskContent - DetachDiskProperties: DevTestLabDiskDetachContent - DetachDiskProperties.leasedByLabVmId: -|arm-id - UpdateResource: DevTestLabResourcePatch - EnableStatus: DevTestLabEnableStatus - EnvironmentDeploymentProperties: DevTestLabEnvironmentDeployment - EnvironmentDeploymentProperties.armTemplateId: -|arm-id - EnvironmentPermission: DevTestLabEnvironmentPermission - EvaluatePoliciesRequest: DevTestLabEvaluatePoliciesContent - EvaluatePoliciesProperties: DevTestLabEvaluatePolicy - EvaluatePoliciesResponse: DevTestLabEvaluatePoliciesResult - PolicySetResult: DevTestLabPolicySetResult - Event: DevTestLabNotificationChannelEvent - NotificationChannelEventType: DevTestLabNotificationChannelEventType - ExportResourceUsageParameters: DevTestLabExportResourceUsageContent - ExternalSubnet: DevTestLabExternalSubnet - ExternalSubnet.id: -|arm-id - SubnetOverride: DevTestLabSubnetOverride - SubnetOverride.resourceId: -|arm-id - FileUploadOptions: DevTestLabFileUploadOption - GalleryImage: DevTestLabGalleryImage - GalleryImage.properties.enabled: IsEnabled - GalleryImageReference: DevTestLabGalleryImageReference - GenerateArmTemplateRequest: DevTestLabArtifactGenerateArmTemplateContent - ParameterInfo: DevTestLabParameter - GenerateUploadUriParameter: DevTestLabGenerateUploadUriContent - GenerateUploadUriResponse: DevTestLabGenerateUploadUriResult - HostCachingOptions: DevTestLabHostCachingOption - IdentityProperties: DevTestLabManagedIdentity - IdentityProperties.principalId: -|uuid - ImportLabVirtualMachineRequest: DevTestLabImportVmContent - ImportLabVirtualMachineRequest.sourceVirtualMachineResourceId: -|arm-id - InboundNatRule: DevTestLabInboundNatRule - LabAnnouncementProperties: DevTestLabAnnouncement - LabResourceCostProperties: DevTestLabResourceCost - LabResourceCostProperties.resourcename: ResourceName - LabResourceCostProperties.resourceUId: ResourceUniqueId - LabSupportProperties: DevTestLabSupport - LabVirtualMachineCreationParameter: DevTestLabVmCreationContent - LinuxOsState: DevTestLabLinuxOsState - NetworkInterfaceProperties: DevTestLabNetworkInterface - NetworkInterfaceProperties.virtualNetworkId: -|arm-id - NetworkInterfaceProperties.subnetId: -|arm-id - NetworkInterfaceProperties.publicIpAddressId: -|arm-id - NotificationSettings: DevTestLabNotificationSettings - NotifyParameters: DevTestLabNotificationChannelNotifyContent - ParametersValueFileInfo: DevTestLabParametersValueFileInfo - PolicyEvaluatorType: DevTestLabPolicyEvaluatorType - PolicyFactName: DevTestLabPolicyFactName - PolicyStatus: DevTestLabPolicyStatus - PolicyViolation: DevTestLabPolicyViolation - Port: DevTestLabPort - TransportProtocol: DevTestLabTransportProtocol - PremiumDataDisk: DevTestLabPremiumDataDisk - RdpConnection: DevTestLabRdpConnection - ReportingCycleType: DevTestLabReportingCycleType - ResizeLabVirtualMachineProperties: DevTestLabVmResizeContent - RetargetScheduleProperties: DevTestLabGlobalScheduleRetargetContent - RetargetScheduleProperties.currentResourceId: -|arm-id - RetargetScheduleProperties.targetResourceId: -|arm-id - ScheduleCreationParameter: DevTestLabScheduleCreationParameter - ScheduleCreationParameter.properties.targetResourceId: -|arm-id - ScheduleFragment: DevTestLabSchedulePatch - SourceControlType: DevTestLabSourceControlType - Subnet: DevTestLabSubnet - Subnet.resourceId: -|arm-id - TargetCostStatus: DevTestLabTargetCostStatus - UsagePermissionType: DevTestLabUsagePermissionType - UserIdentity: DevTestLabUserIdentity - UserSecretStore: DevTestLabUserSecretStore - UserSecretStore.keyVaultId: -|arm-id - VirtualMachineCreationSource: DevTestLabVmCreationSource - WeekDetails: DevTestLabWeekDetails - WindowsOSState: DevTestLabWindowsOSState - ArmTemplate.properties.enabled: IsEnabled - LabAnnouncementProperties.expired: IsExpired - CustomImagePropertiesCustom.sysPrep: IsSysPrepEnabled - Disk.properties.managedDiskId: -|arm-id - Disk.properties.leasedByLabVmId: -|arm-id - LabVirtualMachineCreationParameter.properties.labVirtualNetworkId: -|arm-id - DetachDataDiskProperties.existingLabDiskId: -|arm-id - -directive: - - remove-operation: ProviderOperations_List - -``` diff --git a/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/tests/Generated/Samples/Sample_DevTestLabArmTemplateCollection.cs b/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/tests/Samples/Sample_DevTestLabArmTemplateCollection.cs similarity index 93% rename from sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/tests/Generated/Samples/Sample_DevTestLabArmTemplateCollection.cs rename to sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/tests/Samples/Sample_DevTestLabArmTemplateCollection.cs index b7422574dbcf..71ff35fdec37 100644 --- a/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/tests/Generated/Samples/Sample_DevTestLabArmTemplateCollection.cs +++ b/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/tests/Samples/Sample_DevTestLabArmTemplateCollection.cs @@ -1,8 +1,6 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. -// - #nullable disable using System; @@ -19,7 +17,7 @@ public partial class Sample_DevTestLabArmTemplateCollection [Ignore("Only validating compilation of examples")] public async Task Get_ArmTemplatesGet() { - // Generated from example definition: specification/devtestlabs/resource-manager/Microsoft.DevTestLab/stable/2018-09-15/examples/ArmTemplates_Get.json + // Generated from example definition: 2018-09-15/ArmTemplates_Get.json // this example is just showing the usage of "ArmTemplates_Get" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line @@ -54,7 +52,7 @@ public async Task Get_ArmTemplatesGet() [Ignore("Only validating compilation of examples")] public async Task GetAll_ArmTemplatesList() { - // Generated from example definition: specification/devtestlabs/resource-manager/Microsoft.DevTestLab/stable/2018-09-15/examples/ArmTemplates_List.json + // Generated from example definition: 2018-09-15/ArmTemplates_List.json // this example is just showing the usage of "ArmTemplates_List" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line @@ -91,7 +89,7 @@ public async Task GetAll_ArmTemplatesList() [Ignore("Only validating compilation of examples")] public async Task Exists_ArmTemplatesGet() { - // Generated from example definition: specification/devtestlabs/resource-manager/Microsoft.DevTestLab/stable/2018-09-15/examples/ArmTemplates_Get.json + // Generated from example definition: 2018-09-15/ArmTemplates_Get.json // this example is just showing the usage of "ArmTemplates_Get" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line @@ -122,7 +120,7 @@ public async Task Exists_ArmTemplatesGet() [Ignore("Only validating compilation of examples")] public async Task GetIfExists_ArmTemplatesGet() { - // Generated from example definition: specification/devtestlabs/resource-manager/Microsoft.DevTestLab/stable/2018-09-15/examples/ArmTemplates_Get.json + // Generated from example definition: 2018-09-15/ArmTemplates_Get.json // this example is just showing the usage of "ArmTemplates_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/devtestlabs/Azure.ResourceManager.DevTestLabs/tests/Generated/Samples/Sample_DevTestLabArmTemplateResource.cs b/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/tests/Samples/Sample_DevTestLabArmTemplateResource.cs similarity index 92% rename from sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/tests/Generated/Samples/Sample_DevTestLabArmTemplateResource.cs rename to sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/tests/Samples/Sample_DevTestLabArmTemplateResource.cs index 5d9639178ac0..9ce6278caf8d 100644 --- a/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/tests/Generated/Samples/Sample_DevTestLabArmTemplateResource.cs +++ b/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/tests/Samples/Sample_DevTestLabArmTemplateResource.cs @@ -1,8 +1,6 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. -// - #nullable disable using System; @@ -19,7 +17,7 @@ public partial class Sample_DevTestLabArmTemplateResource [Ignore("Only validating compilation of examples")] public async Task Get_ArmTemplatesGet() { - // Generated from example definition: specification/devtestlabs/resource-manager/Microsoft.DevTestLab/stable/2018-09-15/examples/ArmTemplates_Get.json + // Generated from example definition: 2018-09-15/ArmTemplates_Get.json // this example is just showing the usage of "ArmTemplates_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/devtestlabs/Azure.ResourceManager.DevTestLabs/tests/Generated/Samples/Sample_DevTestLabArtifactCollection.cs b/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/tests/Samples/Sample_DevTestLabArtifactCollection.cs similarity index 93% rename from sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/tests/Generated/Samples/Sample_DevTestLabArtifactCollection.cs rename to sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/tests/Samples/Sample_DevTestLabArtifactCollection.cs index bf7acbf564b3..8a098d7995b4 100644 --- a/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/tests/Generated/Samples/Sample_DevTestLabArtifactCollection.cs +++ b/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/tests/Samples/Sample_DevTestLabArtifactCollection.cs @@ -1,8 +1,6 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. -// - #nullable disable using System; @@ -19,7 +17,7 @@ public partial class Sample_DevTestLabArtifactCollection [Ignore("Only validating compilation of examples")] public async Task Get_ArtifactsGet() { - // Generated from example definition: specification/devtestlabs/resource-manager/Microsoft.DevTestLab/stable/2018-09-15/examples/Artifacts_Get.json + // Generated from example definition: 2018-09-15/Artifacts_Get.json // this example is just showing the usage of "Artifacts_Get" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line @@ -54,7 +52,7 @@ public async Task Get_ArtifactsGet() [Ignore("Only validating compilation of examples")] public async Task GetAll_ArtifactsList() { - // Generated from example definition: specification/devtestlabs/resource-manager/Microsoft.DevTestLab/stable/2018-09-15/examples/Artifacts_List.json + // Generated from example definition: 2018-09-15/Artifacts_List.json // this example is just showing the usage of "Artifacts_List" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line @@ -91,7 +89,7 @@ public async Task GetAll_ArtifactsList() [Ignore("Only validating compilation of examples")] public async Task Exists_ArtifactsGet() { - // Generated from example definition: specification/devtestlabs/resource-manager/Microsoft.DevTestLab/stable/2018-09-15/examples/Artifacts_Get.json + // Generated from example definition: 2018-09-15/Artifacts_Get.json // this example is just showing the usage of "Artifacts_Get" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line @@ -122,7 +120,7 @@ public async Task Exists_ArtifactsGet() [Ignore("Only validating compilation of examples")] public async Task GetIfExists_ArtifactsGet() { - // Generated from example definition: specification/devtestlabs/resource-manager/Microsoft.DevTestLab/stable/2018-09-15/examples/Artifacts_Get.json + // Generated from example definition: 2018-09-15/Artifacts_Get.json // this example is just showing the usage of "Artifacts_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/devtestlabs/Azure.ResourceManager.DevTestLabs/tests/Generated/Samples/Sample_DevTestLabArtifactResource.cs b/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/tests/Samples/Sample_DevTestLabArtifactResource.cs similarity index 91% rename from sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/tests/Generated/Samples/Sample_DevTestLabArtifactResource.cs rename to sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/tests/Samples/Sample_DevTestLabArtifactResource.cs index 4ebdeae344f3..8cbc456d51a4 100644 --- a/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/tests/Generated/Samples/Sample_DevTestLabArtifactResource.cs +++ b/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/tests/Samples/Sample_DevTestLabArtifactResource.cs @@ -1,8 +1,6 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. -// - #nullable disable using System; @@ -20,7 +18,7 @@ public partial class Sample_DevTestLabArtifactResource [Ignore("Only validating compilation of examples")] public async Task Get_ArtifactsGet() { - // Generated from example definition: specification/devtestlabs/resource-manager/Microsoft.DevTestLab/stable/2018-09-15/examples/Artifacts_Get.json + // Generated from example definition: 2018-09-15/Artifacts_Get.json // this example is just showing the usage of "Artifacts_Get" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line @@ -52,7 +50,7 @@ public async Task Get_ArtifactsGet() [Ignore("Only validating compilation of examples")] public async Task GenerateArmTemplate_ArtifactsGenerateArmTemplate() { - // Generated from example definition: specification/devtestlabs/resource-manager/Microsoft.DevTestLab/stable/2018-09-15/examples/Artifacts_GenerateArmTemplate.json + // Generated from example definition: 2018-09-15/Artifacts_GenerateArmTemplate.json // this example is just showing the usage of "Artifacts_GenerateArmTemplate" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line @@ -74,7 +72,7 @@ public async Task GenerateArmTemplate_ArtifactsGenerateArmTemplate() DevTestLabArtifactGenerateArmTemplateContent content = new DevTestLabArtifactGenerateArmTemplateContent { VmName = "{vmName}", - Location = new AzureLocation("{location}"), + Location = "{location}", FileUploadOptions = DevTestLabFileUploadOption.None, }; DevTestLabArmTemplateInfo result = await devTestLabArtifact.GenerateArmTemplateAsync(content); diff --git a/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/tests/Generated/Samples/Sample_DevTestLabArtifactSourceCollection.cs b/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/tests/Samples/Sample_DevTestLabArtifactSourceCollection.cs similarity index 88% rename from sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/tests/Generated/Samples/Sample_DevTestLabArtifactSourceCollection.cs rename to sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/tests/Samples/Sample_DevTestLabArtifactSourceCollection.cs index 6936fcb6e291..29bce33eba52 100644 --- a/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/tests/Generated/Samples/Sample_DevTestLabArtifactSourceCollection.cs +++ b/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/tests/Samples/Sample_DevTestLabArtifactSourceCollection.cs @@ -1,15 +1,12 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. -// - #nullable disable using System; using System.Threading.Tasks; using Azure.Core; using Azure.Identity; -using Azure.ResourceManager.DevTestLabs.Models; using NUnit.Framework; namespace Azure.ResourceManager.DevTestLabs.Samples @@ -20,7 +17,7 @@ public partial class Sample_DevTestLabArtifactSourceCollection [Ignore("Only validating compilation of examples")] public async Task CreateOrUpdate_ArtifactSourcesCreateOrUpdate() { - // Generated from example definition: specification/devtestlabs/resource-manager/Microsoft.DevTestLab/stable/2018-09-15/examples/ArtifactSources_CreateOrUpdate.json + // Generated from example definition: 2018-09-15/ArtifactSources_CreateOrUpdate.json // this example is just showing the usage of "ArtifactSources_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,14 +40,6 @@ public async Task CreateOrUpdate_ArtifactSourcesCreateOrUpdate() string name = "{artifactSourceName}"; DevTestLabArtifactSourceData data = new DevTestLabArtifactSourceData(default) { - DisplayName = "{displayName}", - Uri = new Uri("{artifactSourceUri}"), - SourceType = new DevTestLabSourceControlType("{VsoGit|GitHub|StorageAccount}"), - FolderPath = "{folderPath}", - ArmTemplateFolderPath = "{armTemplateFolderPath}", - BranchRef = "{branchRef}", - SecurityToken = "{securityToken}", - Status = new DevTestLabEnableStatus("{Enabled|Disabled}"), Tags = { ["tagName1"] = "tagValue1" @@ -70,7 +59,7 @@ public async Task CreateOrUpdate_ArtifactSourcesCreateOrUpdate() [Ignore("Only validating compilation of examples")] public async Task Get_ArtifactSourcesGet() { - // Generated from example definition: specification/devtestlabs/resource-manager/Microsoft.DevTestLab/stable/2018-09-15/examples/ArtifactSources_Get.json + // Generated from example definition: 2018-09-15/ArtifactSources_Get.json // this example is just showing the usage of "ArtifactSources_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 @@ -104,7 +93,7 @@ public async Task Get_ArtifactSourcesGet() [Ignore("Only validating compilation of examples")] public async Task GetAll_ArtifactSourcesList() { - // Generated from example definition: specification/devtestlabs/resource-manager/Microsoft.DevTestLab/stable/2018-09-15/examples/ArtifactSources_List.json + // Generated from example definition: 2018-09-15/ArtifactSources_List.json // this example is just showing the usage of "ArtifactSources_List" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line @@ -140,7 +129,7 @@ public async Task GetAll_ArtifactSourcesList() [Ignore("Only validating compilation of examples")] public async Task Exists_ArtifactSourcesGet() { - // Generated from example definition: specification/devtestlabs/resource-manager/Microsoft.DevTestLab/stable/2018-09-15/examples/ArtifactSources_Get.json + // Generated from example definition: 2018-09-15/ArtifactSources_Get.json // this example is just showing the usage of "ArtifactSources_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 @@ -170,7 +159,7 @@ public async Task Exists_ArtifactSourcesGet() [Ignore("Only validating compilation of examples")] public async Task GetIfExists_ArtifactSourcesGet() { - // Generated from example definition: specification/devtestlabs/resource-manager/Microsoft.DevTestLab/stable/2018-09-15/examples/ArtifactSources_Get.json + // Generated from example definition: 2018-09-15/ArtifactSources_Get.json // this example is just showing the usage of "ArtifactSources_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/devtestlabs/Azure.ResourceManager.DevTestLabs/tests/Generated/Samples/Sample_DevTestLabArtifactSourceResource.cs b/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/tests/Samples/Sample_DevTestLabArtifactSourceResource.cs similarity index 92% rename from sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/tests/Generated/Samples/Sample_DevTestLabArtifactSourceResource.cs rename to sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/tests/Samples/Sample_DevTestLabArtifactSourceResource.cs index 6a6f05924558..b018be247811 100644 --- a/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/tests/Generated/Samples/Sample_DevTestLabArtifactSourceResource.cs +++ b/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/tests/Samples/Sample_DevTestLabArtifactSourceResource.cs @@ -1,8 +1,6 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. -// - #nullable disable using System; @@ -20,7 +18,7 @@ public partial class Sample_DevTestLabArtifactSourceResource [Ignore("Only validating compilation of examples")] public async Task Get_ArtifactSourcesGet() { - // Generated from example definition: specification/devtestlabs/resource-manager/Microsoft.DevTestLab/stable/2018-09-15/examples/ArtifactSources_Get.json + // Generated from example definition: 2018-09-15/ArtifactSources_Get.json // this example is just showing the usage of "ArtifactSources_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 +49,7 @@ public async Task Get_ArtifactSourcesGet() [Ignore("Only validating compilation of examples")] public async Task Delete_ArtifactSourcesDelete() { - // Generated from example definition: specification/devtestlabs/resource-manager/Microsoft.DevTestLab/stable/2018-09-15/examples/ArtifactSources_Delete.json + // Generated from example definition: 2018-09-15/ArtifactSources_Delete.json // this example is just showing the usage of "ArtifactSources_Delete" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line @@ -78,7 +76,7 @@ public async Task Delete_ArtifactSourcesDelete() [Ignore("Only validating compilation of examples")] public async Task Update_ArtifactSourcesUpdate() { - // Generated from example definition: specification/devtestlabs/resource-manager/Microsoft.DevTestLab/stable/2018-09-15/examples/ArtifactSources_Update.json + // Generated from example definition: 2018-09-15/ArtifactSources_Update.json // this example is just showing the usage of "ArtifactSources_Update" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line diff --git a/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/tests/Generated/Samples/Sample_DevTestLabCollection.cs b/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/tests/Samples/Sample_DevTestLabCollection.cs similarity index 91% rename from sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/tests/Generated/Samples/Sample_DevTestLabCollection.cs rename to sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/tests/Samples/Sample_DevTestLabCollection.cs index a369ddf3b72a..5c8627956848 100644 --- a/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/tests/Generated/Samples/Sample_DevTestLabCollection.cs +++ b/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/tests/Samples/Sample_DevTestLabCollection.cs @@ -1,15 +1,12 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. -// - #nullable disable using System; using System.Threading.Tasks; using Azure.Core; using Azure.Identity; -using Azure.ResourceManager.DevTestLabs.Models; using Azure.ResourceManager.Resources; using NUnit.Framework; @@ -21,7 +18,7 @@ public partial class Sample_DevTestLabCollection [Ignore("Only validating compilation of examples")] public async Task CreateOrUpdate_LabsCreateOrUpdate() { - // Generated from example definition: specification/devtestlabs/resource-manager/Microsoft.DevTestLab/stable/2018-09-15/examples/Labs_CreateOrUpdate.json + // Generated from example definition: 2018-09-15/Labs_CreateOrUpdate.json // this example is just showing the usage of "Labs_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,7 +40,6 @@ public async Task CreateOrUpdate_LabsCreateOrUpdate() string name = "{labName}"; DevTestLabData data = new DevTestLabData(new AzureLocation("{location}")) { - LabStorageType = new DevTestLabStorageType("{Standard|Premium}"), Tags = { ["tagName1"] = "tagValue1" @@ -63,7 +59,7 @@ public async Task CreateOrUpdate_LabsCreateOrUpdate() [Ignore("Only validating compilation of examples")] public async Task Get_LabsGet() { - // Generated from example definition: specification/devtestlabs/resource-manager/Microsoft.DevTestLab/stable/2018-09-15/examples/Labs_Get.json + // Generated from example definition: 2018-09-15/Labs_Get.json // this example is just showing the usage of "Labs_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 @@ -96,7 +92,7 @@ public async Task Get_LabsGet() [Ignore("Only validating compilation of examples")] public async Task GetAll_LabsListByResourceGroup() { - // Generated from example definition: specification/devtestlabs/resource-manager/Microsoft.DevTestLab/stable/2018-09-15/examples/Labs_ListByResourceGroup.json + // Generated from example definition: 2018-09-15/Labs_ListByResourceGroup.json // this example is just showing the usage of "Labs_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 @@ -131,7 +127,7 @@ public async Task GetAll_LabsListByResourceGroup() [Ignore("Only validating compilation of examples")] public async Task Exists_LabsGet() { - // Generated from example definition: specification/devtestlabs/resource-manager/Microsoft.DevTestLab/stable/2018-09-15/examples/Labs_Get.json + // Generated from example definition: 2018-09-15/Labs_Get.json // this example is just showing the usage of "Labs_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 @@ -160,7 +156,7 @@ public async Task Exists_LabsGet() [Ignore("Only validating compilation of examples")] public async Task GetIfExists_LabsGet() { - // Generated from example definition: specification/devtestlabs/resource-manager/Microsoft.DevTestLab/stable/2018-09-15/examples/Labs_Get.json + // Generated from example definition: 2018-09-15/Labs_Get.json // this example is just showing the usage of "Labs_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/devtestlabs/Azure.ResourceManager.DevTestLabs/tests/Generated/Samples/Sample_DevTestLabCostCollection.cs b/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/tests/Samples/Sample_DevTestLabCostCollection.cs similarity index 76% rename from sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/tests/Generated/Samples/Sample_DevTestLabCostCollection.cs rename to sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/tests/Samples/Sample_DevTestLabCostCollection.cs index 43bd66491ff3..390704898127 100644 --- a/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/tests/Generated/Samples/Sample_DevTestLabCostCollection.cs +++ b/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/tests/Samples/Sample_DevTestLabCostCollection.cs @@ -1,15 +1,12 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. -// - #nullable disable using System; using System.Threading.Tasks; using Azure.Core; using Azure.Identity; -using Azure.ResourceManager.DevTestLabs.Models; using NUnit.Framework; namespace Azure.ResourceManager.DevTestLabs.Samples @@ -20,7 +17,7 @@ public partial class Sample_DevTestLabCostCollection [Ignore("Only validating compilation of examples")] public async Task CreateOrUpdate_CostsCreateOrUpdate() { - // Generated from example definition: specification/devtestlabs/resource-manager/Microsoft.DevTestLab/stable/2018-09-15/examples/Costs_CreateOrUpdate.json + // Generated from example definition: 2018-09-15/Costs_CreateOrUpdate.json // this example is just showing the usage of "Costs_CreateOrUpdate" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line @@ -41,51 +38,7 @@ public async Task CreateOrUpdate_CostsCreateOrUpdate() // invoke the operation string name = "targetCost"; - DevTestLabCostData data = new DevTestLabCostData(default) - { - TargetCost = new DevTestLabTargetCost - { - Status = DevTestLabTargetCostStatus.Enabled, - Target = 100, - CostThresholds = {new DevTestLabCostThreshold -{ -ThresholdId = "00000000-0000-0000-0000-000000000001", -ThresholdValue = 25, -DisplayOnChart = DevTestLabCostThresholdStatus.Disabled, -SendNotificationWhenExceeded = DevTestLabCostThresholdStatus.Disabled, -}, new DevTestLabCostThreshold -{ -ThresholdId = "00000000-0000-0000-0000-000000000002", -ThresholdValue = 50, -DisplayOnChart = DevTestLabCostThresholdStatus.Enabled, -SendNotificationWhenExceeded = DevTestLabCostThresholdStatus.Enabled, -}, new DevTestLabCostThreshold -{ -ThresholdId = "00000000-0000-0000-0000-000000000003", -ThresholdValue = 75, -DisplayOnChart = DevTestLabCostThresholdStatus.Disabled, -SendNotificationWhenExceeded = DevTestLabCostThresholdStatus.Disabled, -}, new DevTestLabCostThreshold -{ -ThresholdId = "00000000-0000-0000-0000-000000000004", -ThresholdValue = 100, -DisplayOnChart = DevTestLabCostThresholdStatus.Disabled, -SendNotificationWhenExceeded = DevTestLabCostThresholdStatus.Disabled, -}, new DevTestLabCostThreshold -{ -ThresholdId = "00000000-0000-0000-0000-000000000005", -ThresholdValue = 125, -DisplayOnChart = DevTestLabCostThresholdStatus.Disabled, -SendNotificationWhenExceeded = DevTestLabCostThresholdStatus.Disabled, -}}, - CycleStartOn = DateTimeOffset.Parse("2020-12-01T00:00:00.000Z"), - CycleEndOn = DateTimeOffset.Parse("2020-12-31T00:00:00.000Z"), - CycleType = DevTestLabReportingCycleType.CalendarMonth, - }, - CurrencyCode = "USD", - StartOn = DateTimeOffset.Parse("2020-12-01T00:00:00Z"), - EndOn = DateTimeOffset.Parse("2020-12-31T23:59:59Z"), - }; + DevTestLabCostData data = new DevTestLabCostData(default); ArmOperation lro = await collection.CreateOrUpdateAsync(WaitUntil.Completed, name, data); DevTestLabCostResource result = lro.Value; @@ -100,7 +53,7 @@ public async Task CreateOrUpdate_CostsCreateOrUpdate() [Ignore("Only validating compilation of examples")] public async Task Get_CostsGet() { - // Generated from example definition: specification/devtestlabs/resource-manager/Microsoft.DevTestLab/stable/2018-09-15/examples/Costs_Get.json + // Generated from example definition: 2018-09-15/Costs_Get.json // this example is just showing the usage of "Costs_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 @@ -134,7 +87,7 @@ public async Task Get_CostsGet() [Ignore("Only validating compilation of examples")] public async Task Exists_CostsGet() { - // Generated from example definition: specification/devtestlabs/resource-manager/Microsoft.DevTestLab/stable/2018-09-15/examples/Costs_Get.json + // Generated from example definition: 2018-09-15/Costs_Get.json // this example is just showing the usage of "Costs_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 +117,7 @@ public async Task Exists_CostsGet() [Ignore("Only validating compilation of examples")] public async Task GetIfExists_CostsGet() { - // Generated from example definition: specification/devtestlabs/resource-manager/Microsoft.DevTestLab/stable/2018-09-15/examples/Costs_Get.json + // Generated from example definition: 2018-09-15/Costs_Get.json // this example is just showing the usage of "Costs_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/devtestlabs/Azure.ResourceManager.DevTestLabs/tests/Generated/Samples/Sample_DevTestLabCostResource.cs b/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/tests/Samples/Sample_DevTestLabCostResource.cs similarity index 64% rename from sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/tests/Generated/Samples/Sample_DevTestLabCostResource.cs rename to sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/tests/Samples/Sample_DevTestLabCostResource.cs index f56a9e3a7312..3bb603476459 100644 --- a/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/tests/Generated/Samples/Sample_DevTestLabCostResource.cs +++ b/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/tests/Samples/Sample_DevTestLabCostResource.cs @@ -1,15 +1,12 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. -// - #nullable disable using System; using System.Threading.Tasks; using Azure.Core; using Azure.Identity; -using Azure.ResourceManager.DevTestLabs.Models; using NUnit.Framework; namespace Azure.ResourceManager.DevTestLabs.Samples @@ -20,7 +17,7 @@ public partial class Sample_DevTestLabCostResource [Ignore("Only validating compilation of examples")] public async Task Get_CostsGet() { - // Generated from example definition: specification/devtestlabs/resource-manager/Microsoft.DevTestLab/stable/2018-09-15/examples/Costs_Get.json + // Generated from example definition: 2018-09-15/Costs_Get.json // this example is just showing the usage of "Costs_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 +48,7 @@ public async Task Get_CostsGet() [Ignore("Only validating compilation of examples")] public async Task Update_CostsCreateOrUpdate() { - // Generated from example definition: specification/devtestlabs/resource-manager/Microsoft.DevTestLab/stable/2018-09-15/examples/Costs_CreateOrUpdate.json + // Generated from example definition: 2018-09-15/Costs_CreateOrUpdate.json // this example is just showing the usage of "Costs_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 @@ -69,51 +66,7 @@ public async Task Update_CostsCreateOrUpdate() DevTestLabCostResource devTestLabCost = client.GetDevTestLabCostResource(devTestLabCostResourceId); // invoke the operation - DevTestLabCostData data = new DevTestLabCostData(default) - { - TargetCost = new DevTestLabTargetCost - { - Status = DevTestLabTargetCostStatus.Enabled, - Target = 100, - CostThresholds = {new DevTestLabCostThreshold -{ -ThresholdId = "00000000-0000-0000-0000-000000000001", -ThresholdValue = 25, -DisplayOnChart = DevTestLabCostThresholdStatus.Disabled, -SendNotificationWhenExceeded = DevTestLabCostThresholdStatus.Disabled, -}, new DevTestLabCostThreshold -{ -ThresholdId = "00000000-0000-0000-0000-000000000002", -ThresholdValue = 50, -DisplayOnChart = DevTestLabCostThresholdStatus.Enabled, -SendNotificationWhenExceeded = DevTestLabCostThresholdStatus.Enabled, -}, new DevTestLabCostThreshold -{ -ThresholdId = "00000000-0000-0000-0000-000000000003", -ThresholdValue = 75, -DisplayOnChart = DevTestLabCostThresholdStatus.Disabled, -SendNotificationWhenExceeded = DevTestLabCostThresholdStatus.Disabled, -}, new DevTestLabCostThreshold -{ -ThresholdId = "00000000-0000-0000-0000-000000000004", -ThresholdValue = 100, -DisplayOnChart = DevTestLabCostThresholdStatus.Disabled, -SendNotificationWhenExceeded = DevTestLabCostThresholdStatus.Disabled, -}, new DevTestLabCostThreshold -{ -ThresholdId = "00000000-0000-0000-0000-000000000005", -ThresholdValue = 125, -DisplayOnChart = DevTestLabCostThresholdStatus.Disabled, -SendNotificationWhenExceeded = DevTestLabCostThresholdStatus.Disabled, -}}, - CycleStartOn = DateTimeOffset.Parse("2020-12-01T00:00:00.000Z"), - CycleEndOn = DateTimeOffset.Parse("2020-12-31T00:00:00.000Z"), - CycleType = DevTestLabReportingCycleType.CalendarMonth, - }, - CurrencyCode = "USD", - StartOn = DateTimeOffset.Parse("2020-12-01T00:00:00Z"), - EndOn = DateTimeOffset.Parse("2020-12-31T23:59:59Z"), - }; + DevTestLabCostData data = new DevTestLabCostData(default); ArmOperation lro = await devTestLabCost.UpdateAsync(WaitUntil.Completed, data); DevTestLabCostResource result = lro.Value; diff --git a/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/tests/Generated/Samples/Sample_DevTestLabCustomImageCollection.cs b/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/tests/Samples/Sample_DevTestLabCustomImageCollection.cs similarity index 89% rename from sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/tests/Generated/Samples/Sample_DevTestLabCustomImageCollection.cs rename to sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/tests/Samples/Sample_DevTestLabCustomImageCollection.cs index 561a27cbb93b..e577d1880287 100644 --- a/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/tests/Generated/Samples/Sample_DevTestLabCustomImageCollection.cs +++ b/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/tests/Samples/Sample_DevTestLabCustomImageCollection.cs @@ -1,15 +1,12 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. -// - #nullable disable using System; using System.Threading.Tasks; using Azure.Core; using Azure.Identity; -using Azure.ResourceManager.DevTestLabs.Models; using NUnit.Framework; namespace Azure.ResourceManager.DevTestLabs.Samples @@ -20,7 +17,7 @@ public partial class Sample_DevTestLabCustomImageCollection [Ignore("Only validating compilation of examples")] public async Task CreateOrUpdate_CustomImagesCreateOrUpdate() { - // Generated from example definition: specification/devtestlabs/resource-manager/Microsoft.DevTestLab/stable/2018-09-15/examples/CustomImages_CreateOrUpdate.json + // Generated from example definition: 2018-09-15/CustomImages_CreateOrUpdate.json // this example is just showing the usage of "CustomImages_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,12 +40,6 @@ public async Task CreateOrUpdate_CustomImagesCreateOrUpdate() string name = "{customImageName}"; DevTestLabCustomImageData data = new DevTestLabCustomImageData(default) { - Vm = new DevTestLabCustomImageVm - { - SourceVmId = "/subscriptions/{subscriptionId}/resourcegroups/resourceGroupName/providers/microsoft.devtestlab/labs/{labName}/virtualmachines/{vmName}", - LinuxOSState = DevTestLabLinuxOSState.NonDeprovisioned, - }, - Description = "My Custom Image", Tags = { ["tagName1"] = "tagValue1" @@ -68,7 +59,7 @@ public async Task CreateOrUpdate_CustomImagesCreateOrUpdate() [Ignore("Only validating compilation of examples")] public async Task Get_CustomImagesGet() { - // Generated from example definition: specification/devtestlabs/resource-manager/Microsoft.DevTestLab/stable/2018-09-15/examples/CustomImages_Get.json + // Generated from example definition: 2018-09-15/CustomImages_Get.json // this example is just showing the usage of "CustomImages_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 @@ -102,7 +93,7 @@ public async Task Get_CustomImagesGet() [Ignore("Only validating compilation of examples")] public async Task GetAll_CustomImagesList() { - // Generated from example definition: specification/devtestlabs/resource-manager/Microsoft.DevTestLab/stable/2018-09-15/examples/CustomImages_List.json + // Generated from example definition: 2018-09-15/CustomImages_List.json // this example is just showing the usage of "CustomImages_List" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line @@ -138,7 +129,7 @@ public async Task GetAll_CustomImagesList() [Ignore("Only validating compilation of examples")] public async Task Exists_CustomImagesGet() { - // Generated from example definition: specification/devtestlabs/resource-manager/Microsoft.DevTestLab/stable/2018-09-15/examples/CustomImages_Get.json + // Generated from example definition: 2018-09-15/CustomImages_Get.json // this example is just showing the usage of "CustomImages_Get" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line @@ -168,7 +159,7 @@ public async Task Exists_CustomImagesGet() [Ignore("Only validating compilation of examples")] public async Task GetIfExists_CustomImagesGet() { - // Generated from example definition: specification/devtestlabs/resource-manager/Microsoft.DevTestLab/stable/2018-09-15/examples/CustomImages_Get.json + // Generated from example definition: 2018-09-15/CustomImages_Get.json // this example is just showing the usage of "CustomImages_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/devtestlabs/Azure.ResourceManager.DevTestLabs/tests/Generated/Samples/Sample_DevTestLabCustomImageResource.cs b/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/tests/Samples/Sample_DevTestLabCustomImageResource.cs similarity index 92% rename from sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/tests/Generated/Samples/Sample_DevTestLabCustomImageResource.cs rename to sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/tests/Samples/Sample_DevTestLabCustomImageResource.cs index 0ec9c1e88cca..f2af7934f6d1 100644 --- a/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/tests/Generated/Samples/Sample_DevTestLabCustomImageResource.cs +++ b/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/tests/Samples/Sample_DevTestLabCustomImageResource.cs @@ -1,8 +1,6 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. -// - #nullable disable using System; @@ -20,7 +18,7 @@ public partial class Sample_DevTestLabCustomImageResource [Ignore("Only validating compilation of examples")] public async Task Get_CustomImagesGet() { - // Generated from example definition: specification/devtestlabs/resource-manager/Microsoft.DevTestLab/stable/2018-09-15/examples/CustomImages_Get.json + // Generated from example definition: 2018-09-15/CustomImages_Get.json // this example is just showing the usage of "CustomImages_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 +49,7 @@ public async Task Get_CustomImagesGet() [Ignore("Only validating compilation of examples")] public async Task Delete_CustomImagesDelete() { - // Generated from example definition: specification/devtestlabs/resource-manager/Microsoft.DevTestLab/stable/2018-09-15/examples/CustomImages_Delete.json + // Generated from example definition: 2018-09-15/CustomImages_Delete.json // this example is just showing the usage of "CustomImages_Delete" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line @@ -78,7 +76,7 @@ public async Task Delete_CustomImagesDelete() [Ignore("Only validating compilation of examples")] public async Task Update_CustomImagesUpdate() { - // Generated from example definition: specification/devtestlabs/resource-manager/Microsoft.DevTestLab/stable/2018-09-15/examples/CustomImages_Update.json + // Generated from example definition: 2018-09-15/CustomImages_Update.json // this example is just showing the usage of "CustomImages_Update" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line diff --git a/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/tests/Generated/Samples/Sample_DevTestLabDiskCollection.cs b/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/tests/Samples/Sample_DevTestLabDiskCollection.cs similarity index 90% rename from sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/tests/Generated/Samples/Sample_DevTestLabDiskCollection.cs rename to sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/tests/Samples/Sample_DevTestLabDiskCollection.cs index 6b58e2b8e6c7..35baf41d449c 100644 --- a/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/tests/Generated/Samples/Sample_DevTestLabDiskCollection.cs +++ b/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/tests/Samples/Sample_DevTestLabDiskCollection.cs @@ -1,15 +1,12 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. -// - #nullable disable using System; using System.Threading.Tasks; using Azure.Core; using Azure.Identity; -using Azure.ResourceManager.DevTestLabs.Models; using NUnit.Framework; namespace Azure.ResourceManager.DevTestLabs.Samples @@ -20,7 +17,7 @@ public partial class Sample_DevTestLabDiskCollection [Ignore("Only validating compilation of examples")] public async Task CreateOrUpdate_DisksCreateOrUpdate() { - // Generated from example definition: specification/devtestlabs/resource-manager/Microsoft.DevTestLab/stable/2018-09-15/examples/Disks_CreateOrUpdate.json + // Generated from example definition: 2018-09-15/Disks_CreateOrUpdate.json // this example is just showing the usage of "Disks_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 @@ -42,12 +39,7 @@ public async Task CreateOrUpdate_DisksCreateOrUpdate() // invoke the operation string name = "{diskName}"; - DevTestLabDiskData data = new DevTestLabDiskData(default) - { - DiskType = DevTestLabStorageType.Standard, - DiskSizeGiB = 1023, - LeasedByLabVmId = new ResourceIdentifier("/subscriptions/{subscriptionId}/resourcegroups/resourceGroupName/providers/microsoft.devtestlab/labs/{labName}/virtualmachines/vmName"), - }; + DevTestLabDiskData data = new DevTestLabDiskData(default); ArmOperation lro = await collection.CreateOrUpdateAsync(WaitUntil.Completed, name, data); DevTestLabDiskResource result = lro.Value; @@ -62,7 +54,7 @@ public async Task CreateOrUpdate_DisksCreateOrUpdate() [Ignore("Only validating compilation of examples")] public async Task Get_DisksGet() { - // Generated from example definition: specification/devtestlabs/resource-manager/Microsoft.DevTestLab/stable/2018-09-15/examples/Disks_Get.json + // Generated from example definition: 2018-09-15/Disks_Get.json // this example is just showing the usage of "Disks_Get" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line @@ -97,7 +89,7 @@ public async Task Get_DisksGet() [Ignore("Only validating compilation of examples")] public async Task GetAll_DisksList() { - // Generated from example definition: specification/devtestlabs/resource-manager/Microsoft.DevTestLab/stable/2018-09-15/examples/Disks_List.json + // Generated from example definition: 2018-09-15/Disks_List.json // this example is just showing the usage of "Disks_List" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line @@ -134,7 +126,7 @@ public async Task GetAll_DisksList() [Ignore("Only validating compilation of examples")] public async Task Exists_DisksGet() { - // Generated from example definition: specification/devtestlabs/resource-manager/Microsoft.DevTestLab/stable/2018-09-15/examples/Disks_Get.json + // Generated from example definition: 2018-09-15/Disks_Get.json // this example is just showing the usage of "Disks_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 @@ -165,7 +157,7 @@ public async Task Exists_DisksGet() [Ignore("Only validating compilation of examples")] public async Task GetIfExists_DisksGet() { - // Generated from example definition: specification/devtestlabs/resource-manager/Microsoft.DevTestLab/stable/2018-09-15/examples/Disks_Get.json + // Generated from example definition: 2018-09-15/Disks_Get.json // this example is just showing the usage of "Disks_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/devtestlabs/Azure.ResourceManager.DevTestLabs/tests/Generated/Samples/Sample_DevTestLabDiskResource.cs b/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/tests/Samples/Sample_DevTestLabDiskResource.cs similarity index 91% rename from sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/tests/Generated/Samples/Sample_DevTestLabDiskResource.cs rename to sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/tests/Samples/Sample_DevTestLabDiskResource.cs index 4c1fbbad487d..94efa54676a3 100644 --- a/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/tests/Generated/Samples/Sample_DevTestLabDiskResource.cs +++ b/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/tests/Samples/Sample_DevTestLabDiskResource.cs @@ -1,8 +1,6 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. -// - #nullable disable using System; @@ -20,7 +18,7 @@ public partial class Sample_DevTestLabDiskResource [Ignore("Only validating compilation of examples")] public async Task Get_DisksGet() { - // Generated from example definition: specification/devtestlabs/resource-manager/Microsoft.DevTestLab/stable/2018-09-15/examples/Disks_Get.json + // Generated from example definition: 2018-09-15/Disks_Get.json // this example is just showing the usage of "Disks_Get" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line @@ -52,7 +50,7 @@ public async Task Get_DisksGet() [Ignore("Only validating compilation of examples")] public async Task Delete_DisksDelete() { - // Generated from example definition: specification/devtestlabs/resource-manager/Microsoft.DevTestLab/stable/2018-09-15/examples/Disks_Delete.json + // Generated from example definition: 2018-09-15/Disks_Delete.json // this example is just showing the usage of "Disks_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 @@ -65,7 +63,7 @@ public async Task Delete_DisksDelete() string subscriptionId = "{subscriptionId}"; string resourceGroupName = "resourceGroupName"; string labName = "{labName}"; - string userName = "{userId}"; + string userName = "@me"; string name = "{diskName}"; ResourceIdentifier devTestLabDiskResourceId = DevTestLabDiskResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, labName, userName, name); DevTestLabDiskResource devTestLabDisk = client.GetDevTestLabDiskResource(devTestLabDiskResourceId); @@ -80,7 +78,7 @@ public async Task Delete_DisksDelete() [Ignore("Only validating compilation of examples")] public async Task Update_DisksUpdate() { - // Generated from example definition: specification/devtestlabs/resource-manager/Microsoft.DevTestLab/stable/2018-09-15/examples/Disks_Update.json + // Generated from example definition: 2018-09-15/Disks_Update.json // this example is just showing the usage of "Disks_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 @@ -119,7 +117,7 @@ public async Task Update_DisksUpdate() [Ignore("Only validating compilation of examples")] public async Task Attach_DisksAttach() { - // Generated from example definition: specification/devtestlabs/resource-manager/Microsoft.DevTestLab/stable/2018-09-15/examples/Disks_Attach.json + // Generated from example definition: 2018-09-15/Disks_Attach.json // this example is just showing the usage of "Disks_Attach" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line @@ -151,7 +149,7 @@ public async Task Attach_DisksAttach() [Ignore("Only validating compilation of examples")] public async Task Detach_DisksDetach() { - // Generated from example definition: specification/devtestlabs/resource-manager/Microsoft.DevTestLab/stable/2018-09-15/examples/Disks_Detach.json + // Generated from example definition: 2018-09-15/Disks_Detach.json // this example is just showing the usage of "Disks_Detach" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details 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/devtestlabs/Azure.ResourceManager.DevTestLabs/tests/Generated/Samples/Sample_DevTestLabEnvironmentCollection.cs b/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/tests/Samples/Sample_DevTestLabEnvironmentCollection.cs similarity index 89% rename from sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/tests/Generated/Samples/Sample_DevTestLabEnvironmentCollection.cs rename to sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/tests/Samples/Sample_DevTestLabEnvironmentCollection.cs index 1d9e0210fd0e..b8033197d7f8 100644 --- a/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/tests/Generated/Samples/Sample_DevTestLabEnvironmentCollection.cs +++ b/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/tests/Samples/Sample_DevTestLabEnvironmentCollection.cs @@ -1,15 +1,12 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. -// - #nullable disable using System; using System.Threading.Tasks; using Azure.Core; using Azure.Identity; -using Azure.ResourceManager.DevTestLabs.Models; using NUnit.Framework; namespace Azure.ResourceManager.DevTestLabs.Samples @@ -20,7 +17,7 @@ public partial class Sample_DevTestLabEnvironmentCollection [Ignore("Only validating compilation of examples")] public async Task CreateOrUpdate_EnvironmentsCreateOrUpdate() { - // Generated from example definition: specification/devtestlabs/resource-manager/Microsoft.DevTestLab/stable/2018-09-15/examples/Environments_CreateOrUpdate.json + // Generated from example definition: 2018-09-15/Environments_CreateOrUpdate.json // this example is just showing the usage of "Environments_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 @@ -42,14 +39,7 @@ public async Task CreateOrUpdate_EnvironmentsCreateOrUpdate() // invoke the operation string name = "{environmentName}"; - DevTestLabEnvironmentData data = new DevTestLabEnvironmentData(default) - { - DeploymentProperties = new DevTestLabEnvironmentDeployment - { - ArmTemplateId = new ResourceIdentifier("/subscriptions/{subscriptionId}/resourceGroups/resourceGroupName/providers/Microsoft.DevTestLab/labs/{labName}/artifactSources/{artifactSourceName}/armTemplates/{armTemplateName}"), - Parameters = { }, - }, - }; + DevTestLabEnvironmentData data = new DevTestLabEnvironmentData(default); ArmOperation lro = await collection.CreateOrUpdateAsync(WaitUntil.Completed, name, data); DevTestLabEnvironmentResource result = lro.Value; @@ -64,7 +54,7 @@ public async Task CreateOrUpdate_EnvironmentsCreateOrUpdate() [Ignore("Only validating compilation of examples")] public async Task Get_EnvironmentsGet() { - // Generated from example definition: specification/devtestlabs/resource-manager/Microsoft.DevTestLab/stable/2018-09-15/examples/Environments_Get.json + // Generated from example definition: 2018-09-15/Environments_Get.json // this example is just showing the usage of "Environments_Get" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line @@ -99,7 +89,7 @@ public async Task Get_EnvironmentsGet() [Ignore("Only validating compilation of examples")] public async Task GetAll_EnvironmentsList() { - // Generated from example definition: specification/devtestlabs/resource-manager/Microsoft.DevTestLab/stable/2018-09-15/examples/Environments_List.json + // Generated from example definition: 2018-09-15/Environments_List.json // this example is just showing the usage of "Environments_List" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line @@ -136,7 +126,7 @@ public async Task GetAll_EnvironmentsList() [Ignore("Only validating compilation of examples")] public async Task Exists_EnvironmentsGet() { - // Generated from example definition: specification/devtestlabs/resource-manager/Microsoft.DevTestLab/stable/2018-09-15/examples/Environments_Get.json + // Generated from example definition: 2018-09-15/Environments_Get.json // this example is just showing the usage of "Environments_Get" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line @@ -167,7 +157,7 @@ public async Task Exists_EnvironmentsGet() [Ignore("Only validating compilation of examples")] public async Task GetIfExists_EnvironmentsGet() { - // Generated from example definition: specification/devtestlabs/resource-manager/Microsoft.DevTestLab/stable/2018-09-15/examples/Environments_Get.json + // Generated from example definition: 2018-09-15/Environments_Get.json // this example is just showing the usage of "Environments_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/devtestlabs/Azure.ResourceManager.DevTestLabs/tests/Generated/Samples/Sample_DevTestLabEnvironmentResource.cs b/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/tests/Samples/Sample_DevTestLabEnvironmentResource.cs similarity index 92% rename from sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/tests/Generated/Samples/Sample_DevTestLabEnvironmentResource.cs rename to sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/tests/Samples/Sample_DevTestLabEnvironmentResource.cs index 20953ca93ba4..437cfe919f07 100644 --- a/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/tests/Generated/Samples/Sample_DevTestLabEnvironmentResource.cs +++ b/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/tests/Samples/Sample_DevTestLabEnvironmentResource.cs @@ -1,8 +1,6 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. -// - #nullable disable using System; @@ -20,7 +18,7 @@ public partial class Sample_DevTestLabEnvironmentResource [Ignore("Only validating compilation of examples")] public async Task Get_EnvironmentsGet() { - // Generated from example definition: specification/devtestlabs/resource-manager/Microsoft.DevTestLab/stable/2018-09-15/examples/Environments_Get.json + // Generated from example definition: 2018-09-15/Environments_Get.json // this example is just showing the usage of "Environments_Get" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line @@ -52,7 +50,7 @@ public async Task Get_EnvironmentsGet() [Ignore("Only validating compilation of examples")] public async Task Delete_EnvironmentsDelete() { - // Generated from example definition: specification/devtestlabs/resource-manager/Microsoft.DevTestLab/stable/2018-09-15/examples/Environments_Delete.json + // Generated from example definition: 2018-09-15/Environments_Delete.json // this example is just showing the usage of "Environments_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 @@ -80,7 +78,7 @@ public async Task Delete_EnvironmentsDelete() [Ignore("Only validating compilation of examples")] public async Task Update_EnvironmentsUpdate() { - // Generated from example definition: specification/devtestlabs/resource-manager/Microsoft.DevTestLab/stable/2018-09-15/examples/Environments_Update.json + // Generated from example definition: 2018-09-15/Environments_Update.json // this example is just showing the usage of "Environments_Update" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line diff --git a/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/tests/Generated/Samples/Sample_DevTestLabFormulaCollection.cs b/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/tests/Samples/Sample_DevTestLabFormulaCollection.cs similarity index 80% rename from sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/tests/Generated/Samples/Sample_DevTestLabFormulaCollection.cs rename to sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/tests/Samples/Sample_DevTestLabFormulaCollection.cs index 388d897c9510..ce38f6f37987 100644 --- a/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/tests/Generated/Samples/Sample_DevTestLabFormulaCollection.cs +++ b/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/tests/Samples/Sample_DevTestLabFormulaCollection.cs @@ -1,15 +1,12 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. -// - #nullable disable using System; using System.Threading.Tasks; using Azure.Core; using Azure.Identity; -using Azure.ResourceManager.DevTestLabs.Models; using NUnit.Framework; namespace Azure.ResourceManager.DevTestLabs.Samples @@ -20,7 +17,7 @@ public partial class Sample_DevTestLabFormulaCollection [Ignore("Only validating compilation of examples")] public async Task CreateOrUpdate_FormulasCreateOrUpdate() { - // Generated from example definition: specification/devtestlabs/resource-manager/Microsoft.DevTestLab/stable/2018-09-15/examples/Formulas_CreateOrUpdate.json + // Generated from example definition: 2018-09-15/Formulas_CreateOrUpdate.json // this example is just showing the usage of "Formulas_CreateOrUpdate" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line @@ -41,44 +38,7 @@ public async Task CreateOrUpdate_FormulasCreateOrUpdate() // invoke the operation string name = "{formulaName}"; - DevTestLabFormulaData data = new DevTestLabFormulaData(new AzureLocation("{location}")) - { - Description = "Formula using a Linux base", - FormulaContent = new DevTestLabVmCreationContent - { - Location = new AzureLocation("{location}"), - Notes = "Ubuntu Server 20.10", - Size = "Standard_B1ms", - UserName = "user", - IsAuthenticationWithSshKey = false, - LabSubnetName = "Dtl{labName}Subnet", - LabVirtualNetworkId = new ResourceIdentifier("/virtualnetworks/dtl{labName}"), - DisallowPublicIPAddress = true, - Artifacts = {new DevTestLabArtifactInstallInfo -{ -ArtifactId = "/artifactsources/{artifactSourceName}/artifacts/linux-install-nodejs", -Parameters = {}, -}}, - GalleryImageReference = new DevTestLabGalleryImageReference - { - Offer = "0001-com-ubuntu-server-groovy", - Publisher = "canonical", - Sku = "20_10", - OSType = "Linux", - Version = "latest", - }, - NetworkInterface = new DevTestLabNetworkInterface - { - SharedPublicIPAddressInboundNatRules = {new DevTestLabInboundNatRule -{ -TransportProtocol = DevTestLabTransportProtocol.Tcp, -BackendPort = 22, -}}, - }, - AllowClaim = false, - StorageType = "Standard", - }, - }; + DevTestLabFormulaData data = new DevTestLabFormulaData(new AzureLocation("{location}")); ArmOperation lro = await collection.CreateOrUpdateAsync(WaitUntil.Completed, name, data); DevTestLabFormulaResource result = lro.Value; @@ -93,7 +53,7 @@ public async Task CreateOrUpdate_FormulasCreateOrUpdate() [Ignore("Only validating compilation of examples")] public async Task Get_FormulasGet() { - // Generated from example definition: specification/devtestlabs/resource-manager/Microsoft.DevTestLab/stable/2018-09-15/examples/Formulas_Get.json + // Generated from example definition: 2018-09-15/Formulas_Get.json // this example is just showing the usage of "Formulas_Get" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line @@ -127,7 +87,7 @@ public async Task Get_FormulasGet() [Ignore("Only validating compilation of examples")] public async Task GetAll_FormulasList() { - // Generated from example definition: specification/devtestlabs/resource-manager/Microsoft.DevTestLab/stable/2018-09-15/examples/Formulas_List.json + // Generated from example definition: 2018-09-15/Formulas_List.json // this example is just showing the usage of "Formulas_List" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line @@ -163,7 +123,7 @@ public async Task GetAll_FormulasList() [Ignore("Only validating compilation of examples")] public async Task Exists_FormulasGet() { - // Generated from example definition: specification/devtestlabs/resource-manager/Microsoft.DevTestLab/stable/2018-09-15/examples/Formulas_Get.json + // Generated from example definition: 2018-09-15/Formulas_Get.json // this example is just showing the usage of "Formulas_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 @@ -193,7 +153,7 @@ public async Task Exists_FormulasGet() [Ignore("Only validating compilation of examples")] public async Task GetIfExists_FormulasGet() { - // Generated from example definition: specification/devtestlabs/resource-manager/Microsoft.DevTestLab/stable/2018-09-15/examples/Formulas_Get.json + // Generated from example definition: 2018-09-15/Formulas_Get.json // this example is just showing the usage of "Formulas_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/devtestlabs/Azure.ResourceManager.DevTestLabs/tests/Generated/Samples/Sample_DevTestLabFormulaResource.cs b/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/tests/Samples/Sample_DevTestLabFormulaResource.cs similarity index 92% rename from sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/tests/Generated/Samples/Sample_DevTestLabFormulaResource.cs rename to sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/tests/Samples/Sample_DevTestLabFormulaResource.cs index 347defaa5174..09b88cf547a2 100644 --- a/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/tests/Generated/Samples/Sample_DevTestLabFormulaResource.cs +++ b/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/tests/Samples/Sample_DevTestLabFormulaResource.cs @@ -1,8 +1,6 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. -// - #nullable disable using System; @@ -20,7 +18,7 @@ public partial class Sample_DevTestLabFormulaResource [Ignore("Only validating compilation of examples")] public async Task Get_FormulasGet() { - // Generated from example definition: specification/devtestlabs/resource-manager/Microsoft.DevTestLab/stable/2018-09-15/examples/Formulas_Get.json + // Generated from example definition: 2018-09-15/Formulas_Get.json // this example is just showing the usage of "Formulas_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 +49,7 @@ public async Task Get_FormulasGet() [Ignore("Only validating compilation of examples")] public async Task Delete_FormulasDelete() { - // Generated from example definition: specification/devtestlabs/resource-manager/Microsoft.DevTestLab/stable/2018-09-15/examples/Formulas_Delete.json + // Generated from example definition: 2018-09-15/Formulas_Delete.json // this example is just showing the usage of "Formulas_Delete" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line @@ -78,7 +76,7 @@ public async Task Delete_FormulasDelete() [Ignore("Only validating compilation of examples")] public async Task Update_FormulasUpdate() { - // Generated from example definition: specification/devtestlabs/resource-manager/Microsoft.DevTestLab/stable/2018-09-15/examples/Formulas_Update.json + // Generated from example definition: 2018-09-15/Formulas_Update.json // this example is just showing the usage of "Formulas_Update" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line diff --git a/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/tests/Generated/Samples/Sample_DevTestLabNotificationChannelCollection.cs b/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/tests/Samples/Sample_DevTestLabNotificationChannelCollection.cs similarity index 88% rename from sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/tests/Generated/Samples/Sample_DevTestLabNotificationChannelCollection.cs rename to sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/tests/Samples/Sample_DevTestLabNotificationChannelCollection.cs index fb196aff4091..907bba9a73dc 100644 --- a/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/tests/Generated/Samples/Sample_DevTestLabNotificationChannelCollection.cs +++ b/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/tests/Samples/Sample_DevTestLabNotificationChannelCollection.cs @@ -1,15 +1,12 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. -// - #nullable disable using System; using System.Threading.Tasks; using Azure.Core; using Azure.Identity; -using Azure.ResourceManager.DevTestLabs.Models; using NUnit.Framework; namespace Azure.ResourceManager.DevTestLabs.Samples @@ -20,7 +17,7 @@ public partial class Sample_DevTestLabNotificationChannelCollection [Ignore("Only validating compilation of examples")] public async Task CreateOrUpdate_NotificationChannelsCreateOrUpdate() { - // Generated from example definition: specification/devtestlabs/resource-manager/Microsoft.DevTestLab/stable/2018-09-15/examples/NotificationChannels_CreateOrUpdate.json + // Generated from example definition: 2018-09-15/NotificationChannels_CreateOrUpdate.json // this example is just showing the usage of "NotificationChannels_CreateOrUpdate" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line @@ -41,17 +38,7 @@ public async Task CreateOrUpdate_NotificationChannelsCreateOrUpdate() // invoke the operation string name = "{notificationChannelName}"; - DevTestLabNotificationChannelData data = new DevTestLabNotificationChannelData(default) - { - WebHookUri = new Uri("{webhookUrl}"), - EmailRecipient = "{email}", - NotificationLocale = "en", - Description = "Integration configured for auto-shutdown", - Events = {new DevTestLabNotificationChannelEvent -{ -EventName = DevTestLabNotificationChannelEventType.AutoShutdown, -}}, - }; + DevTestLabNotificationChannelData data = new DevTestLabNotificationChannelData(default); ArmOperation lro = await collection.CreateOrUpdateAsync(WaitUntil.Completed, name, data); DevTestLabNotificationChannelResource result = lro.Value; @@ -66,7 +53,7 @@ public async Task CreateOrUpdate_NotificationChannelsCreateOrUpdate() [Ignore("Only validating compilation of examples")] public async Task Get_NotificationChannelsGet() { - // Generated from example definition: specification/devtestlabs/resource-manager/Microsoft.DevTestLab/stable/2018-09-15/examples/NotificationChannels_Get.json + // Generated from example definition: 2018-09-15/NotificationChannels_Get.json // this example is just showing the usage of "NotificationChannels_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 +87,7 @@ public async Task Get_NotificationChannelsGet() [Ignore("Only validating compilation of examples")] public async Task GetAll_NotificationChannelsList() { - // Generated from example definition: specification/devtestlabs/resource-manager/Microsoft.DevTestLab/stable/2018-09-15/examples/NotificationChannels_List.json + // Generated from example definition: 2018-09-15/NotificationChannels_List.json // this example is just showing the usage of "NotificationChannels_List" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line @@ -136,7 +123,7 @@ public async Task GetAll_NotificationChannelsList() [Ignore("Only validating compilation of examples")] public async Task Exists_NotificationChannelsGet() { - // Generated from example definition: specification/devtestlabs/resource-manager/Microsoft.DevTestLab/stable/2018-09-15/examples/NotificationChannels_Get.json + // Generated from example definition: 2018-09-15/NotificationChannels_Get.json // this example is just showing the usage of "NotificationChannels_Get" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line @@ -166,7 +153,7 @@ public async Task Exists_NotificationChannelsGet() [Ignore("Only validating compilation of examples")] public async Task GetIfExists_NotificationChannelsGet() { - // Generated from example definition: specification/devtestlabs/resource-manager/Microsoft.DevTestLab/stable/2018-09-15/examples/NotificationChannels_Get.json + // Generated from example definition: 2018-09-15/NotificationChannels_Get.json // this example is just showing the usage of "NotificationChannels_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/devtestlabs/Azure.ResourceManager.DevTestLabs/tests/Generated/Samples/Sample_DevTestLabNotificationChannelResource.cs b/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/tests/Samples/Sample_DevTestLabNotificationChannelResource.cs similarity index 92% rename from sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/tests/Generated/Samples/Sample_DevTestLabNotificationChannelResource.cs rename to sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/tests/Samples/Sample_DevTestLabNotificationChannelResource.cs index 2176f18ab66d..42f2b2eb1973 100644 --- a/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/tests/Generated/Samples/Sample_DevTestLabNotificationChannelResource.cs +++ b/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/tests/Samples/Sample_DevTestLabNotificationChannelResource.cs @@ -1,8 +1,6 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. -// - #nullable disable using System; @@ -20,7 +18,7 @@ public partial class Sample_DevTestLabNotificationChannelResource [Ignore("Only validating compilation of examples")] public async Task Get_NotificationChannelsGet() { - // Generated from example definition: specification/devtestlabs/resource-manager/Microsoft.DevTestLab/stable/2018-09-15/examples/NotificationChannels_Get.json + // Generated from example definition: 2018-09-15/NotificationChannels_Get.json // this example is just showing the usage of "NotificationChannels_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 +49,7 @@ public async Task Get_NotificationChannelsGet() [Ignore("Only validating compilation of examples")] public async Task Delete_NotificationChannelsDelete() { - // Generated from example definition: specification/devtestlabs/resource-manager/Microsoft.DevTestLab/stable/2018-09-15/examples/NotificationChannels_Delete.json + // Generated from example definition: 2018-09-15/NotificationChannels_Delete.json // this example is just showing the usage of "NotificationChannels_Delete" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line @@ -78,7 +76,7 @@ public async Task Delete_NotificationChannelsDelete() [Ignore("Only validating compilation of examples")] public async Task Update_NotificationChannelsUpdate() { - // Generated from example definition: specification/devtestlabs/resource-manager/Microsoft.DevTestLab/stable/2018-09-15/examples/NotificationChannels_Update.json + // Generated from example definition: 2018-09-15/NotificationChannels_Update.json // this example is just showing the usage of "NotificationChannels_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 @@ -110,7 +108,7 @@ public async Task Update_NotificationChannelsUpdate() [Ignore("Only validating compilation of examples")] public async Task Notify_NotificationChannelsNotify() { - // Generated from example definition: specification/devtestlabs/resource-manager/Microsoft.DevTestLab/stable/2018-09-15/examples/NotificationChannels_Notify.json + // Generated from example definition: 2018-09-15/NotificationChannels_Notify.json // this example is just showing the usage of "NotificationChannels_Notify" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details 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/devtestlabs/Azure.ResourceManager.DevTestLabs/tests/Generated/Samples/Sample_DevTestLabPolicyCollection.cs b/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/tests/Samples/Sample_DevTestLabPolicyCollection.cs similarity index 89% rename from sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/tests/Generated/Samples/Sample_DevTestLabPolicyCollection.cs rename to sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/tests/Samples/Sample_DevTestLabPolicyCollection.cs index 1e3e980dac4e..24859361d944 100644 --- a/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/tests/Generated/Samples/Sample_DevTestLabPolicyCollection.cs +++ b/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/tests/Samples/Sample_DevTestLabPolicyCollection.cs @@ -1,15 +1,12 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. -// - #nullable disable using System; using System.Threading.Tasks; using Azure.Core; using Azure.Identity; -using Azure.ResourceManager.DevTestLabs.Models; using NUnit.Framework; namespace Azure.ResourceManager.DevTestLabs.Samples @@ -20,7 +17,7 @@ public partial class Sample_DevTestLabPolicyCollection [Ignore("Only validating compilation of examples")] public async Task CreateOrUpdate_PoliciesCreateOrUpdate() { - // Generated from example definition: specification/devtestlabs/resource-manager/Microsoft.DevTestLab/stable/2018-09-15/examples/Policies_CreateOrUpdate.json + // Generated from example definition: 2018-09-15/Policies_CreateOrUpdate.json // this example is just showing the usage of "Policies_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,12 +41,6 @@ public async Task CreateOrUpdate_PoliciesCreateOrUpdate() string name = "{policyName}"; DevTestLabPolicyData data = new DevTestLabPolicyData(new AzureLocation("{location}")) { - Description = "{policyDescription}", - Status = new DevTestLabPolicyStatus("{policyStatus}"), - FactName = new DevTestLabPolicyFactName("{policyFactName}"), - FactData = "{policyFactData}", - Threshold = "{policyThreshold}", - EvaluatorType = new DevTestLabPolicyEvaluatorType("{policyEvaluatorType}"), Tags = { ["tagName1"] = "tagValue1" @@ -69,7 +60,7 @@ public async Task CreateOrUpdate_PoliciesCreateOrUpdate() [Ignore("Only validating compilation of examples")] public async Task Get_PoliciesGet() { - // Generated from example definition: specification/devtestlabs/resource-manager/Microsoft.DevTestLab/stable/2018-09-15/examples/Policies_Get.json + // Generated from example definition: 2018-09-15/Policies_Get.json // this example is just showing the usage of "Policies_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 @@ -104,7 +95,7 @@ public async Task Get_PoliciesGet() [Ignore("Only validating compilation of examples")] public async Task GetAll_PoliciesList() { - // Generated from example definition: specification/devtestlabs/resource-manager/Microsoft.DevTestLab/stable/2018-09-15/examples/Policies_List.json + // Generated from example definition: 2018-09-15/Policies_List.json // this example is just showing the usage of "Policies_List" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line @@ -141,7 +132,7 @@ public async Task GetAll_PoliciesList() [Ignore("Only validating compilation of examples")] public async Task Exists_PoliciesGet() { - // Generated from example definition: specification/devtestlabs/resource-manager/Microsoft.DevTestLab/stable/2018-09-15/examples/Policies_Get.json + // Generated from example definition: 2018-09-15/Policies_Get.json // this example is just showing the usage of "Policies_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 @@ -172,7 +163,7 @@ public async Task Exists_PoliciesGet() [Ignore("Only validating compilation of examples")] public async Task GetIfExists_PoliciesGet() { - // Generated from example definition: specification/devtestlabs/resource-manager/Microsoft.DevTestLab/stable/2018-09-15/examples/Policies_Get.json + // Generated from example definition: 2018-09-15/Policies_Get.json // this example is just showing the usage of "Policies_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/devtestlabs/Azure.ResourceManager.DevTestLabs/tests/Generated/Samples/Sample_DevTestLabPolicyResource.cs b/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/tests/Samples/Sample_DevTestLabPolicyResource.cs similarity index 92% rename from sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/tests/Generated/Samples/Sample_DevTestLabPolicyResource.cs rename to sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/tests/Samples/Sample_DevTestLabPolicyResource.cs index e4c706706669..8c16ad21e092 100644 --- a/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/tests/Generated/Samples/Sample_DevTestLabPolicyResource.cs +++ b/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/tests/Samples/Sample_DevTestLabPolicyResource.cs @@ -1,8 +1,6 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. -// - #nullable disable using System; @@ -20,7 +18,7 @@ public partial class Sample_DevTestLabPolicyResource [Ignore("Only validating compilation of examples")] public async Task Get_PoliciesGet() { - // Generated from example definition: specification/devtestlabs/resource-manager/Microsoft.DevTestLab/stable/2018-09-15/examples/Policies_Get.json + // Generated from example definition: 2018-09-15/Policies_Get.json // this example is just showing the usage of "Policies_Get" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line @@ -52,7 +50,7 @@ public async Task Get_PoliciesGet() [Ignore("Only validating compilation of examples")] public async Task Delete_PoliciesDelete() { - // Generated from example definition: specification/devtestlabs/resource-manager/Microsoft.DevTestLab/stable/2018-09-15/examples/Policies_Delete.json + // Generated from example definition: 2018-09-15/Policies_Delete.json // this example is just showing the usage of "Policies_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 @@ -80,7 +78,7 @@ public async Task Delete_PoliciesDelete() [Ignore("Only validating compilation of examples")] public async Task Update_PoliciesUpdate() { - // Generated from example definition: specification/devtestlabs/resource-manager/Microsoft.DevTestLab/stable/2018-09-15/examples/Policies_Update.json + // Generated from example definition: 2018-09-15/Policies_Update.json // this example is just showing the usage of "Policies_Update" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line diff --git a/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/tests/Generated/Samples/Sample_DevTestLabResource.cs b/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/tests/Samples/Sample_DevTestLabResource.cs similarity index 86% rename from sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/tests/Generated/Samples/Sample_DevTestLabResource.cs rename to sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/tests/Samples/Sample_DevTestLabResource.cs index baee226c9e2f..abf1f8cbadf2 100644 --- a/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/tests/Generated/Samples/Sample_DevTestLabResource.cs +++ b/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/tests/Samples/Sample_DevTestLabResource.cs @@ -1,8 +1,6 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. -// - #nullable disable using System; @@ -21,7 +19,7 @@ public partial class Sample_DevTestLabResource [Ignore("Only validating compilation of examples")] public async Task Get_LabsGet() { - // Generated from example definition: specification/devtestlabs/resource-manager/Microsoft.DevTestLab/stable/2018-09-15/examples/Labs_Get.json + // Generated from example definition: 2018-09-15/Labs_Get.json // this example is just showing the usage of "Labs_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 +49,7 @@ public async Task Get_LabsGet() [Ignore("Only validating compilation of examples")] public async Task Delete_LabsDelete() { - // Generated from example definition: specification/devtestlabs/resource-manager/Microsoft.DevTestLab/stable/2018-09-15/examples/Labs_Delete.json + // Generated from example definition: 2018-09-15/Labs_Delete.json // this example is just showing the usage of "Labs_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 +75,7 @@ public async Task Delete_LabsDelete() [Ignore("Only validating compilation of examples")] public async Task Update_LabsUpdate() { - // Generated from example definition: specification/devtestlabs/resource-manager/Microsoft.DevTestLab/stable/2018-09-15/examples/Labs_Update.json + // Generated from example definition: 2018-09-15/Labs_Update.json // this example is just showing the usage of "Labs_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 @@ -108,7 +106,7 @@ public async Task Update_LabsUpdate() [Ignore("Only validating compilation of examples")] public async Task ClaimAnyVm_LabsClaimAnyVm() { - // Generated from example definition: specification/devtestlabs/resource-manager/Microsoft.DevTestLab/stable/2018-09-15/examples/Labs_ClaimAnyVm.json + // Generated from example definition: 2018-09-15/Labs_ClaimAnyVm.json // this example is just showing the usage of "Labs_ClaimAnyVm" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line @@ -134,7 +132,7 @@ public async Task ClaimAnyVm_LabsClaimAnyVm() [Ignore("Only validating compilation of examples")] public async Task CreateEnvironment_LabsCreateEnvironment() { - // Generated from example definition: specification/devtestlabs/resource-manager/Microsoft.DevTestLab/stable/2018-09-15/examples/Labs_CreateEnvironment.json + // Generated from example definition: 2018-09-15/Labs_CreateEnvironment.json // this example is just showing the usage of "Labs_CreateEnvironment" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line @@ -154,27 +152,11 @@ public async Task CreateEnvironment_LabsCreateEnvironment() DevTestLabVmCreationContent content = new DevTestLabVmCreationContent { Name = "{vmName}", - Location = new AzureLocation("{location}"), + Location = "{location}", Tags = { ["tagName1"] = "tagValue1" }, - Size = "Standard_A2_v2", - UserName = "{userName}", - Password = "{userPassword}", - LabSubnetName = "{virtualnetwork-subnet-name}", - LabVirtualNetworkId = new ResourceIdentifier("/subscriptions/{subscriptionId}/resourcegroups/resourceGroupName/providers/microsoft.devtestlab/labs/{labName}/virtualnetworks/{virtualNetworkName}"), - DisallowPublicIPAddress = true, - GalleryImageReference = new DevTestLabGalleryImageReference - { - Offer = "UbuntuServer", - Publisher = "Canonical", - Sku = "16.04-LTS", - OSType = "Linux", - Version = "Latest", - }, - AllowClaim = true, - StorageType = "Standard", }; await devTestLab.CreateEnvironmentAsync(WaitUntil.Completed, content); @@ -185,7 +167,7 @@ public async Task CreateEnvironment_LabsCreateEnvironment() [Ignore("Only validating compilation of examples")] public async Task ExportResourceUsage_LabsExportResourceUsage() { - // Generated from example definition: specification/devtestlabs/resource-manager/Microsoft.DevTestLab/stable/2018-09-15/examples/Labs_ExportResourceUsage.json + // Generated from example definition: 2018-09-15/Labs_ExportResourceUsage.json // this example is just showing the usage of "Labs_ExportResourceUsage" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line @@ -216,7 +198,7 @@ public async Task ExportResourceUsage_LabsExportResourceUsage() [Ignore("Only validating compilation of examples")] public async Task GenerateUploadUri_LabsGenerateUploadUri() { - // Generated from example definition: specification/devtestlabs/resource-manager/Microsoft.DevTestLab/stable/2018-09-15/examples/Labs_GenerateUploadUri.json + // Generated from example definition: 2018-09-15/Labs_GenerateUploadUri.json // this example is just showing the usage of "Labs_GenerateUploadUri" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line @@ -246,7 +228,7 @@ public async Task GenerateUploadUri_LabsGenerateUploadUri() [Ignore("Only validating compilation of examples")] public async Task ImportVm_LabsImportVirtualMachine() { - // Generated from example definition: specification/devtestlabs/resource-manager/Microsoft.DevTestLab/stable/2018-09-15/examples/Labs_ImportVirtualMachine.json + // Generated from example definition: 2018-09-15/Labs_ImportVirtualMachine.json // this example is just showing the usage of "Labs_ImportVm" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line @@ -277,7 +259,7 @@ public async Task ImportVm_LabsImportVirtualMachine() [Ignore("Only validating compilation of examples")] public async Task GetVhds_LabsListVhds() { - // Generated from example definition: specification/devtestlabs/resource-manager/Microsoft.DevTestLab/stable/2018-09-15/examples/Labs_ListVhds.json + // Generated from example definition: 2018-09-15/Labs_ListVhds.json // this example is just showing the usage of "Labs_ListVhds" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line @@ -294,7 +276,7 @@ public async Task GetVhds_LabsListVhds() DevTestLabResource devTestLab = client.GetDevTestLabResource(devTestLabResourceId); // invoke the operation and iterate over the result - await foreach (SubResource item in devTestLab.GetVhdsAsync()) + await foreach (DevTestLabVhd item in devTestLab.GetDevTestLabVhdsAsync()) { Console.WriteLine($"Succeeded: {item}"); } @@ -306,8 +288,8 @@ public async Task GetVhds_LabsListVhds() [Ignore("Only validating compilation of examples")] public async Task GetGalleryImages_GalleryImagesList() { - // Generated from example definition: specification/devtestlabs/resource-manager/Microsoft.DevTestLab/stable/2018-09-15/examples/GalleryImages_List.json - // this example is just showing the usage of "GalleryImages_List" operation, for the dependent resources, they will have to be created separately. + // Generated from example definition: 2018-09-15/GalleryImages_List.json + // this example is just showing the usage of "GalleryImage_List" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line TokenCredential cred = new DefaultAzureCredential(); @@ -335,7 +317,7 @@ public async Task GetGalleryImages_GalleryImagesList() [Ignore("Only validating compilation of examples")] public async Task EvaluatePolicies_PolicySetsEvaluatePolicies() { - // Generated from example definition: specification/devtestlabs/resource-manager/Microsoft.DevTestLab/stable/2018-09-15/examples/PolicySets_EvaluatePolicies.json + // Generated from example definition: 2018-09-15/PolicySets_EvaluatePolicies.json // this example is just showing the usage of "PolicySets_EvaluatePolicies" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details 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/devtestlabs/Azure.ResourceManager.DevTestLabs/tests/Generated/Samples/Sample_DevTestLabSecretCollection.cs b/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/tests/Samples/Sample_DevTestLabSecretCollection.cs similarity index 92% rename from sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/tests/Generated/Samples/Sample_DevTestLabSecretCollection.cs rename to sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/tests/Samples/Sample_DevTestLabSecretCollection.cs index 07a25deeeb0a..4b80b00a0611 100644 --- a/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/tests/Generated/Samples/Sample_DevTestLabSecretCollection.cs +++ b/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/tests/Samples/Sample_DevTestLabSecretCollection.cs @@ -1,8 +1,6 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. -// - #nullable disable using System; @@ -19,7 +17,7 @@ public partial class Sample_DevTestLabSecretCollection [Ignore("Only validating compilation of examples")] public async Task CreateOrUpdate_SecretsCreateOrUpdate() { - // Generated from example definition: specification/devtestlabs/resource-manager/Microsoft.DevTestLab/stable/2018-09-15/examples/Secrets_CreateOrUpdate.json + // Generated from example definition: 2018-09-15/Secrets_CreateOrUpdate.json // this example is just showing the usage of "Secrets_CreateOrUpdate" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line @@ -41,10 +39,7 @@ public async Task CreateOrUpdate_SecretsCreateOrUpdate() // invoke the operation string name = "{secretName}"; - DevTestLabSecretData data = new DevTestLabSecretData(default) - { - Value = "{secret}", - }; + DevTestLabSecretData data = new DevTestLabSecretData(default); ArmOperation lro = await collection.CreateOrUpdateAsync(WaitUntil.Completed, name, data); DevTestLabSecretResource result = lro.Value; @@ -59,7 +54,7 @@ public async Task CreateOrUpdate_SecretsCreateOrUpdate() [Ignore("Only validating compilation of examples")] public async Task Get_SecretsGet() { - // Generated from example definition: specification/devtestlabs/resource-manager/Microsoft.DevTestLab/stable/2018-09-15/examples/Secrets_Get.json + // Generated from example definition: 2018-09-15/Secrets_Get.json // this example is just showing the usage of "Secrets_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 @@ -94,7 +89,7 @@ public async Task Get_SecretsGet() [Ignore("Only validating compilation of examples")] public async Task GetAll_SecretsList() { - // Generated from example definition: specification/devtestlabs/resource-manager/Microsoft.DevTestLab/stable/2018-09-15/examples/Secrets_List.json + // Generated from example definition: 2018-09-15/Secrets_List.json // this example is just showing the usage of "Secrets_List" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line @@ -131,7 +126,7 @@ public async Task GetAll_SecretsList() [Ignore("Only validating compilation of examples")] public async Task Exists_SecretsGet() { - // Generated from example definition: specification/devtestlabs/resource-manager/Microsoft.DevTestLab/stable/2018-09-15/examples/Secrets_Get.json + // Generated from example definition: 2018-09-15/Secrets_Get.json // this example is just showing the usage of "Secrets_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 @@ -162,7 +157,7 @@ public async Task Exists_SecretsGet() [Ignore("Only validating compilation of examples")] public async Task GetIfExists_SecretsGet() { - // Generated from example definition: specification/devtestlabs/resource-manager/Microsoft.DevTestLab/stable/2018-09-15/examples/Secrets_Get.json + // Generated from example definition: 2018-09-15/Secrets_Get.json // this example is just showing the usage of "Secrets_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/devtestlabs/Azure.ResourceManager.DevTestLabs/tests/Generated/Samples/Sample_DevTestLabSecretResource.cs b/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/tests/Samples/Sample_DevTestLabSecretResource.cs similarity index 92% rename from sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/tests/Generated/Samples/Sample_DevTestLabSecretResource.cs rename to sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/tests/Samples/Sample_DevTestLabSecretResource.cs index a99bdaffae16..db77b5253183 100644 --- a/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/tests/Generated/Samples/Sample_DevTestLabSecretResource.cs +++ b/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/tests/Samples/Sample_DevTestLabSecretResource.cs @@ -1,8 +1,6 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. -// - #nullable disable using System; @@ -20,7 +18,7 @@ public partial class Sample_DevTestLabSecretResource [Ignore("Only validating compilation of examples")] public async Task Get_SecretsGet() { - // Generated from example definition: specification/devtestlabs/resource-manager/Microsoft.DevTestLab/stable/2018-09-15/examples/Secrets_Get.json + // Generated from example definition: 2018-09-15/Secrets_Get.json // this example is just showing the usage of "Secrets_Get" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line @@ -52,7 +50,7 @@ public async Task Get_SecretsGet() [Ignore("Only validating compilation of examples")] public async Task Delete_SecretsDelete() { - // Generated from example definition: specification/devtestlabs/resource-manager/Microsoft.DevTestLab/stable/2018-09-15/examples/Secrets_Delete.json + // Generated from example definition: 2018-09-15/Secrets_Delete.json // this example is just showing the usage of "Secrets_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 @@ -80,7 +78,7 @@ public async Task Delete_SecretsDelete() [Ignore("Only validating compilation of examples")] public async Task Update_SecretsUpdate() { - // Generated from example definition: specification/devtestlabs/resource-manager/Microsoft.DevTestLab/stable/2018-09-15/examples/Secrets_Update.json + // Generated from example definition: 2018-09-15/Secrets_Update.json // this example is just showing the usage of "Secrets_Update" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line diff --git a/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/tests/Generated/Samples/Sample_DevTestLabServiceFabricCollection.cs b/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/tests/Samples/Sample_DevTestLabServiceFabricCollection.cs similarity index 92% rename from sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/tests/Generated/Samples/Sample_DevTestLabServiceFabricCollection.cs rename to sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/tests/Samples/Sample_DevTestLabServiceFabricCollection.cs index 5925daf97003..65112d57dde0 100644 --- a/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/tests/Generated/Samples/Sample_DevTestLabServiceFabricCollection.cs +++ b/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/tests/Samples/Sample_DevTestLabServiceFabricCollection.cs @@ -1,8 +1,6 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. -// - #nullable disable using System; @@ -19,7 +17,7 @@ public partial class Sample_DevTestLabServiceFabricCollection [Ignore("Only validating compilation of examples")] public async Task CreateOrUpdate_ServiceFabricsCreateOrUpdate() { - // Generated from example definition: specification/devtestlabs/resource-manager/Microsoft.DevTestLab/stable/2018-09-15/examples/ServiceFabrics_CreateOrUpdate.json + // Generated from example definition: 2018-09-15/ServiceFabrics_CreateOrUpdate.json // this example is just showing the usage of "ServiceFabrics_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,8 +41,6 @@ public async Task CreateOrUpdate_ServiceFabricsCreateOrUpdate() string name = "{serviceFabricName}"; DevTestLabServiceFabricData data = new DevTestLabServiceFabricData(new AzureLocation("{location}")) { - ExternalServiceFabricId = "{serviceFabricId}", - EnvironmentId = "{environmentId}", Tags = { ["tagName1"] = "tagValue1" @@ -64,7 +60,7 @@ public async Task CreateOrUpdate_ServiceFabricsCreateOrUpdate() [Ignore("Only validating compilation of examples")] public async Task Get_ServiceFabricsGet() { - // Generated from example definition: specification/devtestlabs/resource-manager/Microsoft.DevTestLab/stable/2018-09-15/examples/ServiceFabrics_Get.json + // Generated from example definition: 2018-09-15/ServiceFabrics_Get.json // this example is just showing the usage of "ServiceFabrics_Get" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line @@ -99,7 +95,7 @@ public async Task Get_ServiceFabricsGet() [Ignore("Only validating compilation of examples")] public async Task GetAll_ServiceFabricsList() { - // Generated from example definition: specification/devtestlabs/resource-manager/Microsoft.DevTestLab/stable/2018-09-15/examples/ServiceFabrics_List.json + // Generated from example definition: 2018-09-15/ServiceFabrics_List.json // this example is just showing the usage of "ServiceFabrics_List" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line @@ -136,7 +132,7 @@ public async Task GetAll_ServiceFabricsList() [Ignore("Only validating compilation of examples")] public async Task Exists_ServiceFabricsGet() { - // Generated from example definition: specification/devtestlabs/resource-manager/Microsoft.DevTestLab/stable/2018-09-15/examples/ServiceFabrics_Get.json + // Generated from example definition: 2018-09-15/ServiceFabrics_Get.json // this example is just showing the usage of "ServiceFabrics_Get" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line @@ -167,7 +163,7 @@ public async Task Exists_ServiceFabricsGet() [Ignore("Only validating compilation of examples")] public async Task GetIfExists_ServiceFabricsGet() { - // Generated from example definition: specification/devtestlabs/resource-manager/Microsoft.DevTestLab/stable/2018-09-15/examples/ServiceFabrics_Get.json + // Generated from example definition: 2018-09-15/ServiceFabrics_Get.json // this example is just showing the usage of "ServiceFabrics_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/devtestlabs/Azure.ResourceManager.DevTestLabs/tests/Generated/Samples/Sample_DevTestLabServiceFabricResource.cs b/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/tests/Samples/Sample_DevTestLabServiceFabricResource.cs similarity index 91% rename from sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/tests/Generated/Samples/Sample_DevTestLabServiceFabricResource.cs rename to sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/tests/Samples/Sample_DevTestLabServiceFabricResource.cs index 544464bd91a6..3490f465b2d1 100644 --- a/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/tests/Generated/Samples/Sample_DevTestLabServiceFabricResource.cs +++ b/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/tests/Samples/Sample_DevTestLabServiceFabricResource.cs @@ -1,8 +1,6 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. -// - #nullable disable using System; @@ -20,7 +18,7 @@ public partial class Sample_DevTestLabServiceFabricResource [Ignore("Only validating compilation of examples")] public async Task Get_ServiceFabricsGet() { - // Generated from example definition: specification/devtestlabs/resource-manager/Microsoft.DevTestLab/stable/2018-09-15/examples/ServiceFabrics_Get.json + // Generated from example definition: 2018-09-15/ServiceFabrics_Get.json // this example is just showing the usage of "ServiceFabrics_Get" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line @@ -52,7 +50,7 @@ public async Task Get_ServiceFabricsGet() [Ignore("Only validating compilation of examples")] public async Task Delete_ServiceFabricsDelete() { - // Generated from example definition: specification/devtestlabs/resource-manager/Microsoft.DevTestLab/stable/2018-09-15/examples/ServiceFabrics_Delete.json + // Generated from example definition: 2018-09-15/ServiceFabrics_Delete.json // this example is just showing the usage of "ServiceFabrics_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 @@ -80,7 +78,7 @@ public async Task Delete_ServiceFabricsDelete() [Ignore("Only validating compilation of examples")] public async Task Update_ServiceFabricsUpdate() { - // Generated from example definition: specification/devtestlabs/resource-manager/Microsoft.DevTestLab/stable/2018-09-15/examples/ServiceFabrics_Update.json + // Generated from example definition: 2018-09-15/ServiceFabrics_Update.json // this example is just showing the usage of "ServiceFabrics_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 @@ -119,7 +117,7 @@ public async Task Update_ServiceFabricsUpdate() [Ignore("Only validating compilation of examples")] public async Task GetApplicableSchedules_ServiceFabricsListApplicableSchedules() { - // Generated from example definition: specification/devtestlabs/resource-manager/Microsoft.DevTestLab/stable/2018-09-15/examples/ServiceFabrics_ListApplicableSchedules.json + // Generated from example definition: 2018-09-15/ServiceFabrics_ListApplicableSchedules.json // this example is just showing the usage of "ServiceFabrics_ListApplicableSchedules" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line @@ -147,7 +145,7 @@ public async Task GetApplicableSchedules_ServiceFabricsListApplicableSchedules() [Ignore("Only validating compilation of examples")] public async Task Start_ServiceFabricsStart() { - // Generated from example definition: specification/devtestlabs/resource-manager/Microsoft.DevTestLab/stable/2018-09-15/examples/ServiceFabrics_Start.json + // Generated from example definition: 2018-09-15/ServiceFabrics_Start.json // this example is just showing the usage of "ServiceFabrics_Start" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line @@ -175,7 +173,7 @@ public async Task Start_ServiceFabricsStart() [Ignore("Only validating compilation of examples")] public async Task Stop_ServiceFabricsStop() { - // Generated from example definition: specification/devtestlabs/resource-manager/Microsoft.DevTestLab/stable/2018-09-15/examples/ServiceFabrics_Stop.json + // Generated from example definition: 2018-09-15/ServiceFabrics_Stop.json // this example is just showing the usage of "ServiceFabrics_Stop" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details 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/devtestlabs/Azure.ResourceManager.DevTestLabs/tests/Generated/Samples/Sample_DevTestLabServiceRunnerCollection.cs b/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/tests/Samples/Sample_DevTestLabServiceRunnerCollection.cs similarity index 92% rename from sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/tests/Generated/Samples/Sample_DevTestLabServiceRunnerCollection.cs rename to sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/tests/Samples/Sample_DevTestLabServiceRunnerCollection.cs index aad7c3c2ad44..6d21add3a94b 100644 --- a/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/tests/Generated/Samples/Sample_DevTestLabServiceRunnerCollection.cs +++ b/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/tests/Samples/Sample_DevTestLabServiceRunnerCollection.cs @@ -1,8 +1,6 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. -// - #nullable disable using System; @@ -20,7 +18,7 @@ public partial class Sample_DevTestLabServiceRunnerCollection [Ignore("Only validating compilation of examples")] public async Task CreateOrUpdate_ServiceRunnersCreateOrUpdate() { - // Generated from example definition: specification/devtestlabs/resource-manager/Microsoft.DevTestLab/stable/2018-09-15/examples/ServiceRunners_CreateOrUpdate.json + // Generated from example definition: 2018-09-15/ServiceRunners_CreateOrUpdate.json // this example is just showing the usage of "ServiceRunners_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 @@ -69,7 +67,7 @@ public async Task CreateOrUpdate_ServiceRunnersCreateOrUpdate() [Ignore("Only validating compilation of examples")] public async Task Get_ServiceRunnersGet() { - // Generated from example definition: specification/devtestlabs/resource-manager/Microsoft.DevTestLab/stable/2018-09-15/examples/ServiceRunners_Get.json + // Generated from example definition: 2018-09-15/ServiceRunners_Get.json // this example is just showing the usage of "ServiceRunners_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 @@ -103,7 +101,7 @@ public async Task Get_ServiceRunnersGet() [Ignore("Only validating compilation of examples")] public async Task Exists_ServiceRunnersGet() { - // Generated from example definition: specification/devtestlabs/resource-manager/Microsoft.DevTestLab/stable/2018-09-15/examples/ServiceRunners_Get.json + // Generated from example definition: 2018-09-15/ServiceRunners_Get.json // this example is just showing the usage of "ServiceRunners_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 @@ -133,7 +131,7 @@ public async Task Exists_ServiceRunnersGet() [Ignore("Only validating compilation of examples")] public async Task GetIfExists_ServiceRunnersGet() { - // Generated from example definition: specification/devtestlabs/resource-manager/Microsoft.DevTestLab/stable/2018-09-15/examples/ServiceRunners_Get.json + // Generated from example definition: 2018-09-15/ServiceRunners_Get.json // this example is just showing the usage of "ServiceRunners_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/devtestlabs/Azure.ResourceManager.DevTestLabs/tests/Generated/Samples/Sample_DevTestLabServiceRunnerResource.cs b/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/tests/Samples/Sample_DevTestLabServiceRunnerResource.cs similarity index 92% rename from sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/tests/Generated/Samples/Sample_DevTestLabServiceRunnerResource.cs rename to sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/tests/Samples/Sample_DevTestLabServiceRunnerResource.cs index ead81ce17c4f..d31bb9235c45 100644 --- a/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/tests/Generated/Samples/Sample_DevTestLabServiceRunnerResource.cs +++ b/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/tests/Samples/Sample_DevTestLabServiceRunnerResource.cs @@ -1,8 +1,6 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. -// - #nullable disable using System; @@ -20,7 +18,7 @@ public partial class Sample_DevTestLabServiceRunnerResource [Ignore("Only validating compilation of examples")] public async Task Get_ServiceRunnersGet() { - // Generated from example definition: specification/devtestlabs/resource-manager/Microsoft.DevTestLab/stable/2018-09-15/examples/ServiceRunners_Get.json + // Generated from example definition: 2018-09-15/ServiceRunners_Get.json // this example is just showing the usage of "ServiceRunners_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 +49,7 @@ public async Task Get_ServiceRunnersGet() [Ignore("Only validating compilation of examples")] public async Task Delete_ServiceRunnersDelete() { - // Generated from example definition: specification/devtestlabs/resource-manager/Microsoft.DevTestLab/stable/2018-09-15/examples/ServiceRunners_Delete.json + // Generated from example definition: 2018-09-15/ServiceRunners_Delete.json // this example is just showing the usage of "ServiceRunners_Delete" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line @@ -78,7 +76,7 @@ public async Task Delete_ServiceRunnersDelete() [Ignore("Only validating compilation of examples")] public async Task Update_ServiceRunnersCreateOrUpdate() { - // Generated from example definition: specification/devtestlabs/resource-manager/Microsoft.DevTestLab/stable/2018-09-15/examples/ServiceRunners_CreateOrUpdate.json + // Generated from example definition: 2018-09-15/ServiceRunners_CreateOrUpdate.json // this example is just showing the usage of "ServiceRunners_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 diff --git a/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/tests/Generated/Samples/Sample_DevTestLabUserCollection.cs b/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/tests/Samples/Sample_DevTestLabUserCollection.cs similarity index 87% rename from sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/tests/Generated/Samples/Sample_DevTestLabUserCollection.cs rename to sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/tests/Samples/Sample_DevTestLabUserCollection.cs index 28940a417305..1351a2c57ac1 100644 --- a/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/tests/Generated/Samples/Sample_DevTestLabUserCollection.cs +++ b/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/tests/Samples/Sample_DevTestLabUserCollection.cs @@ -1,15 +1,12 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. -// - #nullable disable using System; using System.Threading.Tasks; using Azure.Core; using Azure.Identity; -using Azure.ResourceManager.DevTestLabs.Models; using NUnit.Framework; namespace Azure.ResourceManager.DevTestLabs.Samples @@ -20,7 +17,7 @@ public partial class Sample_DevTestLabUserCollection [Ignore("Only validating compilation of examples")] public async Task CreateOrUpdate_UsersCreateOrUpdate() { - // Generated from example definition: specification/devtestlabs/resource-manager/Microsoft.DevTestLab/stable/2018-09-15/examples/Users_CreateOrUpdate.json + // Generated from example definition: 2018-09-15/Users_CreateOrUpdate.json // this example is just showing the usage of "Users_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,19 +40,6 @@ public async Task CreateOrUpdate_UsersCreateOrUpdate() string name = "{userName}"; DevTestLabUserData data = new DevTestLabUserData(new AzureLocation("{location}")) { - Identity = new DevTestLabUserIdentity - { - PrincipalName = "{principalName}", - PrincipalId = "{principalId}", - TenantId = Guid.Parse("{tenantId}"), - ObjectId = "{objectId}", - AppId = "{appId}", - }, - SecretStore = new DevTestLabUserSecretStore - { - KeyVaultUri = new Uri("{keyVaultUri}"), - KeyVaultId = new ResourceIdentifier("{keyVaultId}"), - }, Tags = { ["tagName1"] = "tagValue1" @@ -75,7 +59,7 @@ public async Task CreateOrUpdate_UsersCreateOrUpdate() [Ignore("Only validating compilation of examples")] public async Task Get_UsersGet() { - // Generated from example definition: specification/devtestlabs/resource-manager/Microsoft.DevTestLab/stable/2018-09-15/examples/Users_Get.json + // Generated from example definition: 2018-09-15/Users_Get.json // this example is just showing the usage of "Users_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 +93,7 @@ public async Task Get_UsersGet() [Ignore("Only validating compilation of examples")] public async Task GetAll_UsersList() { - // Generated from example definition: specification/devtestlabs/resource-manager/Microsoft.DevTestLab/stable/2018-09-15/examples/Users_List.json + // Generated from example definition: 2018-09-15/Users_List.json // this example is just showing the usage of "Users_List" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line @@ -145,7 +129,7 @@ public async Task GetAll_UsersList() [Ignore("Only validating compilation of examples")] public async Task Exists_UsersGet() { - // Generated from example definition: specification/devtestlabs/resource-manager/Microsoft.DevTestLab/stable/2018-09-15/examples/Users_Get.json + // Generated from example definition: 2018-09-15/Users_Get.json // this example is just showing the usage of "Users_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 @@ -175,7 +159,7 @@ public async Task Exists_UsersGet() [Ignore("Only validating compilation of examples")] public async Task GetIfExists_UsersGet() { - // Generated from example definition: specification/devtestlabs/resource-manager/Microsoft.DevTestLab/stable/2018-09-15/examples/Users_Get.json + // Generated from example definition: 2018-09-15/Users_Get.json // this example is just showing the usage of "Users_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/devtestlabs/Azure.ResourceManager.DevTestLabs/tests/Generated/Samples/Sample_DevTestLabUserResource.cs b/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/tests/Samples/Sample_DevTestLabUserResource.cs similarity index 92% rename from sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/tests/Generated/Samples/Sample_DevTestLabUserResource.cs rename to sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/tests/Samples/Sample_DevTestLabUserResource.cs index 28ed12749b90..ae33548319b2 100644 --- a/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/tests/Generated/Samples/Sample_DevTestLabUserResource.cs +++ b/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/tests/Samples/Sample_DevTestLabUserResource.cs @@ -1,8 +1,6 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. -// - #nullable disable using System; @@ -20,7 +18,7 @@ public partial class Sample_DevTestLabUserResource [Ignore("Only validating compilation of examples")] public async Task Get_UsersGet() { - // Generated from example definition: specification/devtestlabs/resource-manager/Microsoft.DevTestLab/stable/2018-09-15/examples/Users_Get.json + // Generated from example definition: 2018-09-15/Users_Get.json // this example is just showing the usage of "Users_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 +49,7 @@ public async Task Get_UsersGet() [Ignore("Only validating compilation of examples")] public async Task Delete_UsersDelete() { - // Generated from example definition: specification/devtestlabs/resource-manager/Microsoft.DevTestLab/stable/2018-09-15/examples/Users_Delete.json + // Generated from example definition: 2018-09-15/Users_Delete.json // this example is just showing the usage of "Users_Delete" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line @@ -78,7 +76,7 @@ public async Task Delete_UsersDelete() [Ignore("Only validating compilation of examples")] public async Task Update_UsersUpdate() { - // Generated from example definition: specification/devtestlabs/resource-manager/Microsoft.DevTestLab/stable/2018-09-15/examples/Users_Update.json + // Generated from example definition: 2018-09-15/Users_Update.json // this example is just showing the usage of "Users_Update" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line diff --git a/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/tests/Generated/Samples/Sample_DevTestLabVirtualNetworkCollection.cs b/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/tests/Samples/Sample_DevTestLabVirtualNetworkCollection.cs similarity index 92% rename from sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/tests/Generated/Samples/Sample_DevTestLabVirtualNetworkCollection.cs rename to sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/tests/Samples/Sample_DevTestLabVirtualNetworkCollection.cs index f70011bbacb9..ad4eba39af5b 100644 --- a/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/tests/Generated/Samples/Sample_DevTestLabVirtualNetworkCollection.cs +++ b/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/tests/Samples/Sample_DevTestLabVirtualNetworkCollection.cs @@ -1,8 +1,6 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. -// - #nullable disable using System; @@ -19,7 +17,7 @@ public partial class Sample_DevTestLabVirtualNetworkCollection [Ignore("Only validating compilation of examples")] public async Task CreateOrUpdate_VirtualNetworksCreateOrUpdate() { - // Generated from example definition: specification/devtestlabs/resource-manager/Microsoft.DevTestLab/stable/2018-09-15/examples/VirtualNetworks_CreateOrUpdate.json + // Generated from example definition: 2018-09-15/VirtualNetworks_CreateOrUpdate.json // this example is just showing the usage of "VirtualNetworks_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 @@ -61,7 +59,7 @@ public async Task CreateOrUpdate_VirtualNetworksCreateOrUpdate() [Ignore("Only validating compilation of examples")] public async Task Get_VirtualNetworksGet() { - // Generated from example definition: specification/devtestlabs/resource-manager/Microsoft.DevTestLab/stable/2018-09-15/examples/VirtualNetworks_Get.json + // Generated from example definition: 2018-09-15/VirtualNetworks_Get.json // this example is just showing the usage of "VirtualNetworks_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 @@ -95,7 +93,7 @@ public async Task Get_VirtualNetworksGet() [Ignore("Only validating compilation of examples")] public async Task GetAll_VirtualNetworksList() { - // Generated from example definition: specification/devtestlabs/resource-manager/Microsoft.DevTestLab/stable/2018-09-15/examples/VirtualNetworks_List.json + // Generated from example definition: 2018-09-15/VirtualNetworks_List.json // this example is just showing the usage of "VirtualNetworks_List" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line @@ -131,7 +129,7 @@ public async Task GetAll_VirtualNetworksList() [Ignore("Only validating compilation of examples")] public async Task Exists_VirtualNetworksGet() { - // Generated from example definition: specification/devtestlabs/resource-manager/Microsoft.DevTestLab/stable/2018-09-15/examples/VirtualNetworks_Get.json + // Generated from example definition: 2018-09-15/VirtualNetworks_Get.json // this example is just showing the usage of "VirtualNetworks_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 @@ -161,7 +159,7 @@ public async Task Exists_VirtualNetworksGet() [Ignore("Only validating compilation of examples")] public async Task GetIfExists_VirtualNetworksGet() { - // Generated from example definition: specification/devtestlabs/resource-manager/Microsoft.DevTestLab/stable/2018-09-15/examples/VirtualNetworks_Get.json + // Generated from example definition: 2018-09-15/VirtualNetworks_Get.json // this example is just showing the usage of "VirtualNetworks_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/devtestlabs/Azure.ResourceManager.DevTestLabs/tests/Generated/Samples/Sample_DevTestLabVirtualNetworkResource.cs b/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/tests/Samples/Sample_DevTestLabVirtualNetworkResource.cs similarity index 92% rename from sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/tests/Generated/Samples/Sample_DevTestLabVirtualNetworkResource.cs rename to sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/tests/Samples/Sample_DevTestLabVirtualNetworkResource.cs index 8595c3d01795..1ec791536df6 100644 --- a/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/tests/Generated/Samples/Sample_DevTestLabVirtualNetworkResource.cs +++ b/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/tests/Samples/Sample_DevTestLabVirtualNetworkResource.cs @@ -1,8 +1,6 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. -// - #nullable disable using System; @@ -20,7 +18,7 @@ public partial class Sample_DevTestLabVirtualNetworkResource [Ignore("Only validating compilation of examples")] public async Task Get_VirtualNetworksGet() { - // Generated from example definition: specification/devtestlabs/resource-manager/Microsoft.DevTestLab/stable/2018-09-15/examples/VirtualNetworks_Get.json + // Generated from example definition: 2018-09-15/VirtualNetworks_Get.json // this example is just showing the usage of "VirtualNetworks_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 +49,7 @@ public async Task Get_VirtualNetworksGet() [Ignore("Only validating compilation of examples")] public async Task Delete_VirtualNetworksDelete() { - // Generated from example definition: specification/devtestlabs/resource-manager/Microsoft.DevTestLab/stable/2018-09-15/examples/VirtualNetworks_Delete.json + // Generated from example definition: 2018-09-15/VirtualNetworks_Delete.json // this example is just showing the usage of "VirtualNetworks_Delete" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line @@ -78,7 +76,7 @@ public async Task Delete_VirtualNetworksDelete() [Ignore("Only validating compilation of examples")] public async Task Update_VirtualNetworksUpdate() { - // Generated from example definition: specification/devtestlabs/resource-manager/Microsoft.DevTestLab/stable/2018-09-15/examples/VirtualNetworks_Update.json + // Generated from example definition: 2018-09-15/VirtualNetworks_Update.json // this example is just showing the usage of "VirtualNetworks_Update" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line diff --git a/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/tests/Generated/Samples/Sample_DevTestLabVmCollection.cs b/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/tests/Samples/Sample_DevTestLabVmCollection.cs similarity index 85% rename from sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/tests/Generated/Samples/Sample_DevTestLabVmCollection.cs rename to sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/tests/Samples/Sample_DevTestLabVmCollection.cs index 92816b5df17d..7d02decfc8a7 100644 --- a/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/tests/Generated/Samples/Sample_DevTestLabVmCollection.cs +++ b/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/tests/Samples/Sample_DevTestLabVmCollection.cs @@ -1,15 +1,12 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. -// - #nullable disable using System; using System.Threading.Tasks; using Azure.Core; using Azure.Identity; -using Azure.ResourceManager.DevTestLabs.Models; using NUnit.Framework; namespace Azure.ResourceManager.DevTestLabs.Samples @@ -20,7 +17,7 @@ public partial class Sample_DevTestLabVmCollection [Ignore("Only validating compilation of examples")] public async Task CreateOrUpdate_VirtualMachinesCreateOrUpdate() { - // Generated from example definition: specification/devtestlabs/resource-manager/Microsoft.DevTestLab/stable/2018-09-15/examples/VirtualMachines_CreateOrUpdate.json + // Generated from example definition: 2018-09-15/VirtualMachines_CreateOrUpdate.json // this example is just showing the usage of "VirtualMachines_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,22 +40,6 @@ public async Task CreateOrUpdate_VirtualMachinesCreateOrUpdate() string name = "{vmName}"; DevTestLabVmData data = new DevTestLabVmData(new AzureLocation("{location}")) { - Size = "Standard_A2_v2", - UserName = "{userName}", - Password = "{userPassword}", - LabSubnetName = "{virtualNetworkName}Subnet", - LabVirtualNetworkId = new ResourceIdentifier("/subscriptions/{subscriptionId}/resourcegroups/resourceGroupName/providers/microsoft.devtestlab/labs/{labName}/virtualnetworks/{virtualNetworkName}"), - DisallowPublicIPAddress = true, - GalleryImageReference = new DevTestLabGalleryImageReference - { - Offer = "UbuntuServer", - Publisher = "Canonical", - Sku = "16.04-LTS", - OSType = "Linux", - Version = "Latest", - }, - AllowClaim = true, - StorageType = "Standard", Tags = { ["tagName1"] = "tagValue1" @@ -78,7 +59,7 @@ public async Task CreateOrUpdate_VirtualMachinesCreateOrUpdate() [Ignore("Only validating compilation of examples")] public async Task Get_VirtualMachinesGet() { - // Generated from example definition: specification/devtestlabs/resource-manager/Microsoft.DevTestLab/stable/2018-09-15/examples/VirtualMachines_Get.json + // Generated from example definition: 2018-09-15/VirtualMachines_Get.json // this example is just showing the usage of "VirtualMachines_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 @@ -112,7 +93,7 @@ public async Task Get_VirtualMachinesGet() [Ignore("Only validating compilation of examples")] public async Task GetAll_VirtualMachinesList() { - // Generated from example definition: specification/devtestlabs/resource-manager/Microsoft.DevTestLab/stable/2018-09-15/examples/VirtualMachines_List.json + // Generated from example definition: 2018-09-15/VirtualMachines_List.json // this example is just showing the usage of "VirtualMachines_List" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line @@ -148,7 +129,7 @@ public async Task GetAll_VirtualMachinesList() [Ignore("Only validating compilation of examples")] public async Task Exists_VirtualMachinesGet() { - // Generated from example definition: specification/devtestlabs/resource-manager/Microsoft.DevTestLab/stable/2018-09-15/examples/VirtualMachines_Get.json + // Generated from example definition: 2018-09-15/VirtualMachines_Get.json // this example is just showing the usage of "VirtualMachines_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 @@ -178,7 +159,7 @@ public async Task Exists_VirtualMachinesGet() [Ignore("Only validating compilation of examples")] public async Task GetIfExists_VirtualMachinesGet() { - // Generated from example definition: specification/devtestlabs/resource-manager/Microsoft.DevTestLab/stable/2018-09-15/examples/VirtualMachines_Get.json + // Generated from example definition: 2018-09-15/VirtualMachines_Get.json // this example is just showing the usage of "VirtualMachines_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/devtestlabs/Azure.ResourceManager.DevTestLabs/tests/Generated/Samples/Sample_DevTestLabVmResource.cs b/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/tests/Samples/Sample_DevTestLabVmResource.cs similarity index 90% rename from sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/tests/Generated/Samples/Sample_DevTestLabVmResource.cs rename to sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/tests/Samples/Sample_DevTestLabVmResource.cs index aa8814d37cb8..c728df3ce740 100644 --- a/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/tests/Generated/Samples/Sample_DevTestLabVmResource.cs +++ b/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/tests/Samples/Sample_DevTestLabVmResource.cs @@ -1,8 +1,6 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. -// - #nullable disable using System; @@ -20,7 +18,7 @@ public partial class Sample_DevTestLabVmResource [Ignore("Only validating compilation of examples")] public async Task Get_VirtualMachinesGet() { - // Generated from example definition: specification/devtestlabs/resource-manager/Microsoft.DevTestLab/stable/2018-09-15/examples/VirtualMachines_Get.json + // Generated from example definition: 2018-09-15/VirtualMachines_Get.json // this example is just showing the usage of "VirtualMachines_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 +49,7 @@ public async Task Get_VirtualMachinesGet() [Ignore("Only validating compilation of examples")] public async Task Delete_VirtualMachinesDelete() { - // Generated from example definition: specification/devtestlabs/resource-manager/Microsoft.DevTestLab/stable/2018-09-15/examples/VirtualMachines_Delete.json + // Generated from example definition: 2018-09-15/VirtualMachines_Delete.json // this example is just showing the usage of "VirtualMachines_Delete" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line @@ -78,7 +76,7 @@ public async Task Delete_VirtualMachinesDelete() [Ignore("Only validating compilation of examples")] public async Task Update_VirtualMachinesUpdate() { - // Generated from example definition: specification/devtestlabs/resource-manager/Microsoft.DevTestLab/stable/2018-09-15/examples/VirtualMachines_Update.json + // Generated from example definition: 2018-09-15/VirtualMachines_Update.json // this example is just showing the usage of "VirtualMachines_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 @@ -110,7 +108,7 @@ public async Task Update_VirtualMachinesUpdate() [Ignore("Only validating compilation of examples")] public async Task AddDataDisk_VirtualMachinesAddDataDisk() { - // Generated from example definition: specification/devtestlabs/resource-manager/Microsoft.DevTestLab/stable/2018-09-15/examples/VirtualMachines_AddDataDisk.json + // Generated from example definition: 2018-09-15/VirtualMachines_AddDataDisk.json // this example is just showing the usage of "VirtualMachines_AddDataDisk" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line @@ -146,7 +144,7 @@ public async Task AddDataDisk_VirtualMachinesAddDataDisk() [Ignore("Only validating compilation of examples")] public async Task ApplyArtifacts_VirtualMachinesApplyArtifacts() { - // Generated from example definition: specification/devtestlabs/resource-manager/Microsoft.DevTestLab/stable/2018-09-15/examples/VirtualMachines_ApplyArtifacts.json + // Generated from example definition: 2018-09-15/VirtualMachines_ApplyArtifacts.json // this example is just showing the usage of "VirtualMachines_ApplyArtifacts" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line @@ -180,7 +178,7 @@ public async Task ApplyArtifacts_VirtualMachinesApplyArtifacts() [Ignore("Only validating compilation of examples")] public async Task Claim_VirtualMachinesClaim() { - // Generated from example definition: specification/devtestlabs/resource-manager/Microsoft.DevTestLab/stable/2018-09-15/examples/VirtualMachines_Claim.json + // Generated from example definition: 2018-09-15/VirtualMachines_Claim.json // this example is just showing the usage of "VirtualMachines_Claim" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line @@ -207,7 +205,7 @@ public async Task Claim_VirtualMachinesClaim() [Ignore("Only validating compilation of examples")] public async Task DetachDataDisk_VirtualMachinesDetachDataDisk() { - // Generated from example definition: specification/devtestlabs/resource-manager/Microsoft.DevTestLab/stable/2018-09-15/examples/VirtualMachines_DetachDataDisk.json + // Generated from example definition: 2018-09-15/VirtualMachines_DetachDataDisk.json // this example is just showing the usage of "VirtualMachines_DetachDataDisk" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line @@ -238,7 +236,7 @@ public async Task DetachDataDisk_VirtualMachinesDetachDataDisk() [Ignore("Only validating compilation of examples")] public async Task GetRdpFileContents_VirtualMachinesGetRdpFileContents() { - // Generated from example definition: specification/devtestlabs/resource-manager/Microsoft.DevTestLab/stable/2018-09-15/examples/VirtualMachines_GetRdpFileContents.json + // Generated from example definition: 2018-09-15/VirtualMachines_GetRdpFileContents.json // this example is just showing the usage of "VirtualMachines_GetRdpFileContents" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line @@ -265,7 +263,7 @@ public async Task GetRdpFileContents_VirtualMachinesGetRdpFileContents() [Ignore("Only validating compilation of examples")] public async Task GetApplicableSchedules_VirtualMachinesListApplicableSchedules() { - // Generated from example definition: specification/devtestlabs/resource-manager/Microsoft.DevTestLab/stable/2018-09-15/examples/VirtualMachines_ListApplicableSchedules.json + // Generated from example definition: 2018-09-15/VirtualMachines_ListApplicableSchedules.json // this example is just showing the usage of "VirtualMachines_ListApplicableSchedules" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line @@ -292,7 +290,7 @@ public async Task GetApplicableSchedules_VirtualMachinesListApplicableSchedules( [Ignore("Only validating compilation of examples")] public async Task Redeploy_VirtualMachinesRedeploy() { - // Generated from example definition: specification/devtestlabs/resource-manager/Microsoft.DevTestLab/stable/2018-09-15/examples/VirtualMachines_Redeploy.json + // Generated from example definition: 2018-09-15/VirtualMachines_Redeploy.json // this example is just showing the usage of "VirtualMachines_Redeploy" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line @@ -319,7 +317,7 @@ public async Task Redeploy_VirtualMachinesRedeploy() [Ignore("Only validating compilation of examples")] public async Task Resize_VirtualMachinesResize() { - // Generated from example definition: specification/devtestlabs/resource-manager/Microsoft.DevTestLab/stable/2018-09-15/examples/VirtualMachines_Resize.json + // Generated from example definition: 2018-09-15/VirtualMachines_Resize.json // this example is just showing the usage of "VirtualMachines_Resize" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line @@ -350,7 +348,7 @@ public async Task Resize_VirtualMachinesResize() [Ignore("Only validating compilation of examples")] public async Task Restart_VirtualMachinesRestart() { - // Generated from example definition: specification/devtestlabs/resource-manager/Microsoft.DevTestLab/stable/2018-09-15/examples/VirtualMachines_Restart.json + // Generated from example definition: 2018-09-15/VirtualMachines_Restart.json // this example is just showing the usage of "VirtualMachines_Restart" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line @@ -377,7 +375,7 @@ public async Task Restart_VirtualMachinesRestart() [Ignore("Only validating compilation of examples")] public async Task Start_VirtualMachinesStart() { - // Generated from example definition: specification/devtestlabs/resource-manager/Microsoft.DevTestLab/stable/2018-09-15/examples/VirtualMachines_Start.json + // Generated from example definition: 2018-09-15/VirtualMachines_Start.json // this example is just showing the usage of "VirtualMachines_Start" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line @@ -404,7 +402,7 @@ public async Task Start_VirtualMachinesStart() [Ignore("Only validating compilation of examples")] public async Task Stop_VirtualMachinesStop() { - // Generated from example definition: specification/devtestlabs/resource-manager/Microsoft.DevTestLab/stable/2018-09-15/examples/VirtualMachines_Stop.json + // Generated from example definition: 2018-09-15/VirtualMachines_Stop.json // this example is just showing the usage of "VirtualMachines_Stop" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line @@ -431,7 +429,7 @@ public async Task Stop_VirtualMachinesStop() [Ignore("Only validating compilation of examples")] public async Task TransferDisks_VirtualMachinesTransferDisks() { - // Generated from example definition: specification/devtestlabs/resource-manager/Microsoft.DevTestLab/stable/2018-09-15/examples/VirtualMachines_TransferDisks.json + // Generated from example definition: 2018-09-15/VirtualMachines_TransferDisks.json // this example is just showing the usage of "VirtualMachines_TransferDisks" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line @@ -458,7 +456,7 @@ public async Task TransferDisks_VirtualMachinesTransferDisks() [Ignore("Only validating compilation of examples")] public async Task UnClaim_VirtualMachinesUnClaim() { - // Generated from example definition: specification/devtestlabs/resource-manager/Microsoft.DevTestLab/stable/2018-09-15/examples/VirtualMachines_UnClaim.json + // Generated from example definition: 2018-09-15/VirtualMachines_UnClaim.json // this example is just showing the usage of "VirtualMachines_UnClaim" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details 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/devtestlabs/Azure.ResourceManager.DevTestLabs/tests/Generated/Samples/Sample_DevTestLabScheduleCollection.cs b/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/tests/Samples/Sample_LabScheduleCollection.cs similarity index 85% rename from sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/tests/Generated/Samples/Sample_DevTestLabScheduleCollection.cs rename to sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/tests/Samples/Sample_LabScheduleCollection.cs index c6bd82cd8773..1ad81ec847f8 100644 --- a/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/tests/Generated/Samples/Sample_DevTestLabScheduleCollection.cs +++ b/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/tests/Samples/Sample_LabScheduleCollection.cs @@ -1,26 +1,23 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. -// - #nullable disable using System; using System.Threading.Tasks; using Azure.Core; using Azure.Identity; -using Azure.ResourceManager.DevTestLabs.Models; using NUnit.Framework; namespace Azure.ResourceManager.DevTestLabs.Samples { - public partial class Sample_DevTestLabScheduleCollection + public partial class Sample_LabScheduleCollection { [Test] [Ignore("Only validating compilation of examples")] public async Task CreateOrUpdate_SchedulesCreateOrUpdate() { - // Generated from example definition: specification/devtestlabs/resource-manager/Microsoft.DevTestLab/stable/2018-09-15/examples/Schedules_CreateOrUpdate.json + // Generated from example definition: 2018-09-15/Schedules_CreateOrUpdate.json // this example is just showing the usage of "Schedules_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,25 +40,6 @@ public async Task CreateOrUpdate_SchedulesCreateOrUpdate() string name = "{scheduleName}"; DevTestLabScheduleData data = new DevTestLabScheduleData(new AzureLocation("{location}")) { - Status = new DevTestLabEnableStatus("{Enabled|Disabled}"), - TaskType = "{myLabVmTaskType}", - WeeklyRecurrence = new DevTestLabWeekDetails - { - Weekdays = { "Monday", "Wednesday", "Friday" }, - Time = "{timeOfTheDayTheScheduleWillOccurOnThoseDays}", - }, - DailyRecurrenceTime = "{timeOfTheDayTheScheduleWillOccurEveryDay}", - HourlyRecurrenceMinute = 30, - TimeZoneId = "Pacific Standard Time", - NotificationSettings = new DevTestLabNotificationSettings - { - Status = new DevTestLabEnableStatus("{Enabled|Disabled}"), - TimeInMinutes = 15, - WebhookUri = new Uri("{webhookUrl}"), - EmailRecipient = "{email}", - NotificationLocale = "EN", - }, - TargetResourceId = "/subscriptions/{subscriptionId}/resourcegroups/resourceGroupName/providers/microsoft.devtestlab/labs/{labName}", Tags = { ["tagName1"] = "tagValue1" @@ -81,7 +59,7 @@ public async Task CreateOrUpdate_SchedulesCreateOrUpdate() [Ignore("Only validating compilation of examples")] public async Task Get_SchedulesGet() { - // Generated from example definition: specification/devtestlabs/resource-manager/Microsoft.DevTestLab/stable/2018-09-15/examples/Schedules_Get.json + // Generated from example definition: 2018-09-15/Schedules_Get.json // this example is just showing the usage of "Schedules_Get" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line @@ -115,7 +93,7 @@ public async Task Get_SchedulesGet() [Ignore("Only validating compilation of examples")] public async Task GetAll_SchedulesList() { - // Generated from example definition: specification/devtestlabs/resource-manager/Microsoft.DevTestLab/stable/2018-09-15/examples/Schedules_List.json + // Generated from example definition: 2018-09-15/Schedules_List.json // this example is just showing the usage of "Schedules_List" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line @@ -151,7 +129,7 @@ public async Task GetAll_SchedulesList() [Ignore("Only validating compilation of examples")] public async Task GetApplicable_SchedulesListApplicable() { - // Generated from example definition: specification/devtestlabs/resource-manager/Microsoft.DevTestLab/stable/2018-09-15/examples/Schedules_ListApplicable.json + // Generated from example definition: 2018-09-15/Schedules_ListApplicable.json // this example is just showing the usage of "Schedules_ListApplicable" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line @@ -188,7 +166,7 @@ public async Task GetApplicable_SchedulesListApplicable() [Ignore("Only validating compilation of examples")] public async Task Exists_SchedulesGet() { - // Generated from example definition: specification/devtestlabs/resource-manager/Microsoft.DevTestLab/stable/2018-09-15/examples/Schedules_Get.json + // Generated from example definition: 2018-09-15/Schedules_Get.json // this example is just showing the usage of "Schedules_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 @@ -218,7 +196,7 @@ public async Task Exists_SchedulesGet() [Ignore("Only validating compilation of examples")] public async Task GetIfExists_SchedulesGet() { - // Generated from example definition: specification/devtestlabs/resource-manager/Microsoft.DevTestLab/stable/2018-09-15/examples/Schedules_Get.json + // Generated from example definition: 2018-09-15/Schedules_Get.json // this example is just showing the usage of "Schedules_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/devtestlabs/Azure.ResourceManager.DevTestLabs/tests/Generated/Samples/Sample_DevTestLabScheduleResource.cs b/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/tests/Samples/Sample_LabScheduleResource.cs similarity index 72% rename from sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/tests/Generated/Samples/Sample_DevTestLabScheduleResource.cs rename to sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/tests/Samples/Sample_LabScheduleResource.cs index 5e1cddfb7fcc..338f9d5be88e 100644 --- a/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/tests/Generated/Samples/Sample_DevTestLabScheduleResource.cs +++ b/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/tests/Samples/Sample_LabScheduleResource.cs @@ -1,8 +1,6 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. -// - #nullable disable using System; @@ -14,13 +12,13 @@ namespace Azure.ResourceManager.DevTestLabs.Samples { - public partial class Sample_DevTestLabScheduleResource + public partial class Sample_LabScheduleResource { [Test] [Ignore("Only validating compilation of examples")] public async Task Get_SchedulesGet() { - // Generated from example definition: specification/devtestlabs/resource-manager/Microsoft.DevTestLab/stable/2018-09-15/examples/Schedules_Get.json + // Generated from example definition: 2018-09-15/Schedules_Get.json // this example is just showing the usage of "Schedules_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 @@ -34,11 +32,11 @@ public async Task Get_SchedulesGet() string resourceGroupName = "resourceGroupName"; string labName = "{labName}"; string name = "{scheduleName}"; - ResourceIdentifier devTestLabScheduleResourceId = DevTestLabScheduleResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, labName, name); - DevTestLabScheduleResource devTestLabSchedule = client.GetDevTestLabScheduleResource(devTestLabScheduleResourceId); + ResourceIdentifier labScheduleResourceId = DevTestLabScheduleResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, labName, name); + DevTestLabScheduleResource labSchedule = client.GetDevTestLabScheduleResource(labScheduleResourceId); // invoke the operation - DevTestLabScheduleResource result = await devTestLabSchedule.GetAsync(); + DevTestLabScheduleResource result = await labSchedule.GetAsync(); // the variable result is a resource, you could call other operations on this instance as well // but just for demo, we get its data from this resource instance @@ -51,7 +49,7 @@ public async Task Get_SchedulesGet() [Ignore("Only validating compilation of examples")] public async Task Delete_SchedulesDelete() { - // Generated from example definition: specification/devtestlabs/resource-manager/Microsoft.DevTestLab/stable/2018-09-15/examples/Schedules_Delete.json + // Generated from example definition: 2018-09-15/Schedules_Delete.json // this example is just showing the usage of "Schedules_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 @@ -65,11 +63,11 @@ public async Task Delete_SchedulesDelete() string resourceGroupName = "resourceGroupName"; string labName = "{labName}"; string name = "{scheduleName}"; - ResourceIdentifier devTestLabScheduleResourceId = DevTestLabScheduleResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, labName, name); - DevTestLabScheduleResource devTestLabSchedule = client.GetDevTestLabScheduleResource(devTestLabScheduleResourceId); + ResourceIdentifier labScheduleResourceId = DevTestLabScheduleResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, labName, name); + DevTestLabScheduleResource labSchedule = client.GetDevTestLabScheduleResource(labScheduleResourceId); // invoke the operation - await devTestLabSchedule.DeleteAsync(WaitUntil.Completed); + await labSchedule.DeleteAsync(WaitUntil.Completed); Console.WriteLine("Succeeded"); } @@ -78,7 +76,7 @@ public async Task Delete_SchedulesDelete() [Ignore("Only validating compilation of examples")] public async Task Update_SchedulesUpdate() { - // Generated from example definition: specification/devtestlabs/resource-manager/Microsoft.DevTestLab/stable/2018-09-15/examples/Schedules_Update.json + // Generated from example definition: 2018-09-15/Schedules_Update.json // this example is just showing the usage of "Schedules_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 @@ -92,8 +90,8 @@ public async Task Update_SchedulesUpdate() string resourceGroupName = "resourceGroupName"; string labName = "{labName}"; string name = "{scheduleName}"; - ResourceIdentifier devTestLabScheduleResourceId = DevTestLabScheduleResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, labName, name); - DevTestLabScheduleResource devTestLabSchedule = client.GetDevTestLabScheduleResource(devTestLabScheduleResourceId); + ResourceIdentifier labScheduleResourceId = DevTestLabScheduleResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, labName, name); + DevTestLabScheduleResource labSchedule = client.GetDevTestLabScheduleResource(labScheduleResourceId); // invoke the operation DevTestLabSchedulePatch patch = new DevTestLabSchedulePatch @@ -103,7 +101,7 @@ public async Task Update_SchedulesUpdate() ["tagName1"] = "tagValue1" }, }; - DevTestLabScheduleResource result = await devTestLabSchedule.UpdateAsync(patch); + DevTestLabScheduleResource result = await labSchedule.UpdateAsync(patch); // the variable result is a resource, you could call other operations on this instance as well // but just for demo, we get its data from this resource instance @@ -116,7 +114,7 @@ public async Task Update_SchedulesUpdate() [Ignore("Only validating compilation of examples")] public async Task Execute_SchedulesExecute() { - // Generated from example definition: specification/devtestlabs/resource-manager/Microsoft.DevTestLab/stable/2018-09-15/examples/Schedules_Execute.json + // Generated from example definition: 2018-09-15/Schedules_Execute.json // this example is just showing the usage of "Schedules_Execute" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line @@ -130,11 +128,11 @@ public async Task Execute_SchedulesExecute() string resourceGroupName = "resourceGroupName"; string labName = "{labName}"; string name = "{scheduleName}"; - ResourceIdentifier devTestLabScheduleResourceId = DevTestLabScheduleResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, labName, name); - DevTestLabScheduleResource devTestLabSchedule = client.GetDevTestLabScheduleResource(devTestLabScheduleResourceId); + ResourceIdentifier labScheduleResourceId = DevTestLabScheduleResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, labName, name); + DevTestLabScheduleResource labSchedule = client.GetDevTestLabScheduleResource(labScheduleResourceId); // invoke the operation - await devTestLabSchedule.ExecuteAsync(WaitUntil.Completed); + await labSchedule.ExecuteAsync(WaitUntil.Completed); Console.WriteLine("Succeeded"); } diff --git a/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/tests/Generated/Samples/Sample_DevTestLabServiceFabricScheduleCollection.cs b/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/tests/Samples/Sample_LabUserServicefabricScheduleCollection.cs similarity index 84% rename from sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/tests/Generated/Samples/Sample_DevTestLabServiceFabricScheduleCollection.cs rename to sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/tests/Samples/Sample_LabUserServicefabricScheduleCollection.cs index d72270785d44..7d888986e0d7 100644 --- a/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/tests/Generated/Samples/Sample_DevTestLabServiceFabricScheduleCollection.cs +++ b/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/tests/Samples/Sample_LabUserServicefabricScheduleCollection.cs @@ -1,26 +1,23 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. -// - #nullable disable using System; using System.Threading.Tasks; using Azure.Core; using Azure.Identity; -using Azure.ResourceManager.DevTestLabs.Models; using NUnit.Framework; namespace Azure.ResourceManager.DevTestLabs.Samples { - public partial class Sample_DevTestLabServiceFabricScheduleCollection + public partial class Sample_LabUserServicefabricScheduleCollection { [Test] [Ignore("Only validating compilation of examples")] public async Task CreateOrUpdate_ServiceFabricSchedulesCreateOrUpdate() { - // Generated from example definition: specification/devtestlabs/resource-manager/Microsoft.DevTestLab/stable/2018-09-15/examples/ServiceFabricSchedules_CreateOrUpdate.json + // Generated from example definition: 2018-09-15/ServiceFabricSchedules_CreateOrUpdate.json // this example is just showing the usage of "ServiceFabricSchedules_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 @@ -45,25 +42,6 @@ public async Task CreateOrUpdate_ServiceFabricSchedulesCreateOrUpdate() string name = "{scheduleName}"; DevTestLabScheduleData data = new DevTestLabScheduleData(new AzureLocation("{location}")) { - Status = new DevTestLabEnableStatus("{Enabled|Disabled}"), - TaskType = "{Unknown|LabVmsShutdownTask|LabVmsStartupTask|LabVmReclamationTask|ComputeVmShutdownTask}", - WeeklyRecurrence = new DevTestLabWeekDetails - { - Weekdays = { "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday", "Sunday" }, - Time = "19:00", - }, - DailyRecurrenceTime = "19:00", - HourlyRecurrenceMinute = 0, - TimeZoneId = "Pacific Standard Time", - NotificationSettings = new DevTestLabNotificationSettings - { - Status = new DevTestLabEnableStatus("{Enabled|Disabled}"), - TimeInMinutes = 15, - WebhookUri = new Uri("{webhoolUrl}"), - EmailRecipient = "{email}", - NotificationLocale = "EN", - }, - TargetResourceId = "/subscriptions/{subscriptionId}/resourceGroups/resourceGroupName/providers/Microsoft.DevTestLab/labs/{labName}/users/{uniqueIdentifier}/servicefabrics/{serviceFrabicName}", Tags = { ["tagName1"] = "tagValue1" @@ -83,7 +61,7 @@ public async Task CreateOrUpdate_ServiceFabricSchedulesCreateOrUpdate() [Ignore("Only validating compilation of examples")] public async Task Get_ServiceFabricSchedulesGet() { - // Generated from example definition: specification/devtestlabs/resource-manager/Microsoft.DevTestLab/stable/2018-09-15/examples/ServiceFabricSchedules_Get.json + // Generated from example definition: 2018-09-15/ServiceFabricSchedules_Get.json // this example is just showing the usage of "ServiceFabricSchedules_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 +97,7 @@ public async Task Get_ServiceFabricSchedulesGet() [Ignore("Only validating compilation of examples")] public async Task GetAll_ServiceFabricSchedulesList() { - // Generated from example definition: specification/devtestlabs/resource-manager/Microsoft.DevTestLab/stable/2018-09-15/examples/ServiceFabricSchedules_List.json + // Generated from example definition: 2018-09-15/ServiceFabricSchedules_List.json // this example is just showing the usage of "ServiceFabricSchedules_List" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line @@ -157,7 +135,7 @@ public async Task GetAll_ServiceFabricSchedulesList() [Ignore("Only validating compilation of examples")] public async Task Exists_ServiceFabricSchedulesGet() { - // Generated from example definition: specification/devtestlabs/resource-manager/Microsoft.DevTestLab/stable/2018-09-15/examples/ServiceFabricSchedules_Get.json + // Generated from example definition: 2018-09-15/ServiceFabricSchedules_Get.json // this example is just showing the usage of "ServiceFabricSchedules_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 @@ -189,7 +167,7 @@ public async Task Exists_ServiceFabricSchedulesGet() [Ignore("Only validating compilation of examples")] public async Task GetIfExists_ServiceFabricSchedulesGet() { - // Generated from example definition: specification/devtestlabs/resource-manager/Microsoft.DevTestLab/stable/2018-09-15/examples/ServiceFabricSchedules_Get.json + // Generated from example definition: 2018-09-15/ServiceFabricSchedules_Get.json // this example is just showing the usage of "ServiceFabricSchedules_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/devtestlabs/Azure.ResourceManager.DevTestLabs/tests/Generated/Samples/Sample_DevTestLabServiceFabricScheduleResource.cs b/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/tests/Samples/Sample_LabUserServicefabricScheduleResource.cs similarity index 78% rename from sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/tests/Generated/Samples/Sample_DevTestLabServiceFabricScheduleResource.cs rename to sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/tests/Samples/Sample_LabUserServicefabricScheduleResource.cs index 5827b3c093f8..b1562c773511 100644 --- a/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/tests/Generated/Samples/Sample_DevTestLabServiceFabricScheduleResource.cs +++ b/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/tests/Samples/Sample_LabUserServicefabricScheduleResource.cs @@ -1,8 +1,6 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. -// - #nullable disable using System; @@ -20,7 +18,7 @@ public partial class Sample_DevTestLabServiceFabricScheduleResource [Ignore("Only validating compilation of examples")] public async Task Get_ServiceFabricSchedulesGet() { - // Generated from example definition: specification/devtestlabs/resource-manager/Microsoft.DevTestLab/stable/2018-09-15/examples/ServiceFabricSchedules_Get.json + // Generated from example definition: 2018-09-15/ServiceFabricSchedules_Get.json // this example is just showing the usage of "ServiceFabricSchedules_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 @@ -36,11 +34,11 @@ public async Task Get_ServiceFabricSchedulesGet() string userName = "@me"; string serviceFabricName = "{serviceFrabicName}"; string name = "{scheduleName}"; - ResourceIdentifier devTestLabServiceFabricScheduleResourceId = DevTestLabServiceFabricScheduleResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, labName, userName, serviceFabricName, name); - DevTestLabServiceFabricScheduleResource devTestLabServiceFabricSchedule = client.GetDevTestLabServiceFabricScheduleResource(devTestLabServiceFabricScheduleResourceId); + ResourceIdentifier DevTestLabServiceFabricScheduleResourceId = DevTestLabServiceFabricScheduleResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, labName, userName, serviceFabricName, name); + DevTestLabServiceFabricScheduleResource labUserServicefabricSchedule = client.GetDevTestLabServiceFabricScheduleResource(DevTestLabServiceFabricScheduleResourceId); // invoke the operation - DevTestLabServiceFabricScheduleResource result = await devTestLabServiceFabricSchedule.GetAsync(); + DevTestLabServiceFabricScheduleResource result = await labUserServicefabricSchedule.GetAsync(); // the variable result is a resource, you could call other operations on this instance as well // but just for demo, we get its data from this resource instance @@ -53,7 +51,7 @@ public async Task Get_ServiceFabricSchedulesGet() [Ignore("Only validating compilation of examples")] public async Task Delete_ServiceFabricSchedulesDelete() { - // Generated from example definition: specification/devtestlabs/resource-manager/Microsoft.DevTestLab/stable/2018-09-15/examples/ServiceFabricSchedules_Delete.json + // Generated from example definition: 2018-09-15/ServiceFabricSchedules_Delete.json // this example is just showing the usage of "ServiceFabricSchedules_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 @@ -69,11 +67,11 @@ public async Task Delete_ServiceFabricSchedulesDelete() string userName = "@me"; string serviceFabricName = "{serviceFrabicName}"; string name = "{scheduleName}"; - ResourceIdentifier devTestLabServiceFabricScheduleResourceId = DevTestLabServiceFabricScheduleResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, labName, userName, serviceFabricName, name); - DevTestLabServiceFabricScheduleResource devTestLabServiceFabricSchedule = client.GetDevTestLabServiceFabricScheduleResource(devTestLabServiceFabricScheduleResourceId); + ResourceIdentifier DevTestLabServiceFabricScheduleResourceId = DevTestLabServiceFabricScheduleResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, labName, userName, serviceFabricName, name); + DevTestLabServiceFabricScheduleResource labUserServicefabricSchedule = client.GetDevTestLabServiceFabricScheduleResource(DevTestLabServiceFabricScheduleResourceId); // invoke the operation - await devTestLabServiceFabricSchedule.DeleteAsync(WaitUntil.Completed); + await labUserServicefabricSchedule.DeleteAsync(WaitUntil.Completed); Console.WriteLine("Succeeded"); } @@ -82,7 +80,7 @@ public async Task Delete_ServiceFabricSchedulesDelete() [Ignore("Only validating compilation of examples")] public async Task Update_ServiceFabricSchedulesUpdate() { - // Generated from example definition: specification/devtestlabs/resource-manager/Microsoft.DevTestLab/stable/2018-09-15/examples/ServiceFabricSchedules_Update.json + // Generated from example definition: 2018-09-15/ServiceFabricSchedules_Update.json // this example is just showing the usage of "ServiceFabricSchedules_Update" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line @@ -98,8 +96,8 @@ public async Task Update_ServiceFabricSchedulesUpdate() string userName = "@me"; string serviceFabricName = "{serviceFrabicName}"; string name = "{scheduleName}"; - ResourceIdentifier devTestLabServiceFabricScheduleResourceId = DevTestLabServiceFabricScheduleResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, labName, userName, serviceFabricName, name); - DevTestLabServiceFabricScheduleResource devTestLabServiceFabricSchedule = client.GetDevTestLabServiceFabricScheduleResource(devTestLabServiceFabricScheduleResourceId); + ResourceIdentifier DevTestLabServiceFabricScheduleResourceId = DevTestLabServiceFabricScheduleResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, labName, userName, serviceFabricName, name); + DevTestLabServiceFabricScheduleResource labUserServicefabricSchedule = client.GetDevTestLabServiceFabricScheduleResource (DevTestLabServiceFabricScheduleResourceId); // invoke the operation DevTestLabSchedulePatch patch = new DevTestLabSchedulePatch @@ -109,7 +107,7 @@ public async Task Update_ServiceFabricSchedulesUpdate() ["tagName1"] = "tagValue1" }, }; - DevTestLabServiceFabricScheduleResource result = await devTestLabServiceFabricSchedule.UpdateAsync(patch); + DevTestLabServiceFabricScheduleResource result = await labUserServicefabricSchedule.UpdateAsync(patch); // the variable result is a resource, you could call other operations on this instance as well // but just for demo, we get its data from this resource instance @@ -122,7 +120,7 @@ public async Task Update_ServiceFabricSchedulesUpdate() [Ignore("Only validating compilation of examples")] public async Task Execute_ServiceFabricSchedulesExecute() { - // Generated from example definition: specification/devtestlabs/resource-manager/Microsoft.DevTestLab/stable/2018-09-15/examples/ServiceFabricSchedules_Execute.json + // Generated from example definition: 2018-09-15/ServiceFabricSchedules_Execute.json // this example is just showing the usage of "ServiceFabricSchedules_Execute" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line @@ -138,11 +136,11 @@ public async Task Execute_ServiceFabricSchedulesExecute() string userName = "@me"; string serviceFabricName = "{serviceFrabicName}"; string name = "{scheduleName}"; - ResourceIdentifier devTestLabServiceFabricScheduleResourceId = DevTestLabServiceFabricScheduleResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, labName, userName, serviceFabricName, name); - DevTestLabServiceFabricScheduleResource devTestLabServiceFabricSchedule = client.GetDevTestLabServiceFabricScheduleResource(devTestLabServiceFabricScheduleResourceId); + ResourceIdentifier DevTestLabServiceFabricScheduleResourceId = DevTestLabServiceFabricScheduleResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, labName, userName, serviceFabricName, name); + DevTestLabServiceFabricScheduleResource labUserServicefabricSchedule = client.GetDevTestLabServiceFabricScheduleResource(DevTestLabServiceFabricScheduleResourceId); // invoke the operation - await devTestLabServiceFabricSchedule.ExecuteAsync(WaitUntil.Completed); + await labUserServicefabricSchedule.ExecuteAsync(WaitUntil.Completed); Console.WriteLine("Succeeded"); } diff --git a/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/tests/Generated/Samples/Sample_DevTestLabVmScheduleCollection.cs b/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/tests/Samples/Sample_LabVirtualmachineScheduleCollection.cs similarity index 80% rename from sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/tests/Generated/Samples/Sample_DevTestLabVmScheduleCollection.cs rename to sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/tests/Samples/Sample_LabVirtualmachineScheduleCollection.cs index 24b97285bae6..980acf55dd50 100644 --- a/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/tests/Generated/Samples/Sample_DevTestLabVmScheduleCollection.cs +++ b/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/tests/Samples/Sample_LabVirtualmachineScheduleCollection.cs @@ -1,26 +1,23 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. -// - #nullable disable using System; using System.Threading.Tasks; using Azure.Core; using Azure.Identity; -using Azure.ResourceManager.DevTestLabs.Models; using NUnit.Framework; namespace Azure.ResourceManager.DevTestLabs.Samples { - public partial class Sample_DevTestLabVmScheduleCollection + public partial class Sample_LabVirtualmachineScheduleCollection { [Test] [Ignore("Only validating compilation of examples")] public async Task CreateOrUpdate_VirtualMachineSchedulesCreateOrUpdate() { - // Generated from example definition: specification/devtestlabs/resource-manager/Microsoft.DevTestLab/stable/2018-09-15/examples/VirtualMachineSchedules_CreateOrUpdate.json + // Generated from example definition: 2018-09-15/VirtualMachineSchedules_CreateOrUpdate.json // this example is just showing the usage of "VirtualMachineSchedules_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 @@ -33,36 +30,17 @@ public async Task CreateOrUpdate_VirtualMachineSchedulesCreateOrUpdate() string subscriptionId = "{subscriptionId}"; string resourceGroupName = "resourceGroupName"; string labName = "{labName}"; - string vmName = "{vmName}"; - ResourceIdentifier devTestLabVmResourceId = DevTestLabVmResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, labName, vmName); + string virtualMachineName = "{vmName}"; + ResourceIdentifier devTestLabVmResourceId = DevTestLabVmResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, labName, virtualMachineName); DevTestLabVmResource devTestLabVm = client.GetDevTestLabVmResource(devTestLabVmResourceId); - // get the collection of this DevTestLabVmScheduleResource + // get the collection of this LabVirtualmachineScheduleResource DevTestLabVmScheduleCollection collection = devTestLabVm.GetDevTestLabVmSchedules(); // invoke the operation string name = "LabVmsShutdown"; DevTestLabScheduleData data = new DevTestLabScheduleData(new AzureLocation("{location}")) { - Status = DevTestLabEnableStatus.Enabled, - TaskType = "LabVmsShutdownTask", - WeeklyRecurrence = new DevTestLabWeekDetails - { - Weekdays = { "Friday", "Saturday", "Sunday" }, - Time = "1700", - }, - DailyRecurrenceTime = "1900", - HourlyRecurrenceMinute = 30, - TimeZoneId = "Pacific Standard Time", - NotificationSettings = new DevTestLabNotificationSettings - { - Status = DevTestLabEnableStatus.Enabled, - TimeInMinutes = 30, - WebhookUri = new Uri("{webhookUrl}"), - EmailRecipient = "{email}", - NotificationLocale = "EN", - }, - TargetResourceId = "/subscriptions/{subscriptionId}/resourcegroups/resourceGroupName/providers/microsoft.devtestlab/labs/{labName}/virtualMachines/{vmName}", Tags = { ["tagName1"] = "tagValue1" @@ -82,7 +60,7 @@ public async Task CreateOrUpdate_VirtualMachineSchedulesCreateOrUpdate() [Ignore("Only validating compilation of examples")] public async Task Get_VirtualMachineSchedulesGet() { - // Generated from example definition: specification/devtestlabs/resource-manager/Microsoft.DevTestLab/stable/2018-09-15/examples/VirtualMachineSchedules_Get.json + // Generated from example definition: 2018-09-15/VirtualMachineSchedules_Get.json // this example is just showing the usage of "VirtualMachineSchedules_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 @@ -95,11 +73,11 @@ public async Task Get_VirtualMachineSchedulesGet() string subscriptionId = "{subscriptionId}"; string resourceGroupName = "resourceGroupName"; string labName = "{labName}"; - string vmName = "{vmName}"; - ResourceIdentifier devTestLabVmResourceId = DevTestLabVmResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, labName, vmName); + string virtualMachineName = "{vmName}"; + ResourceIdentifier devTestLabVmResourceId = DevTestLabVmResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, labName, virtualMachineName); DevTestLabVmResource devTestLabVm = client.GetDevTestLabVmResource(devTestLabVmResourceId); - // get the collection of this DevTestLabVmScheduleResource + // get the collection of this LabVirtualmachineScheduleResource DevTestLabVmScheduleCollection collection = devTestLabVm.GetDevTestLabVmSchedules(); // invoke the operation @@ -117,7 +95,7 @@ public async Task Get_VirtualMachineSchedulesGet() [Ignore("Only validating compilation of examples")] public async Task GetAll_VirtualMachineSchedulesList() { - // Generated from example definition: specification/devtestlabs/resource-manager/Microsoft.DevTestLab/stable/2018-09-15/examples/VirtualMachineSchedules_List.json + // Generated from example definition: 2018-09-15/VirtualMachineSchedules_List.json // this example is just showing the usage of "VirtualMachineSchedules_List" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line @@ -130,8 +108,8 @@ public async Task GetAll_VirtualMachineSchedulesList() string subscriptionId = "{subscriptionId}"; string resourceGroupName = "resourceGroupName"; string labName = "{labName}"; - string vmName = "{vmName}"; - ResourceIdentifier devTestLabVmResourceId = DevTestLabVmResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, labName, vmName); + string virtualMachineName = "{vmName}"; + ResourceIdentifier devTestLabVmResourceId = DevTestLabVmResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, labName, virtualMachineName); DevTestLabVmResource devTestLabVm = client.GetDevTestLabVmResource(devTestLabVmResourceId); // get the collection of this DevTestLabVmScheduleResource @@ -154,7 +132,7 @@ public async Task GetAll_VirtualMachineSchedulesList() [Ignore("Only validating compilation of examples")] public async Task Exists_VirtualMachineSchedulesGet() { - // Generated from example definition: specification/devtestlabs/resource-manager/Microsoft.DevTestLab/stable/2018-09-15/examples/VirtualMachineSchedules_Get.json + // Generated from example definition: 2018-09-15/VirtualMachineSchedules_Get.json // this example is just showing the usage of "VirtualMachineSchedules_Get" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line @@ -167,8 +145,8 @@ public async Task Exists_VirtualMachineSchedulesGet() string subscriptionId = "{subscriptionId}"; string resourceGroupName = "resourceGroupName"; string labName = "{labName}"; - string vmName = "{vmName}"; - ResourceIdentifier devTestLabVmResourceId = DevTestLabVmResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, labName, vmName); + string virtualMachineName = "{vmName}"; + ResourceIdentifier devTestLabVmResourceId = DevTestLabVmResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, labName, virtualMachineName); DevTestLabVmResource devTestLabVm = client.GetDevTestLabVmResource(devTestLabVmResourceId); // get the collection of this DevTestLabVmScheduleResource @@ -185,7 +163,7 @@ public async Task Exists_VirtualMachineSchedulesGet() [Ignore("Only validating compilation of examples")] public async Task GetIfExists_VirtualMachineSchedulesGet() { - // Generated from example definition: specification/devtestlabs/resource-manager/Microsoft.DevTestLab/stable/2018-09-15/examples/VirtualMachineSchedules_Get.json + // Generated from example definition: 2018-09-15/VirtualMachineSchedules_Get.json // this example is just showing the usage of "VirtualMachineSchedules_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 @@ -198,8 +176,8 @@ public async Task GetIfExists_VirtualMachineSchedulesGet() string subscriptionId = "{subscriptionId}"; string resourceGroupName = "resourceGroupName"; string labName = "{labName}"; - string vmName = "{vmName}"; - ResourceIdentifier devTestLabVmResourceId = DevTestLabVmResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, labName, vmName); + string virtualMachineName = "{vmName}"; + ResourceIdentifier devTestLabVmResourceId = DevTestLabVmResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, labName, virtualMachineName); DevTestLabVmResource devTestLabVm = client.GetDevTestLabVmResource(devTestLabVmResourceId); // get the collection of this DevTestLabVmScheduleResource diff --git a/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/tests/Generated/Samples/Sample_DevTestLabVmScheduleResource.cs b/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/tests/Samples/Sample_LabVirtualmachineScheduleResource.cs similarity index 70% rename from sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/tests/Generated/Samples/Sample_DevTestLabVmScheduleResource.cs rename to sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/tests/Samples/Sample_LabVirtualmachineScheduleResource.cs index 7859ebf15d7c..36992d8a93f9 100644 --- a/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/tests/Generated/Samples/Sample_DevTestLabVmScheduleResource.cs +++ b/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/tests/Samples/Sample_LabVirtualmachineScheduleResource.cs @@ -1,8 +1,6 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. -// - #nullable disable using System; @@ -14,13 +12,13 @@ namespace Azure.ResourceManager.DevTestLabs.Samples { - public partial class Sample_DevTestLabVmScheduleResource + public partial class Sample_LabVirtualmachineScheduleResource { [Test] [Ignore("Only validating compilation of examples")] public async Task Get_VirtualMachineSchedulesGet() { - // Generated from example definition: specification/devtestlabs/resource-manager/Microsoft.DevTestLab/stable/2018-09-15/examples/VirtualMachineSchedules_Get.json + // Generated from example definition: 2018-09-15/VirtualMachineSchedules_Get.json // this example is just showing the usage of "VirtualMachineSchedules_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 @@ -33,13 +31,13 @@ public async Task Get_VirtualMachineSchedulesGet() string subscriptionId = "{subscriptionId}"; string resourceGroupName = "resourceGroupName"; string labName = "{labName}"; - string vmName = "{vmName}"; + string virtualMachineName = "{vmName}"; string name = "LabVmsShutdown"; - ResourceIdentifier devTestLabVmScheduleResourceId = DevTestLabVmScheduleResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, labName, vmName, name); - DevTestLabVmScheduleResource devTestLabVmSchedule = client.GetDevTestLabVmScheduleResource(devTestLabVmScheduleResourceId); + ResourceIdentifier labVirtualmachineScheduleResourceId = DevTestLabVmScheduleResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, labName, virtualMachineName, name); + DevTestLabVmScheduleResource labVirtualmachineSchedule = client.GetDevTestLabVmScheduleResource(labVirtualmachineScheduleResourceId); // invoke the operation - DevTestLabVmScheduleResource result = await devTestLabVmSchedule.GetAsync(); + DevTestLabVmScheduleResource result = await labVirtualmachineSchedule.GetAsync(); // the variable result is a resource, you could call other operations on this instance as well // but just for demo, we get its data from this resource instance @@ -52,7 +50,7 @@ public async Task Get_VirtualMachineSchedulesGet() [Ignore("Only validating compilation of examples")] public async Task Delete_VirtualMachineSchedulesDelete() { - // Generated from example definition: specification/devtestlabs/resource-manager/Microsoft.DevTestLab/stable/2018-09-15/examples/VirtualMachineSchedules_Delete.json + // Generated from example definition: 2018-09-15/VirtualMachineSchedules_Delete.json // this example is just showing the usage of "VirtualMachineSchedules_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 @@ -65,13 +63,13 @@ public async Task Delete_VirtualMachineSchedulesDelete() string subscriptionId = "{subscriptionId}"; string resourceGroupName = "resourceGroupName"; string labName = "{labName}"; - string vmName = "{vmName}"; + string virtualMachineName = "{vmName}"; string name = "LabVmsShutdown"; - ResourceIdentifier devTestLabVmScheduleResourceId = DevTestLabVmScheduleResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, labName, vmName, name); - DevTestLabVmScheduleResource devTestLabVmSchedule = client.GetDevTestLabVmScheduleResource(devTestLabVmScheduleResourceId); + ResourceIdentifier labVirtualmachineScheduleResourceId = DevTestLabVmScheduleResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, labName, virtualMachineName, name); + DevTestLabVmScheduleResource labVirtualmachineSchedule = client.GetDevTestLabVmScheduleResource(labVirtualmachineScheduleResourceId); // invoke the operation - await devTestLabVmSchedule.DeleteAsync(WaitUntil.Completed); + await labVirtualmachineSchedule.DeleteAsync(WaitUntil.Completed); Console.WriteLine("Succeeded"); } @@ -80,7 +78,7 @@ public async Task Delete_VirtualMachineSchedulesDelete() [Ignore("Only validating compilation of examples")] public async Task Update_VirtualMachineSchedulesUpdate() { - // Generated from example definition: specification/devtestlabs/resource-manager/Microsoft.DevTestLab/stable/2018-09-15/examples/VirtualMachineSchedules_Update.json + // Generated from example definition: 2018-09-15/VirtualMachineSchedules_Update.json // this example is just showing the usage of "VirtualMachineSchedules_Update" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line @@ -93,10 +91,10 @@ public async Task Update_VirtualMachineSchedulesUpdate() string subscriptionId = "{subscriptionId}"; string resourceGroupName = "resourceGroupName"; string labName = "{labName}"; - string vmName = "{vmName}"; + string virtualMachineName = "{vmName}"; string name = "LabVmsShutdown"; - ResourceIdentifier devTestLabVmScheduleResourceId = DevTestLabVmScheduleResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, labName, vmName, name); - DevTestLabVmScheduleResource devTestLabVmSchedule = client.GetDevTestLabVmScheduleResource(devTestLabVmScheduleResourceId); + ResourceIdentifier labVirtualmachineScheduleResourceId = DevTestLabVmScheduleResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, labName, virtualMachineName, name); + DevTestLabVmScheduleResource labVirtualmachineSchedule = client.GetDevTestLabVmScheduleResource(labVirtualmachineScheduleResourceId); // invoke the operation DevTestLabSchedulePatch patch = new DevTestLabSchedulePatch @@ -106,7 +104,7 @@ public async Task Update_VirtualMachineSchedulesUpdate() ["tagName1"] = "tagValue1" }, }; - DevTestLabVmScheduleResource result = await devTestLabVmSchedule.UpdateAsync(patch); + DevTestLabVmScheduleResource result = await labVirtualmachineSchedule.UpdateAsync(patch); // the variable result is a resource, you could call other operations on this instance as well // but just for demo, we get its data from this resource instance @@ -119,7 +117,7 @@ public async Task Update_VirtualMachineSchedulesUpdate() [Ignore("Only validating compilation of examples")] public async Task Execute_VirtualMachineSchedulesExecute() { - // Generated from example definition: specification/devtestlabs/resource-manager/Microsoft.DevTestLab/stable/2018-09-15/examples/VirtualMachineSchedules_Execute.json + // Generated from example definition: 2018-09-15/VirtualMachineSchedules_Execute.json // this example is just showing the usage of "VirtualMachineSchedules_Execute" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line @@ -132,13 +130,13 @@ public async Task Execute_VirtualMachineSchedulesExecute() string subscriptionId = "{subscriptionId}"; string resourceGroupName = "resourceGroupName"; string labName = "{labName}"; - string vmName = "{vmName}"; + string virtualMachineName = "{vmName}"; string name = "LabVmsShutdown"; - ResourceIdentifier devTestLabVmScheduleResourceId = DevTestLabVmScheduleResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, labName, vmName, name); - DevTestLabVmScheduleResource devTestLabVmSchedule = client.GetDevTestLabVmScheduleResource(devTestLabVmScheduleResourceId); + ResourceIdentifier labVirtualmachineScheduleResourceId = DevTestLabVmScheduleResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, labName, virtualMachineName, name); + DevTestLabVmScheduleResource labVirtualmachineSchedule = client.GetDevTestLabVmScheduleResource(labVirtualmachineScheduleResourceId); // invoke the operation - await devTestLabVmSchedule.ExecuteAsync(WaitUntil.Completed); + await labVirtualmachineSchedule.ExecuteAsync(WaitUntil.Completed); Console.WriteLine("Succeeded"); } diff --git a/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/tests/Generated/Samples/Sample_DevTestLabGlobalScheduleCollection.cs b/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/tests/Samples/Sample_ScheduleCollection.cs similarity index 81% rename from sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/tests/Generated/Samples/Sample_DevTestLabGlobalScheduleCollection.cs rename to sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/tests/Samples/Sample_ScheduleCollection.cs index 8b9d73455558..48841bf59fa1 100644 --- a/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/tests/Generated/Samples/Sample_DevTestLabGlobalScheduleCollection.cs +++ b/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/tests/Samples/Sample_ScheduleCollection.cs @@ -1,28 +1,25 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. -// - #nullable disable using System; using System.Threading.Tasks; using Azure.Core; using Azure.Identity; -using Azure.ResourceManager.DevTestLabs.Models; using Azure.ResourceManager.Resources; using NUnit.Framework; namespace Azure.ResourceManager.DevTestLabs.Samples { - public partial class Sample_DevTestLabGlobalScheduleCollection + public partial class Sample_ScheduleCollection { [Test] [Ignore("Only validating compilation of examples")] public async Task CreateOrUpdate_GlobalSchedulesCreateOrUpdate() { - // Generated from example definition: specification/devtestlabs/resource-manager/Microsoft.DevTestLab/stable/2018-09-15/examples/GlobalSchedules_CreateOrUpdate.json - // this example is just showing the usage of "GlobalSchedules_CreateOrUpdate" operation, for the dependent resources, they will have to be created separately. + // Generated from example definition: 2018-09-15/GlobalSchedules_CreateOrUpdate.json + // this example is just showing the usage of "Schedules_CreateOrUpdate" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line TokenCredential cred = new DefaultAzureCredential(); @@ -41,17 +38,7 @@ public async Task CreateOrUpdate_GlobalSchedulesCreateOrUpdate() // invoke the operation string name = "labvmautostart"; - DevTestLabScheduleData data = new DevTestLabScheduleData(default) - { - Status = DevTestLabEnableStatus.Enabled, - TaskType = "LabVmsStartupTask", - WeeklyRecurrence = new DevTestLabWeekDetails - { - Weekdays = { "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday" }, - Time = "0700", - }, - TimeZoneId = "Hawaiian Standard Time", - }; + DevTestLabScheduleData data = new DevTestLabScheduleData(default); ArmOperation lro = await collection.CreateOrUpdateAsync(WaitUntil.Completed, name, data); DevTestLabGlobalScheduleResource result = lro.Value; @@ -66,8 +53,8 @@ public async Task CreateOrUpdate_GlobalSchedulesCreateOrUpdate() [Ignore("Only validating compilation of examples")] public async Task Get_GlobalSchedulesGet() { - // Generated from example definition: specification/devtestlabs/resource-manager/Microsoft.DevTestLab/stable/2018-09-15/examples/GlobalSchedules_Get.json - // this example is just showing the usage of "GlobalSchedules_Get" operation, for the dependent resources, they will have to be created separately. + // Generated from example definition: 2018-09-15/GlobalSchedules_Get.json + // this example is just showing the usage of "Schedules_Get" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line TokenCredential cred = new DefaultAzureCredential(); @@ -99,8 +86,8 @@ public async Task Get_GlobalSchedulesGet() [Ignore("Only validating compilation of examples")] public async Task GetAll_GlobalSchedulesListByResourceGroup() { - // Generated from example definition: specification/devtestlabs/resource-manager/Microsoft.DevTestLab/stable/2018-09-15/examples/GlobalSchedules_ListByResourceGroup.json - // this example is just showing the usage of "GlobalSchedules_ListByResourceGroup" operation, for the dependent resources, they will have to be created separately. + // Generated from example definition: 2018-09-15/GlobalSchedules_ListByResourceGroup.json + // this example is just showing the usage of "Schedule_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 TokenCredential cred = new DefaultAzureCredential(); @@ -134,8 +121,8 @@ public async Task GetAll_GlobalSchedulesListByResourceGroup() [Ignore("Only validating compilation of examples")] public async Task Exists_GlobalSchedulesGet() { - // Generated from example definition: specification/devtestlabs/resource-manager/Microsoft.DevTestLab/stable/2018-09-15/examples/GlobalSchedules_Get.json - // this example is just showing the usage of "GlobalSchedules_Get" operation, for the dependent resources, they will have to be created separately. + // Generated from example definition: 2018-09-15/GlobalSchedules_Get.json + // this example is just showing the usage of "Schedules_Get" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line TokenCredential cred = new DefaultAzureCredential(); @@ -163,8 +150,8 @@ public async Task Exists_GlobalSchedulesGet() [Ignore("Only validating compilation of examples")] public async Task GetIfExists_GlobalSchedulesGet() { - // Generated from example definition: specification/devtestlabs/resource-manager/Microsoft.DevTestLab/stable/2018-09-15/examples/GlobalSchedules_Get.json - // this example is just showing the usage of "GlobalSchedules_Get" operation, for the dependent resources, they will have to be created separately. + // Generated from example definition: 2018-09-15/GlobalSchedules_Get.json + // this example is just showing the usage of "Schedules_Get" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line TokenCredential cred = new DefaultAzureCredential(); diff --git a/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/tests/Generated/Samples/Sample_DevTestLabGlobalScheduleResource.cs b/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/tests/Samples/Sample_ScheduleResource.cs similarity index 71% rename from sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/tests/Generated/Samples/Sample_DevTestLabGlobalScheduleResource.cs rename to sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/tests/Samples/Sample_ScheduleResource.cs index 0f81f8daac1a..6c828498d07e 100644 --- a/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/tests/Generated/Samples/Sample_DevTestLabGlobalScheduleResource.cs +++ b/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/tests/Samples/Sample_ScheduleResource.cs @@ -1,8 +1,6 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. -// - #nullable disable using System; @@ -14,13 +12,13 @@ namespace Azure.ResourceManager.DevTestLabs.Samples { - public partial class Sample_DevTestLabGlobalScheduleResource + public partial class Sample_ScheduleResource { [Test] [Ignore("Only validating compilation of examples")] public async Task Get_GlobalSchedulesGet() { - // Generated from example definition: specification/devtestlabs/resource-manager/Microsoft.DevTestLab/stable/2018-09-15/examples/GlobalSchedules_Get.json + // Generated from example definition: 2018-09-15/GlobalSchedules_Get.json // this example is just showing the usage of "GlobalSchedules_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 @@ -33,11 +31,11 @@ public async Task Get_GlobalSchedulesGet() string subscriptionId = "{subscriptionId}"; string resourceGroupName = "resourceGroupName"; string name = "labvmautostart"; - ResourceIdentifier devTestLabGlobalScheduleResourceId = DevTestLabGlobalScheduleResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, name); - DevTestLabGlobalScheduleResource devTestLabGlobalSchedule = client.GetDevTestLabGlobalScheduleResource(devTestLabGlobalScheduleResourceId); + ResourceIdentifier scheduleResourceId = DevTestLabGlobalScheduleResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, name); + DevTestLabGlobalScheduleResource schedule = client.GetDevTestLabGlobalScheduleResource(scheduleResourceId); // invoke the operation - DevTestLabGlobalScheduleResource result = await devTestLabGlobalSchedule.GetAsync(); + DevTestLabGlobalScheduleResource result = await schedule.GetAsync(); // the variable result is a resource, you could call other operations on this instance as well // but just for demo, we get its data from this resource instance @@ -50,7 +48,7 @@ public async Task Get_GlobalSchedulesGet() [Ignore("Only validating compilation of examples")] public async Task Delete_GlobalSchedulesDelete() { - // Generated from example definition: specification/devtestlabs/resource-manager/Microsoft.DevTestLab/stable/2018-09-15/examples/GlobalSchedules_Delete.json + // Generated from example definition: 2018-09-15/GlobalSchedules_Delete.json // this example is just showing the usage of "GlobalSchedules_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 @@ -63,11 +61,11 @@ public async Task Delete_GlobalSchedulesDelete() string subscriptionId = "{subscriptionId}"; string resourceGroupName = "resourceGroupName"; string name = "labvmautostart"; - ResourceIdentifier devTestLabGlobalScheduleResourceId = DevTestLabGlobalScheduleResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, name); - DevTestLabGlobalScheduleResource devTestLabGlobalSchedule = client.GetDevTestLabGlobalScheduleResource(devTestLabGlobalScheduleResourceId); + ResourceIdentifier scheduleResourceId = DevTestLabGlobalScheduleResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, name); + DevTestLabGlobalScheduleResource schedule = client.GetDevTestLabGlobalScheduleResource(scheduleResourceId); // invoke the operation - await devTestLabGlobalSchedule.DeleteAsync(WaitUntil.Completed); + await schedule.DeleteAsync(WaitUntil.Completed); Console.WriteLine("Succeeded"); } @@ -76,7 +74,7 @@ public async Task Delete_GlobalSchedulesDelete() [Ignore("Only validating compilation of examples")] public async Task Update_GlobalSchedulesUpdate() { - // Generated from example definition: specification/devtestlabs/resource-manager/Microsoft.DevTestLab/stable/2018-09-15/examples/GlobalSchedules_Update.json + // Generated from example definition: 2018-09-15/GlobalSchedules_Update.json // this example is just showing the usage of "GlobalSchedules_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 @@ -89,8 +87,8 @@ public async Task Update_GlobalSchedulesUpdate() string subscriptionId = "{subscriptionId}"; string resourceGroupName = "resourceGroupName"; string name = "labvmautostart"; - ResourceIdentifier devTestLabGlobalScheduleResourceId = DevTestLabGlobalScheduleResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, name); - DevTestLabGlobalScheduleResource devTestLabGlobalSchedule = client.GetDevTestLabGlobalScheduleResource(devTestLabGlobalScheduleResourceId); + ResourceIdentifier scheduleResourceId = DevTestLabGlobalScheduleResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, name); + DevTestLabGlobalScheduleResource schedule = client.GetDevTestLabGlobalScheduleResource(scheduleResourceId); // invoke the operation DevTestLabSchedulePatch patch = new DevTestLabSchedulePatch @@ -100,7 +98,7 @@ public async Task Update_GlobalSchedulesUpdate() ["tagName1"] = "tagValue1" }, }; - DevTestLabGlobalScheduleResource result = await devTestLabGlobalSchedule.UpdateAsync(patch); + DevTestLabGlobalScheduleResource result = await schedule.UpdateAsync(patch); // the variable result is a resource, you could call other operations on this instance as well // but just for demo, we get its data from this resource instance @@ -113,7 +111,7 @@ public async Task Update_GlobalSchedulesUpdate() [Ignore("Only validating compilation of examples")] public async Task Execute_GlobalSchedulesExecute() { - // Generated from example definition: specification/devtestlabs/resource-manager/Microsoft.DevTestLab/stable/2018-09-15/examples/GlobalSchedules_Execute.json + // Generated from example definition: 2018-09-15/GlobalSchedules_Execute.json // this example is just showing the usage of "GlobalSchedules_Execute" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line @@ -126,11 +124,11 @@ public async Task Execute_GlobalSchedulesExecute() string subscriptionId = "{subscriptionId}"; string resourceGroupName = "resourceGroupName"; string name = "labvmautostart"; - ResourceIdentifier devTestLabGlobalScheduleResourceId = DevTestLabGlobalScheduleResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, name); - DevTestLabGlobalScheduleResource devTestLabGlobalSchedule = client.GetDevTestLabGlobalScheduleResource(devTestLabGlobalScheduleResourceId); + ResourceIdentifier scheduleResourceId = DevTestLabGlobalScheduleResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, name); + DevTestLabGlobalScheduleResource schedule = client.GetDevTestLabGlobalScheduleResource(scheduleResourceId); // invoke the operation - await devTestLabGlobalSchedule.ExecuteAsync(WaitUntil.Completed); + await schedule.ExecuteAsync(WaitUntil.Completed); Console.WriteLine("Succeeded"); } @@ -139,7 +137,7 @@ public async Task Execute_GlobalSchedulesExecute() [Ignore("Only validating compilation of examples")] public async Task Retarget_GlobalSchedulesRetarget() { - // Generated from example definition: specification/devtestlabs/resource-manager/Microsoft.DevTestLab/stable/2018-09-15/examples/GlobalSchedules_Retarget.json + // Generated from example definition: 2018-09-15/GlobalSchedules_Retarget.json // this example is just showing the usage of "GlobalSchedules_Retarget" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line @@ -152,8 +150,8 @@ public async Task Retarget_GlobalSchedulesRetarget() string subscriptionId = "{subscriptionId}"; string resourceGroupName = "resourceGroupName"; string name = "{scheduleName}"; - ResourceIdentifier devTestLabGlobalScheduleResourceId = DevTestLabGlobalScheduleResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, name); - DevTestLabGlobalScheduleResource devTestLabGlobalSchedule = client.GetDevTestLabGlobalScheduleResource(devTestLabGlobalScheduleResourceId); + ResourceIdentifier scheduleResourceId = DevTestLabGlobalScheduleResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, name); + DevTestLabGlobalScheduleResource schedule = client.GetDevTestLabGlobalScheduleResource(scheduleResourceId); // invoke the operation DevTestLabGlobalScheduleRetargetContent content = new DevTestLabGlobalScheduleRetargetContent @@ -161,7 +159,7 @@ public async Task Retarget_GlobalSchedulesRetarget() CurrentResourceId = new ResourceIdentifier("/subscriptions/{subscriptionId}/resourcegroups/resourceGroupName/providers/microsoft.devtestlab/labs/{targetLab}"), TargetResourceId = new ResourceIdentifier("/subscriptions/{subscriptionId}/resourcegroups/resourceGroupName/providers/microsoft.devtestlab/labs/{currentLab}"), }; - await devTestLabGlobalSchedule.RetargetAsync(WaitUntil.Completed, content); + await schedule.RetargetAsync(WaitUntil.Completed, content); Console.WriteLine("Succeeded"); } diff --git a/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/tests/Generated/Samples/Sample_SubscriptionResourceExtensions.cs b/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/tests/Samples/Sample_SubscriptionResourceExtensions.cs similarity index 89% rename from sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/tests/Generated/Samples/Sample_SubscriptionResourceExtensions.cs rename to sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/tests/Samples/Sample_SubscriptionResourceExtensions.cs index 552600faf499..5cbe12eed5b0 100644 --- a/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/tests/Generated/Samples/Sample_SubscriptionResourceExtensions.cs +++ b/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/tests/Samples/Sample_SubscriptionResourceExtensions.cs @@ -1,8 +1,6 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. -// - #nullable disable using System; @@ -20,7 +18,7 @@ public partial class Sample_SubscriptionResourceExtensions [Ignore("Only validating compilation of examples")] public async Task GetDevTestLabs_LabsListBySubscription() { - // Generated from example definition: specification/devtestlabs/resource-manager/Microsoft.DevTestLab/stable/2018-09-15/examples/Labs_ListBySubscription.json + // Generated from example definition: 2018-09-15/Labs_ListBySubscription.json // this example is just showing the usage of "Labs_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 @@ -49,9 +47,9 @@ public async Task GetDevTestLabs_LabsListBySubscription() [Test] [Ignore("Only validating compilation of examples")] - public async Task GetDevTestLabGlobalSchedules_GlobalSchedulesListBySubscription() + public async Task GetSchedules_GlobalSchedulesListBySubscription() { - // Generated from example definition: specification/devtestlabs/resource-manager/Microsoft.DevTestLab/stable/2018-09-15/examples/GlobalSchedules_ListBySubscription.json + // Generated from example definition: 2018-09-15/GlobalSchedules_ListBySubscription.json // this example is just showing the usage of "GlobalSchedules_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/devtestlabs/Azure.ResourceManager.DevTestLabs/tsp-location.yaml b/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/tsp-location.yaml new file mode 100644 index 000000000000..744b0823bff5 --- /dev/null +++ b/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/tsp-location.yaml @@ -0,0 +1,4 @@ +directory: specification/devtestlabs/resource-manager/Microsoft.DevTestLab/DevTestLabs +commit: 095b67fa70bf85a51667949506fe090e987d2475 +repo: Azure/azure-rest-api-specs +emitterPackageJsonPath: "eng/azure-typespec-http-client-csharp-mgmt-emitter-package.json"