From d923f307075324fe9ca4e1ba50d2cd66957ec240 Mon Sep 17 00:00:00 2001 From: Zhonglei Ma Date: Tue, 2 Dec 2025 16:05:51 +0800 Subject: [PATCH 1/6] Use the new code generator to generate SDK code from TSP. --- ...ceManager.DisconnectedOperations.net8.0.cs | 42 +- ...r.DisconnectedOperations.netstandard2.0.cs | 42 +- .../ArmDisconnectedOperationsModelFactory.cs | 113 +-- ...actsGetByParentAsyncCollectionResultOfT.cs | 87 ++ ...ArtifactsGetByParentCollectionResultOfT.cs | 86 ++ ...ByResourceGroupAsyncCollectionResultOfT.cs | 81 ++ ...rsGetByResourceGroupCollectionResultOfT.cs | 80 ++ ...tBySubscriptionAsyncCollectionResultOfT.cs | 78 ++ ...prsGetBySubscriptionCollectionResultOfT.cs | 77 ++ ...nectedOperationAsyncCollectionResultOfT.cs | 93 ++ ...isconnectedOperationCollectionResultOfT.cs | 92 ++ .../DisconnectedOperationCollection.cs | 386 ++++---- ...DisconnectedOperationData.Serialization.cs | 160 ++-- .../Generated/DisconnectedOperationData.cs | 63 +- ...onnectedOperationResource.Serialization.cs | 18 +- .../DisconnectedOperationResource.cs | 749 ++++++++-------- ...isconnectedOperationsArtifactCollection.cs | 326 ++++--- ...tedOperationsArtifactData.Serialization.cs | 108 ++- .../DisconnectedOperationsArtifactData.cs | 52 +- ...perationsArtifactResource.Serialization.cs | 18 +- .../DisconnectedOperationsArtifactResource.cs | 181 ++-- .../DisconnectedOperationsImageCollection.cs | 334 ++++--- ...nectedOperationsImageData.Serialization.cs | 108 ++- .../DisconnectedOperationsImageData.cs | 52 +- ...edOperationsImageResource.Serialization.cs | 18 +- .../DisconnectedOperationsImageResource.cs | 279 +++--- .../DisconnectedOperationsExtensions.cs | 156 +--- ...MockableDisconnectedOperationsArmClient.cs | 33 +- ...onnectedOperationsResourceGroupResource.cs | 56 +- ...connectedOperationsSubscriptionResource.cs | 75 +- .../src/Generated/Internal/Argument.cs | 75 +- .../Internal/AsyncPageableWrapper.cs | 48 + .../Internal/ChangeTrackingDictionary.cs | 24 +- .../Generated/Internal/ChangeTrackingList.cs | 17 +- .../Internal/ClientPipelineExtensions.cs | 72 ++ .../Internal/CodeGenMemberAttribute.cs | 20 + .../Internal/CodeGenSerializationAttribute.cs | 48 + .../Internal/CodeGenSuppressAttribute.cs | 29 + .../Internal/CodeGenTypeAttribute.cs | 24 + .../src/Generated/Internal/ErrorResult.cs | 32 + .../Internal/ModelSerializationExtensions.cs | 173 +--- .../src/Generated/Internal/Optional.cs | 12 +- .../src/Generated/Internal/PageableWrapper.cs | 47 + .../RawRequestUriBuilderExtensions.cs | 23 + .../Internal/RequestContextExtensions.cs | 26 + .../Generated/Internal/SerializationFormat.cs | 49 ++ .../src/Generated/Internal/TypeFormatters.cs | 181 ++++ .../Internal/Utf8JsonRequestContent.cs | 8 +- .../DisconnectedOperationOperationSource.cs | 23 +- .../DisconnectedOperationsArmOperation.cs | 70 +- .../DisconnectedOperationsArmOperationOfT.cs | 79 +- .../ArtifactListResult.Serialization.cs | 95 +- .../Generated/Models/ArtifactListResult.cs | 51 +- ...rceManagerDisconnectedOperationsContext.cs | 3 +- ...erationDeploymentManifest.Serialization.cs | 105 ++- ...DisconnectedOperationDeploymentManifest.cs | 64 +- ...nectedOperationListResult.Serialization.cs | 95 +- .../Models/DisconnectedOperationListResult.cs | 51 +- ...isconnectedOperationPatch.Serialization.cs | 107 ++- .../Models/DisconnectedOperationPatch.cs | 41 +- ...nectedOperationProperties.Serialization.cs | 107 ++- .../Models/DisconnectedOperationProperties.cs | 56 +- ...OperationUpdateProperties.Serialization.cs | 86 +- .../DisconnectedOperationUpdateProperties.cs | 41 +- ...onsArtifactDownloadResult.Serialization.cs | 110 ++- ...nnectedOperationsArtifactDownloadResult.cs | 62 +- ...rationsArtifactProperties.Serialization.cs | 94 +- ...isconnectedOperationsArtifactProperties.cs | 56 +- .../DisconnectedOperationsBillingModel.cs | 34 +- .../DisconnectedOperationsConnectionIntent.cs | 38 +- .../DisconnectedOperationsConnectionStatus.cs | 38 +- ...ationsImageDownloadResult.Serialization.cs | 142 +-- ...sconnectedOperationsImageDownloadResult.cs | 72 +- ...OperationsImageProperties.Serialization.cs | 122 +-- .../DisconnectedOperationsImageProperties.cs | 63 +- ...isconnectedOperationsRegistrationStatus.cs | 38 +- .../DisconnectedOperationsReleaseType.cs | 38 +- ...ctedOperationsResourceProvisioningState.cs | 42 +- .../Models/ImageListResult.Serialization.cs | 95 +- .../src/Generated/Models/ImageListResult.cs | 51 +- .../src/Generated/ProviderConstants.cs | 3 +- .../RestOperations/ArtifactsRestOperations.cs | 426 ++------- ...isconnectedOperationsOprsRestOperations.cs | 201 +++++ .../DisconnectedRestOperations.cs | 824 ------------------ .../RestOperations/ImagesRestOperations.cs | 432 ++------- .../tsp-location.yaml | 3 +- 86 files changed, 4571 insertions(+), 4438 deletions(-) create mode 100644 sdk/disconnectedoperations/Azure.ResourceManager.DisconnectedOperations/src/Generated/CollectionResults/ArtifactsGetByParentAsyncCollectionResultOfT.cs create mode 100644 sdk/disconnectedoperations/Azure.ResourceManager.DisconnectedOperations/src/Generated/CollectionResults/ArtifactsGetByParentCollectionResultOfT.cs create mode 100644 sdk/disconnectedoperations/Azure.ResourceManager.DisconnectedOperations/src/Generated/CollectionResults/DisconnectedOperationsOprsGetByResourceGroupAsyncCollectionResultOfT.cs create mode 100644 sdk/disconnectedoperations/Azure.ResourceManager.DisconnectedOperations/src/Generated/CollectionResults/DisconnectedOperationsOprsGetByResourceGroupCollectionResultOfT.cs create mode 100644 sdk/disconnectedoperations/Azure.ResourceManager.DisconnectedOperations/src/Generated/CollectionResults/DisconnectedOperationsOprsGetBySubscriptionAsyncCollectionResultOfT.cs create mode 100644 sdk/disconnectedoperations/Azure.ResourceManager.DisconnectedOperations/src/Generated/CollectionResults/DisconnectedOperationsOprsGetBySubscriptionCollectionResultOfT.cs create mode 100644 sdk/disconnectedoperations/Azure.ResourceManager.DisconnectedOperations/src/Generated/CollectionResults/ImagesGetByDisconnectedOperationAsyncCollectionResultOfT.cs create mode 100644 sdk/disconnectedoperations/Azure.ResourceManager.DisconnectedOperations/src/Generated/CollectionResults/ImagesGetByDisconnectedOperationCollectionResultOfT.cs create mode 100644 sdk/disconnectedoperations/Azure.ResourceManager.DisconnectedOperations/src/Generated/Internal/AsyncPageableWrapper.cs create mode 100644 sdk/disconnectedoperations/Azure.ResourceManager.DisconnectedOperations/src/Generated/Internal/ClientPipelineExtensions.cs create mode 100644 sdk/disconnectedoperations/Azure.ResourceManager.DisconnectedOperations/src/Generated/Internal/CodeGenMemberAttribute.cs create mode 100644 sdk/disconnectedoperations/Azure.ResourceManager.DisconnectedOperations/src/Generated/Internal/CodeGenSerializationAttribute.cs create mode 100644 sdk/disconnectedoperations/Azure.ResourceManager.DisconnectedOperations/src/Generated/Internal/CodeGenSuppressAttribute.cs create mode 100644 sdk/disconnectedoperations/Azure.ResourceManager.DisconnectedOperations/src/Generated/Internal/CodeGenTypeAttribute.cs create mode 100644 sdk/disconnectedoperations/Azure.ResourceManager.DisconnectedOperations/src/Generated/Internal/ErrorResult.cs create mode 100644 sdk/disconnectedoperations/Azure.ResourceManager.DisconnectedOperations/src/Generated/Internal/PageableWrapper.cs create mode 100644 sdk/disconnectedoperations/Azure.ResourceManager.DisconnectedOperations/src/Generated/Internal/RawRequestUriBuilderExtensions.cs create mode 100644 sdk/disconnectedoperations/Azure.ResourceManager.DisconnectedOperations/src/Generated/Internal/RequestContextExtensions.cs create mode 100644 sdk/disconnectedoperations/Azure.ResourceManager.DisconnectedOperations/src/Generated/Internal/SerializationFormat.cs create mode 100644 sdk/disconnectedoperations/Azure.ResourceManager.DisconnectedOperations/src/Generated/Internal/TypeFormatters.cs create mode 100644 sdk/disconnectedoperations/Azure.ResourceManager.DisconnectedOperations/src/Generated/RestOperations/DisconnectedOperationsOprsRestOperations.cs delete mode 100644 sdk/disconnectedoperations/Azure.ResourceManager.DisconnectedOperations/src/Generated/RestOperations/DisconnectedRestOperations.cs diff --git a/sdk/disconnectedoperations/Azure.ResourceManager.DisconnectedOperations/api/Azure.ResourceManager.DisconnectedOperations.net8.0.cs b/sdk/disconnectedoperations/Azure.ResourceManager.DisconnectedOperations/api/Azure.ResourceManager.DisconnectedOperations.net8.0.cs index e1a228632c1d..ac8af320a647 100644 --- a/sdk/disconnectedoperations/Azure.ResourceManager.DisconnectedOperations/api/Azure.ResourceManager.DisconnectedOperations.net8.0.cs +++ b/sdk/disconnectedoperations/Azure.ResourceManager.DisconnectedOperations/api/Azure.ResourceManager.DisconnectedOperations.net8.0.cs @@ -27,7 +27,10 @@ public partial class DisconnectedOperationData : Azure.ResourceManager.Models.Tr { public DisconnectedOperationData(Azure.Core.AzureLocation location) { } public Azure.ResourceManager.DisconnectedOperations.Models.DisconnectedOperationProperties Properties { 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.DisconnectedOperations.DisconnectedOperationData System.ClientModel.Primitives.IJsonModel.Create(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } void System.ClientModel.Primitives.IJsonModel.Write(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } Azure.ResourceManager.DisconnectedOperations.DisconnectedOperationData System.ClientModel.Primitives.IPersistableModel.Create(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } @@ -83,7 +86,10 @@ public partial class DisconnectedOperationsArtifactData : Azure.ResourceManager. { internal DisconnectedOperationsArtifactData() { } public Azure.ResourceManager.DisconnectedOperations.Models.DisconnectedOperationsArtifactProperties Properties { 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.DisconnectedOperations.DisconnectedOperationsArtifactData System.ClientModel.Primitives.IJsonModel.Create(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } void System.ClientModel.Primitives.IJsonModel.Write(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } Azure.ResourceManager.DisconnectedOperations.DisconnectedOperationsArtifactData System.ClientModel.Primitives.IPersistableModel.Create(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } @@ -137,7 +143,10 @@ public partial class DisconnectedOperationsImageData : Azure.ResourceManager.Mod { internal DisconnectedOperationsImageData() { } public Azure.ResourceManager.DisconnectedOperations.Models.DisconnectedOperationsImageProperties Properties { 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.DisconnectedOperations.DisconnectedOperationsImageData System.ClientModel.Primitives.IJsonModel.Create(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } void System.ClientModel.Primitives.IJsonModel.Write(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } Azure.ResourceManager.DisconnectedOperations.DisconnectedOperationsImageData System.ClientModel.Primitives.IPersistableModel.Create(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } @@ -194,6 +203,7 @@ public static partial class ArmDisconnectedOperationsModelFactory { public static Azure.ResourceManager.DisconnectedOperations.DisconnectedOperationData DisconnectedOperationData(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.DisconnectedOperations.Models.DisconnectedOperationProperties properties = null) { throw null; } public static Azure.ResourceManager.DisconnectedOperations.Models.DisconnectedOperationDeploymentManifest DisconnectedOperationDeploymentManifest(Azure.Core.ResourceIdentifier resourceId = null, string resourceName = null, string stampId = null, string location = null, Azure.ResourceManager.DisconnectedOperations.Models.DisconnectedOperationsBillingModel billingModel = default(Azure.ResourceManager.DisconnectedOperations.Models.DisconnectedOperationsBillingModel), Azure.ResourceManager.DisconnectedOperations.Models.DisconnectedOperationsConnectionIntent connectionIntent = default(Azure.ResourceManager.DisconnectedOperations.Models.DisconnectedOperationsConnectionIntent), string cloud = null) { throw null; } + public static Azure.ResourceManager.DisconnectedOperations.Models.DisconnectedOperationPatch DisconnectedOperationPatch(System.Collections.Generic.IDictionary tags = null, Azure.ResourceManager.DisconnectedOperations.Models.DisconnectedOperationUpdateProperties properties = null) { throw null; } public static Azure.ResourceManager.DisconnectedOperations.Models.DisconnectedOperationProperties DisconnectedOperationProperties(Azure.ResourceManager.DisconnectedOperations.Models.DisconnectedOperationsResourceProvisioningState? provisioningState = default(Azure.ResourceManager.DisconnectedOperations.Models.DisconnectedOperationsResourceProvisioningState?), string stampId = null, Azure.ResourceManager.DisconnectedOperations.Models.DisconnectedOperationsBillingModel billingModel = default(Azure.ResourceManager.DisconnectedOperations.Models.DisconnectedOperationsBillingModel), Azure.ResourceManager.DisconnectedOperations.Models.DisconnectedOperationsConnectionIntent connectionIntent = default(Azure.ResourceManager.DisconnectedOperations.Models.DisconnectedOperationsConnectionIntent), Azure.ResourceManager.DisconnectedOperations.Models.DisconnectedOperationsConnectionStatus? connectionStatus = default(Azure.ResourceManager.DisconnectedOperations.Models.DisconnectedOperationsConnectionStatus?), Azure.ResourceManager.DisconnectedOperations.Models.DisconnectedOperationsRegistrationStatus? registrationStatus = default(Azure.ResourceManager.DisconnectedOperations.Models.DisconnectedOperationsRegistrationStatus?), string deviceVersion = null) { throw null; } public static Azure.ResourceManager.DisconnectedOperations.DisconnectedOperationsArtifactData DisconnectedOperationsArtifactData(Azure.Core.ResourceIdentifier id = null, string name = null, Azure.Core.ResourceType resourceType = default(Azure.Core.ResourceType), Azure.ResourceManager.Models.SystemData systemData = null, Azure.ResourceManager.DisconnectedOperations.Models.DisconnectedOperationsArtifactProperties properties = null) { throw null; } public static Azure.ResourceManager.DisconnectedOperations.Models.DisconnectedOperationsArtifactDownloadResult DisconnectedOperationsArtifactDownloadResult(Azure.ResourceManager.DisconnectedOperations.Models.DisconnectedOperationsResourceProvisioningState? provisioningState = default(Azure.ResourceManager.DisconnectedOperations.Models.DisconnectedOperationsResourceProvisioningState?), int artifactOrder = 0, string title = null, string description = null, long? size = default(long?), System.Uri downloadLink = null, System.DateTimeOffset linkExpiry = default(System.DateTimeOffset)) { throw null; } @@ -212,7 +222,10 @@ internal DisconnectedOperationDeploymentManifest() { } public Azure.Core.ResourceIdentifier ResourceId { get { throw null; } } public string ResourceName { get { throw null; } } public string StampId { get { throw null; } } + protected virtual Azure.ResourceManager.DisconnectedOperations.Models.DisconnectedOperationDeploymentManifest 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.DisconnectedOperations.Models.DisconnectedOperationDeploymentManifest 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.DisconnectedOperations.Models.DisconnectedOperationDeploymentManifest System.ClientModel.Primitives.IJsonModel.Create(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } void System.ClientModel.Primitives.IJsonModel.Write(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } Azure.ResourceManager.DisconnectedOperations.Models.DisconnectedOperationDeploymentManifest System.ClientModel.Primitives.IPersistableModel.Create(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } @@ -224,7 +237,10 @@ public partial class DisconnectedOperationPatch : System.ClientModel.Primitives. public DisconnectedOperationPatch() { } public Azure.ResourceManager.DisconnectedOperations.Models.DisconnectedOperationUpdateProperties Properties { get { throw null; } set { } } public System.Collections.Generic.IDictionary Tags { get { throw null; } } + protected virtual Azure.ResourceManager.DisconnectedOperations.Models.DisconnectedOperationPatch 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.DisconnectedOperations.Models.DisconnectedOperationPatch 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.DisconnectedOperations.Models.DisconnectedOperationPatch System.ClientModel.Primitives.IJsonModel.Create(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } void System.ClientModel.Primitives.IJsonModel.Write(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } Azure.ResourceManager.DisconnectedOperations.Models.DisconnectedOperationPatch System.ClientModel.Primitives.IPersistableModel.Create(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } @@ -233,7 +249,7 @@ protected virtual void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer } public partial class DisconnectedOperationProperties : System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel { - public DisconnectedOperationProperties(string stampId, Azure.ResourceManager.DisconnectedOperations.Models.DisconnectedOperationsBillingModel billingModel, Azure.ResourceManager.DisconnectedOperations.Models.DisconnectedOperationsConnectionIntent connectionIntent) { } + public DisconnectedOperationProperties(Azure.ResourceManager.DisconnectedOperations.Models.DisconnectedOperationsConnectionIntent connectionIntent) { } public Azure.ResourceManager.DisconnectedOperations.Models.DisconnectedOperationsBillingModel BillingModel { get { throw null; } } public Azure.ResourceManager.DisconnectedOperations.Models.DisconnectedOperationsConnectionIntent ConnectionIntent { get { throw null; } set { } } public Azure.ResourceManager.DisconnectedOperations.Models.DisconnectedOperationsConnectionStatus? ConnectionStatus { get { throw null; } } @@ -241,7 +257,10 @@ public DisconnectedOperationProperties(string stampId, Azure.ResourceManager.Dis public Azure.ResourceManager.DisconnectedOperations.Models.DisconnectedOperationsResourceProvisioningState? ProvisioningState { get { throw null; } } public Azure.ResourceManager.DisconnectedOperations.Models.DisconnectedOperationsRegistrationStatus? RegistrationStatus { get { throw null; } set { } } public string StampId { get { throw null; } } + protected virtual Azure.ResourceManager.DisconnectedOperations.Models.DisconnectedOperationProperties 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.DisconnectedOperations.Models.DisconnectedOperationProperties 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.DisconnectedOperations.Models.DisconnectedOperationProperties System.ClientModel.Primitives.IJsonModel.Create(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } void System.ClientModel.Primitives.IJsonModel.Write(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } Azure.ResourceManager.DisconnectedOperations.Models.DisconnectedOperationProperties System.ClientModel.Primitives.IPersistableModel.Create(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } @@ -258,7 +277,10 @@ internal DisconnectedOperationsArtifactDownloadResult() { } public Azure.ResourceManager.DisconnectedOperations.Models.DisconnectedOperationsResourceProvisioningState? ProvisioningState { get { throw null; } } public long? Size { get { throw null; } } public string Title { get { throw null; } } + protected virtual Azure.ResourceManager.DisconnectedOperations.Models.DisconnectedOperationsArtifactDownloadResult 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.DisconnectedOperations.Models.DisconnectedOperationsArtifactDownloadResult 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.DisconnectedOperations.Models.DisconnectedOperationsArtifactDownloadResult System.ClientModel.Primitives.IJsonModel.Create(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } void System.ClientModel.Primitives.IJsonModel.Write(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } Azure.ResourceManager.DisconnectedOperations.Models.DisconnectedOperationsArtifactDownloadResult System.ClientModel.Primitives.IPersistableModel.Create(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } @@ -273,7 +295,10 @@ internal DisconnectedOperationsArtifactProperties() { } public Azure.ResourceManager.DisconnectedOperations.Models.DisconnectedOperationsResourceProvisioningState? ProvisioningState { get { throw null; } } public long? Size { get { throw null; } } public string Title { get { throw null; } } + protected virtual Azure.ResourceManager.DisconnectedOperations.Models.DisconnectedOperationsArtifactProperties 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.DisconnectedOperations.Models.DisconnectedOperationsArtifactProperties 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.DisconnectedOperations.Models.DisconnectedOperationsArtifactProperties System.ClientModel.Primitives.IJsonModel.Create(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } void System.ClientModel.Primitives.IJsonModel.Write(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } Azure.ResourceManager.DisconnectedOperations.Models.DisconnectedOperationsArtifactProperties System.ClientModel.Primitives.IPersistableModel.Create(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } @@ -294,6 +319,7 @@ protected virtual void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer public override int GetHashCode() { throw null; } public static bool operator ==(Azure.ResourceManager.DisconnectedOperations.Models.DisconnectedOperationsBillingModel left, Azure.ResourceManager.DisconnectedOperations.Models.DisconnectedOperationsBillingModel right) { throw null; } public static implicit operator Azure.ResourceManager.DisconnectedOperations.Models.DisconnectedOperationsBillingModel (string value) { throw null; } + public static implicit operator Azure.ResourceManager.DisconnectedOperations.Models.DisconnectedOperationsBillingModel? (string value) { throw null; } public static bool operator !=(Azure.ResourceManager.DisconnectedOperations.Models.DisconnectedOperationsBillingModel left, Azure.ResourceManager.DisconnectedOperations.Models.DisconnectedOperationsBillingModel right) { throw null; } public override string ToString() { throw null; } } @@ -312,6 +338,7 @@ protected virtual void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer public override int GetHashCode() { throw null; } public static bool operator ==(Azure.ResourceManager.DisconnectedOperations.Models.DisconnectedOperationsConnectionIntent left, Azure.ResourceManager.DisconnectedOperations.Models.DisconnectedOperationsConnectionIntent right) { throw null; } public static implicit operator Azure.ResourceManager.DisconnectedOperations.Models.DisconnectedOperationsConnectionIntent (string value) { throw null; } + public static implicit operator Azure.ResourceManager.DisconnectedOperations.Models.DisconnectedOperationsConnectionIntent? (string value) { throw null; } public static bool operator !=(Azure.ResourceManager.DisconnectedOperations.Models.DisconnectedOperationsConnectionIntent left, Azure.ResourceManager.DisconnectedOperations.Models.DisconnectedOperationsConnectionIntent right) { throw null; } public override string ToString() { throw null; } } @@ -330,6 +357,7 @@ protected virtual void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer public override int GetHashCode() { throw null; } public static bool operator ==(Azure.ResourceManager.DisconnectedOperations.Models.DisconnectedOperationsConnectionStatus left, Azure.ResourceManager.DisconnectedOperations.Models.DisconnectedOperationsConnectionStatus right) { throw null; } public static implicit operator Azure.ResourceManager.DisconnectedOperations.Models.DisconnectedOperationsConnectionStatus (string value) { throw null; } + public static implicit operator Azure.ResourceManager.DisconnectedOperations.Models.DisconnectedOperationsConnectionStatus? (string value) { throw null; } public static bool operator !=(Azure.ResourceManager.DisconnectedOperations.Models.DisconnectedOperationsConnectionStatus left, Azure.ResourceManager.DisconnectedOperations.Models.DisconnectedOperationsConnectionStatus right) { throw null; } public override string ToString() { throw null; } } @@ -346,7 +374,10 @@ internal DisconnectedOperationsImageDownloadResult() { } public Azure.ResourceManager.DisconnectedOperations.Models.DisconnectedOperationsReleaseType ReleaseType { get { throw null; } } public string ReleaseVersion { get { throw null; } } public string TransactionId { get { throw null; } } + protected virtual Azure.ResourceManager.DisconnectedOperations.Models.DisconnectedOperationsImageDownloadResult 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.DisconnectedOperations.Models.DisconnectedOperationsImageDownloadResult 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.DisconnectedOperations.Models.DisconnectedOperationsImageDownloadResult System.ClientModel.Primitives.IJsonModel.Create(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } void System.ClientModel.Primitives.IJsonModel.Write(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } Azure.ResourceManager.DisconnectedOperations.Models.DisconnectedOperationsImageDownloadResult System.ClientModel.Primitives.IPersistableModel.Create(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } @@ -363,7 +394,10 @@ internal DisconnectedOperationsImageProperties() { } public System.DateTimeOffset ReleaseOn { get { throw null; } } public Azure.ResourceManager.DisconnectedOperations.Models.DisconnectedOperationsReleaseType ReleaseType { get { throw null; } } public string ReleaseVersion { get { throw null; } } + protected virtual Azure.ResourceManager.DisconnectedOperations.Models.DisconnectedOperationsImageProperties 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.DisconnectedOperations.Models.DisconnectedOperationsImageProperties 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.DisconnectedOperations.Models.DisconnectedOperationsImageProperties System.ClientModel.Primitives.IJsonModel.Create(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } void System.ClientModel.Primitives.IJsonModel.Write(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } Azure.ResourceManager.DisconnectedOperations.Models.DisconnectedOperationsImageProperties System.ClientModel.Primitives.IPersistableModel.Create(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } @@ -385,6 +419,7 @@ protected virtual void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer public override int GetHashCode() { throw null; } public static bool operator ==(Azure.ResourceManager.DisconnectedOperations.Models.DisconnectedOperationsRegistrationStatus left, Azure.ResourceManager.DisconnectedOperations.Models.DisconnectedOperationsRegistrationStatus right) { throw null; } public static implicit operator Azure.ResourceManager.DisconnectedOperations.Models.DisconnectedOperationsRegistrationStatus (string value) { throw null; } + public static implicit operator Azure.ResourceManager.DisconnectedOperations.Models.DisconnectedOperationsRegistrationStatus? (string value) { throw null; } public static bool operator !=(Azure.ResourceManager.DisconnectedOperations.Models.DisconnectedOperationsRegistrationStatus left, Azure.ResourceManager.DisconnectedOperations.Models.DisconnectedOperationsRegistrationStatus right) { throw null; } public override string ToString() { throw null; } } @@ -403,6 +438,7 @@ protected virtual void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer public override int GetHashCode() { throw null; } public static bool operator ==(Azure.ResourceManager.DisconnectedOperations.Models.DisconnectedOperationsReleaseType left, Azure.ResourceManager.DisconnectedOperations.Models.DisconnectedOperationsReleaseType right) { throw null; } public static implicit operator Azure.ResourceManager.DisconnectedOperations.Models.DisconnectedOperationsReleaseType (string value) { throw null; } + public static implicit operator Azure.ResourceManager.DisconnectedOperations.Models.DisconnectedOperationsReleaseType? (string value) { throw null; } public static bool operator !=(Azure.ResourceManager.DisconnectedOperations.Models.DisconnectedOperationsReleaseType left, Azure.ResourceManager.DisconnectedOperations.Models.DisconnectedOperationsReleaseType right) { throw null; } public override string ToString() { throw null; } } @@ -422,6 +458,7 @@ protected virtual void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer public override int GetHashCode() { throw null; } public static bool operator ==(Azure.ResourceManager.DisconnectedOperations.Models.DisconnectedOperationsResourceProvisioningState left, Azure.ResourceManager.DisconnectedOperations.Models.DisconnectedOperationsResourceProvisioningState right) { throw null; } public static implicit operator Azure.ResourceManager.DisconnectedOperations.Models.DisconnectedOperationsResourceProvisioningState (string value) { throw null; } + public static implicit operator Azure.ResourceManager.DisconnectedOperations.Models.DisconnectedOperationsResourceProvisioningState? (string value) { throw null; } public static bool operator !=(Azure.ResourceManager.DisconnectedOperations.Models.DisconnectedOperationsResourceProvisioningState left, Azure.ResourceManager.DisconnectedOperations.Models.DisconnectedOperationsResourceProvisioningState right) { throw null; } public override string ToString() { throw null; } } @@ -431,7 +468,10 @@ public DisconnectedOperationUpdateProperties() { } public Azure.ResourceManager.DisconnectedOperations.Models.DisconnectedOperationsConnectionIntent? ConnectionIntent { get { throw null; } set { } } public string DeviceVersion { get { throw null; } set { } } public Azure.ResourceManager.DisconnectedOperations.Models.DisconnectedOperationsRegistrationStatus? RegistrationStatus { get { throw null; } set { } } + protected virtual Azure.ResourceManager.DisconnectedOperations.Models.DisconnectedOperationUpdateProperties 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.DisconnectedOperations.Models.DisconnectedOperationUpdateProperties 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.DisconnectedOperations.Models.DisconnectedOperationUpdateProperties System.ClientModel.Primitives.IJsonModel.Create(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } void System.ClientModel.Primitives.IJsonModel.Write(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } Azure.ResourceManager.DisconnectedOperations.Models.DisconnectedOperationUpdateProperties System.ClientModel.Primitives.IPersistableModel.Create(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } diff --git a/sdk/disconnectedoperations/Azure.ResourceManager.DisconnectedOperations/api/Azure.ResourceManager.DisconnectedOperations.netstandard2.0.cs b/sdk/disconnectedoperations/Azure.ResourceManager.DisconnectedOperations/api/Azure.ResourceManager.DisconnectedOperations.netstandard2.0.cs index e1a228632c1d..ac8af320a647 100644 --- a/sdk/disconnectedoperations/Azure.ResourceManager.DisconnectedOperations/api/Azure.ResourceManager.DisconnectedOperations.netstandard2.0.cs +++ b/sdk/disconnectedoperations/Azure.ResourceManager.DisconnectedOperations/api/Azure.ResourceManager.DisconnectedOperations.netstandard2.0.cs @@ -27,7 +27,10 @@ public partial class DisconnectedOperationData : Azure.ResourceManager.Models.Tr { public DisconnectedOperationData(Azure.Core.AzureLocation location) { } public Azure.ResourceManager.DisconnectedOperations.Models.DisconnectedOperationProperties Properties { 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.DisconnectedOperations.DisconnectedOperationData System.ClientModel.Primitives.IJsonModel.Create(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } void System.ClientModel.Primitives.IJsonModel.Write(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } Azure.ResourceManager.DisconnectedOperations.DisconnectedOperationData System.ClientModel.Primitives.IPersistableModel.Create(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } @@ -83,7 +86,10 @@ public partial class DisconnectedOperationsArtifactData : Azure.ResourceManager. { internal DisconnectedOperationsArtifactData() { } public Azure.ResourceManager.DisconnectedOperations.Models.DisconnectedOperationsArtifactProperties Properties { 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.DisconnectedOperations.DisconnectedOperationsArtifactData System.ClientModel.Primitives.IJsonModel.Create(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } void System.ClientModel.Primitives.IJsonModel.Write(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } Azure.ResourceManager.DisconnectedOperations.DisconnectedOperationsArtifactData System.ClientModel.Primitives.IPersistableModel.Create(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } @@ -137,7 +143,10 @@ public partial class DisconnectedOperationsImageData : Azure.ResourceManager.Mod { internal DisconnectedOperationsImageData() { } public Azure.ResourceManager.DisconnectedOperations.Models.DisconnectedOperationsImageProperties Properties { 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.DisconnectedOperations.DisconnectedOperationsImageData System.ClientModel.Primitives.IJsonModel.Create(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } void System.ClientModel.Primitives.IJsonModel.Write(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } Azure.ResourceManager.DisconnectedOperations.DisconnectedOperationsImageData System.ClientModel.Primitives.IPersistableModel.Create(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } @@ -194,6 +203,7 @@ public static partial class ArmDisconnectedOperationsModelFactory { public static Azure.ResourceManager.DisconnectedOperations.DisconnectedOperationData DisconnectedOperationData(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.DisconnectedOperations.Models.DisconnectedOperationProperties properties = null) { throw null; } public static Azure.ResourceManager.DisconnectedOperations.Models.DisconnectedOperationDeploymentManifest DisconnectedOperationDeploymentManifest(Azure.Core.ResourceIdentifier resourceId = null, string resourceName = null, string stampId = null, string location = null, Azure.ResourceManager.DisconnectedOperations.Models.DisconnectedOperationsBillingModel billingModel = default(Azure.ResourceManager.DisconnectedOperations.Models.DisconnectedOperationsBillingModel), Azure.ResourceManager.DisconnectedOperations.Models.DisconnectedOperationsConnectionIntent connectionIntent = default(Azure.ResourceManager.DisconnectedOperations.Models.DisconnectedOperationsConnectionIntent), string cloud = null) { throw null; } + public static Azure.ResourceManager.DisconnectedOperations.Models.DisconnectedOperationPatch DisconnectedOperationPatch(System.Collections.Generic.IDictionary tags = null, Azure.ResourceManager.DisconnectedOperations.Models.DisconnectedOperationUpdateProperties properties = null) { throw null; } public static Azure.ResourceManager.DisconnectedOperations.Models.DisconnectedOperationProperties DisconnectedOperationProperties(Azure.ResourceManager.DisconnectedOperations.Models.DisconnectedOperationsResourceProvisioningState? provisioningState = default(Azure.ResourceManager.DisconnectedOperations.Models.DisconnectedOperationsResourceProvisioningState?), string stampId = null, Azure.ResourceManager.DisconnectedOperations.Models.DisconnectedOperationsBillingModel billingModel = default(Azure.ResourceManager.DisconnectedOperations.Models.DisconnectedOperationsBillingModel), Azure.ResourceManager.DisconnectedOperations.Models.DisconnectedOperationsConnectionIntent connectionIntent = default(Azure.ResourceManager.DisconnectedOperations.Models.DisconnectedOperationsConnectionIntent), Azure.ResourceManager.DisconnectedOperations.Models.DisconnectedOperationsConnectionStatus? connectionStatus = default(Azure.ResourceManager.DisconnectedOperations.Models.DisconnectedOperationsConnectionStatus?), Azure.ResourceManager.DisconnectedOperations.Models.DisconnectedOperationsRegistrationStatus? registrationStatus = default(Azure.ResourceManager.DisconnectedOperations.Models.DisconnectedOperationsRegistrationStatus?), string deviceVersion = null) { throw null; } public static Azure.ResourceManager.DisconnectedOperations.DisconnectedOperationsArtifactData DisconnectedOperationsArtifactData(Azure.Core.ResourceIdentifier id = null, string name = null, Azure.Core.ResourceType resourceType = default(Azure.Core.ResourceType), Azure.ResourceManager.Models.SystemData systemData = null, Azure.ResourceManager.DisconnectedOperations.Models.DisconnectedOperationsArtifactProperties properties = null) { throw null; } public static Azure.ResourceManager.DisconnectedOperations.Models.DisconnectedOperationsArtifactDownloadResult DisconnectedOperationsArtifactDownloadResult(Azure.ResourceManager.DisconnectedOperations.Models.DisconnectedOperationsResourceProvisioningState? provisioningState = default(Azure.ResourceManager.DisconnectedOperations.Models.DisconnectedOperationsResourceProvisioningState?), int artifactOrder = 0, string title = null, string description = null, long? size = default(long?), System.Uri downloadLink = null, System.DateTimeOffset linkExpiry = default(System.DateTimeOffset)) { throw null; } @@ -212,7 +222,10 @@ internal DisconnectedOperationDeploymentManifest() { } public Azure.Core.ResourceIdentifier ResourceId { get { throw null; } } public string ResourceName { get { throw null; } } public string StampId { get { throw null; } } + protected virtual Azure.ResourceManager.DisconnectedOperations.Models.DisconnectedOperationDeploymentManifest 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.DisconnectedOperations.Models.DisconnectedOperationDeploymentManifest 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.DisconnectedOperations.Models.DisconnectedOperationDeploymentManifest System.ClientModel.Primitives.IJsonModel.Create(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } void System.ClientModel.Primitives.IJsonModel.Write(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } Azure.ResourceManager.DisconnectedOperations.Models.DisconnectedOperationDeploymentManifest System.ClientModel.Primitives.IPersistableModel.Create(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } @@ -224,7 +237,10 @@ public partial class DisconnectedOperationPatch : System.ClientModel.Primitives. public DisconnectedOperationPatch() { } public Azure.ResourceManager.DisconnectedOperations.Models.DisconnectedOperationUpdateProperties Properties { get { throw null; } set { } } public System.Collections.Generic.IDictionary Tags { get { throw null; } } + protected virtual Azure.ResourceManager.DisconnectedOperations.Models.DisconnectedOperationPatch 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.DisconnectedOperations.Models.DisconnectedOperationPatch 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.DisconnectedOperations.Models.DisconnectedOperationPatch System.ClientModel.Primitives.IJsonModel.Create(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } void System.ClientModel.Primitives.IJsonModel.Write(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } Azure.ResourceManager.DisconnectedOperations.Models.DisconnectedOperationPatch System.ClientModel.Primitives.IPersistableModel.Create(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } @@ -233,7 +249,7 @@ protected virtual void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer } public partial class DisconnectedOperationProperties : System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel { - public DisconnectedOperationProperties(string stampId, Azure.ResourceManager.DisconnectedOperations.Models.DisconnectedOperationsBillingModel billingModel, Azure.ResourceManager.DisconnectedOperations.Models.DisconnectedOperationsConnectionIntent connectionIntent) { } + public DisconnectedOperationProperties(Azure.ResourceManager.DisconnectedOperations.Models.DisconnectedOperationsConnectionIntent connectionIntent) { } public Azure.ResourceManager.DisconnectedOperations.Models.DisconnectedOperationsBillingModel BillingModel { get { throw null; } } public Azure.ResourceManager.DisconnectedOperations.Models.DisconnectedOperationsConnectionIntent ConnectionIntent { get { throw null; } set { } } public Azure.ResourceManager.DisconnectedOperations.Models.DisconnectedOperationsConnectionStatus? ConnectionStatus { get { throw null; } } @@ -241,7 +257,10 @@ public DisconnectedOperationProperties(string stampId, Azure.ResourceManager.Dis public Azure.ResourceManager.DisconnectedOperations.Models.DisconnectedOperationsResourceProvisioningState? ProvisioningState { get { throw null; } } public Azure.ResourceManager.DisconnectedOperations.Models.DisconnectedOperationsRegistrationStatus? RegistrationStatus { get { throw null; } set { } } public string StampId { get { throw null; } } + protected virtual Azure.ResourceManager.DisconnectedOperations.Models.DisconnectedOperationProperties 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.DisconnectedOperations.Models.DisconnectedOperationProperties 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.DisconnectedOperations.Models.DisconnectedOperationProperties System.ClientModel.Primitives.IJsonModel.Create(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } void System.ClientModel.Primitives.IJsonModel.Write(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } Azure.ResourceManager.DisconnectedOperations.Models.DisconnectedOperationProperties System.ClientModel.Primitives.IPersistableModel.Create(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } @@ -258,7 +277,10 @@ internal DisconnectedOperationsArtifactDownloadResult() { } public Azure.ResourceManager.DisconnectedOperations.Models.DisconnectedOperationsResourceProvisioningState? ProvisioningState { get { throw null; } } public long? Size { get { throw null; } } public string Title { get { throw null; } } + protected virtual Azure.ResourceManager.DisconnectedOperations.Models.DisconnectedOperationsArtifactDownloadResult 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.DisconnectedOperations.Models.DisconnectedOperationsArtifactDownloadResult 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.DisconnectedOperations.Models.DisconnectedOperationsArtifactDownloadResult System.ClientModel.Primitives.IJsonModel.Create(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } void System.ClientModel.Primitives.IJsonModel.Write(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } Azure.ResourceManager.DisconnectedOperations.Models.DisconnectedOperationsArtifactDownloadResult System.ClientModel.Primitives.IPersistableModel.Create(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } @@ -273,7 +295,10 @@ internal DisconnectedOperationsArtifactProperties() { } public Azure.ResourceManager.DisconnectedOperations.Models.DisconnectedOperationsResourceProvisioningState? ProvisioningState { get { throw null; } } public long? Size { get { throw null; } } public string Title { get { throw null; } } + protected virtual Azure.ResourceManager.DisconnectedOperations.Models.DisconnectedOperationsArtifactProperties 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.DisconnectedOperations.Models.DisconnectedOperationsArtifactProperties 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.DisconnectedOperations.Models.DisconnectedOperationsArtifactProperties System.ClientModel.Primitives.IJsonModel.Create(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } void System.ClientModel.Primitives.IJsonModel.Write(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } Azure.ResourceManager.DisconnectedOperations.Models.DisconnectedOperationsArtifactProperties System.ClientModel.Primitives.IPersistableModel.Create(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } @@ -294,6 +319,7 @@ protected virtual void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer public override int GetHashCode() { throw null; } public static bool operator ==(Azure.ResourceManager.DisconnectedOperations.Models.DisconnectedOperationsBillingModel left, Azure.ResourceManager.DisconnectedOperations.Models.DisconnectedOperationsBillingModel right) { throw null; } public static implicit operator Azure.ResourceManager.DisconnectedOperations.Models.DisconnectedOperationsBillingModel (string value) { throw null; } + public static implicit operator Azure.ResourceManager.DisconnectedOperations.Models.DisconnectedOperationsBillingModel? (string value) { throw null; } public static bool operator !=(Azure.ResourceManager.DisconnectedOperations.Models.DisconnectedOperationsBillingModel left, Azure.ResourceManager.DisconnectedOperations.Models.DisconnectedOperationsBillingModel right) { throw null; } public override string ToString() { throw null; } } @@ -312,6 +338,7 @@ protected virtual void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer public override int GetHashCode() { throw null; } public static bool operator ==(Azure.ResourceManager.DisconnectedOperations.Models.DisconnectedOperationsConnectionIntent left, Azure.ResourceManager.DisconnectedOperations.Models.DisconnectedOperationsConnectionIntent right) { throw null; } public static implicit operator Azure.ResourceManager.DisconnectedOperations.Models.DisconnectedOperationsConnectionIntent (string value) { throw null; } + public static implicit operator Azure.ResourceManager.DisconnectedOperations.Models.DisconnectedOperationsConnectionIntent? (string value) { throw null; } public static bool operator !=(Azure.ResourceManager.DisconnectedOperations.Models.DisconnectedOperationsConnectionIntent left, Azure.ResourceManager.DisconnectedOperations.Models.DisconnectedOperationsConnectionIntent right) { throw null; } public override string ToString() { throw null; } } @@ -330,6 +357,7 @@ protected virtual void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer public override int GetHashCode() { throw null; } public static bool operator ==(Azure.ResourceManager.DisconnectedOperations.Models.DisconnectedOperationsConnectionStatus left, Azure.ResourceManager.DisconnectedOperations.Models.DisconnectedOperationsConnectionStatus right) { throw null; } public static implicit operator Azure.ResourceManager.DisconnectedOperations.Models.DisconnectedOperationsConnectionStatus (string value) { throw null; } + public static implicit operator Azure.ResourceManager.DisconnectedOperations.Models.DisconnectedOperationsConnectionStatus? (string value) { throw null; } public static bool operator !=(Azure.ResourceManager.DisconnectedOperations.Models.DisconnectedOperationsConnectionStatus left, Azure.ResourceManager.DisconnectedOperations.Models.DisconnectedOperationsConnectionStatus right) { throw null; } public override string ToString() { throw null; } } @@ -346,7 +374,10 @@ internal DisconnectedOperationsImageDownloadResult() { } public Azure.ResourceManager.DisconnectedOperations.Models.DisconnectedOperationsReleaseType ReleaseType { get { throw null; } } public string ReleaseVersion { get { throw null; } } public string TransactionId { get { throw null; } } + protected virtual Azure.ResourceManager.DisconnectedOperations.Models.DisconnectedOperationsImageDownloadResult 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.DisconnectedOperations.Models.DisconnectedOperationsImageDownloadResult 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.DisconnectedOperations.Models.DisconnectedOperationsImageDownloadResult System.ClientModel.Primitives.IJsonModel.Create(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } void System.ClientModel.Primitives.IJsonModel.Write(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } Azure.ResourceManager.DisconnectedOperations.Models.DisconnectedOperationsImageDownloadResult System.ClientModel.Primitives.IPersistableModel.Create(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } @@ -363,7 +394,10 @@ internal DisconnectedOperationsImageProperties() { } public System.DateTimeOffset ReleaseOn { get { throw null; } } public Azure.ResourceManager.DisconnectedOperations.Models.DisconnectedOperationsReleaseType ReleaseType { get { throw null; } } public string ReleaseVersion { get { throw null; } } + protected virtual Azure.ResourceManager.DisconnectedOperations.Models.DisconnectedOperationsImageProperties 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.DisconnectedOperations.Models.DisconnectedOperationsImageProperties 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.DisconnectedOperations.Models.DisconnectedOperationsImageProperties System.ClientModel.Primitives.IJsonModel.Create(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } void System.ClientModel.Primitives.IJsonModel.Write(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } Azure.ResourceManager.DisconnectedOperations.Models.DisconnectedOperationsImageProperties System.ClientModel.Primitives.IPersistableModel.Create(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } @@ -385,6 +419,7 @@ protected virtual void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer public override int GetHashCode() { throw null; } public static bool operator ==(Azure.ResourceManager.DisconnectedOperations.Models.DisconnectedOperationsRegistrationStatus left, Azure.ResourceManager.DisconnectedOperations.Models.DisconnectedOperationsRegistrationStatus right) { throw null; } public static implicit operator Azure.ResourceManager.DisconnectedOperations.Models.DisconnectedOperationsRegistrationStatus (string value) { throw null; } + public static implicit operator Azure.ResourceManager.DisconnectedOperations.Models.DisconnectedOperationsRegistrationStatus? (string value) { throw null; } public static bool operator !=(Azure.ResourceManager.DisconnectedOperations.Models.DisconnectedOperationsRegistrationStatus left, Azure.ResourceManager.DisconnectedOperations.Models.DisconnectedOperationsRegistrationStatus right) { throw null; } public override string ToString() { throw null; } } @@ -403,6 +438,7 @@ protected virtual void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer public override int GetHashCode() { throw null; } public static bool operator ==(Azure.ResourceManager.DisconnectedOperations.Models.DisconnectedOperationsReleaseType left, Azure.ResourceManager.DisconnectedOperations.Models.DisconnectedOperationsReleaseType right) { throw null; } public static implicit operator Azure.ResourceManager.DisconnectedOperations.Models.DisconnectedOperationsReleaseType (string value) { throw null; } + public static implicit operator Azure.ResourceManager.DisconnectedOperations.Models.DisconnectedOperationsReleaseType? (string value) { throw null; } public static bool operator !=(Azure.ResourceManager.DisconnectedOperations.Models.DisconnectedOperationsReleaseType left, Azure.ResourceManager.DisconnectedOperations.Models.DisconnectedOperationsReleaseType right) { throw null; } public override string ToString() { throw null; } } @@ -422,6 +458,7 @@ protected virtual void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer public override int GetHashCode() { throw null; } public static bool operator ==(Azure.ResourceManager.DisconnectedOperations.Models.DisconnectedOperationsResourceProvisioningState left, Azure.ResourceManager.DisconnectedOperations.Models.DisconnectedOperationsResourceProvisioningState right) { throw null; } public static implicit operator Azure.ResourceManager.DisconnectedOperations.Models.DisconnectedOperationsResourceProvisioningState (string value) { throw null; } + public static implicit operator Azure.ResourceManager.DisconnectedOperations.Models.DisconnectedOperationsResourceProvisioningState? (string value) { throw null; } public static bool operator !=(Azure.ResourceManager.DisconnectedOperations.Models.DisconnectedOperationsResourceProvisioningState left, Azure.ResourceManager.DisconnectedOperations.Models.DisconnectedOperationsResourceProvisioningState right) { throw null; } public override string ToString() { throw null; } } @@ -431,7 +468,10 @@ public DisconnectedOperationUpdateProperties() { } public Azure.ResourceManager.DisconnectedOperations.Models.DisconnectedOperationsConnectionIntent? ConnectionIntent { get { throw null; } set { } } public string DeviceVersion { get { throw null; } set { } } public Azure.ResourceManager.DisconnectedOperations.Models.DisconnectedOperationsRegistrationStatus? RegistrationStatus { get { throw null; } set { } } + protected virtual Azure.ResourceManager.DisconnectedOperations.Models.DisconnectedOperationUpdateProperties 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.DisconnectedOperations.Models.DisconnectedOperationUpdateProperties 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.DisconnectedOperations.Models.DisconnectedOperationUpdateProperties System.ClientModel.Primitives.IJsonModel.Create(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } void System.ClientModel.Primitives.IJsonModel.Write(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } Azure.ResourceManager.DisconnectedOperations.Models.DisconnectedOperationUpdateProperties System.ClientModel.Primitives.IPersistableModel.Create(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } diff --git a/sdk/disconnectedoperations/Azure.ResourceManager.DisconnectedOperations/src/Generated/ArmDisconnectedOperationsModelFactory.cs b/sdk/disconnectedoperations/Azure.ResourceManager.DisconnectedOperations/src/Generated/ArmDisconnectedOperationsModelFactory.cs index e1146a7d8db0..a092480fbc11 100644 --- a/sdk/disconnectedoperations/Azure.ResourceManager.DisconnectedOperations/src/Generated/ArmDisconnectedOperationsModelFactory.cs +++ b/sdk/disconnectedoperations/Azure.ResourceManager.DisconnectedOperations/src/Generated/ArmDisconnectedOperationsModelFactory.cs @@ -8,39 +8,41 @@ using System; using System.Collections.Generic; using System.Linq; +using Azure; using Azure.Core; +using Azure.ResourceManager.DisconnectedOperations; using Azure.ResourceManager.Models; namespace Azure.ResourceManager.DisconnectedOperations.Models { - /// Model factory for models. + /// A factory class for creating instances of the models for mocking. public static partial class ArmDisconnectedOperationsModelFactory { - /// Initializes a new instance of . - /// The id. - /// The name. - /// The resourceType. - /// The systemData. - /// The tags. - /// The location. + /// Disconnected operation resource. + /// Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. + /// The name of the resource. + /// The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts". + /// Azure Resource Manager metadata containing createdBy and modifiedBy information. + /// Resource tags. + /// The geo-location where the resource lives. /// The resource-specific properties for this resource. /// A new instance for mocking. - public static DisconnectedOperationData DisconnectedOperationData(ResourceIdentifier id = null, string name = null, ResourceType resourceType = default, SystemData systemData = null, IDictionary tags = null, AzureLocation location = default, DisconnectedOperationProperties properties = null) + public static DisconnectedOperationData DisconnectedOperationData(ResourceIdentifier id = default, string name = default, ResourceType resourceType = default, SystemData systemData = default, IDictionary tags = default, AzureLocation location = default, DisconnectedOperationProperties properties = default) { - tags ??= new Dictionary(); + tags ??= new ChangeTrackingDictionary(); return new DisconnectedOperationData( id, name, resourceType, systemData, + additionalBinaryDataProperties: null, tags, location, - properties, - serializedAdditionalRawData: null); + properties); } - /// Initializes a new instance of . + /// The disconnected operation properties. /// The resource provisioning state. /// The unique GUID of the stamp. /// The billing model. @@ -49,7 +51,7 @@ public static DisconnectedOperationData DisconnectedOperationData(ResourceIdenti /// The registration intent. /// The device version. /// A new instance for mocking. - public static DisconnectedOperationProperties DisconnectedOperationProperties(DisconnectedOperationsResourceProvisioningState? provisioningState = null, string stampId = null, DisconnectedOperationsBillingModel billingModel = default, DisconnectedOperationsConnectionIntent connectionIntent = default, DisconnectedOperationsConnectionStatus? connectionStatus = null, DisconnectedOperationsRegistrationStatus? registrationStatus = null, string deviceVersion = null) + public static DisconnectedOperationProperties DisconnectedOperationProperties(DisconnectedOperationsResourceProvisioningState? provisioningState = default, string stampId = default, DisconnectedOperationsBillingModel billingModel = default, DisconnectedOperationsConnectionIntent connectionIntent = default, DisconnectedOperationsConnectionStatus? connectionStatus = default, DisconnectedOperationsRegistrationStatus? registrationStatus = default, string deviceVersion = default) { return new DisconnectedOperationProperties( provisioningState, @@ -59,10 +61,21 @@ public static DisconnectedOperationProperties DisconnectedOperationProperties(Di connectionStatus, registrationStatus, deviceVersion, - serializedAdditionalRawData: null); + additionalBinaryDataProperties: null); } - /// Initializes a new instance of . + /// The type used for update operations of the DisconnectedOperation. + /// Resource tags. + /// The resource-specific properties for this resource. + /// A new instance for mocking. + public static DisconnectedOperationPatch DisconnectedOperationPatch(IDictionary tags = default, DisconnectedOperationUpdateProperties properties = default) + { + tags ??= new ChangeTrackingDictionary(); + + return new DisconnectedOperationPatch(tags, properties, additionalBinaryDataProperties: null); + } + + /// The disconnected operation manifest. /// The resource identifier of the disconnected operations resource. /// The resource name. /// The unique GUID of the stamp. @@ -71,7 +84,7 @@ public static DisconnectedOperationProperties DisconnectedOperationProperties(Di /// The connection intent. /// The cloud in which the resource is registered. /// A new instance for mocking. - public static DisconnectedOperationDeploymentManifest DisconnectedOperationDeploymentManifest(ResourceIdentifier resourceId = null, string resourceName = null, string stampId = null, string location = null, DisconnectedOperationsBillingModel billingModel = default, DisconnectedOperationsConnectionIntent connectionIntent = default, string cloud = null) + public static DisconnectedOperationDeploymentManifest DisconnectedOperationDeploymentManifest(ResourceIdentifier resourceId = default, string resourceName = default, string stampId = default, string location = default, DisconnectedOperationsBillingModel billingModel = default, DisconnectedOperationsConnectionIntent connectionIntent = default, string cloud = default) { return new DisconnectedOperationDeploymentManifest( resourceId, @@ -81,28 +94,28 @@ public static DisconnectedOperationDeploymentManifest DisconnectedOperationDeplo billingModel, connectionIntent, cloud, - serializedAdditionalRawData: null); + additionalBinaryDataProperties: null); } - /// Initializes a new instance of . - /// The id. - /// The name. - /// The resourceType. - /// The systemData. + /// Holds the release information of a disconnected operations image. + /// Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. + /// The name of the resource. + /// The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts". + /// Azure Resource Manager metadata containing createdBy and modifiedBy information. /// The resource-specific properties for this resource. /// A new instance for mocking. - public static DisconnectedOperationsImageData DisconnectedOperationsImageData(ResourceIdentifier id = null, string name = null, ResourceType resourceType = default, SystemData systemData = null, DisconnectedOperationsImageProperties properties = null) + public static DisconnectedOperationsImageData DisconnectedOperationsImageData(ResourceIdentifier id = default, string name = default, ResourceType resourceType = default, SystemData systemData = default, DisconnectedOperationsImageProperties properties = default) { return new DisconnectedOperationsImageData( id, name, resourceType, systemData, - properties, - serializedAdditionalRawData: null); + additionalBinaryDataProperties: null, + properties); } - /// Initializes a new instance of . + /// The image properties. /// The resource provisioning state. /// The version of the package in the format 1.1.1. /// The release name. @@ -111,9 +124,9 @@ public static DisconnectedOperationsImageData DisconnectedOperationsImageData(Re /// The release type. /// The versions that are compatible for this update package. /// A new instance for mocking. - public static DisconnectedOperationsImageProperties DisconnectedOperationsImageProperties(DisconnectedOperationsResourceProvisioningState? provisioningState = null, string releaseVersion = null, string releaseDisplayName = null, string releaseNotes = null, DateTimeOffset releaseOn = default, DisconnectedOperationsReleaseType releaseType = default, IEnumerable compatibleVersions = null) + public static DisconnectedOperationsImageProperties DisconnectedOperationsImageProperties(DisconnectedOperationsResourceProvisioningState? provisioningState = default, string releaseVersion = default, string releaseDisplayName = default, string releaseNotes = default, DateTimeOffset releaseOn = default, DisconnectedOperationsReleaseType releaseType = default, IEnumerable compatibleVersions = default) { - compatibleVersions ??= new List(); + compatibleVersions ??= new ChangeTrackingList(); return new DisconnectedOperationsImageProperties( provisioningState, @@ -122,11 +135,11 @@ public static DisconnectedOperationsImageProperties DisconnectedOperationsImageP releaseNotes, releaseOn, releaseType, - compatibleVersions?.ToList(), - serializedAdditionalRawData: null); + compatibleVersions.ToList(), + additionalBinaryDataProperties: null); } - /// Initializes a new instance of . + /// The image download properties. /// The resource provisioning state. /// The version of the package in the format 1.1.1. /// The release name. @@ -138,9 +151,9 @@ public static DisconnectedOperationsImageProperties DisconnectedOperationsImageP /// The download URI. /// The download link expiry time. /// A new instance for mocking. - public static DisconnectedOperationsImageDownloadResult DisconnectedOperationsImageDownloadResult(DisconnectedOperationsResourceProvisioningState? provisioningState = null, string releaseVersion = null, string releaseDisplayName = null, string releaseNotes = null, DateTimeOffset releaseOn = default, DisconnectedOperationsReleaseType releaseType = default, IEnumerable compatibleVersions = null, string transactionId = null, Uri downloadLink = null, DateTimeOffset linkExpiry = default) + public static DisconnectedOperationsImageDownloadResult DisconnectedOperationsImageDownloadResult(DisconnectedOperationsResourceProvisioningState? provisioningState = default, string releaseVersion = default, string releaseDisplayName = default, string releaseNotes = default, DateTimeOffset releaseOn = default, DisconnectedOperationsReleaseType releaseType = default, IEnumerable compatibleVersions = default, string transactionId = default, Uri downloadLink = default, DateTimeOffset linkExpiry = default) { - compatibleVersions ??= new List(); + compatibleVersions ??= new ChangeTrackingList(); return new DisconnectedOperationsImageDownloadResult( provisioningState, @@ -149,39 +162,39 @@ public static DisconnectedOperationsImageDownloadResult DisconnectedOperationsIm releaseNotes, releaseOn, releaseType, - compatibleVersions?.ToList(), + compatibleVersions.ToList(), transactionId, downloadLink, linkExpiry, - serializedAdditionalRawData: null); + additionalBinaryDataProperties: null); } - /// Initializes a new instance of . - /// The id. - /// The name. - /// The resourceType. - /// The systemData. + /// Disconnected operations artifact resource. + /// Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. + /// The name of the resource. + /// The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts". + /// Azure Resource Manager metadata containing createdBy and modifiedBy information. /// The resource-specific properties for this resource. /// A new instance for mocking. - public static DisconnectedOperationsArtifactData DisconnectedOperationsArtifactData(ResourceIdentifier id = null, string name = null, ResourceType resourceType = default, SystemData systemData = null, DisconnectedOperationsArtifactProperties properties = null) + public static DisconnectedOperationsArtifactData DisconnectedOperationsArtifactData(ResourceIdentifier id = default, string name = default, ResourceType resourceType = default, SystemData systemData = default, DisconnectedOperationsArtifactProperties properties = default) { return new DisconnectedOperationsArtifactData( id, name, resourceType, systemData, - properties, - serializedAdditionalRawData: null); + additionalBinaryDataProperties: null, + properties); } - /// Initializes a new instance of . + /// The artifact properties. /// The resource provisioning state. /// The artifact display order. /// The artifact title. /// The artifact description. /// The artifact size in MB. /// A new instance for mocking. - public static DisconnectedOperationsArtifactProperties DisconnectedOperationsArtifactProperties(DisconnectedOperationsResourceProvisioningState? provisioningState = null, int artifactOrder = default, string title = null, string description = null, long? size = null) + public static DisconnectedOperationsArtifactProperties DisconnectedOperationsArtifactProperties(DisconnectedOperationsResourceProvisioningState? provisioningState = default, int artifactOrder = default, string title = default, string description = default, long? size = default) { return new DisconnectedOperationsArtifactProperties( provisioningState, @@ -189,10 +202,10 @@ public static DisconnectedOperationsArtifactProperties DisconnectedOperationsArt title, description, size, - serializedAdditionalRawData: null); + additionalBinaryDataProperties: null); } - /// Initializes a new instance of . + /// The artifact download properties. /// The resource provisioning state. /// The artifact display order. /// The artifact title. @@ -201,7 +214,7 @@ public static DisconnectedOperationsArtifactProperties DisconnectedOperationsArt /// The download URI. /// The download link expiry time. /// A new instance for mocking. - public static DisconnectedOperationsArtifactDownloadResult DisconnectedOperationsArtifactDownloadResult(DisconnectedOperationsResourceProvisioningState? provisioningState = null, int artifactOrder = default, string title = null, string description = null, long? size = null, Uri downloadLink = null, DateTimeOffset linkExpiry = default) + public static DisconnectedOperationsArtifactDownloadResult DisconnectedOperationsArtifactDownloadResult(DisconnectedOperationsResourceProvisioningState? provisioningState = default, int artifactOrder = default, string title = default, string description = default, long? size = default, Uri downloadLink = default, DateTimeOffset linkExpiry = default) { return new DisconnectedOperationsArtifactDownloadResult( provisioningState, @@ -211,7 +224,7 @@ public static DisconnectedOperationsArtifactDownloadResult DisconnectedOperation size, downloadLink, linkExpiry, - serializedAdditionalRawData: null); + additionalBinaryDataProperties: null); } } } diff --git a/sdk/disconnectedoperations/Azure.ResourceManager.DisconnectedOperations/src/Generated/CollectionResults/ArtifactsGetByParentAsyncCollectionResultOfT.cs b/sdk/disconnectedoperations/Azure.ResourceManager.DisconnectedOperations/src/Generated/CollectionResults/ArtifactsGetByParentAsyncCollectionResultOfT.cs new file mode 100644 index 000000000000..02cdb235bc9f --- /dev/null +++ b/sdk/disconnectedoperations/Azure.ResourceManager.DisconnectedOperations/src/Generated/CollectionResults/ArtifactsGetByParentAsyncCollectionResultOfT.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.DisconnectedOperations.Models; + +namespace Azure.ResourceManager.DisconnectedOperations +{ + internal partial class ArtifactsGetByParentAsyncCollectionResultOfT : AsyncPageable + { + private readonly Artifacts _client; + private readonly Guid _subscriptionId; + private readonly string _resourceGroupName; + private readonly string _name; + private readonly string _imageName; + private readonly RequestContext _context; + + /// Initializes a new instance of ArtifactsGetByParentAsyncCollectionResultOfT, 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. + /// Name of the resource. + /// The name of the Image. + /// The request options, which can override default behaviors of the client pipeline on a per-call basis. + public ArtifactsGetByParentAsyncCollectionResultOfT(Artifacts client, Guid subscriptionId, string resourceGroupName, string name, string imageName, RequestContext context) : base(context?.CancellationToken ?? default) + { + _client = client; + _subscriptionId = subscriptionId; + _resourceGroupName = resourceGroupName; + _name = name; + _imageName = imageName; + _context = context; + } + + /// Gets the pages of ArtifactsGetByParentAsyncCollectionResultOfT as an enumerable collection. + /// A continuation token indicating where to resume paging. + /// The number of items per page. + /// The pages of ArtifactsGetByParentAsyncCollectionResultOfT 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; + } + ArtifactListResult result = ArtifactListResult.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.CreateNextGetByParentRequest(nextLink, _subscriptionId, _resourceGroupName, _name, _imageName, _context) : _client.CreateGetByParentRequest(_subscriptionId, _resourceGroupName, _name, _imageName, _context); + using DiagnosticScope scope = _client.ClientDiagnostics.CreateScope("DisconnectedOperationsArtifactCollection.GetAll"); + scope.Start(); + try + { + return await _client.Pipeline.ProcessMessageAsync(message, _context).ConfigureAwait(false); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + } +} diff --git a/sdk/disconnectedoperations/Azure.ResourceManager.DisconnectedOperations/src/Generated/CollectionResults/ArtifactsGetByParentCollectionResultOfT.cs b/sdk/disconnectedoperations/Azure.ResourceManager.DisconnectedOperations/src/Generated/CollectionResults/ArtifactsGetByParentCollectionResultOfT.cs new file mode 100644 index 000000000000..ca673adfa04f --- /dev/null +++ b/sdk/disconnectedoperations/Azure.ResourceManager.DisconnectedOperations/src/Generated/CollectionResults/ArtifactsGetByParentCollectionResultOfT.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.DisconnectedOperations.Models; + +namespace Azure.ResourceManager.DisconnectedOperations +{ + internal partial class ArtifactsGetByParentCollectionResultOfT : Pageable + { + private readonly Artifacts _client; + private readonly Guid _subscriptionId; + private readonly string _resourceGroupName; + private readonly string _name; + private readonly string _imageName; + private readonly RequestContext _context; + + /// Initializes a new instance of ArtifactsGetByParentCollectionResultOfT, 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. + /// Name of the resource. + /// The name of the Image. + /// The request options, which can override default behaviors of the client pipeline on a per-call basis. + public ArtifactsGetByParentCollectionResultOfT(Artifacts client, Guid subscriptionId, string resourceGroupName, string name, string imageName, RequestContext context) : base(context?.CancellationToken ?? default) + { + _client = client; + _subscriptionId = subscriptionId; + _resourceGroupName = resourceGroupName; + _name = name; + _imageName = imageName; + _context = context; + } + + /// Gets the pages of ArtifactsGetByParentCollectionResultOfT as an enumerable collection. + /// A continuation token indicating where to resume paging. + /// The number of items per page. + /// The pages of ArtifactsGetByParentCollectionResultOfT 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; + } + ArtifactListResult result = ArtifactListResult.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.CreateNextGetByParentRequest(nextLink, _subscriptionId, _resourceGroupName, _name, _imageName, _context) : _client.CreateGetByParentRequest(_subscriptionId, _resourceGroupName, _name, _imageName, _context); + using DiagnosticScope scope = _client.ClientDiagnostics.CreateScope("DisconnectedOperationsArtifactCollection.GetAll"); + scope.Start(); + try + { + return _client.Pipeline.ProcessMessage(message, _context); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + } +} diff --git a/sdk/disconnectedoperations/Azure.ResourceManager.DisconnectedOperations/src/Generated/CollectionResults/DisconnectedOperationsOprsGetByResourceGroupAsyncCollectionResultOfT.cs b/sdk/disconnectedoperations/Azure.ResourceManager.DisconnectedOperations/src/Generated/CollectionResults/DisconnectedOperationsOprsGetByResourceGroupAsyncCollectionResultOfT.cs new file mode 100644 index 000000000000..1a18539442db --- /dev/null +++ b/sdk/disconnectedoperations/Azure.ResourceManager.DisconnectedOperations/src/Generated/CollectionResults/DisconnectedOperationsOprsGetByResourceGroupAsyncCollectionResultOfT.cs @@ -0,0 +1,81 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; +using System.Threading.Tasks; +using Azure; +using Azure.Core; +using Azure.Core.Pipeline; +using Azure.ResourceManager.DisconnectedOperations.Models; + +namespace Azure.ResourceManager.DisconnectedOperations +{ + internal partial class DisconnectedOperationsOprsGetByResourceGroupAsyncCollectionResultOfT : AsyncPageable + { + private readonly DisconnectedOperationsOprs _client; + private readonly Guid _subscriptionId; + private readonly string _resourceGroupName; + private readonly RequestContext _context; + + /// Initializes a new instance of DisconnectedOperationsOprsGetByResourceGroupAsyncCollectionResultOfT, which is used to iterate over the pages of a collection. + /// The DisconnectedOperationsOprs client used to send requests. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. + /// The request options, which can override default behaviors of the client pipeline on a per-call basis. + public DisconnectedOperationsOprsGetByResourceGroupAsyncCollectionResultOfT(DisconnectedOperationsOprs client, Guid subscriptionId, string resourceGroupName, RequestContext context) : base(context?.CancellationToken ?? default) + { + _client = client; + _subscriptionId = subscriptionId; + _resourceGroupName = resourceGroupName; + _context = context; + } + + /// Gets the pages of DisconnectedOperationsOprsGetByResourceGroupAsyncCollectionResultOfT as an enumerable collection. + /// A continuation token indicating where to resume paging. + /// The number of items per page. + /// The pages of DisconnectedOperationsOprsGetByResourceGroupAsyncCollectionResultOfT 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; + } + DisconnectedOperationListResult result = DisconnectedOperationListResult.FromResponse(response); + yield return Page.FromValues((IReadOnlyList)result.Value, nextPage?.AbsoluteUri, response); + nextPage = result.NextLink; + if (nextPage == null) + { + yield break; + } + } + } + + /// Get next page. + /// The number of items per page. + /// The next link to use for the next page of results. + private async ValueTask GetNextResponseAsync(int? pageSizeHint, Uri nextLink) + { + HttpMessage message = nextLink != null ? _client.CreateNextGetByResourceGroupRequest(nextLink, _subscriptionId, _resourceGroupName, _context) : _client.CreateGetByResourceGroupRequest(_subscriptionId, _resourceGroupName, _context); + using DiagnosticScope scope = _client.ClientDiagnostics.CreateScope("DisconnectedOperationCollection.GetAll"); + scope.Start(); + try + { + return await _client.Pipeline.ProcessMessageAsync(message, _context).ConfigureAwait(false); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + } +} diff --git a/sdk/disconnectedoperations/Azure.ResourceManager.DisconnectedOperations/src/Generated/CollectionResults/DisconnectedOperationsOprsGetByResourceGroupCollectionResultOfT.cs b/sdk/disconnectedoperations/Azure.ResourceManager.DisconnectedOperations/src/Generated/CollectionResults/DisconnectedOperationsOprsGetByResourceGroupCollectionResultOfT.cs new file mode 100644 index 000000000000..bf9b7a170335 --- /dev/null +++ b/sdk/disconnectedoperations/Azure.ResourceManager.DisconnectedOperations/src/Generated/CollectionResults/DisconnectedOperationsOprsGetByResourceGroupCollectionResultOfT.cs @@ -0,0 +1,80 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; +using Azure; +using Azure.Core; +using Azure.Core.Pipeline; +using Azure.ResourceManager.DisconnectedOperations.Models; + +namespace Azure.ResourceManager.DisconnectedOperations +{ + internal partial class DisconnectedOperationsOprsGetByResourceGroupCollectionResultOfT : Pageable + { + private readonly DisconnectedOperationsOprs _client; + private readonly Guid _subscriptionId; + private readonly string _resourceGroupName; + private readonly RequestContext _context; + + /// Initializes a new instance of DisconnectedOperationsOprsGetByResourceGroupCollectionResultOfT, which is used to iterate over the pages of a collection. + /// The DisconnectedOperationsOprs client used to send requests. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. + /// The request options, which can override default behaviors of the client pipeline on a per-call basis. + public DisconnectedOperationsOprsGetByResourceGroupCollectionResultOfT(DisconnectedOperationsOprs client, Guid subscriptionId, string resourceGroupName, RequestContext context) : base(context?.CancellationToken ?? default) + { + _client = client; + _subscriptionId = subscriptionId; + _resourceGroupName = resourceGroupName; + _context = context; + } + + /// Gets the pages of DisconnectedOperationsOprsGetByResourceGroupCollectionResultOfT as an enumerable collection. + /// A continuation token indicating where to resume paging. + /// The number of items per page. + /// The pages of DisconnectedOperationsOprsGetByResourceGroupCollectionResultOfT 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; + } + DisconnectedOperationListResult result = DisconnectedOperationListResult.FromResponse(response); + yield return Page.FromValues((IReadOnlyList)result.Value, nextPage?.AbsoluteUri, response); + nextPage = result.NextLink; + if (nextPage == null) + { + yield break; + } + } + } + + /// Get next page. + /// The number of items per page. + /// The next link to use for the next page of results. + private Response GetNextResponse(int? pageSizeHint, Uri nextLink) + { + HttpMessage message = nextLink != null ? _client.CreateNextGetByResourceGroupRequest(nextLink, _subscriptionId, _resourceGroupName, _context) : _client.CreateGetByResourceGroupRequest(_subscriptionId, _resourceGroupName, _context); + using DiagnosticScope scope = _client.ClientDiagnostics.CreateScope("DisconnectedOperationCollection.GetAll"); + scope.Start(); + try + { + return _client.Pipeline.ProcessMessage(message, _context); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + } +} diff --git a/sdk/disconnectedoperations/Azure.ResourceManager.DisconnectedOperations/src/Generated/CollectionResults/DisconnectedOperationsOprsGetBySubscriptionAsyncCollectionResultOfT.cs b/sdk/disconnectedoperations/Azure.ResourceManager.DisconnectedOperations/src/Generated/CollectionResults/DisconnectedOperationsOprsGetBySubscriptionAsyncCollectionResultOfT.cs new file mode 100644 index 000000000000..7855cd25df38 --- /dev/null +++ b/sdk/disconnectedoperations/Azure.ResourceManager.DisconnectedOperations/src/Generated/CollectionResults/DisconnectedOperationsOprsGetBySubscriptionAsyncCollectionResultOfT.cs @@ -0,0 +1,78 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; +using System.Threading.Tasks; +using Azure; +using Azure.Core; +using Azure.Core.Pipeline; +using Azure.ResourceManager.DisconnectedOperations.Models; + +namespace Azure.ResourceManager.DisconnectedOperations +{ + internal partial class DisconnectedOperationsOprsGetBySubscriptionAsyncCollectionResultOfT : AsyncPageable + { + private readonly DisconnectedOperationsOprs _client; + private readonly Guid _subscriptionId; + private readonly RequestContext _context; + + /// Initializes a new instance of DisconnectedOperationsOprsGetBySubscriptionAsyncCollectionResultOfT, which is used to iterate over the pages of a collection. + /// The DisconnectedOperationsOprs client used to send requests. + /// The ID of the target subscription. The value must be an UUID. + /// The request options, which can override default behaviors of the client pipeline on a per-call basis. + public DisconnectedOperationsOprsGetBySubscriptionAsyncCollectionResultOfT(DisconnectedOperationsOprs client, Guid subscriptionId, RequestContext context) : base(context?.CancellationToken ?? default) + { + _client = client; + _subscriptionId = subscriptionId; + _context = context; + } + + /// Gets the pages of DisconnectedOperationsOprsGetBySubscriptionAsyncCollectionResultOfT as an enumerable collection. + /// A continuation token indicating where to resume paging. + /// The number of items per page. + /// The pages of DisconnectedOperationsOprsGetBySubscriptionAsyncCollectionResultOfT 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; + } + DisconnectedOperationListResult result = DisconnectedOperationListResult.FromResponse(response); + yield return Page.FromValues((IReadOnlyList)result.Value, nextPage?.AbsoluteUri, response); + nextPage = result.NextLink; + if (nextPage == null) + { + yield break; + } + } + } + + /// Get next page. + /// The number of items per page. + /// The next link to use for the next page of results. + private async ValueTask GetNextResponseAsync(int? pageSizeHint, Uri nextLink) + { + HttpMessage message = nextLink != null ? _client.CreateNextGetBySubscriptionRequest(nextLink, _subscriptionId, _context) : _client.CreateGetBySubscriptionRequest(_subscriptionId, _context); + using DiagnosticScope scope = _client.ClientDiagnostics.CreateScope("MockableDisconnectedOperationsSubscriptionResource.GetDisconnectedOperations"); + scope.Start(); + try + { + return await _client.Pipeline.ProcessMessageAsync(message, _context).ConfigureAwait(false); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + } +} diff --git a/sdk/disconnectedoperations/Azure.ResourceManager.DisconnectedOperations/src/Generated/CollectionResults/DisconnectedOperationsOprsGetBySubscriptionCollectionResultOfT.cs b/sdk/disconnectedoperations/Azure.ResourceManager.DisconnectedOperations/src/Generated/CollectionResults/DisconnectedOperationsOprsGetBySubscriptionCollectionResultOfT.cs new file mode 100644 index 000000000000..1c53cc676aa9 --- /dev/null +++ b/sdk/disconnectedoperations/Azure.ResourceManager.DisconnectedOperations/src/Generated/CollectionResults/DisconnectedOperationsOprsGetBySubscriptionCollectionResultOfT.cs @@ -0,0 +1,77 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; +using Azure; +using Azure.Core; +using Azure.Core.Pipeline; +using Azure.ResourceManager.DisconnectedOperations.Models; + +namespace Azure.ResourceManager.DisconnectedOperations +{ + internal partial class DisconnectedOperationsOprsGetBySubscriptionCollectionResultOfT : Pageable + { + private readonly DisconnectedOperationsOprs _client; + private readonly Guid _subscriptionId; + private readonly RequestContext _context; + + /// Initializes a new instance of DisconnectedOperationsOprsGetBySubscriptionCollectionResultOfT, which is used to iterate over the pages of a collection. + /// The DisconnectedOperationsOprs client used to send requests. + /// The ID of the target subscription. The value must be an UUID. + /// The request options, which can override default behaviors of the client pipeline on a per-call basis. + public DisconnectedOperationsOprsGetBySubscriptionCollectionResultOfT(DisconnectedOperationsOprs client, Guid subscriptionId, RequestContext context) : base(context?.CancellationToken ?? default) + { + _client = client; + _subscriptionId = subscriptionId; + _context = context; + } + + /// Gets the pages of DisconnectedOperationsOprsGetBySubscriptionCollectionResultOfT as an enumerable collection. + /// A continuation token indicating where to resume paging. + /// The number of items per page. + /// The pages of DisconnectedOperationsOprsGetBySubscriptionCollectionResultOfT 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; + } + DisconnectedOperationListResult result = DisconnectedOperationListResult.FromResponse(response); + yield return Page.FromValues((IReadOnlyList)result.Value, nextPage?.AbsoluteUri, response); + nextPage = result.NextLink; + if (nextPage == null) + { + yield break; + } + } + } + + /// Get next page. + /// The number of items per page. + /// The next link to use for the next page of results. + private Response GetNextResponse(int? pageSizeHint, Uri nextLink) + { + HttpMessage message = nextLink != null ? _client.CreateNextGetBySubscriptionRequest(nextLink, _subscriptionId, _context) : _client.CreateGetBySubscriptionRequest(_subscriptionId, _context); + using DiagnosticScope scope = _client.ClientDiagnostics.CreateScope("MockableDisconnectedOperationsSubscriptionResource.GetDisconnectedOperations"); + scope.Start(); + try + { + return _client.Pipeline.ProcessMessage(message, _context); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + } +} diff --git a/sdk/disconnectedoperations/Azure.ResourceManager.DisconnectedOperations/src/Generated/CollectionResults/ImagesGetByDisconnectedOperationAsyncCollectionResultOfT.cs b/sdk/disconnectedoperations/Azure.ResourceManager.DisconnectedOperations/src/Generated/CollectionResults/ImagesGetByDisconnectedOperationAsyncCollectionResultOfT.cs new file mode 100644 index 000000000000..29d5f356f2e6 --- /dev/null +++ b/sdk/disconnectedoperations/Azure.ResourceManager.DisconnectedOperations/src/Generated/CollectionResults/ImagesGetByDisconnectedOperationAsyncCollectionResultOfT.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.DisconnectedOperations.Models; + +namespace Azure.ResourceManager.DisconnectedOperations +{ + internal partial class ImagesGetByDisconnectedOperationAsyncCollectionResultOfT : AsyncPageable + { + private readonly Images _client; + private readonly Guid _subscriptionId; + private readonly string _resourceGroupName; + private readonly string _name; + private readonly string _filter; + private readonly int? _top; + private readonly int? _skip; + private readonly RequestContext _context; + + /// Initializes a new instance of ImagesGetByDisconnectedOperationAsyncCollectionResultOfT, which is used to iterate over the pages of a collection. + /// The Images client used to send requests. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. + /// Name of the resource. + /// Filter the result list using the given expression. + /// The number of result items to return. + /// The number of result items to skip. + /// The request options, which can override default behaviors of the client pipeline on a per-call basis. + public ImagesGetByDisconnectedOperationAsyncCollectionResultOfT(Images client, Guid subscriptionId, string resourceGroupName, string name, string filter, int? top, int? skip, RequestContext context) : base(context?.CancellationToken ?? default) + { + _client = client; + _subscriptionId = subscriptionId; + _resourceGroupName = resourceGroupName; + _name = name; + _filter = filter; + _top = top; + _skip = skip; + _context = context; + } + + /// Gets the pages of ImagesGetByDisconnectedOperationAsyncCollectionResultOfT as an enumerable collection. + /// A continuation token indicating where to resume paging. + /// The number of items per page. + /// The pages of ImagesGetByDisconnectedOperationAsyncCollectionResultOfT 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; + } + ImageListResult result = ImageListResult.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.CreateNextGetByDisconnectedOperationRequest(nextLink, _subscriptionId, _resourceGroupName, _name, _filter, _top, _skip, _context) : _client.CreateGetByDisconnectedOperationRequest(_subscriptionId, _resourceGroupName, _name, _filter, _top, _skip, _context); + using DiagnosticScope scope = _client.ClientDiagnostics.CreateScope("DisconnectedOperationsImageCollection.GetAll"); + scope.Start(); + try + { + return await _client.Pipeline.ProcessMessageAsync(message, _context).ConfigureAwait(false); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + } +} diff --git a/sdk/disconnectedoperations/Azure.ResourceManager.DisconnectedOperations/src/Generated/CollectionResults/ImagesGetByDisconnectedOperationCollectionResultOfT.cs b/sdk/disconnectedoperations/Azure.ResourceManager.DisconnectedOperations/src/Generated/CollectionResults/ImagesGetByDisconnectedOperationCollectionResultOfT.cs new file mode 100644 index 000000000000..30039f05e38b --- /dev/null +++ b/sdk/disconnectedoperations/Azure.ResourceManager.DisconnectedOperations/src/Generated/CollectionResults/ImagesGetByDisconnectedOperationCollectionResultOfT.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.DisconnectedOperations.Models; + +namespace Azure.ResourceManager.DisconnectedOperations +{ + internal partial class ImagesGetByDisconnectedOperationCollectionResultOfT : Pageable + { + private readonly Images _client; + private readonly Guid _subscriptionId; + private readonly string _resourceGroupName; + private readonly string _name; + private readonly string _filter; + private readonly int? _top; + private readonly int? _skip; + private readonly RequestContext _context; + + /// Initializes a new instance of ImagesGetByDisconnectedOperationCollectionResultOfT, which is used to iterate over the pages of a collection. + /// The Images client used to send requests. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. + /// Name of the resource. + /// Filter the result list using the given expression. + /// The number of result items to return. + /// The number of result items to skip. + /// The request options, which can override default behaviors of the client pipeline on a per-call basis. + public ImagesGetByDisconnectedOperationCollectionResultOfT(Images client, Guid subscriptionId, string resourceGroupName, string name, string filter, int? top, int? skip, RequestContext context) : base(context?.CancellationToken ?? default) + { + _client = client; + _subscriptionId = subscriptionId; + _resourceGroupName = resourceGroupName; + _name = name; + _filter = filter; + _top = top; + _skip = skip; + _context = context; + } + + /// Gets the pages of ImagesGetByDisconnectedOperationCollectionResultOfT as an enumerable collection. + /// A continuation token indicating where to resume paging. + /// The number of items per page. + /// The pages of ImagesGetByDisconnectedOperationCollectionResultOfT 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; + } + ImageListResult result = ImageListResult.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.CreateNextGetByDisconnectedOperationRequest(nextLink, _subscriptionId, _resourceGroupName, _name, _filter, _top, _skip, _context) : _client.CreateGetByDisconnectedOperationRequest(_subscriptionId, _resourceGroupName, _name, _filter, _top, _skip, _context); + using DiagnosticScope scope = _client.ClientDiagnostics.CreateScope("DisconnectedOperationsImageCollection.GetAll"); + scope.Start(); + try + { + return _client.Pipeline.ProcessMessage(message, _context); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + } +} diff --git a/sdk/disconnectedoperations/Azure.ResourceManager.DisconnectedOperations/src/Generated/DisconnectedOperationCollection.cs b/sdk/disconnectedoperations/Azure.ResourceManager.DisconnectedOperations/src/Generated/DisconnectedOperationCollection.cs index 1024351c100e..c12e5f4eb2f5 100644 --- a/sdk/disconnectedoperations/Azure.ResourceManager.DisconnectedOperations/src/Generated/DisconnectedOperationCollection.cs +++ b/sdk/disconnectedoperations/Azure.ResourceManager.DisconnectedOperations/src/Generated/DisconnectedOperationCollection.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.DisconnectedOperations @@ -25,51 +26,49 @@ namespace Azure.ResourceManager.DisconnectedOperations /// public partial class DisconnectedOperationCollection : ArmCollection, IEnumerable, IAsyncEnumerable { - private readonly ClientDiagnostics _disconnectedOperationClientDiagnostics; - private readonly DisconnectedRestOperations _disconnectedOperationRestClient; + private readonly ClientDiagnostics _disconnectedOperationsOprsClientDiagnostics; + private readonly DisconnectedOperationsOprs _disconnectedOperationsOprsRestClient; - /// Initializes a new instance of the class for mocking. + /// Initializes a new instance of DisconnectedOperationCollection for mocking. protected DisconnectedOperationCollection() { } - /// 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 DisconnectedOperationCollection(ArmClient client, ResourceIdentifier id) : base(client, id) { - _disconnectedOperationClientDiagnostics = new ClientDiagnostics("Azure.ResourceManager.DisconnectedOperations", DisconnectedOperationResource.ResourceType.Namespace, Diagnostics); TryGetApiVersion(DisconnectedOperationResource.ResourceType, out string disconnectedOperationApiVersion); - _disconnectedOperationRestClient = new DisconnectedRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, disconnectedOperationApiVersion); -#if DEBUG - ValidateResourceId(Id); -#endif + _disconnectedOperationsOprsClientDiagnostics = new ClientDiagnostics("Azure.ResourceManager.DisconnectedOperations", DisconnectedOperationResource.ResourceType.Namespace, Diagnostics); + _disconnectedOperationsOprsRestClient = new DisconnectedOperationsOprs(_disconnectedOperationsOprsClientDiagnostics, Pipeline, Endpoint, disconnectedOperationApiVersion ?? "2025-06-01-preview"); + ValidateResourceId(id); } + /// + [Conditional("DEBUG")] internal static void ValidateResourceId(ResourceIdentifier id) { if (id.ResourceType != ResourceGroupResource.ResourceType) - throw new ArgumentException(string.Format(CultureInfo.CurrentCulture, "Invalid resource type {0} expected {1}", id.ResourceType, ResourceGroupResource.ResourceType), nameof(id)); + { + throw new ArgumentException(string.Format("Invalid resource type {0} expected {1}", id.ResourceType, ResourceGroupResource.ResourceType), id); + } } /// /// Create a DisconnectedOperation /// /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Edge/disconnectedOperations/{name} - /// - /// - /// Operation Id - /// DisconnectedOperation_CreateOrUpdate + /// Request Path. + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Edge/disconnectedOperations/{name}. /// /// - /// Default Api Version - /// 2025-06-01-preview + /// Operation Id. + /// DisconnectedOperations_CreateOrUpdate. /// /// - /// Resource - /// + /// Default Api Version. + /// 2025-06-01-preview. /// /// /// @@ -77,21 +76,34 @@ internal static void ValidateResourceId(ResourceIdentifier id) /// Name of the resource. /// Resource create parameters. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// or is null. + /// is an empty string, and was expected to be non-empty. public virtual async Task> CreateOrUpdateAsync(WaitUntil waitUntil, string name, DisconnectedOperationData data, CancellationToken cancellationToken = default) { Argument.AssertNotNullOrEmpty(name, nameof(name)); Argument.AssertNotNull(data, nameof(data)); - using var scope = _disconnectedOperationClientDiagnostics.CreateScope("DisconnectedOperationCollection.CreateOrUpdate"); + using DiagnosticScope scope = _disconnectedOperationsOprsClientDiagnostics.CreateScope("DisconnectedOperationCollection.CreateOrUpdate"); scope.Start(); try { - var response = await _disconnectedOperationRestClient.CreateOrUpdateAsync(Id.SubscriptionId, Id.ResourceGroupName, name, data, cancellationToken).ConfigureAwait(false); - var operation = new DisconnectedOperationsArmOperation(new DisconnectedOperationOperationSource(Client), _disconnectedOperationClientDiagnostics, Pipeline, _disconnectedOperationRestClient.CreateCreateOrUpdateRequest(Id.SubscriptionId, Id.ResourceGroupName, name, data).Request, response, OperationFinalStateVia.AzureAsyncOperation); + RequestContext context = new RequestContext + { + CancellationToken = cancellationToken + }; + HttpMessage message = _disconnectedOperationsOprsRestClient.CreateCreateOrUpdateRequest(Guid.Parse(Id.SubscriptionId), Id.ResourceGroupName, name, DisconnectedOperationData.ToRequestContent(data), context); + Response response = await Pipeline.ProcessMessageAsync(message, context).ConfigureAwait(false); + DisconnectedOperationsArmOperation operation = new DisconnectedOperationsArmOperation( + new DisconnectedOperationOperationSource(Client), + _disconnectedOperationsOprsClientDiagnostics, + Pipeline, + message.Request, + response, + OperationFinalStateVia.AzureAsyncOperation); if (waitUntil == WaitUntil.Completed) + { await operation.WaitForCompletionAsync(cancellationToken).ConfigureAwait(false); + } return operation; } catch (Exception e) @@ -105,20 +117,16 @@ public virtual async Task> CreateOrU /// Create a DisconnectedOperation /// /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Edge/disconnectedOperations/{name} + /// Request Path. + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Edge/disconnectedOperations/{name}. /// /// - /// Operation Id - /// DisconnectedOperation_CreateOrUpdate + /// Operation Id. + /// DisconnectedOperations_CreateOrUpdate. /// /// - /// Default Api Version - /// 2025-06-01-preview - /// - /// - /// Resource - /// + /// Default Api Version. + /// 2025-06-01-preview. /// /// /// @@ -126,21 +134,34 @@ public virtual async Task> CreateOrU /// Name of the resource. /// Resource create parameters. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. /// or is null. + /// is an empty string, and was expected to be non-empty. public virtual ArmOperation CreateOrUpdate(WaitUntil waitUntil, string name, DisconnectedOperationData data, CancellationToken cancellationToken = default) { Argument.AssertNotNullOrEmpty(name, nameof(name)); Argument.AssertNotNull(data, nameof(data)); - using var scope = _disconnectedOperationClientDiagnostics.CreateScope("DisconnectedOperationCollection.CreateOrUpdate"); + using DiagnosticScope scope = _disconnectedOperationsOprsClientDiagnostics.CreateScope("DisconnectedOperationCollection.CreateOrUpdate"); scope.Start(); try { - var response = _disconnectedOperationRestClient.CreateOrUpdate(Id.SubscriptionId, Id.ResourceGroupName, name, data, cancellationToken); - var operation = new DisconnectedOperationsArmOperation(new DisconnectedOperationOperationSource(Client), _disconnectedOperationClientDiagnostics, Pipeline, _disconnectedOperationRestClient.CreateCreateOrUpdateRequest(Id.SubscriptionId, Id.ResourceGroupName, name, data).Request, response, OperationFinalStateVia.AzureAsyncOperation); + RequestContext context = new RequestContext + { + CancellationToken = cancellationToken + }; + HttpMessage message = _disconnectedOperationsOprsRestClient.CreateCreateOrUpdateRequest(Guid.Parse(Id.SubscriptionId), Id.ResourceGroupName, name, DisconnectedOperationData.ToRequestContent(data), context); + Response response = Pipeline.ProcessMessage(message, context); + DisconnectedOperationsArmOperation operation = new DisconnectedOperationsArmOperation( + new DisconnectedOperationOperationSource(Client), + _disconnectedOperationsOprsClientDiagnostics, + Pipeline, + message.Request, + response, + OperationFinalStateVia.AzureAsyncOperation); if (waitUntil == WaitUntil.Completed) + { operation.WaitForCompletion(cancellationToken); + } return operation; } catch (Exception e) @@ -154,38 +175,42 @@ public virtual ArmOperation CreateOrUpdate(WaitUn /// Get a DisconnectedOperation /// /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Edge/disconnectedOperations/{name} - /// - /// - /// Operation Id - /// DisconnectedOperation_Get + /// Request Path. + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Edge/disconnectedOperations/{name}. /// /// - /// Default Api Version - /// 2025-06-01-preview + /// Operation Id. + /// DisconnectedOperations_Get. /// /// - /// Resource - /// + /// Default Api Version. + /// 2025-06-01-preview. /// /// /// /// Name of the resource. /// 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 = _disconnectedOperationClientDiagnostics.CreateScope("DisconnectedOperationCollection.Get"); + using DiagnosticScope scope = _disconnectedOperationsOprsClientDiagnostics.CreateScope("DisconnectedOperationCollection.Get"); scope.Start(); try { - var response = await _disconnectedOperationRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, name, cancellationToken).ConfigureAwait(false); + RequestContext context = new RequestContext + { + CancellationToken = cancellationToken + }; + HttpMessage message = _disconnectedOperationsOprsRestClient.CreateGetRequest(Guid.Parse(Id.SubscriptionId), Id.ResourceGroupName, name, context); + Response result = await Pipeline.ProcessMessageAsync(message, context).ConfigureAwait(false); + Response response = Response.FromValue(DisconnectedOperationData.FromResponse(result), result); if (response.Value == null) + { throw new RequestFailedException(response.GetRawResponse()); + } return Response.FromValue(new DisconnectedOperationResource(Client, response.Value), response.GetRawResponse()); } catch (Exception e) @@ -199,38 +224,42 @@ public virtual async Task> GetAsync(stri /// Get a DisconnectedOperation /// /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Edge/disconnectedOperations/{name} - /// - /// - /// Operation Id - /// DisconnectedOperation_Get + /// Request Path. + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Edge/disconnectedOperations/{name}. /// /// - /// Default Api Version - /// 2025-06-01-preview + /// Operation Id. + /// DisconnectedOperations_Get. /// /// - /// Resource - /// + /// Default Api Version. + /// 2025-06-01-preview. /// /// /// /// Name of the resource. /// 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 = _disconnectedOperationClientDiagnostics.CreateScope("DisconnectedOperationCollection.Get"); + using DiagnosticScope scope = _disconnectedOperationsOprsClientDiagnostics.CreateScope("DisconnectedOperationCollection.Get"); scope.Start(); try { - var response = _disconnectedOperationRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, name, cancellationToken); + RequestContext context = new RequestContext + { + CancellationToken = cancellationToken + }; + HttpMessage message = _disconnectedOperationsOprsRestClient.CreateGetRequest(Guid.Parse(Id.SubscriptionId), Id.ResourceGroupName, name, context); + Response result = Pipeline.ProcessMessage(message, context); + Response response = Response.FromValue(DisconnectedOperationData.FromResponse(result), result); if (response.Value == null) + { throw new RequestFailedException(response.GetRawResponse()); + } return Response.FromValue(new DisconnectedOperationResource(Client, response.Value), response.GetRawResponse()); } catch (Exception e) @@ -244,50 +273,44 @@ public virtual Response Get(string name, Cancella /// List DisconnectedOperation resources by resource group /// /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Edge/disconnectedOperations + /// Request Path. + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Edge/disconnectedOperations. /// /// - /// Operation Id - /// DisconnectedOperation_ListByResourceGroup + /// Operation Id. + /// DisconnectedOperations_ListByResourceGroup. /// /// - /// Default Api Version - /// 2025-06-01-preview - /// - /// - /// Resource - /// + /// Default Api Version. + /// 2025-06-01-preview. /// /// /// /// The cancellation token to use. - /// An async collection of that may take multiple service requests to iterate over. + /// A collection of that may take multiple service requests to iterate over. public virtual AsyncPageable GetAllAsync(CancellationToken cancellationToken = default) { - HttpMessage FirstPageRequest(int? pageSizeHint) => _disconnectedOperationRestClient.CreateListByResourceGroupRequest(Id.SubscriptionId, Id.ResourceGroupName); - HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _disconnectedOperationRestClient.CreateListByResourceGroupNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName); - return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new DisconnectedOperationResource(Client, DisconnectedOperationData.DeserializeDisconnectedOperationData(e)), _disconnectedOperationClientDiagnostics, Pipeline, "DisconnectedOperationCollection.GetAll", "value", "nextLink", cancellationToken); + RequestContext context = new RequestContext + { + CancellationToken = cancellationToken + }; + return new AsyncPageableWrapper(new DisconnectedOperationsOprsGetByResourceGroupAsyncCollectionResultOfT(_disconnectedOperationsOprsRestClient, Guid.Parse(Id.SubscriptionId), Id.ResourceGroupName, context), data => new DisconnectedOperationResource(Client, data)); } /// /// List DisconnectedOperation resources by resource group /// /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Edge/disconnectedOperations - /// - /// - /// Operation Id - /// DisconnectedOperation_ListByResourceGroup + /// Request Path. + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Edge/disconnectedOperations. /// /// - /// Default Api Version - /// 2025-06-01-preview + /// Operation Id. + /// DisconnectedOperations_ListByResourceGroup. /// /// - /// Resource - /// + /// Default Api Version. + /// 2025-06-01-preview. /// /// /// @@ -295,45 +318,61 @@ public virtual AsyncPageable GetAllAsync(Cancella /// A collection of that may take multiple service requests to iterate over. public virtual Pageable GetAll(CancellationToken cancellationToken = default) { - HttpMessage FirstPageRequest(int? pageSizeHint) => _disconnectedOperationRestClient.CreateListByResourceGroupRequest(Id.SubscriptionId, Id.ResourceGroupName); - HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _disconnectedOperationRestClient.CreateListByResourceGroupNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName); - return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new DisconnectedOperationResource(Client, DisconnectedOperationData.DeserializeDisconnectedOperationData(e)), _disconnectedOperationClientDiagnostics, Pipeline, "DisconnectedOperationCollection.GetAll", "value", "nextLink", cancellationToken); + RequestContext context = new RequestContext + { + CancellationToken = cancellationToken + }; + return new PageableWrapper(new DisconnectedOperationsOprsGetByResourceGroupCollectionResultOfT(_disconnectedOperationsOprsRestClient, Guid.Parse(Id.SubscriptionId), Id.ResourceGroupName, context), data => new DisconnectedOperationResource(Client, data)); } /// - /// Checks to see if the resource exists in azure. + /// Get a DisconnectedOperation /// /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Edge/disconnectedOperations/{name} + /// Request Path. + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Edge/disconnectedOperations/{name}. /// /// - /// Operation Id - /// DisconnectedOperation_Get + /// Operation Id. + /// DisconnectedOperations_Get. /// /// - /// Default Api Version - /// 2025-06-01-preview - /// - /// - /// Resource - /// + /// Default Api Version. + /// 2025-06-01-preview. /// /// /// /// Name of the resource. /// 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 = _disconnectedOperationClientDiagnostics.CreateScope("DisconnectedOperationCollection.Exists"); + using DiagnosticScope scope = _disconnectedOperationsOprsClientDiagnostics.CreateScope("DisconnectedOperationCollection.Exists"); scope.Start(); try { - var response = await _disconnectedOperationRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, name, cancellationToken: cancellationToken).ConfigureAwait(false); + RequestContext context = new RequestContext + { + CancellationToken = cancellationToken + }; + HttpMessage message = _disconnectedOperationsOprsRestClient.CreateGetRequest(Guid.Parse(Id.SubscriptionId), Id.ResourceGroupName, 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(DisconnectedOperationData.FromResponse(result), result); + break; + case 404: + response = Response.FromValue((DisconnectedOperationData)null, result); + break; + default: + throw new RequestFailedException(result); + } return Response.FromValue(response.Value != null, response.GetRawResponse()); } catch (Exception e) @@ -344,39 +383,53 @@ public virtual async Task> ExistsAsync(string name, CancellationT } /// - /// Checks to see if the resource exists in azure. + /// Get a DisconnectedOperation /// /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Edge/disconnectedOperations/{name} - /// - /// - /// Operation Id - /// DisconnectedOperation_Get + /// Request Path. + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Edge/disconnectedOperations/{name}. /// /// - /// Default Api Version - /// 2025-06-01-preview + /// Operation Id. + /// DisconnectedOperations_Get. /// /// - /// Resource - /// + /// Default Api Version. + /// 2025-06-01-preview. /// /// /// /// Name of the resource. /// 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 = _disconnectedOperationClientDiagnostics.CreateScope("DisconnectedOperationCollection.Exists"); + using DiagnosticScope scope = _disconnectedOperationsOprsClientDiagnostics.CreateScope("DisconnectedOperationCollection.Exists"); scope.Start(); try { - var response = _disconnectedOperationRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, name, cancellationToken: cancellationToken); + RequestContext context = new RequestContext + { + CancellationToken = cancellationToken + }; + HttpMessage message = _disconnectedOperationsOprsRestClient.CreateGetRequest(Guid.Parse(Id.SubscriptionId), Id.ResourceGroupName, name, context); + Pipeline.Send(message, context.CancellationToken); + Response result = message.Response; + Response response = default; + switch (result.Status) + { + case 200: + response = Response.FromValue(DisconnectedOperationData.FromResponse(result), result); + break; + case 404: + response = Response.FromValue((DisconnectedOperationData)null, result); + break; + default: + throw new RequestFailedException(result); + } return Response.FromValue(response.Value != null, response.GetRawResponse()); } catch (Exception e) @@ -387,41 +440,57 @@ public virtual Response Exists(string name, CancellationToken cancellation } /// - /// Tries to get details for this resource from the service. + /// Get a DisconnectedOperation /// /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Edge/disconnectedOperations/{name} - /// - /// - /// Operation Id - /// DisconnectedOperation_Get + /// Request Path. + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Edge/disconnectedOperations/{name}. /// /// - /// Default Api Version - /// 2025-06-01-preview + /// Operation Id. + /// DisconnectedOperations_Get. /// /// - /// Resource - /// + /// Default Api Version. + /// 2025-06-01-preview. /// /// /// /// Name of the resource. /// 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 = _disconnectedOperationClientDiagnostics.CreateScope("DisconnectedOperationCollection.GetIfExists"); + using DiagnosticScope scope = _disconnectedOperationsOprsClientDiagnostics.CreateScope("DisconnectedOperationCollection.GetIfExists"); scope.Start(); try { - var response = await _disconnectedOperationRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, name, cancellationToken: cancellationToken).ConfigureAwait(false); + RequestContext context = new RequestContext + { + CancellationToken = cancellationToken + }; + HttpMessage message = _disconnectedOperationsOprsRestClient.CreateGetRequest(Guid.Parse(Id.SubscriptionId), Id.ResourceGroupName, 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(DisconnectedOperationData.FromResponse(result), result); + break; + case 404: + response = Response.FromValue((DisconnectedOperationData)null, result); + break; + default: + throw new RequestFailedException(result); + } if (response.Value == null) + { return new NoValueResponse(response.GetRawResponse()); + } return Response.FromValue(new DisconnectedOperationResource(Client, response.Value), response.GetRawResponse()); } catch (Exception e) @@ -432,41 +501,57 @@ public virtual async Task> GetIf } /// - /// Tries to get details for this resource from the service. + /// Get a DisconnectedOperation /// /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Edge/disconnectedOperations/{name} + /// Request Path. + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Edge/disconnectedOperations/{name}. /// /// - /// Operation Id - /// DisconnectedOperation_Get + /// Operation Id. + /// DisconnectedOperations_Get. /// /// - /// Default Api Version - /// 2025-06-01-preview - /// - /// - /// Resource - /// + /// Default Api Version. + /// 2025-06-01-preview. /// /// /// /// Name of the resource. /// 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 = _disconnectedOperationClientDiagnostics.CreateScope("DisconnectedOperationCollection.GetIfExists"); + using DiagnosticScope scope = _disconnectedOperationsOprsClientDiagnostics.CreateScope("DisconnectedOperationCollection.GetIfExists"); scope.Start(); try { - var response = _disconnectedOperationRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, name, cancellationToken: cancellationToken); + RequestContext context = new RequestContext + { + CancellationToken = cancellationToken + }; + HttpMessage message = _disconnectedOperationsOprsRestClient.CreateGetRequest(Guid.Parse(Id.SubscriptionId), Id.ResourceGroupName, name, context); + Pipeline.Send(message, context.CancellationToken); + Response result = message.Response; + Response response = default; + switch (result.Status) + { + case 200: + response = Response.FromValue(DisconnectedOperationData.FromResponse(result), result); + break; + case 404: + response = Response.FromValue((DisconnectedOperationData)null, result); + break; + default: + throw new RequestFailedException(result); + } if (response.Value == null) + { return new NoValueResponse(response.GetRawResponse()); + } return Response.FromValue(new DisconnectedOperationResource(Client, response.Value), response.GetRawResponse()); } catch (Exception e) @@ -486,6 +571,7 @@ IEnumerator IEnumerable.GetEnumerator() return GetAll().GetEnumerator(); } + /// The cancellation token to use. IAsyncEnumerator IAsyncEnumerable.GetAsyncEnumerator(CancellationToken cancellationToken) { return GetAllAsync(cancellationToken: cancellationToken).GetAsyncEnumerator(cancellationToken); diff --git a/sdk/disconnectedoperations/Azure.ResourceManager.DisconnectedOperations/src/Generated/DisconnectedOperationData.Serialization.cs b/sdk/disconnectedoperations/Azure.ResourceManager.DisconnectedOperations/src/Generated/DisconnectedOperationData.Serialization.cs index 7f99e5bc4ec7..3034d8a20b79 100644 --- a/sdk/disconnectedoperations/Azure.ResourceManager.DisconnectedOperations/src/Generated/DisconnectedOperationData.Serialization.cs +++ b/sdk/disconnectedoperations/Azure.ResourceManager.DisconnectedOperations/src/Generated/DisconnectedOperationData.Serialization.cs @@ -10,16 +10,23 @@ using System.Collections.Generic; using System.Text; using System.Text.Json; +using Azure; using Azure.Core; using Azure.ResourceManager.DisconnectedOperations.Models; using Azure.ResourceManager.Models; namespace Azure.ResourceManager.DisconnectedOperations { - public partial class DisconnectedOperationData : IUtf8JsonSerializable, IJsonModel + /// Disconnected operation resource. + public partial class DisconnectedOperationData : TrackedResourceData, IJsonModel { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + /// Initializes a new instance of for deserialization. + internal DisconnectedOperationData() + { + } + /// The JSON writer. + /// The client options for reading and writing models. void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) { writer.WriteStartObject(); @@ -31,12 +38,11 @@ void IJsonModel.Write(Utf8JsonWriter writer, 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(DisconnectedOperationData)} does not support writing '{format}' format."); } - base.JsonModelWriteCore(writer, options); if (Optional.IsDefined(Properties)) { @@ -45,110 +51,131 @@ protected override void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWri } } - DisconnectedOperationData IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + /// The JSON reader. + /// The client options for reading and writing models. + DisconnectedOperationData IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) => (DisconnectedOperationData)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(DisconnectedOperationData)} does not support reading '{format}' format."); } - using JsonDocument document = JsonDocument.ParseValue(ref reader); return DeserializeDisconnectedOperationData(document.RootElement, options); } - internal static DisconnectedOperationData DeserializeDisconnectedOperationData(JsonElement element, ModelReaderWriterOptions options = null) + /// The JSON element to deserialize. + /// The client options for reading and writing models. + internal static DisconnectedOperationData DeserializeDisconnectedOperationData(JsonElement element, ModelReaderWriterOptions options) { - options ??= ModelSerializationExtensions.WireOptions; - if (element.ValueKind == JsonValueKind.Null) { return null; } - DisconnectedOperationProperties properties = default; - IDictionary tags = default; - AzureLocation location = default; ResourceIdentifier id = default; string name = default; - ResourceType type = default; + ResourceType resourceType = default; SystemData systemData = default; - IDictionary serializedAdditionalRawData = default; - Dictionary rawDataDictionary = new Dictionary(); - foreach (var property in element.EnumerateObject()) + IDictionary additionalBinaryDataProperties = new ChangeTrackingDictionary(); + IDictionary tags = default; + AzureLocation location = default; + DisconnectedOperationProperties properties = default; + foreach (var prop in element.EnumerateObject()) { - if (property.NameEquals("properties"u8)) + if (prop.NameEquals("id"u8)) { - if (property.Value.ValueKind == JsonValueKind.Null) + if (prop.Value.ValueKind == JsonValueKind.Null) { continue; } - properties = DisconnectedOperationProperties.DeserializeDisconnectedOperationProperties(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, AzureResourceManagerDisconnectedOperationsContext.Default); continue; } - if (property.NameEquals("name"u8)) + if (prop.NameEquals("tags"u8)) { - name = property.Value.GetString(); + if (prop.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + Dictionary dictionary = new Dictionary(); + foreach (var prop0 in prop.Value.EnumerateObject()) + { + if (prop0.Value.ValueKind == JsonValueKind.Null) + { + dictionary.Add(prop0.Name, null); + } + else + { + dictionary.Add(prop0.Name, prop0.Value.GetString()); + } + } + tags = dictionary; continue; } - if (property.NameEquals("type"u8)) + if (prop.NameEquals("location"u8)) { - type = new ResourceType(property.Value.GetString()); + location = new AzureLocation(prop.Value.GetString()); continue; } - if (property.NameEquals("systemData"u8)) + if (prop.NameEquals("properties"u8)) { - if (property.Value.ValueKind == JsonValueKind.Null) + if (prop.Value.ValueKind == JsonValueKind.Null) { continue; } - systemData = ModelReaderWriter.Read(new BinaryData(Encoding.UTF8.GetBytes(property.Value.GetRawText())), ModelSerializationExtensions.WireOptions, AzureResourceManagerDisconnectedOperationsContext.Default); + properties = DisconnectedOperationProperties.DeserializeDisconnectedOperationProperties(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 DisconnectedOperationData( id, name, - type, + resourceType, systemData, + additionalBinaryDataProperties, tags ?? new ChangeTrackingDictionary(), location, - properties, - serializedAdditionalRawData); + properties); } - BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) - { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + /// The client options for reading and writing models. + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) => PersistableModelWriteCore(options); + /// The client options for reading and writing models. + protected virtual BinaryData PersistableModelWriteCore(ModelReaderWriterOptions options) + { + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; switch (format) { case "J": @@ -158,15 +185,20 @@ BinaryData IPersistableModel.Write(ModelReaderWriterO } } - DisconnectedOperationData 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. + DisconnectedOperationData IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) => (DisconnectedOperationData)PersistableModelCreateCore(data, options); + /// The data to parse. + /// The client options for reading and writing models. + protected virtual ResourceData PersistableModelCreateCore(BinaryData data, ModelReaderWriterOptions options) + { + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; switch (format) { case "J": + using (JsonDocument document = JsonDocument.Parse(data, ModelSerializationExtensions.JsonDocumentOptions)) { - using JsonDocument document = JsonDocument.Parse(data, ModelSerializationExtensions.JsonDocumentOptions); return DeserializeDisconnectedOperationData(document.RootElement, options); } default: @@ -174,6 +206,26 @@ DisconnectedOperationData IPersistableModel.Create(Bi } } + /// The client options for reading and writing models. string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + + /// The to serialize into . + internal static RequestContent ToRequestContent(DisconnectedOperationData disconnectedOperationData) + { + if (disconnectedOperationData == null) + { + return null; + } + Utf8JsonRequestContent content = new Utf8JsonRequestContent(); + content.JsonWriter.WriteObjectValue(disconnectedOperationData, ModelSerializationExtensions.WireOptions); + return content; + } + + /// The to deserialize the from. + internal static DisconnectedOperationData FromResponse(Response response) + { + using JsonDocument document = JsonDocument.Parse(response.Content, ModelSerializationExtensions.JsonDocumentOptions); + return DeserializeDisconnectedOperationData(document.RootElement, ModelSerializationExtensions.WireOptions); + } } } diff --git a/sdk/disconnectedoperations/Azure.ResourceManager.DisconnectedOperations/src/Generated/DisconnectedOperationData.cs b/sdk/disconnectedoperations/Azure.ResourceManager.DisconnectedOperations/src/Generated/DisconnectedOperationData.cs index 2f23f60b2851..b34290c18803 100644 --- a/sdk/disconnectedoperations/Azure.ResourceManager.DisconnectedOperations/src/Generated/DisconnectedOperationData.cs +++ b/sdk/disconnectedoperations/Azure.ResourceManager.DisconnectedOperations/src/Generated/DisconnectedOperationData.cs @@ -13,68 +13,31 @@ namespace Azure.ResourceManager.DisconnectedOperations { - /// - /// A class representing the DisconnectedOperation data model. - /// Disconnected operation resource. - /// + /// Disconnected operation resource. public partial class DisconnectedOperationData : 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 DisconnectedOperationData(AzureLocation location) : base(location) { } /// Initializes a new instance of . - /// The id. - /// The name. - /// The resourceType. - /// The systemData. - /// The tags. - /// The location. + /// Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. + /// The name of the resource. + /// The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts". + /// Azure Resource Manager metadata containing createdBy and modifiedBy information. + /// Keeps track of any properties unknown to the library. + /// Resource tags. + /// The geo-location where the resource lives. /// The resource-specific properties for this resource. - /// Keeps track of any properties unknown to the library. - internal DisconnectedOperationData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, IDictionary tags, AzureLocation location, DisconnectedOperationProperties properties, IDictionary serializedAdditionalRawData) : base(id, name, resourceType, systemData, tags, location) + internal DisconnectedOperationData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, IDictionary additionalBinaryDataProperties, IDictionary tags, AzureLocation location, DisconnectedOperationProperties properties) : base(id, name, resourceType, systemData, tags, location) { + _additionalBinaryDataProperties = additionalBinaryDataProperties; Properties = properties; - _serializedAdditionalRawData = serializedAdditionalRawData; - } - - /// Initializes a new instance of for deserialization. - internal DisconnectedOperationData() - { } /// The resource-specific properties for this resource. diff --git a/sdk/disconnectedoperations/Azure.ResourceManager.DisconnectedOperations/src/Generated/DisconnectedOperationResource.Serialization.cs b/sdk/disconnectedoperations/Azure.ResourceManager.DisconnectedOperations/src/Generated/DisconnectedOperationResource.Serialization.cs index fd575211c918..bb6d59203426 100644 --- a/sdk/disconnectedoperations/Azure.ResourceManager.DisconnectedOperations/src/Generated/DisconnectedOperationResource.Serialization.cs +++ b/sdk/disconnectedoperations/Azure.ResourceManager.DisconnectedOperations/src/Generated/DisconnectedOperationResource.Serialization.cs @@ -11,19 +11,29 @@ namespace Azure.ResourceManager.DisconnectedOperations { + /// public partial class DisconnectedOperationResource : IJsonModel { - private static DisconnectedOperationData s_dataDeserializationInstance; - private static DisconnectedOperationData DataDeserializationInstance => s_dataDeserializationInstance ??= new(); + private static IJsonModel s_dataDeserializationInstance; + private static IJsonModel DataDeserializationInstance => s_dataDeserializationInstance ??= new DisconnectedOperationData(); + + /// 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); - DisconnectedOperationData 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. + DisconnectedOperationData 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, AzureResourceManagerDisconnectedOperationsContext.Default); + /// The binary data to be processed. + /// The client options for reading and writing models. DisconnectedOperationData IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) => ModelReaderWriter.Read(data, options, AzureResourceManagerDisconnectedOperationsContext.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/disconnectedoperations/Azure.ResourceManager.DisconnectedOperations/src/Generated/DisconnectedOperationResource.cs b/sdk/disconnectedoperations/Azure.ResourceManager.DisconnectedOperations/src/Generated/DisconnectedOperationResource.cs index b743492bd078..fe22708ef5b1 100644 --- a/sdk/disconnectedoperations/Azure.ResourceManager.DisconnectedOperations/src/Generated/DisconnectedOperationResource.cs +++ b/sdk/disconnectedoperations/Azure.ResourceManager.DisconnectedOperations/src/Generated/DisconnectedOperationResource.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.DisconnectedOperations.Models; using Azure.ResourceManager.Resources; namespace Azure.ResourceManager.DisconnectedOperations { /// - /// A Class representing a DisconnectedOperation 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 GetDisconnectedOperationResource method. - /// Otherwise you can get one from its parent resource using the GetDisconnectedOperation method. + /// A class representing a DisconnectedOperation 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 GetDisconnectedOperations method. /// public partial class DisconnectedOperationResource : 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.Edge/disconnectedOperations/{name}"; - return new ResourceIdentifier(resourceId); - } - - private readonly ClientDiagnostics _disconnectedOperationClientDiagnostics; - private readonly DisconnectedRestOperations _disconnectedOperationRestClient; + private readonly ClientDiagnostics _disconnectedOperationsOprsClientDiagnostics; + private readonly DisconnectedOperationsOprs _disconnectedOperationsOprsRestClient; private readonly DisconnectedOperationData _data; - /// Gets the resource type for the operations. public static readonly ResourceType ResourceType = "Microsoft.Edge/disconnectedOperations"; - /// Initializes a new instance of the class for mocking. + /// Initializes a new instance of DisconnectedOperationResource for mocking. protected DisconnectedOperationResource() { } - /// 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 DisconnectedOperationResource(ArmClient client, DisconnectedOperationData data) : this(client, data.Id) @@ -56,140 +46,92 @@ internal DisconnectedOperationResource(ArmClient client, DisconnectedOperationDa _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 DisconnectedOperationResource(ArmClient client, ResourceIdentifier id) : base(client, id) { - _disconnectedOperationClientDiagnostics = new ClientDiagnostics("Azure.ResourceManager.DisconnectedOperations", ResourceType.Namespace, Diagnostics); TryGetApiVersion(ResourceType, out string disconnectedOperationApiVersion); - _disconnectedOperationRestClient = new DisconnectedRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, disconnectedOperationApiVersion); -#if DEBUG - ValidateResourceId(Id); -#endif + _disconnectedOperationsOprsClientDiagnostics = new ClientDiagnostics("Azure.ResourceManager.DisconnectedOperations", ResourceType.Namespace, Diagnostics); + _disconnectedOperationsOprsRestClient = new DisconnectedOperationsOprs(_disconnectedOperationsOprsClientDiagnostics, Pipeline, Endpoint, disconnectedOperationApiVersion ?? "2025-06-01-preview"); + 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 DisconnectedOperationData 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 DisconnectedOperationsImageResources in the DisconnectedOperation. - /// An object representing collection of DisconnectedOperationsImageResources and their operations over a DisconnectedOperationsImageResource. - public virtual DisconnectedOperationsImageCollection GetDisconnectedOperationsImages() - { - return GetCachedClient(client => new DisconnectedOperationsImageCollection(client, Id)); - } - - /// - /// Get the resource. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Edge/disconnectedOperations/{name}/images/{imageName} - /// - /// - /// Operation Id - /// Image_Get - /// - /// - /// Default Api Version - /// 2025-06-01-preview - /// - /// - /// Resource - /// - /// - /// - /// - /// The name of the Image. - /// The cancellation token to use. - /// is null. - /// is an empty string, and was expected to be non-empty. - [ForwardsClientCalls] - public virtual async Task> GetDisconnectedOperationsImageAsync(string imageName, CancellationToken cancellationToken = default) + /// Generate the resource identifier for this resource. + /// The subscriptionId. + /// The resourceGroupName. + /// The name. + public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string name) { - return await GetDisconnectedOperationsImages().GetAsync(imageName, cancellationToken).ConfigureAwait(false); + string resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Edge/disconnectedOperations/{name}"; + return new ResourceIdentifier(resourceId); } - /// - /// Get the resource. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Edge/disconnectedOperations/{name}/images/{imageName} - /// - /// - /// Operation Id - /// Image_Get - /// - /// - /// Default Api Version - /// 2025-06-01-preview - /// - /// - /// Resource - /// - /// - /// - /// - /// The name of the Image. - /// The cancellation token to use. - /// is null. - /// is an empty string, and was expected to be non-empty. - [ForwardsClientCalls] - public virtual Response GetDisconnectedOperationsImage(string imageName, CancellationToken cancellationToken = default) + /// + [Conditional("DEBUG")] + internal static void ValidateResourceId(ResourceIdentifier id) { - return GetDisconnectedOperationsImages().Get(imageName, cancellationToken); + if (id.ResourceType != ResourceType) + { + throw new ArgumentException(string.Format("Invalid resource type {0} expected {1}", id.ResourceType, ResourceType), id); + } } /// /// Get a DisconnectedOperation /// /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Edge/disconnectedOperations/{name} + /// Request Path. + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Edge/disconnectedOperations/{name}. /// /// - /// Operation Id - /// DisconnectedOperation_Get + /// Operation Id. + /// DisconnectedOperations_Get. /// /// - /// Default Api Version - /// 2025-06-01-preview + /// Default Api Version. + /// 2025-06-01-preview. /// /// - /// Resource - /// + /// Resource. + /// . /// /// /// /// The cancellation token to use. public virtual async Task> GetAsync(CancellationToken cancellationToken = default) { - using var scope = _disconnectedOperationClientDiagnostics.CreateScope("DisconnectedOperationResource.Get"); + using DiagnosticScope scope = _disconnectedOperationsOprsClientDiagnostics.CreateScope("DisconnectedOperationResource.Get"); scope.Start(); try { - var response = await _disconnectedOperationRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, cancellationToken).ConfigureAwait(false); + RequestContext context = new RequestContext + { + CancellationToken = cancellationToken + }; + HttpMessage message = _disconnectedOperationsOprsRestClient.CreateGetRequest(Guid.Parse(Id.SubscriptionId), Id.ResourceGroupName, Id.Name, context); + Response result = await Pipeline.ProcessMessageAsync(message, context).ConfigureAwait(false); + Response response = Response.FromValue(DisconnectedOperationData.FromResponse(result), result); if (response.Value == null) + { throw new RequestFailedException(response.GetRawResponse()); + } return Response.FromValue(new DisconnectedOperationResource(Client, response.Value), response.GetRawResponse()); } catch (Exception e) @@ -203,33 +145,41 @@ public virtual async Task> GetAsync(Canc /// Get a DisconnectedOperation /// /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Edge/disconnectedOperations/{name} + /// Request Path. + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Edge/disconnectedOperations/{name}. /// /// - /// Operation Id - /// DisconnectedOperation_Get + /// Operation Id. + /// DisconnectedOperations_Get. /// /// - /// Default Api Version - /// 2025-06-01-preview + /// Default Api Version. + /// 2025-06-01-preview. /// /// - /// Resource - /// + /// Resource. + /// . /// /// /// /// The cancellation token to use. public virtual Response Get(CancellationToken cancellationToken = default) { - using var scope = _disconnectedOperationClientDiagnostics.CreateScope("DisconnectedOperationResource.Get"); + using DiagnosticScope scope = _disconnectedOperationsOprsClientDiagnostics.CreateScope("DisconnectedOperationResource.Get"); scope.Start(); try { - var response = _disconnectedOperationRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, cancellationToken); + RequestContext context = new RequestContext + { + CancellationToken = cancellationToken + }; + HttpMessage message = _disconnectedOperationsOprsRestClient.CreateGetRequest(Guid.Parse(Id.SubscriptionId), Id.ResourceGroupName, Id.Name, context); + Response result = Pipeline.ProcessMessage(message, context); + Response response = Response.FromValue(DisconnectedOperationData.FromResponse(result), result); if (response.Value == null) + { throw new RequestFailedException(response.GetRawResponse()); + } return Response.FromValue(new DisconnectedOperationResource(Client, response.Value), response.GetRawResponse()); } catch (Exception e) @@ -240,39 +190,49 @@ public virtual Response Get(CancellationToken can } /// - /// Delete a DisconnectedOperation + /// Update a DisconnectedOperation /// /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Edge/disconnectedOperations/{name} + /// Request Path. + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Edge/disconnectedOperations/{name}. /// /// - /// Operation Id - /// DisconnectedOperation_Delete + /// Operation Id. + /// DisconnectedOperations_Update. /// /// - /// Default Api Version - /// 2025-06-01-preview + /// Default Api Version. + /// 2025-06-01-preview. /// /// - /// 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. + /// The resource properties to be updated. /// The cancellation token to use. - public virtual async Task DeleteAsync(WaitUntil waitUntil, CancellationToken cancellationToken = default) + /// is null. + public virtual async Task> UpdateAsync(DisconnectedOperationPatch patch, CancellationToken cancellationToken = default) { - using var scope = _disconnectedOperationClientDiagnostics.CreateScope("DisconnectedOperationResource.Delete"); + Argument.AssertNotNull(patch, nameof(patch)); + + using DiagnosticScope scope = _disconnectedOperationsOprsClientDiagnostics.CreateScope("DisconnectedOperationResource.Update"); scope.Start(); try { - var response = await _disconnectedOperationRestClient.DeleteAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, cancellationToken).ConfigureAwait(false); - var operation = new DisconnectedOperationsArmOperation(_disconnectedOperationClientDiagnostics, Pipeline, _disconnectedOperationRestClient.CreateDeleteRequest(Id.SubscriptionId, Id.ResourceGroupName, 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 = _disconnectedOperationsOprsRestClient.CreateUpdateRequest(Guid.Parse(Id.SubscriptionId), Id.ResourceGroupName, Id.Name, DisconnectedOperationPatch.ToRequestContent(patch), context); + Response result = await Pipeline.ProcessMessageAsync(message, context).ConfigureAwait(false); + Response response = Response.FromValue(DisconnectedOperationData.FromResponse(result), result); + if (response.Value == null) + { + throw new RequestFailedException(response.GetRawResponse()); + } + return Response.FromValue(new DisconnectedOperationResource(Client, response.Value), response.GetRawResponse()); } catch (Exception e) { @@ -282,39 +242,49 @@ public virtual async Task DeleteAsync(WaitUntil waitUntil, Cancell } /// - /// Delete a DisconnectedOperation + /// Update a DisconnectedOperation /// /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Edge/disconnectedOperations/{name} + /// Request Path. + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Edge/disconnectedOperations/{name}. /// /// - /// Operation Id - /// DisconnectedOperation_Delete + /// Operation Id. + /// DisconnectedOperations_Update. /// /// - /// Default Api Version - /// 2025-06-01-preview + /// Default Api Version. + /// 2025-06-01-preview. /// /// - /// 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. + /// The resource properties to be updated. /// The cancellation token to use. - public virtual ArmOperation Delete(WaitUntil waitUntil, CancellationToken cancellationToken = default) + /// is null. + public virtual Response Update(DisconnectedOperationPatch patch, CancellationToken cancellationToken = default) { - using var scope = _disconnectedOperationClientDiagnostics.CreateScope("DisconnectedOperationResource.Delete"); + Argument.AssertNotNull(patch, nameof(patch)); + + using DiagnosticScope scope = _disconnectedOperationsOprsClientDiagnostics.CreateScope("DisconnectedOperationResource.Update"); scope.Start(); try { - var response = _disconnectedOperationRestClient.Delete(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, cancellationToken); - var operation = new DisconnectedOperationsArmOperation(_disconnectedOperationClientDiagnostics, Pipeline, _disconnectedOperationRestClient.CreateDeleteRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name).Request, response, OperationFinalStateVia.Location); - if (waitUntil == WaitUntil.Completed) - operation.WaitForCompletionResponse(cancellationToken); - return operation; + RequestContext context = new RequestContext + { + CancellationToken = cancellationToken + }; + HttpMessage message = _disconnectedOperationsOprsRestClient.CreateUpdateRequest(Guid.Parse(Id.SubscriptionId), Id.ResourceGroupName, Id.Name, DisconnectedOperationPatch.ToRequestContent(patch), context); + Response result = Pipeline.ProcessMessage(message, context); + Response response = Response.FromValue(DisconnectedOperationData.FromResponse(result), result); + if (response.Value == null) + { + throw new RequestFailedException(response.GetRawResponse()); + } + return Response.FromValue(new DisconnectedOperationResource(Client, response.Value), response.GetRawResponse()); } catch (Exception e) { @@ -324,39 +294,46 @@ public virtual ArmOperation Delete(WaitUntil waitUntil, CancellationToken cancel } /// - /// Update a DisconnectedOperation + /// Delete a DisconnectedOperation /// /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Edge/disconnectedOperations/{name} + /// Request Path. + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Edge/disconnectedOperations/{name}. /// /// - /// Operation Id - /// DisconnectedOperation_Update + /// Operation Id. + /// DisconnectedOperations_Delete. /// /// - /// Default Api Version - /// 2025-06-01-preview + /// Default Api Version. + /// 2025-06-01-preview. /// /// - /// Resource - /// + /// Resource. + /// . /// /// /// - /// The resource properties to be updated. + /// 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(DisconnectedOperationPatch patch, CancellationToken cancellationToken = default) + public virtual async Task DeleteAsync(WaitUntil waitUntil, CancellationToken cancellationToken = default) { - Argument.AssertNotNull(patch, nameof(patch)); - - using var scope = _disconnectedOperationClientDiagnostics.CreateScope("DisconnectedOperationResource.Update"); + using DiagnosticScope scope = _disconnectedOperationsOprsClientDiagnostics.CreateScope("DisconnectedOperationResource.Delete"); scope.Start(); try { - var response = await _disconnectedOperationRestClient.UpdateAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, patch, cancellationToken).ConfigureAwait(false); - return Response.FromValue(new DisconnectedOperationResource(Client, response.Value), response.GetRawResponse()); + RequestContext context = new RequestContext + { + CancellationToken = cancellationToken + }; + HttpMessage message = _disconnectedOperationsOprsRestClient.CreateDeleteRequest(Guid.Parse(Id.SubscriptionId), Id.ResourceGroupName, Id.Name, context); + Response response = await Pipeline.ProcessMessageAsync(message, context).ConfigureAwait(false); + DisconnectedOperationsArmOperation operation = new DisconnectedOperationsArmOperation(_disconnectedOperationsOprsClientDiagnostics, Pipeline, message.Request, response, OperationFinalStateVia.Location); + if (waitUntil == WaitUntil.Completed) + { + await operation.WaitForCompletionResponseAsync(cancellationToken).ConfigureAwait(false); + } + return operation; } catch (Exception e) { @@ -366,39 +343,46 @@ public virtual async Task> UpdateAsync(D } /// - /// Update a DisconnectedOperation + /// Delete a DisconnectedOperation /// /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Edge/disconnectedOperations/{name} + /// Request Path. + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Edge/disconnectedOperations/{name}. /// /// - /// Operation Id - /// DisconnectedOperation_Update + /// Operation Id. + /// DisconnectedOperations_Delete. /// /// - /// Default Api Version - /// 2025-06-01-preview + /// Default Api Version. + /// 2025-06-01-preview. /// /// - /// Resource - /// + /// Resource. + /// . /// /// /// - /// The resource properties to be updated. + /// 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(DisconnectedOperationPatch patch, CancellationToken cancellationToken = default) + public virtual ArmOperation Delete(WaitUntil waitUntil, CancellationToken cancellationToken = default) { - Argument.AssertNotNull(patch, nameof(patch)); - - using var scope = _disconnectedOperationClientDiagnostics.CreateScope("DisconnectedOperationResource.Update"); + using DiagnosticScope scope = _disconnectedOperationsOprsClientDiagnostics.CreateScope("DisconnectedOperationResource.Delete"); scope.Start(); try { - var response = _disconnectedOperationRestClient.Update(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, patch, cancellationToken); - return Response.FromValue(new DisconnectedOperationResource(Client, response.Value), response.GetRawResponse()); + RequestContext context = new RequestContext + { + CancellationToken = cancellationToken + }; + HttpMessage message = _disconnectedOperationsOprsRestClient.CreateDeleteRequest(Guid.Parse(Id.SubscriptionId), Id.ResourceGroupName, Id.Name, context); + Response response = Pipeline.ProcessMessage(message, context); + DisconnectedOperationsArmOperation operation = new DisconnectedOperationsArmOperation(_disconnectedOperationsOprsClientDiagnostics, Pipeline, message.Request, response, OperationFinalStateVia.Location); + if (waitUntil == WaitUntil.Completed) + { + operation.WaitForCompletionResponse(cancellationToken); + } + return operation; } catch (Exception e) { @@ -411,31 +395,41 @@ public virtual Response Update(DisconnectedOperat /// get deployment manifest. /// /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Edge/disconnectedOperations/{name}/listDeploymentManifest + /// Request Path. + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Edge/disconnectedOperations/{name}/listDeploymentManifest. /// /// - /// Operation Id - /// DisconnectedOperations_ListDeploymentManifest + /// Operation Id. + /// DisconnectedOperations_ListDeploymentManifest. /// /// - /// Default Api Version - /// 2025-06-01-preview + /// Default Api Version. + /// 2025-06-01-preview. /// /// - /// Resource - /// + /// Resource. + /// . /// /// /// /// The cancellation token to use. public virtual async Task> GetDeploymentManifestAsync(CancellationToken cancellationToken = default) { - using var scope = _disconnectedOperationClientDiagnostics.CreateScope("DisconnectedOperationResource.GetDeploymentManifest"); + using DiagnosticScope scope = _disconnectedOperationsOprsClientDiagnostics.CreateScope("DisconnectedOperationResource.GetDeploymentManifest"); scope.Start(); try { - var response = await _disconnectedOperationRestClient.ListDeploymentManifestAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, cancellationToken).ConfigureAwait(false); + RequestContext context = new RequestContext + { + CancellationToken = cancellationToken + }; + HttpMessage message = _disconnectedOperationsOprsRestClient.CreateGetDeploymentManifestRequest(Guid.Parse(Id.SubscriptionId), Id.ResourceGroupName, Id.Name, context); + Response result = await Pipeline.ProcessMessageAsync(message, context).ConfigureAwait(false); + Response response = Response.FromValue(DisconnectedOperationDeploymentManifest.FromResponse(result), result); + if (response.Value == null) + { + throw new RequestFailedException(response.GetRawResponse()); + } return response; } catch (Exception e) @@ -449,31 +443,41 @@ public virtual async Task> Get /// get deployment manifest. /// /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Edge/disconnectedOperations/{name}/listDeploymentManifest + /// Request Path. + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Edge/disconnectedOperations/{name}/listDeploymentManifest. /// /// - /// Operation Id - /// DisconnectedOperations_ListDeploymentManifest + /// Operation Id. + /// DisconnectedOperations_ListDeploymentManifest. /// /// - /// Default Api Version - /// 2025-06-01-preview + /// Default Api Version. + /// 2025-06-01-preview. /// /// - /// Resource - /// + /// Resource. + /// . /// /// /// /// The cancellation token to use. public virtual Response GetDeploymentManifest(CancellationToken cancellationToken = default) { - using var scope = _disconnectedOperationClientDiagnostics.CreateScope("DisconnectedOperationResource.GetDeploymentManifest"); + using DiagnosticScope scope = _disconnectedOperationsOprsClientDiagnostics.CreateScope("DisconnectedOperationResource.GetDeploymentManifest"); scope.Start(); try { - var response = _disconnectedOperationRestClient.ListDeploymentManifest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, cancellationToken); + RequestContext context = new RequestContext + { + CancellationToken = cancellationToken + }; + HttpMessage message = _disconnectedOperationsOprsRestClient.CreateGetDeploymentManifestRequest(Guid.Parse(Id.SubscriptionId), Id.ResourceGroupName, Id.Name, context); + Response result = Pipeline.ProcessMessage(message, context); + Response response = Response.FromValue(DisconnectedOperationDeploymentManifest.FromResponse(result), result); + if (response.Value == null) + { + throw new RequestFailedException(response.GetRawResponse()); + } return response; } catch (Exception e) @@ -483,27 +487,7 @@ public virtual Response GetDeploymentMa } } - /// - /// Add a tag to the current resource. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Edge/disconnectedOperations/{name} - /// - /// - /// Operation Id - /// DisconnectedOperation_Get - /// - /// - /// Default Api Version - /// 2025-06-01-preview - /// - /// - /// Resource - /// - /// - /// - /// + /// Add a tag to the current resource. /// The key for the tag. /// The value for the tag. /// The cancellation token to use. @@ -513,29 +497,35 @@ public virtual async Task> AddTagAsync(s Argument.AssertNotNull(key, nameof(key)); Argument.AssertNotNull(value, nameof(value)); - using var scope = _disconnectedOperationClientDiagnostics.CreateScope("DisconnectedOperationResource.AddTag"); + using DiagnosticScope scope = _disconnectedOperationsOprsClientDiagnostics.CreateScope("DisconnectedOperationResource.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 _disconnectedOperationRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, cancellationToken).ConfigureAwait(false); - return Response.FromValue(new DisconnectedOperationResource(Client, originalResponse.Value), originalResponse.GetRawResponse()); + await GetTagResource().CreateOrUpdateAsync(WaitUntil.Completed, originalTags.Value.Data, cancellationToken).ConfigureAwait(false); + RequestContext context = new RequestContext + { + CancellationToken = cancellationToken + }; + HttpMessage message = _disconnectedOperationsOprsRestClient.CreateGetRequest(Guid.Parse(Id.SubscriptionId), Id.ResourceGroupName, Id.Name, context); + Response result = await Pipeline.ProcessMessageAsync(message, context).ConfigureAwait(false); + Response response = Response.FromValue(DisconnectedOperationData.FromResponse(result), result); + return Response.FromValue(new DisconnectedOperationResource(Client, response.Value), response.GetRawResponse()); } else { - var current = (await GetAsync(cancellationToken: cancellationToken).ConfigureAwait(false)).Value.Data; - var patch = new DisconnectedOperationPatch(); - foreach (var tag in current.Tags) + DisconnectedOperationData current = (await GetAsync(cancellationToken: cancellationToken).ConfigureAwait(false)).Value.Data; + DisconnectedOperationPatch patch = new DisconnectedOperationPatch(); + 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) @@ -545,27 +535,7 @@ public virtual async Task> AddTagAsync(s } } - /// - /// Add a tag to the current resource. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Edge/disconnectedOperations/{name} - /// - /// - /// Operation Id - /// DisconnectedOperation_Get - /// - /// - /// Default Api Version - /// 2025-06-01-preview - /// - /// - /// Resource - /// - /// - /// - /// + /// Add a tag to the current resource. /// The key for the tag. /// The value for the tag. /// The cancellation token to use. @@ -575,29 +545,35 @@ public virtual Response AddTag(string key, string Argument.AssertNotNull(key, nameof(key)); Argument.AssertNotNull(value, nameof(value)); - using var scope = _disconnectedOperationClientDiagnostics.CreateScope("DisconnectedOperationResource.AddTag"); + using DiagnosticScope scope = _disconnectedOperationsOprsClientDiagnostics.CreateScope("DisconnectedOperationResource.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 = _disconnectedOperationRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, cancellationToken); - return Response.FromValue(new DisconnectedOperationResource(Client, originalResponse.Value), originalResponse.GetRawResponse()); + GetTagResource().CreateOrUpdate(WaitUntil.Completed, originalTags.Value.Data, cancellationToken); + RequestContext context = new RequestContext + { + CancellationToken = cancellationToken + }; + HttpMessage message = _disconnectedOperationsOprsRestClient.CreateGetRequest(Guid.Parse(Id.SubscriptionId), Id.ResourceGroupName, Id.Name, context); + Response result = Pipeline.ProcessMessage(message, context); + Response response = Response.FromValue(DisconnectedOperationData.FromResponse(result), result); + return Response.FromValue(new DisconnectedOperationResource(Client, response.Value), response.GetRawResponse()); } else { - var current = Get(cancellationToken: cancellationToken).Value.Data; - var patch = new DisconnectedOperationPatch(); - foreach (var tag in current.Tags) + DisconnectedOperationData current = Get(cancellationToken: cancellationToken).Value.Data; + DisconnectedOperationPatch patch = new DisconnectedOperationPatch(); + 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) @@ -607,54 +583,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.Edge/disconnectedOperations/{name} - /// - /// - /// Operation Id - /// DisconnectedOperation_Get - /// - /// - /// Default Api Version - /// 2025-06-01-preview - /// - /// - /// 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 = _disconnectedOperationClientDiagnostics.CreateScope("DisconnectedOperationResource.SetTags"); + using DiagnosticScope scope = _disconnectedOperationsOprsClientDiagnostics.CreateScope("DisconnectedOperationResource.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 _disconnectedOperationRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, cancellationToken).ConfigureAwait(false); - return Response.FromValue(new DisconnectedOperationResource(Client, originalResponse.Value), originalResponse.GetRawResponse()); + await GetTagResource().CreateOrUpdateAsync(WaitUntil.Completed, originalTags.Value.Data, cancellationToken).ConfigureAwait(false); + RequestContext context = new RequestContext + { + CancellationToken = cancellationToken + }; + HttpMessage message = _disconnectedOperationsOprsRestClient.CreateGetRequest(Guid.Parse(Id.SubscriptionId), Id.ResourceGroupName, Id.Name, context); + Response result = await Pipeline.ProcessMessageAsync(message, context).ConfigureAwait(false); + Response response = Response.FromValue(DisconnectedOperationData.FromResponse(result), result); + return Response.FromValue(new DisconnectedOperationResource(Client, response.Value), response.GetRawResponse()); } else { - var current = (await GetAsync(cancellationToken: cancellationToken).ConfigureAwait(false)).Value.Data; - var patch = new DisconnectedOperationPatch(); + DisconnectedOperationData current = (await GetAsync(cancellationToken: cancellationToken).ConfigureAwait(false)).Value.Data; + DisconnectedOperationPatch patch = new DisconnectedOperationPatch(); 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) @@ -664,54 +626,40 @@ public virtual async Task> SetTagsAsync( } } - /// - /// Replace the tags on the resource with the given set. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Edge/disconnectedOperations/{name} - /// - /// - /// Operation Id - /// DisconnectedOperation_Get - /// - /// - /// Default Api Version - /// 2025-06-01-preview - /// - /// - /// 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 = _disconnectedOperationClientDiagnostics.CreateScope("DisconnectedOperationResource.SetTags"); + using DiagnosticScope scope = _disconnectedOperationsOprsClientDiagnostics.CreateScope("DisconnectedOperationResource.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 = _disconnectedOperationRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, cancellationToken); - return Response.FromValue(new DisconnectedOperationResource(Client, originalResponse.Value), originalResponse.GetRawResponse()); + GetTagResource().CreateOrUpdate(WaitUntil.Completed, originalTags.Value.Data, cancellationToken); + RequestContext context = new RequestContext + { + CancellationToken = cancellationToken + }; + HttpMessage message = _disconnectedOperationsOprsRestClient.CreateGetRequest(Guid.Parse(Id.SubscriptionId), Id.ResourceGroupName, Id.Name, context); + Response result = Pipeline.ProcessMessage(message, context); + Response response = Response.FromValue(DisconnectedOperationData.FromResponse(result), result); + return Response.FromValue(new DisconnectedOperationResource(Client, response.Value), response.GetRawResponse()); } else { - var current = Get(cancellationToken: cancellationToken).Value.Data; - var patch = new DisconnectedOperationPatch(); + DisconnectedOperationData current = Get(cancellationToken: cancellationToken).Value.Data; + DisconnectedOperationPatch patch = new DisconnectedOperationPatch(); 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) @@ -721,27 +669,7 @@ public virtual Response SetTags(IDictionary - /// Removes a tag by key from the resource. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Edge/disconnectedOperations/{name} - /// - /// - /// Operation Id - /// DisconnectedOperation_Get - /// - /// - /// Default Api Version - /// 2025-06-01-preview - /// - /// - /// Resource - /// - /// - /// - /// + /// Removes a tag by key from the resource. /// The key for the tag. /// The cancellation token to use. /// is null. @@ -749,29 +677,35 @@ public virtual async Task> RemoveTagAsyn { Argument.AssertNotNull(key, nameof(key)); - using var scope = _disconnectedOperationClientDiagnostics.CreateScope("DisconnectedOperationResource.RemoveTag"); + using DiagnosticScope scope = _disconnectedOperationsOprsClientDiagnostics.CreateScope("DisconnectedOperationResource.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 _disconnectedOperationRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, cancellationToken).ConfigureAwait(false); - return Response.FromValue(new DisconnectedOperationResource(Client, originalResponse.Value), originalResponse.GetRawResponse()); + await GetTagResource().CreateOrUpdateAsync(WaitUntil.Completed, originalTags.Value.Data, cancellationToken).ConfigureAwait(false); + RequestContext context = new RequestContext + { + CancellationToken = cancellationToken + }; + HttpMessage message = _disconnectedOperationsOprsRestClient.CreateGetRequest(Guid.Parse(Id.SubscriptionId), Id.ResourceGroupName, Id.Name, context); + Response result = await Pipeline.ProcessMessageAsync(message, context).ConfigureAwait(false); + Response response = Response.FromValue(DisconnectedOperationData.FromResponse(result), result); + return Response.FromValue(new DisconnectedOperationResource(Client, response.Value), response.GetRawResponse()); } else { - var current = (await GetAsync(cancellationToken: cancellationToken).ConfigureAwait(false)).Value.Data; - var patch = new DisconnectedOperationPatch(); - foreach (var tag in current.Tags) + DisconnectedOperationData current = (await GetAsync(cancellationToken: cancellationToken).ConfigureAwait(false)).Value.Data; + DisconnectedOperationPatch patch = new DisconnectedOperationPatch(); + 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) @@ -781,27 +715,7 @@ public virtual async Task> RemoveTagAsyn } } - /// - /// Removes a tag by key from the resource. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Edge/disconnectedOperations/{name} - /// - /// - /// Operation Id - /// DisconnectedOperation_Get - /// - /// - /// Default Api Version - /// 2025-06-01-preview - /// - /// - /// Resource - /// - /// - /// - /// + /// Removes a tag by key from the resource. /// The key for the tag. /// The cancellation token to use. /// is null. @@ -809,29 +723,35 @@ public virtual Response RemoveTag(string key, Can { Argument.AssertNotNull(key, nameof(key)); - using var scope = _disconnectedOperationClientDiagnostics.CreateScope("DisconnectedOperationResource.RemoveTag"); + using DiagnosticScope scope = _disconnectedOperationsOprsClientDiagnostics.CreateScope("DisconnectedOperationResource.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 = _disconnectedOperationRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, cancellationToken); - return Response.FromValue(new DisconnectedOperationResource(Client, originalResponse.Value), originalResponse.GetRawResponse()); + GetTagResource().CreateOrUpdate(WaitUntil.Completed, originalTags.Value.Data, cancellationToken); + RequestContext context = new RequestContext + { + CancellationToken = cancellationToken + }; + HttpMessage message = _disconnectedOperationsOprsRestClient.CreateGetRequest(Guid.Parse(Id.SubscriptionId), Id.ResourceGroupName, Id.Name, context); + Response result = Pipeline.ProcessMessage(message, context); + Response response = Response.FromValue(DisconnectedOperationData.FromResponse(result), result); + return Response.FromValue(new DisconnectedOperationResource(Client, response.Value), response.GetRawResponse()); } else { - var current = Get(cancellationToken: cancellationToken).Value.Data; - var patch = new DisconnectedOperationPatch(); - foreach (var tag in current.Tags) + DisconnectedOperationData current = Get(cancellationToken: cancellationToken).Value.Data; + DisconnectedOperationPatch patch = new DisconnectedOperationPatch(); + 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) @@ -840,5 +760,38 @@ public virtual Response RemoveTag(string key, Can throw; } } + + /// Gets a collection of DisconnectedOperationsImages in the . + /// An object representing collection of DisconnectedOperationsImages and their operations over a DisconnectedOperationsImageResource. + public virtual DisconnectedOperationsImageCollection GetDisconnectedOperationsImages() + { + return GetCachedClient(client => new DisconnectedOperationsImageCollection(client, Id)); + } + + /// Get the resource. + /// The name of the Image. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public virtual async Task> GetDisconnectedOperationsImageAsync(string imageName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(imageName, nameof(imageName)); + + return await GetDisconnectedOperationsImages().GetAsync(imageName, cancellationToken).ConfigureAwait(false); + } + + /// Get the resource. + /// The name of the Image. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public virtual Response GetDisconnectedOperationsImage(string imageName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(imageName, nameof(imageName)); + + return GetDisconnectedOperationsImages().Get(imageName, cancellationToken); + } } } diff --git a/sdk/disconnectedoperations/Azure.ResourceManager.DisconnectedOperations/src/Generated/DisconnectedOperationsArtifactCollection.cs b/sdk/disconnectedoperations/Azure.ResourceManager.DisconnectedOperations/src/Generated/DisconnectedOperationsArtifactCollection.cs index 17d1c238aca4..c84cfc6de7fe 100644 --- a/sdk/disconnectedoperations/Azure.ResourceManager.DisconnectedOperations/src/Generated/DisconnectedOperationsArtifactCollection.cs +++ b/sdk/disconnectedoperations/Azure.ResourceManager.DisconnectedOperations/src/Generated/DisconnectedOperationsArtifactCollection.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.DisconnectedOperations { @@ -24,69 +25,75 @@ namespace Azure.ResourceManager.DisconnectedOperations /// public partial class DisconnectedOperationsArtifactCollection : ArmCollection, IEnumerable, IAsyncEnumerable { - private readonly ClientDiagnostics _disconnectedOperationsArtifactArtifactsClientDiagnostics; - private readonly ArtifactsRestOperations _disconnectedOperationsArtifactArtifactsRestClient; + private readonly ClientDiagnostics _artifactsClientDiagnostics; + private readonly Artifacts _artifactsRestClient; - /// Initializes a new instance of the class for mocking. + /// Initializes a new instance of DisconnectedOperationsArtifactCollection for mocking. protected DisconnectedOperationsArtifactCollection() { } - /// 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 DisconnectedOperationsArtifactCollection(ArmClient client, ResourceIdentifier id) : base(client, id) { - _disconnectedOperationsArtifactArtifactsClientDiagnostics = new ClientDiagnostics("Azure.ResourceManager.DisconnectedOperations", DisconnectedOperationsArtifactResource.ResourceType.Namespace, Diagnostics); - TryGetApiVersion(DisconnectedOperationsArtifactResource.ResourceType, out string disconnectedOperationsArtifactArtifactsApiVersion); - _disconnectedOperationsArtifactArtifactsRestClient = new ArtifactsRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, disconnectedOperationsArtifactArtifactsApiVersion); -#if DEBUG - ValidateResourceId(Id); -#endif + TryGetApiVersion(DisconnectedOperationsArtifactResource.ResourceType, out string disconnectedOperationsArtifactApiVersion); + _artifactsClientDiagnostics = new ClientDiagnostics("Azure.ResourceManager.DisconnectedOperations", DisconnectedOperationsArtifactResource.ResourceType.Namespace, Diagnostics); + _artifactsRestClient = new Artifacts(_artifactsClientDiagnostics, Pipeline, Endpoint, disconnectedOperationsArtifactApiVersion ?? "2025-06-01-preview"); + ValidateResourceId(id); } + /// + [Conditional("DEBUG")] internal static void ValidateResourceId(ResourceIdentifier id) { if (id.ResourceType != DisconnectedOperationsImageResource.ResourceType) - throw new ArgumentException(string.Format(CultureInfo.CurrentCulture, "Invalid resource type {0} expected {1}", id.ResourceType, DisconnectedOperationsImageResource.ResourceType), nameof(id)); + { + throw new ArgumentException(string.Format("Invalid resource type {0} expected {1}", id.ResourceType, DisconnectedOperationsImageResource.ResourceType), id); + } } /// /// Get the resource /// /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Edge/disconnectedOperations/{name}/images/{imageName}/artifacts/{artifactName} + /// Request Path. + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Edge/disconnectedOperations/{name}/images/{imageName}/artifacts/{artifactName}. /// /// - /// Operation Id - /// Artifact_Get + /// Operation Id. + /// Artifacts_Get. /// /// - /// Default Api Version - /// 2025-06-01-preview - /// - /// - /// Resource - /// + /// Default Api Version. + /// 2025-06-01-preview. /// /// /// /// The name of the Artifact. /// 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 artifactName, CancellationToken cancellationToken = default) { Argument.AssertNotNullOrEmpty(artifactName, nameof(artifactName)); - using var scope = _disconnectedOperationsArtifactArtifactsClientDiagnostics.CreateScope("DisconnectedOperationsArtifactCollection.Get"); + using DiagnosticScope scope = _artifactsClientDiagnostics.CreateScope("DisconnectedOperationsArtifactCollection.Get"); scope.Start(); try { - var response = await _disconnectedOperationsArtifactArtifactsRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, artifactName, cancellationToken).ConfigureAwait(false); + RequestContext context = new RequestContext + { + CancellationToken = cancellationToken + }; + HttpMessage message = _artifactsRestClient.CreateGetRequest(Guid.Parse(Id.SubscriptionId), Id.ResourceGroupName, Id.Parent.Name, Id.Name, artifactName, context); + Response result = await Pipeline.ProcessMessageAsync(message, context).ConfigureAwait(false); + Response response = Response.FromValue(DisconnectedOperationsArtifactData.FromResponse(result), result); if (response.Value == null) + { throw new RequestFailedException(response.GetRawResponse()); + } return Response.FromValue(new DisconnectedOperationsArtifactResource(Client, response.Value), response.GetRawResponse()); } catch (Exception e) @@ -100,38 +107,42 @@ public virtual async Task> GetA /// Get the resource /// /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Edge/disconnectedOperations/{name}/images/{imageName}/artifacts/{artifactName} - /// - /// - /// Operation Id - /// Artifact_Get + /// Request Path. + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Edge/disconnectedOperations/{name}/images/{imageName}/artifacts/{artifactName}. /// /// - /// Default Api Version - /// 2025-06-01-preview + /// Operation Id. + /// Artifacts_Get. /// /// - /// Resource - /// + /// Default Api Version. + /// 2025-06-01-preview. /// /// /// /// The name of the Artifact. /// 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 artifactName, CancellationToken cancellationToken = default) { Argument.AssertNotNullOrEmpty(artifactName, nameof(artifactName)); - using var scope = _disconnectedOperationsArtifactArtifactsClientDiagnostics.CreateScope("DisconnectedOperationsArtifactCollection.Get"); + using DiagnosticScope scope = _artifactsClientDiagnostics.CreateScope("DisconnectedOperationsArtifactCollection.Get"); scope.Start(); try { - var response = _disconnectedOperationsArtifactArtifactsRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, artifactName, cancellationToken); + RequestContext context = new RequestContext + { + CancellationToken = cancellationToken + }; + HttpMessage message = _artifactsRestClient.CreateGetRequest(Guid.Parse(Id.SubscriptionId), Id.ResourceGroupName, Id.Parent.Name, Id.Name, artifactName, context); + Response result = Pipeline.ProcessMessage(message, context); + Response response = Response.FromValue(DisconnectedOperationsArtifactData.FromResponse(result), result); if (response.Value == null) + { throw new RequestFailedException(response.GetRawResponse()); + } return Response.FromValue(new DisconnectedOperationsArtifactResource(Client, response.Value), response.GetRawResponse()); } catch (Exception e) @@ -145,50 +156,50 @@ public virtual Response Get(string artif /// List by parent /// /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Edge/disconnectedOperations/{name}/images/{imageName}/artifacts + /// Request Path. + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Edge/disconnectedOperations/{name}/images/{imageName}/artifacts. /// /// - /// Operation Id - /// Artifact_ListByParent + /// Operation Id. + /// Artifacts_ListByParent. /// /// - /// Default Api Version - /// 2025-06-01-preview - /// - /// - /// Resource - /// + /// Default Api Version. + /// 2025-06-01-preview. /// /// /// /// The cancellation token to use. - /// An async collection of that may take multiple service requests to iterate over. + /// A collection of that may take multiple service requests to iterate over. public virtual AsyncPageable GetAllAsync(CancellationToken cancellationToken = default) { - HttpMessage FirstPageRequest(int? pageSizeHint) => _disconnectedOperationsArtifactArtifactsRestClient.CreateListByParentRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name); - HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _disconnectedOperationsArtifactArtifactsRestClient.CreateListByParentNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name); - return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new DisconnectedOperationsArtifactResource(Client, DisconnectedOperationsArtifactData.DeserializeDisconnectedOperationsArtifactData(e)), _disconnectedOperationsArtifactArtifactsClientDiagnostics, Pipeline, "DisconnectedOperationsArtifactCollection.GetAll", "value", "nextLink", cancellationToken); + RequestContext context = new RequestContext + { + CancellationToken = cancellationToken + }; + return new AsyncPageableWrapper(new ArtifactsGetByParentAsyncCollectionResultOfT( + _artifactsRestClient, + Guid.Parse(Id.SubscriptionId), + Id.ResourceGroupName, + Id.Parent.Name, + Id.Name, + context), data => new DisconnectedOperationsArtifactResource(Client, data)); } /// /// List by parent /// /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Edge/disconnectedOperations/{name}/images/{imageName}/artifacts + /// Request Path. + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Edge/disconnectedOperations/{name}/images/{imageName}/artifacts. /// /// - /// Operation Id - /// Artifact_ListByParent + /// Operation Id. + /// Artifacts_ListByParent. /// /// - /// Default Api Version - /// 2025-06-01-preview - /// - /// - /// Resource - /// + /// Default Api Version. + /// 2025-06-01-preview. /// /// /// @@ -196,45 +207,67 @@ public virtual AsyncPageable GetAllAsync /// A collection of that may take multiple service requests to iterate over. public virtual Pageable GetAll(CancellationToken cancellationToken = default) { - HttpMessage FirstPageRequest(int? pageSizeHint) => _disconnectedOperationsArtifactArtifactsRestClient.CreateListByParentRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name); - HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _disconnectedOperationsArtifactArtifactsRestClient.CreateListByParentNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name); - return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new DisconnectedOperationsArtifactResource(Client, DisconnectedOperationsArtifactData.DeserializeDisconnectedOperationsArtifactData(e)), _disconnectedOperationsArtifactArtifactsClientDiagnostics, Pipeline, "DisconnectedOperationsArtifactCollection.GetAll", "value", "nextLink", cancellationToken); + RequestContext context = new RequestContext + { + CancellationToken = cancellationToken + }; + return new PageableWrapper(new ArtifactsGetByParentCollectionResultOfT( + _artifactsRestClient, + Guid.Parse(Id.SubscriptionId), + Id.ResourceGroupName, + Id.Parent.Name, + Id.Name, + context), data => new DisconnectedOperationsArtifactResource(Client, data)); } /// - /// Checks to see if the resource exists in azure. + /// Get the resource /// /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Edge/disconnectedOperations/{name}/images/{imageName}/artifacts/{artifactName} - /// - /// - /// Operation Id - /// Artifact_Get + /// Request Path. + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Edge/disconnectedOperations/{name}/images/{imageName}/artifacts/{artifactName}. /// /// - /// Default Api Version - /// 2025-06-01-preview + /// Operation Id. + /// Artifacts_Get. /// /// - /// Resource - /// + /// Default Api Version. + /// 2025-06-01-preview. /// /// /// /// The name of the Artifact. /// 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 artifactName, CancellationToken cancellationToken = default) { Argument.AssertNotNullOrEmpty(artifactName, nameof(artifactName)); - using var scope = _disconnectedOperationsArtifactArtifactsClientDiagnostics.CreateScope("DisconnectedOperationsArtifactCollection.Exists"); + using DiagnosticScope scope = _artifactsClientDiagnostics.CreateScope("DisconnectedOperationsArtifactCollection.Exists"); scope.Start(); try { - var response = await _disconnectedOperationsArtifactArtifactsRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, artifactName, cancellationToken: cancellationToken).ConfigureAwait(false); + RequestContext context = new RequestContext + { + CancellationToken = cancellationToken + }; + HttpMessage message = _artifactsRestClient.CreateGetRequest(Guid.Parse(Id.SubscriptionId), Id.ResourceGroupName, Id.Parent.Name, Id.Name, artifactName, context); + await Pipeline.SendAsync(message, context.CancellationToken).ConfigureAwait(false); + Response result = message.Response; + Response response = default; + switch (result.Status) + { + case 200: + response = Response.FromValue(DisconnectedOperationsArtifactData.FromResponse(result), result); + break; + case 404: + response = Response.FromValue((DisconnectedOperationsArtifactData)null, result); + break; + default: + throw new RequestFailedException(result); + } return Response.FromValue(response.Value != null, response.GetRawResponse()); } catch (Exception e) @@ -245,39 +278,53 @@ public virtual async Task> ExistsAsync(string artifactName, Cance } /// - /// Checks to see if the resource exists in azure. + /// Get the resource /// /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Edge/disconnectedOperations/{name}/images/{imageName}/artifacts/{artifactName} - /// - /// - /// Operation Id - /// Artifact_Get + /// Request Path. + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Edge/disconnectedOperations/{name}/images/{imageName}/artifacts/{artifactName}. /// /// - /// Default Api Version - /// 2025-06-01-preview + /// Operation Id. + /// Artifacts_Get. /// /// - /// Resource - /// + /// Default Api Version. + /// 2025-06-01-preview. /// /// /// /// The name of the Artifact. /// 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 artifactName, CancellationToken cancellationToken = default) { Argument.AssertNotNullOrEmpty(artifactName, nameof(artifactName)); - using var scope = _disconnectedOperationsArtifactArtifactsClientDiagnostics.CreateScope("DisconnectedOperationsArtifactCollection.Exists"); + using DiagnosticScope scope = _artifactsClientDiagnostics.CreateScope("DisconnectedOperationsArtifactCollection.Exists"); scope.Start(); try { - var response = _disconnectedOperationsArtifactArtifactsRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, artifactName, cancellationToken: cancellationToken); + RequestContext context = new RequestContext + { + CancellationToken = cancellationToken + }; + HttpMessage message = _artifactsRestClient.CreateGetRequest(Guid.Parse(Id.SubscriptionId), Id.ResourceGroupName, Id.Parent.Name, Id.Name, artifactName, context); + Pipeline.Send(message, context.CancellationToken); + Response result = message.Response; + Response response = default; + switch (result.Status) + { + case 200: + response = Response.FromValue(DisconnectedOperationsArtifactData.FromResponse(result), result); + break; + case 404: + response = Response.FromValue((DisconnectedOperationsArtifactData)null, result); + break; + default: + throw new RequestFailedException(result); + } return Response.FromValue(response.Value != null, response.GetRawResponse()); } catch (Exception e) @@ -288,41 +335,57 @@ public virtual Response Exists(string artifactName, CancellationToken canc } /// - /// Tries to get details for this resource from the service. + /// Get the resource /// /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Edge/disconnectedOperations/{name}/images/{imageName}/artifacts/{artifactName} + /// Request Path. + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Edge/disconnectedOperations/{name}/images/{imageName}/artifacts/{artifactName}. /// /// - /// Operation Id - /// Artifact_Get + /// Operation Id. + /// Artifacts_Get. /// /// - /// Default Api Version - /// 2025-06-01-preview - /// - /// - /// Resource - /// + /// Default Api Version. + /// 2025-06-01-preview. /// /// /// /// The name of the Artifact. /// 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 artifactName, CancellationToken cancellationToken = default) { Argument.AssertNotNullOrEmpty(artifactName, nameof(artifactName)); - using var scope = _disconnectedOperationsArtifactArtifactsClientDiagnostics.CreateScope("DisconnectedOperationsArtifactCollection.GetIfExists"); + using DiagnosticScope scope = _artifactsClientDiagnostics.CreateScope("DisconnectedOperationsArtifactCollection.GetIfExists"); scope.Start(); try { - var response = await _disconnectedOperationsArtifactArtifactsRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, artifactName, cancellationToken: cancellationToken).ConfigureAwait(false); + RequestContext context = new RequestContext + { + CancellationToken = cancellationToken + }; + HttpMessage message = _artifactsRestClient.CreateGetRequest(Guid.Parse(Id.SubscriptionId), Id.ResourceGroupName, Id.Parent.Name, Id.Name, artifactName, context); + await Pipeline.SendAsync(message, context.CancellationToken).ConfigureAwait(false); + Response result = message.Response; + Response response = default; + switch (result.Status) + { + case 200: + response = Response.FromValue(DisconnectedOperationsArtifactData.FromResponse(result), result); + break; + case 404: + response = Response.FromValue((DisconnectedOperationsArtifactData)null, result); + break; + default: + throw new RequestFailedException(result); + } if (response.Value == null) + { return new NoValueResponse(response.GetRawResponse()); + } return Response.FromValue(new DisconnectedOperationsArtifactResource(Client, response.Value), response.GetRawResponse()); } catch (Exception e) @@ -333,41 +396,57 @@ public virtual async Task - /// Tries to get details for this resource from the service. + /// Get the resource /// /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Edge/disconnectedOperations/{name}/images/{imageName}/artifacts/{artifactName} + /// Request Path. + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Edge/disconnectedOperations/{name}/images/{imageName}/artifacts/{artifactName}. /// /// - /// Operation Id - /// Artifact_Get + /// Operation Id. + /// Artifacts_Get. /// /// - /// Default Api Version - /// 2025-06-01-preview - /// - /// - /// Resource - /// + /// Default Api Version. + /// 2025-06-01-preview. /// /// /// /// The name of the Artifact. /// 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 artifactName, CancellationToken cancellationToken = default) { Argument.AssertNotNullOrEmpty(artifactName, nameof(artifactName)); - using var scope = _disconnectedOperationsArtifactArtifactsClientDiagnostics.CreateScope("DisconnectedOperationsArtifactCollection.GetIfExists"); + using DiagnosticScope scope = _artifactsClientDiagnostics.CreateScope("DisconnectedOperationsArtifactCollection.GetIfExists"); scope.Start(); try { - var response = _disconnectedOperationsArtifactArtifactsRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, artifactName, cancellationToken: cancellationToken); + RequestContext context = new RequestContext + { + CancellationToken = cancellationToken + }; + HttpMessage message = _artifactsRestClient.CreateGetRequest(Guid.Parse(Id.SubscriptionId), Id.ResourceGroupName, Id.Parent.Name, Id.Name, artifactName, context); + Pipeline.Send(message, context.CancellationToken); + Response result = message.Response; + Response response = default; + switch (result.Status) + { + case 200: + response = Response.FromValue(DisconnectedOperationsArtifactData.FromResponse(result), result); + break; + case 404: + response = Response.FromValue((DisconnectedOperationsArtifactData)null, result); + break; + default: + throw new RequestFailedException(result); + } if (response.Value == null) + { return new NoValueResponse(response.GetRawResponse()); + } return Response.FromValue(new DisconnectedOperationsArtifactResource(Client, response.Value), response.GetRawResponse()); } catch (Exception e) @@ -387,6 +466,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/disconnectedoperations/Azure.ResourceManager.DisconnectedOperations/src/Generated/DisconnectedOperationsArtifactData.Serialization.cs b/sdk/disconnectedoperations/Azure.ResourceManager.DisconnectedOperations/src/Generated/DisconnectedOperationsArtifactData.Serialization.cs index 01b5221cf16b..668f3021c85c 100644 --- a/sdk/disconnectedoperations/Azure.ResourceManager.DisconnectedOperations/src/Generated/DisconnectedOperationsArtifactData.Serialization.cs +++ b/sdk/disconnectedoperations/Azure.ResourceManager.DisconnectedOperations/src/Generated/DisconnectedOperationsArtifactData.Serialization.cs @@ -10,16 +10,18 @@ using System.Collections.Generic; using System.Text; using System.Text.Json; +using Azure; using Azure.Core; using Azure.ResourceManager.DisconnectedOperations.Models; using Azure.ResourceManager.Models; namespace Azure.ResourceManager.DisconnectedOperations { - public partial class DisconnectedOperationsArtifactData : IUtf8JsonSerializable, IJsonModel + /// Disconnected operations artifact resource. + public partial class DisconnectedOperationsArtifactData : ResourceData, IJsonModel { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); - + /// The JSON writer. + /// The client options for reading and writing models. void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) { writer.WriteStartObject(); @@ -31,12 +33,11 @@ void IJsonModel.Write(Utf8JsonWriter writer, /// 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(DisconnectedOperationsArtifactData)} does not support writing '{format}' format."); } - base.JsonModelWriteCore(writer, options); if (Optional.IsDefined(Properties)) { @@ -45,87 +46,101 @@ protected override void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWri } } - DisconnectedOperationsArtifactData IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + /// The JSON reader. + /// The client options for reading and writing models. + DisconnectedOperationsArtifactData IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) => (DisconnectedOperationsArtifactData)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(DisconnectedOperationsArtifactData)} does not support reading '{format}' format."); } - using JsonDocument document = JsonDocument.ParseValue(ref reader); return DeserializeDisconnectedOperationsArtifactData(document.RootElement, options); } - internal static DisconnectedOperationsArtifactData DeserializeDisconnectedOperationsArtifactData(JsonElement element, ModelReaderWriterOptions options = null) + /// The JSON element to deserialize. + /// The client options for reading and writing models. + internal static DisconnectedOperationsArtifactData DeserializeDisconnectedOperationsArtifactData(JsonElement element, ModelReaderWriterOptions options) { - options ??= ModelSerializationExtensions.WireOptions; - if (element.ValueKind == JsonValueKind.Null) { return null; } - DisconnectedOperationsArtifactProperties properties = default; ResourceIdentifier id = default; string name = default; - ResourceType type = default; + ResourceType resourceType = default; SystemData systemData = default; - IDictionary serializedAdditionalRawData = default; - Dictionary rawDataDictionary = new Dictionary(); - foreach (var property in element.EnumerateObject()) + IDictionary additionalBinaryDataProperties = new ChangeTrackingDictionary(); + DisconnectedOperationsArtifactProperties properties = default; + foreach (var prop in element.EnumerateObject()) { - if (property.NameEquals("properties"u8)) + if (prop.NameEquals("id"u8)) { - if (property.Value.ValueKind == JsonValueKind.Null) + if (prop.Value.ValueKind == JsonValueKind.Null) { continue; } - properties = DisconnectedOperationsArtifactProperties.DeserializeDisconnectedOperationsArtifactProperties(property.Value, options); + id = new ResourceIdentifier(prop.Value.GetString()); continue; } - if (property.NameEquals("id"u8)) + if (prop.NameEquals("name"u8)) { - id = new ResourceIdentifier(property.Value.GetString()); + name = prop.Value.GetString(); continue; } - if (property.NameEquals("name"u8)) + if (prop.NameEquals("type"u8)) { - name = property.Value.GetString(); + if (prop.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + resourceType = new ResourceType(prop.Value.GetString()); continue; } - if (property.NameEquals("type"u8)) + if (prop.NameEquals("systemData"u8)) { - type = new ResourceType(property.Value.GetString()); + if (prop.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + systemData = ModelReaderWriter.Read(new BinaryData(Encoding.UTF8.GetBytes(prop.Value.GetRawText())), ModelSerializationExtensions.WireOptions, AzureResourceManagerDisconnectedOperationsContext.Default); continue; } - if (property.NameEquals("systemData"u8)) + if (prop.NameEquals("properties"u8)) { - if (property.Value.ValueKind == JsonValueKind.Null) + if (prop.Value.ValueKind == JsonValueKind.Null) { continue; } - systemData = ModelReaderWriter.Read(new BinaryData(Encoding.UTF8.GetBytes(property.Value.GetRawText())), ModelSerializationExtensions.WireOptions, AzureResourceManagerDisconnectedOperationsContext.Default); + properties = DisconnectedOperationsArtifactProperties.DeserializeDisconnectedOperationsArtifactProperties(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 DisconnectedOperationsArtifactData( id, name, - type, + resourceType, systemData, - properties, - serializedAdditionalRawData); + additionalBinaryDataProperties, + properties); } - BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) - { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + /// The client options for reading and writing models. + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) => PersistableModelWriteCore(options); + /// The client options for reading and writing models. + protected virtual BinaryData PersistableModelWriteCore(ModelReaderWriterOptions options) + { + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; switch (format) { case "J": @@ -135,15 +150,20 @@ BinaryData IPersistableModel.Write(ModelRead } } - DisconnectedOperationsArtifactData 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. + DisconnectedOperationsArtifactData IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) => (DisconnectedOperationsArtifactData)PersistableModelCreateCore(data, options); + /// The data to parse. + /// The client options for reading and writing models. + protected virtual ResourceData PersistableModelCreateCore(BinaryData data, ModelReaderWriterOptions options) + { + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; switch (format) { case "J": + using (JsonDocument document = JsonDocument.Parse(data, ModelSerializationExtensions.JsonDocumentOptions)) { - using JsonDocument document = JsonDocument.Parse(data, ModelSerializationExtensions.JsonDocumentOptions); return DeserializeDisconnectedOperationsArtifactData(document.RootElement, options); } default: @@ -151,6 +171,14 @@ DisconnectedOperationsArtifactData IPersistableModel The client options for reading and writing models. string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + + /// The to deserialize the from. + internal static DisconnectedOperationsArtifactData FromResponse(Response response) + { + using JsonDocument document = JsonDocument.Parse(response.Content, ModelSerializationExtensions.JsonDocumentOptions); + return DeserializeDisconnectedOperationsArtifactData(document.RootElement, ModelSerializationExtensions.WireOptions); + } } } diff --git a/sdk/disconnectedoperations/Azure.ResourceManager.DisconnectedOperations/src/Generated/DisconnectedOperationsArtifactData.cs b/sdk/disconnectedoperations/Azure.ResourceManager.DisconnectedOperations/src/Generated/DisconnectedOperationsArtifactData.cs index aa5659c5f49e..6ef2d78afec8 100644 --- a/sdk/disconnectedoperations/Azure.ResourceManager.DisconnectedOperations/src/Generated/DisconnectedOperationsArtifactData.cs +++ b/sdk/disconnectedoperations/Azure.ResourceManager.DisconnectedOperations/src/Generated/DisconnectedOperationsArtifactData.cs @@ -13,43 +13,11 @@ namespace Azure.ResourceManager.DisconnectedOperations { - /// - /// A class representing the DisconnectedOperationsArtifact data model. - /// Disconnected operations artifact resource. - /// + /// Disconnected operations artifact resource. public partial class DisconnectedOperationsArtifactData : ResourceData { - /// - /// Keeps track of any properties unknown to the library. - /// - /// To assign an object to the value of this property use . - /// - /// - /// To assign an already formatted json string to this property use . - /// - /// - /// Examples: - /// - /// - /// BinaryData.FromObjectAsJson("foo") - /// Creates a payload of "foo". - /// - /// - /// BinaryData.FromString("\"foo\"") - /// Creates a payload of "foo". - /// - /// - /// BinaryData.FromObjectAsJson(new { key = "value" }) - /// Creates a payload of { "key": "value" }. - /// - /// - /// BinaryData.FromString("{\"key\": \"value\"}") - /// Creates a payload of { "key": "value" }. - /// - /// - /// - /// - private IDictionary _serializedAdditionalRawData; + /// Keeps track of any properties unknown to the library. + private protected readonly IDictionary _additionalBinaryDataProperties; /// Initializes a new instance of . internal DisconnectedOperationsArtifactData() @@ -57,16 +25,16 @@ internal DisconnectedOperationsArtifactData() } /// Initializes a new instance of . - /// The id. - /// The name. - /// The resourceType. - /// The systemData. + /// Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. + /// The name of the resource. + /// The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts". + /// Azure Resource Manager metadata containing createdBy and modifiedBy information. + /// Keeps track of any properties unknown to the library. /// The resource-specific properties for this resource. - /// Keeps track of any properties unknown to the library. - internal DisconnectedOperationsArtifactData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, DisconnectedOperationsArtifactProperties properties, IDictionary serializedAdditionalRawData) : base(id, name, resourceType, systemData) + internal DisconnectedOperationsArtifactData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, IDictionary additionalBinaryDataProperties, DisconnectedOperationsArtifactProperties properties) : base(id, name, resourceType, systemData) { + _additionalBinaryDataProperties = additionalBinaryDataProperties; Properties = properties; - _serializedAdditionalRawData = serializedAdditionalRawData; } /// The resource-specific properties for this resource. diff --git a/sdk/disconnectedoperations/Azure.ResourceManager.DisconnectedOperations/src/Generated/DisconnectedOperationsArtifactResource.Serialization.cs b/sdk/disconnectedoperations/Azure.ResourceManager.DisconnectedOperations/src/Generated/DisconnectedOperationsArtifactResource.Serialization.cs index 55ba4eef8c6e..4f72eb4f273f 100644 --- a/sdk/disconnectedoperations/Azure.ResourceManager.DisconnectedOperations/src/Generated/DisconnectedOperationsArtifactResource.Serialization.cs +++ b/sdk/disconnectedoperations/Azure.ResourceManager.DisconnectedOperations/src/Generated/DisconnectedOperationsArtifactResource.Serialization.cs @@ -11,19 +11,29 @@ namespace Azure.ResourceManager.DisconnectedOperations { + /// public partial class DisconnectedOperationsArtifactResource : IJsonModel { - private static DisconnectedOperationsArtifactData s_dataDeserializationInstance; - private static DisconnectedOperationsArtifactData DataDeserializationInstance => s_dataDeserializationInstance ??= new(); + private static IJsonModel s_dataDeserializationInstance; + private static IJsonModel DataDeserializationInstance => s_dataDeserializationInstance ??= new DisconnectedOperationsArtifactData(); + + /// 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); - DisconnectedOperationsArtifactData 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. + DisconnectedOperationsArtifactData 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, AzureResourceManagerDisconnectedOperationsContext.Default); + /// The binary data to be processed. + /// The client options for reading and writing models. DisconnectedOperationsArtifactData IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) => ModelReaderWriter.Read(data, options, AzureResourceManagerDisconnectedOperationsContext.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/disconnectedoperations/Azure.ResourceManager.DisconnectedOperations/src/Generated/DisconnectedOperationsArtifactResource.cs b/sdk/disconnectedoperations/Azure.ResourceManager.DisconnectedOperations/src/Generated/DisconnectedOperationsArtifactResource.cs index 80235ef106dc..bcbf2722bd0e 100644 --- a/sdk/disconnectedoperations/Azure.ResourceManager.DisconnectedOperations/src/Generated/DisconnectedOperationsArtifactResource.cs +++ b/sdk/disconnectedoperations/Azure.ResourceManager.DisconnectedOperations/src/Generated/DisconnectedOperationsArtifactResource.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.DisconnectedOperations.Models; namespace Azure.ResourceManager.DisconnectedOperations { /// - /// A Class representing a DisconnectedOperationsArtifact 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 GetDisconnectedOperationsArtifactResource method. - /// Otherwise you can get one from its parent resource using the GetDisconnectedOperationsArtifact method. + /// A class representing a DisconnectedOperationsArtifact 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 GetDisconnectedOperationsArtifacts method. /// public partial class DisconnectedOperationsArtifactResource : ArmResource { - /// Generate the resource identifier of a instance. - /// The subscriptionId. - /// The resourceGroupName. - /// The name. - /// The imageName. - /// The artifactName. - public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string name, string imageName, string artifactName) - { - var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Edge/disconnectedOperations/{name}/images/{imageName}/artifacts/{artifactName}"; - return new ResourceIdentifier(resourceId); - } - - private readonly ClientDiagnostics _disconnectedOperationsArtifactArtifactsClientDiagnostics; - private readonly ArtifactsRestOperations _disconnectedOperationsArtifactArtifactsRestClient; + private readonly ClientDiagnostics _artifactsClientDiagnostics; + private readonly Artifacts _artifactsRestClient; private readonly DisconnectedOperationsArtifactData _data; - /// Gets the resource type for the operations. public static readonly ResourceType ResourceType = "Microsoft.Edge/disconnectedOperations/images/artifacts"; - /// Initializes a new instance of the class for mocking. + /// Initializes a new instance of DisconnectedOperationsArtifactResource for mocking. protected DisconnectedOperationsArtifactResource() { } - /// 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 DisconnectedOperationsArtifactResource(ArmClient client, DisconnectedOperationsArtifactData data) : this(client, data.Id) @@ -56,71 +44,94 @@ internal DisconnectedOperationsArtifactResource(ArmClient client, DisconnectedOp _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 DisconnectedOperationsArtifactResource(ArmClient client, ResourceIdentifier id) : base(client, id) { - _disconnectedOperationsArtifactArtifactsClientDiagnostics = new ClientDiagnostics("Azure.ResourceManager.DisconnectedOperations", ResourceType.Namespace, Diagnostics); - TryGetApiVersion(ResourceType, out string disconnectedOperationsArtifactArtifactsApiVersion); - _disconnectedOperationsArtifactArtifactsRestClient = new ArtifactsRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, disconnectedOperationsArtifactArtifactsApiVersion); -#if DEBUG - ValidateResourceId(Id); -#endif + TryGetApiVersion(ResourceType, out string disconnectedOperationsArtifactApiVersion); + _artifactsClientDiagnostics = new ClientDiagnostics("Azure.ResourceManager.DisconnectedOperations", ResourceType.Namespace, Diagnostics); + _artifactsRestClient = new Artifacts(_artifactsClientDiagnostics, Pipeline, Endpoint, disconnectedOperationsArtifactApiVersion ?? "2025-06-01-preview"); + 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 DisconnectedOperationsArtifactData 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. + /// The imageName. + /// The artifactName. + public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string name, string imageName, string artifactName) + { + string resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Edge/disconnectedOperations/{name}/images/{imageName}/artifacts/{artifactName}"; + 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 the resource /// /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Edge/disconnectedOperations/{name}/images/{imageName}/artifacts/{artifactName} + /// Request Path. + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Edge/disconnectedOperations/{name}/images/{imageName}/artifacts/{artifactName}. /// /// - /// Operation Id - /// Artifact_Get + /// Operation Id. + /// Artifacts_Get. /// /// - /// Default Api Version - /// 2025-06-01-preview + /// Default Api Version. + /// 2025-06-01-preview. /// /// - /// Resource - /// + /// Resource. + /// . /// /// /// /// The cancellation token to use. public virtual async Task> GetAsync(CancellationToken cancellationToken = default) { - using var scope = _disconnectedOperationsArtifactArtifactsClientDiagnostics.CreateScope("DisconnectedOperationsArtifactResource.Get"); + using DiagnosticScope scope = _artifactsClientDiagnostics.CreateScope("DisconnectedOperationsArtifactResource.Get"); scope.Start(); try { - var response = await _disconnectedOperationsArtifactArtifactsRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, cancellationToken).ConfigureAwait(false); + RequestContext context = new RequestContext + { + CancellationToken = cancellationToken + }; + HttpMessage message = _artifactsRestClient.CreateGetRequest(Guid.Parse(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(DisconnectedOperationsArtifactData.FromResponse(result), result); if (response.Value == null) + { throw new RequestFailedException(response.GetRawResponse()); + } return Response.FromValue(new DisconnectedOperationsArtifactResource(Client, response.Value), response.GetRawResponse()); } catch (Exception e) @@ -134,33 +145,41 @@ public virtual async Task> GetA /// Get the resource /// /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Edge/disconnectedOperations/{name}/images/{imageName}/artifacts/{artifactName} + /// Request Path. + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Edge/disconnectedOperations/{name}/images/{imageName}/artifacts/{artifactName}. /// /// - /// Operation Id - /// Artifact_Get + /// Operation Id. + /// Artifacts_Get. /// /// - /// Default Api Version - /// 2025-06-01-preview + /// Default Api Version. + /// 2025-06-01-preview. /// /// - /// Resource - /// + /// Resource. + /// . /// /// /// /// The cancellation token to use. public virtual Response Get(CancellationToken cancellationToken = default) { - using var scope = _disconnectedOperationsArtifactArtifactsClientDiagnostics.CreateScope("DisconnectedOperationsArtifactResource.Get"); + using DiagnosticScope scope = _artifactsClientDiagnostics.CreateScope("DisconnectedOperationsArtifactResource.Get"); scope.Start(); try { - var response = _disconnectedOperationsArtifactArtifactsRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, cancellationToken); + RequestContext context = new RequestContext + { + CancellationToken = cancellationToken + }; + HttpMessage message = _artifactsRestClient.CreateGetRequest(Guid.Parse(Id.SubscriptionId), Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, context); + Response result = Pipeline.ProcessMessage(message, context); + Response response = Response.FromValue(DisconnectedOperationsArtifactData.FromResponse(result), result); if (response.Value == null) + { throw new RequestFailedException(response.GetRawResponse()); + } return Response.FromValue(new DisconnectedOperationsArtifactResource(Client, response.Value), response.GetRawResponse()); } catch (Exception e) @@ -174,31 +193,41 @@ public virtual Response Get(Cancellation /// Get artifact download link. /// /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Edge/disconnectedOperations/{name}/images/{imageName}/artifacts/{artifactName}/listDownloadUri + /// Request Path. + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Edge/disconnectedOperations/{name}/images/{imageName}/artifacts/{artifactName}/listDownloadUri. /// /// - /// Operation Id - /// Artifacts_ListDownloadUri + /// Operation Id. + /// Artifacts_ListDownloadUri. /// /// - /// Default Api Version - /// 2025-06-01-preview + /// Default Api Version. + /// 2025-06-01-preview. /// /// - /// Resource - /// + /// Resource. + /// . /// /// /// /// The cancellation token to use. public virtual async Task> GetDownloadUriAsync(CancellationToken cancellationToken = default) { - using var scope = _disconnectedOperationsArtifactArtifactsClientDiagnostics.CreateScope("DisconnectedOperationsArtifactResource.GetDownloadUri"); + using DiagnosticScope scope = _artifactsClientDiagnostics.CreateScope("DisconnectedOperationsArtifactResource.GetDownloadUri"); scope.Start(); try { - var response = await _disconnectedOperationsArtifactArtifactsRestClient.ListDownloadUriAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, cancellationToken).ConfigureAwait(false); + RequestContext context = new RequestContext + { + CancellationToken = cancellationToken + }; + HttpMessage message = _artifactsRestClient.CreateGetDownloadUriRequest(Guid.Parse(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(DisconnectedOperationsArtifactDownloadResult.FromResponse(result), result); + if (response.Value == null) + { + throw new RequestFailedException(response.GetRawResponse()); + } return response; } catch (Exception e) @@ -212,31 +241,41 @@ public virtual async Task /// Get artifact download link. /// /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Edge/disconnectedOperations/{name}/images/{imageName}/artifacts/{artifactName}/listDownloadUri + /// Request Path. + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Edge/disconnectedOperations/{name}/images/{imageName}/artifacts/{artifactName}/listDownloadUri. /// /// - /// Operation Id - /// Artifacts_ListDownloadUri + /// Operation Id. + /// Artifacts_ListDownloadUri. /// /// - /// Default Api Version - /// 2025-06-01-preview + /// Default Api Version. + /// 2025-06-01-preview. /// /// - /// Resource - /// + /// Resource. + /// . /// /// /// /// The cancellation token to use. public virtual Response GetDownloadUri(CancellationToken cancellationToken = default) { - using var scope = _disconnectedOperationsArtifactArtifactsClientDiagnostics.CreateScope("DisconnectedOperationsArtifactResource.GetDownloadUri"); + using DiagnosticScope scope = _artifactsClientDiagnostics.CreateScope("DisconnectedOperationsArtifactResource.GetDownloadUri"); scope.Start(); try { - var response = _disconnectedOperationsArtifactArtifactsRestClient.ListDownloadUri(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, cancellationToken); + RequestContext context = new RequestContext + { + CancellationToken = cancellationToken + }; + HttpMessage message = _artifactsRestClient.CreateGetDownloadUriRequest(Guid.Parse(Id.SubscriptionId), Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, context); + Response result = Pipeline.ProcessMessage(message, context); + Response response = Response.FromValue(DisconnectedOperationsArtifactDownloadResult.FromResponse(result), result); + if (response.Value == null) + { + throw new RequestFailedException(response.GetRawResponse()); + } return response; } catch (Exception e) diff --git a/sdk/disconnectedoperations/Azure.ResourceManager.DisconnectedOperations/src/Generated/DisconnectedOperationsImageCollection.cs b/sdk/disconnectedoperations/Azure.ResourceManager.DisconnectedOperations/src/Generated/DisconnectedOperationsImageCollection.cs index bf18dc15165c..37aca7b030eb 100644 --- a/sdk/disconnectedoperations/Azure.ResourceManager.DisconnectedOperations/src/Generated/DisconnectedOperationsImageCollection.cs +++ b/sdk/disconnectedoperations/Azure.ResourceManager.DisconnectedOperations/src/Generated/DisconnectedOperationsImageCollection.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.DisconnectedOperations { @@ -24,69 +25,75 @@ namespace Azure.ResourceManager.DisconnectedOperations /// public partial class DisconnectedOperationsImageCollection : ArmCollection, IEnumerable, IAsyncEnumerable { - private readonly ClientDiagnostics _disconnectedOperationsImageImagesClientDiagnostics; - private readonly ImagesRestOperations _disconnectedOperationsImageImagesRestClient; + private readonly ClientDiagnostics _imagesClientDiagnostics; + private readonly Images _imagesRestClient; - /// Initializes a new instance of the class for mocking. + /// Initializes a new instance of DisconnectedOperationsImageCollection for mocking. protected DisconnectedOperationsImageCollection() { } - /// 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 DisconnectedOperationsImageCollection(ArmClient client, ResourceIdentifier id) : base(client, id) { - _disconnectedOperationsImageImagesClientDiagnostics = new ClientDiagnostics("Azure.ResourceManager.DisconnectedOperations", DisconnectedOperationsImageResource.ResourceType.Namespace, Diagnostics); - TryGetApiVersion(DisconnectedOperationsImageResource.ResourceType, out string disconnectedOperationsImageImagesApiVersion); - _disconnectedOperationsImageImagesRestClient = new ImagesRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, disconnectedOperationsImageImagesApiVersion); -#if DEBUG - ValidateResourceId(Id); -#endif + TryGetApiVersion(DisconnectedOperationsImageResource.ResourceType, out string disconnectedOperationsImageApiVersion); + _imagesClientDiagnostics = new ClientDiagnostics("Azure.ResourceManager.DisconnectedOperations", DisconnectedOperationsImageResource.ResourceType.Namespace, Diagnostics); + _imagesRestClient = new Images(_imagesClientDiagnostics, Pipeline, Endpoint, disconnectedOperationsImageApiVersion ?? "2025-06-01-preview"); + ValidateResourceId(id); } + /// + [Conditional("DEBUG")] internal static void ValidateResourceId(ResourceIdentifier id) { if (id.ResourceType != DisconnectedOperationResource.ResourceType) - throw new ArgumentException(string.Format(CultureInfo.CurrentCulture, "Invalid resource type {0} expected {1}", id.ResourceType, DisconnectedOperationResource.ResourceType), nameof(id)); + { + throw new ArgumentException(string.Format("Invalid resource type {0} expected {1}", id.ResourceType, DisconnectedOperationResource.ResourceType), id); + } } /// /// Get the resource. /// /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Edge/disconnectedOperations/{name}/images/{imageName} + /// Request Path. + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Edge/disconnectedOperations/{name}/images/{imageName}. /// /// - /// Operation Id - /// Image_Get + /// Operation Id. + /// Images_Get. /// /// - /// Default Api Version - /// 2025-06-01-preview - /// - /// - /// Resource - /// + /// Default Api Version. + /// 2025-06-01-preview. /// /// /// /// The name of the Image. /// 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 imageName, CancellationToken cancellationToken = default) { Argument.AssertNotNullOrEmpty(imageName, nameof(imageName)); - using var scope = _disconnectedOperationsImageImagesClientDiagnostics.CreateScope("DisconnectedOperationsImageCollection.Get"); + using DiagnosticScope scope = _imagesClientDiagnostics.CreateScope("DisconnectedOperationsImageCollection.Get"); scope.Start(); try { - var response = await _disconnectedOperationsImageImagesRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, imageName, cancellationToken).ConfigureAwait(false); + RequestContext context = new RequestContext + { + CancellationToken = cancellationToken + }; + HttpMessage message = _imagesRestClient.CreateGetRequest(Guid.Parse(Id.SubscriptionId), Id.ResourceGroupName, Id.Name, imageName, context); + Response result = await Pipeline.ProcessMessageAsync(message, context).ConfigureAwait(false); + Response response = Response.FromValue(DisconnectedOperationsImageData.FromResponse(result), result); if (response.Value == null) + { throw new RequestFailedException(response.GetRawResponse()); + } return Response.FromValue(new DisconnectedOperationsImageResource(Client, response.Value), response.GetRawResponse()); } catch (Exception e) @@ -100,38 +107,42 @@ public virtual async Task> GetAsyn /// Get the resource. /// /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Edge/disconnectedOperations/{name}/images/{imageName} - /// - /// - /// Operation Id - /// Image_Get + /// Request Path. + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Edge/disconnectedOperations/{name}/images/{imageName}. /// /// - /// Default Api Version - /// 2025-06-01-preview + /// Operation Id. + /// Images_Get. /// /// - /// Resource - /// + /// Default Api Version. + /// 2025-06-01-preview. /// /// /// /// The name of the Image. /// 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 imageName, CancellationToken cancellationToken = default) { Argument.AssertNotNullOrEmpty(imageName, nameof(imageName)); - using var scope = _disconnectedOperationsImageImagesClientDiagnostics.CreateScope("DisconnectedOperationsImageCollection.Get"); + using DiagnosticScope scope = _imagesClientDiagnostics.CreateScope("DisconnectedOperationsImageCollection.Get"); scope.Start(); try { - var response = _disconnectedOperationsImageImagesRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, imageName, cancellationToken); + RequestContext context = new RequestContext + { + CancellationToken = cancellationToken + }; + HttpMessage message = _imagesRestClient.CreateGetRequest(Guid.Parse(Id.SubscriptionId), Id.ResourceGroupName, Id.Name, imageName, context); + Response result = Pipeline.ProcessMessage(message, context); + Response response = Response.FromValue(DisconnectedOperationsImageData.FromResponse(result), result); if (response.Value == null) + { throw new RequestFailedException(response.GetRawResponse()); + } return Response.FromValue(new DisconnectedOperationsImageResource(Client, response.Value), response.GetRawResponse()); } catch (Exception e) @@ -145,20 +156,16 @@ public virtual Response Get(string imageNam /// List by disconnected operation. /// /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Edge/disconnectedOperations/{name}/images + /// Request Path. + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Edge/disconnectedOperations/{name}/images. /// /// - /// Operation Id - /// Image_ListByDisconnectedOperation + /// Operation Id. + /// Images_ListByDisconnectedOperation. /// /// - /// Default Api Version - /// 2025-06-01-preview - /// - /// - /// Resource - /// + /// Default Api Version. + /// 2025-06-01-preview. /// /// /// @@ -166,32 +173,38 @@ public virtual Response Get(string imageNam /// The number of result items to return. /// The number of result items to skip. /// The cancellation token to use. - /// An async collection of that may take multiple service requests to iterate over. - public virtual AsyncPageable GetAllAsync(string filter = null, int? top = null, int? skip = null, CancellationToken cancellationToken = default) + /// A collection of that may take multiple service requests to iterate over. + public virtual AsyncPageable GetAllAsync(string filter = default, int? top = default, int? skip = default, CancellationToken cancellationToken = default) { - HttpMessage FirstPageRequest(int? pageSizeHint) => _disconnectedOperationsImageImagesRestClient.CreateListByDisconnectedOperationRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, filter, top, skip); - HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _disconnectedOperationsImageImagesRestClient.CreateListByDisconnectedOperationNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName, Id.Name, filter, top, skip); - return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new DisconnectedOperationsImageResource(Client, DisconnectedOperationsImageData.DeserializeDisconnectedOperationsImageData(e)), _disconnectedOperationsImageImagesClientDiagnostics, Pipeline, "DisconnectedOperationsImageCollection.GetAll", "value", "nextLink", cancellationToken); + RequestContext context = new RequestContext + { + CancellationToken = cancellationToken + }; + return new AsyncPageableWrapper(new ImagesGetByDisconnectedOperationAsyncCollectionResultOfT( + _imagesRestClient, + Guid.Parse(Id.SubscriptionId), + Id.ResourceGroupName, + Id.Name, + filter, + top, + skip, + context), data => new DisconnectedOperationsImageResource(Client, data)); } /// /// List by disconnected operation. /// /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Edge/disconnectedOperations/{name}/images + /// Request Path. + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Edge/disconnectedOperations/{name}/images. /// /// - /// Operation Id - /// Image_ListByDisconnectedOperation + /// Operation Id. + /// Images_ListByDisconnectedOperation. /// /// - /// Default Api Version - /// 2025-06-01-preview - /// - /// - /// Resource - /// + /// Default Api Version. + /// 2025-06-01-preview. /// /// /// @@ -200,47 +213,71 @@ public virtual AsyncPageable GetAllAsync(st /// The number of result items to skip. /// The cancellation token to use. /// A collection of that may take multiple service requests to iterate over. - public virtual Pageable GetAll(string filter = null, int? top = null, int? skip = null, CancellationToken cancellationToken = default) + public virtual Pageable GetAll(string filter = default, int? top = default, int? skip = default, CancellationToken cancellationToken = default) { - HttpMessage FirstPageRequest(int? pageSizeHint) => _disconnectedOperationsImageImagesRestClient.CreateListByDisconnectedOperationRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, filter, top, skip); - HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _disconnectedOperationsImageImagesRestClient.CreateListByDisconnectedOperationNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName, Id.Name, filter, top, skip); - return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new DisconnectedOperationsImageResource(Client, DisconnectedOperationsImageData.DeserializeDisconnectedOperationsImageData(e)), _disconnectedOperationsImageImagesClientDiagnostics, Pipeline, "DisconnectedOperationsImageCollection.GetAll", "value", "nextLink", cancellationToken); + RequestContext context = new RequestContext + { + CancellationToken = cancellationToken + }; + return new PageableWrapper(new ImagesGetByDisconnectedOperationCollectionResultOfT( + _imagesRestClient, + Guid.Parse(Id.SubscriptionId), + Id.ResourceGroupName, + Id.Name, + filter, + top, + skip, + context), data => new DisconnectedOperationsImageResource(Client, data)); } /// - /// Checks to see if the resource exists in azure. + /// Get the resource. /// /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Edge/disconnectedOperations/{name}/images/{imageName} - /// - /// - /// Operation Id - /// Image_Get + /// Request Path. + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Edge/disconnectedOperations/{name}/images/{imageName}. /// /// - /// Default Api Version - /// 2025-06-01-preview + /// Operation Id. + /// Images_Get. /// /// - /// Resource - /// + /// Default Api Version. + /// 2025-06-01-preview. /// /// /// /// The name of the Image. /// 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 imageName, CancellationToken cancellationToken = default) { Argument.AssertNotNullOrEmpty(imageName, nameof(imageName)); - using var scope = _disconnectedOperationsImageImagesClientDiagnostics.CreateScope("DisconnectedOperationsImageCollection.Exists"); + using DiagnosticScope scope = _imagesClientDiagnostics.CreateScope("DisconnectedOperationsImageCollection.Exists"); scope.Start(); try { - var response = await _disconnectedOperationsImageImagesRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, imageName, cancellationToken: cancellationToken).ConfigureAwait(false); + RequestContext context = new RequestContext + { + CancellationToken = cancellationToken + }; + HttpMessage message = _imagesRestClient.CreateGetRequest(Guid.Parse(Id.SubscriptionId), Id.ResourceGroupName, Id.Name, imageName, context); + await Pipeline.SendAsync(message, context.CancellationToken).ConfigureAwait(false); + Response result = message.Response; + Response response = default; + switch (result.Status) + { + case 200: + response = Response.FromValue(DisconnectedOperationsImageData.FromResponse(result), result); + break; + case 404: + response = Response.FromValue((DisconnectedOperationsImageData)null, result); + break; + default: + throw new RequestFailedException(result); + } return Response.FromValue(response.Value != null, response.GetRawResponse()); } catch (Exception e) @@ -251,39 +288,53 @@ public virtual async Task> ExistsAsync(string imageName, Cancella } /// - /// Checks to see if the resource exists in azure. + /// Get the resource. /// /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Edge/disconnectedOperations/{name}/images/{imageName} - /// - /// - /// Operation Id - /// Image_Get + /// Request Path. + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Edge/disconnectedOperations/{name}/images/{imageName}. /// /// - /// Default Api Version - /// 2025-06-01-preview + /// Operation Id. + /// Images_Get. /// /// - /// Resource - /// + /// Default Api Version. + /// 2025-06-01-preview. /// /// /// /// The name of the Image. /// 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 imageName, CancellationToken cancellationToken = default) { Argument.AssertNotNullOrEmpty(imageName, nameof(imageName)); - using var scope = _disconnectedOperationsImageImagesClientDiagnostics.CreateScope("DisconnectedOperationsImageCollection.Exists"); + using DiagnosticScope scope = _imagesClientDiagnostics.CreateScope("DisconnectedOperationsImageCollection.Exists"); scope.Start(); try { - var response = _disconnectedOperationsImageImagesRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, imageName, cancellationToken: cancellationToken); + RequestContext context = new RequestContext + { + CancellationToken = cancellationToken + }; + HttpMessage message = _imagesRestClient.CreateGetRequest(Guid.Parse(Id.SubscriptionId), Id.ResourceGroupName, Id.Name, imageName, context); + Pipeline.Send(message, context.CancellationToken); + Response result = message.Response; + Response response = default; + switch (result.Status) + { + case 200: + response = Response.FromValue(DisconnectedOperationsImageData.FromResponse(result), result); + break; + case 404: + response = Response.FromValue((DisconnectedOperationsImageData)null, result); + break; + default: + throw new RequestFailedException(result); + } return Response.FromValue(response.Value != null, response.GetRawResponse()); } catch (Exception e) @@ -294,41 +345,57 @@ public virtual Response Exists(string imageName, CancellationToken cancell } /// - /// Tries to get details for this resource from the service. + /// Get the resource. /// /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Edge/disconnectedOperations/{name}/images/{imageName} + /// Request Path. + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Edge/disconnectedOperations/{name}/images/{imageName}. /// /// - /// Operation Id - /// Image_Get + /// Operation Id. + /// Images_Get. /// /// - /// Default Api Version - /// 2025-06-01-preview - /// - /// - /// Resource - /// + /// Default Api Version. + /// 2025-06-01-preview. /// /// /// /// The name of the Image. /// 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 imageName, CancellationToken cancellationToken = default) { Argument.AssertNotNullOrEmpty(imageName, nameof(imageName)); - using var scope = _disconnectedOperationsImageImagesClientDiagnostics.CreateScope("DisconnectedOperationsImageCollection.GetIfExists"); + using DiagnosticScope scope = _imagesClientDiagnostics.CreateScope("DisconnectedOperationsImageCollection.GetIfExists"); scope.Start(); try { - var response = await _disconnectedOperationsImageImagesRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, imageName, cancellationToken: cancellationToken).ConfigureAwait(false); + RequestContext context = new RequestContext + { + CancellationToken = cancellationToken + }; + HttpMessage message = _imagesRestClient.CreateGetRequest(Guid.Parse(Id.SubscriptionId), Id.ResourceGroupName, Id.Name, imageName, context); + await Pipeline.SendAsync(message, context.CancellationToken).ConfigureAwait(false); + Response result = message.Response; + Response response = default; + switch (result.Status) + { + case 200: + response = Response.FromValue(DisconnectedOperationsImageData.FromResponse(result), result); + break; + case 404: + response = Response.FromValue((DisconnectedOperationsImageData)null, result); + break; + default: + throw new RequestFailedException(result); + } if (response.Value == null) + { return new NoValueResponse(response.GetRawResponse()); + } return Response.FromValue(new DisconnectedOperationsImageResource(Client, response.Value), response.GetRawResponse()); } catch (Exception e) @@ -339,41 +406,57 @@ public virtual async Task> } /// - /// Tries to get details for this resource from the service. + /// Get the resource. /// /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Edge/disconnectedOperations/{name}/images/{imageName} + /// Request Path. + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Edge/disconnectedOperations/{name}/images/{imageName}. /// /// - /// Operation Id - /// Image_Get + /// Operation Id. + /// Images_Get. /// /// - /// Default Api Version - /// 2025-06-01-preview - /// - /// - /// Resource - /// + /// Default Api Version. + /// 2025-06-01-preview. /// /// /// /// The name of the Image. /// 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 imageName, CancellationToken cancellationToken = default) { Argument.AssertNotNullOrEmpty(imageName, nameof(imageName)); - using var scope = _disconnectedOperationsImageImagesClientDiagnostics.CreateScope("DisconnectedOperationsImageCollection.GetIfExists"); + using DiagnosticScope scope = _imagesClientDiagnostics.CreateScope("DisconnectedOperationsImageCollection.GetIfExists"); scope.Start(); try { - var response = _disconnectedOperationsImageImagesRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, imageName, cancellationToken: cancellationToken); + RequestContext context = new RequestContext + { + CancellationToken = cancellationToken + }; + HttpMessage message = _imagesRestClient.CreateGetRequest(Guid.Parse(Id.SubscriptionId), Id.ResourceGroupName, Id.Name, imageName, context); + Pipeline.Send(message, context.CancellationToken); + Response result = message.Response; + Response response = default; + switch (result.Status) + { + case 200: + response = Response.FromValue(DisconnectedOperationsImageData.FromResponse(result), result); + break; + case 404: + response = Response.FromValue((DisconnectedOperationsImageData)null, result); + break; + default: + throw new RequestFailedException(result); + } if (response.Value == null) + { return new NoValueResponse(response.GetRawResponse()); + } return Response.FromValue(new DisconnectedOperationsImageResource(Client, response.Value), response.GetRawResponse()); } catch (Exception e) @@ -393,6 +476,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/disconnectedoperations/Azure.ResourceManager.DisconnectedOperations/src/Generated/DisconnectedOperationsImageData.Serialization.cs b/sdk/disconnectedoperations/Azure.ResourceManager.DisconnectedOperations/src/Generated/DisconnectedOperationsImageData.Serialization.cs index 446beb595771..f0249be89961 100644 --- a/sdk/disconnectedoperations/Azure.ResourceManager.DisconnectedOperations/src/Generated/DisconnectedOperationsImageData.Serialization.cs +++ b/sdk/disconnectedoperations/Azure.ResourceManager.DisconnectedOperations/src/Generated/DisconnectedOperationsImageData.Serialization.cs @@ -10,16 +10,18 @@ using System.Collections.Generic; using System.Text; using System.Text.Json; +using Azure; using Azure.Core; using Azure.ResourceManager.DisconnectedOperations.Models; using Azure.ResourceManager.Models; namespace Azure.ResourceManager.DisconnectedOperations { - public partial class DisconnectedOperationsImageData : IUtf8JsonSerializable, IJsonModel + /// Holds the release information of a disconnected operations image. + public partial class DisconnectedOperationsImageData : ResourceData, IJsonModel { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); - + /// The JSON writer. + /// The client options for reading and writing models. void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) { writer.WriteStartObject(); @@ -31,12 +33,11 @@ void IJsonModel.Write(Utf8JsonWriter writer, Mo /// 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(DisconnectedOperationsImageData)} does not support writing '{format}' format."); } - base.JsonModelWriteCore(writer, options); if (Optional.IsDefined(Properties)) { @@ -45,87 +46,101 @@ protected override void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWri } } - DisconnectedOperationsImageData IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + /// The JSON reader. + /// The client options for reading and writing models. + DisconnectedOperationsImageData IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) => (DisconnectedOperationsImageData)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(DisconnectedOperationsImageData)} does not support reading '{format}' format."); } - using JsonDocument document = JsonDocument.ParseValue(ref reader); return DeserializeDisconnectedOperationsImageData(document.RootElement, options); } - internal static DisconnectedOperationsImageData DeserializeDisconnectedOperationsImageData(JsonElement element, ModelReaderWriterOptions options = null) + /// The JSON element to deserialize. + /// The client options for reading and writing models. + internal static DisconnectedOperationsImageData DeserializeDisconnectedOperationsImageData(JsonElement element, ModelReaderWriterOptions options) { - options ??= ModelSerializationExtensions.WireOptions; - if (element.ValueKind == JsonValueKind.Null) { return null; } - DisconnectedOperationsImageProperties properties = default; ResourceIdentifier id = default; string name = default; - ResourceType type = default; + ResourceType resourceType = default; SystemData systemData = default; - IDictionary serializedAdditionalRawData = default; - Dictionary rawDataDictionary = new Dictionary(); - foreach (var property in element.EnumerateObject()) + IDictionary additionalBinaryDataProperties = new ChangeTrackingDictionary(); + DisconnectedOperationsImageProperties properties = default; + foreach (var prop in element.EnumerateObject()) { - if (property.NameEquals("properties"u8)) + if (prop.NameEquals("id"u8)) { - if (property.Value.ValueKind == JsonValueKind.Null) + if (prop.Value.ValueKind == JsonValueKind.Null) { continue; } - properties = DisconnectedOperationsImageProperties.DeserializeDisconnectedOperationsImageProperties(property.Value, options); + id = new ResourceIdentifier(prop.Value.GetString()); continue; } - if (property.NameEquals("id"u8)) + if (prop.NameEquals("name"u8)) { - id = new ResourceIdentifier(property.Value.GetString()); + name = prop.Value.GetString(); continue; } - if (property.NameEquals("name"u8)) + if (prop.NameEquals("type"u8)) { - name = property.Value.GetString(); + if (prop.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + resourceType = new ResourceType(prop.Value.GetString()); continue; } - if (property.NameEquals("type"u8)) + if (prop.NameEquals("systemData"u8)) { - type = new ResourceType(property.Value.GetString()); + if (prop.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + systemData = ModelReaderWriter.Read(new BinaryData(Encoding.UTF8.GetBytes(prop.Value.GetRawText())), ModelSerializationExtensions.WireOptions, AzureResourceManagerDisconnectedOperationsContext.Default); continue; } - if (property.NameEquals("systemData"u8)) + if (prop.NameEquals("properties"u8)) { - if (property.Value.ValueKind == JsonValueKind.Null) + if (prop.Value.ValueKind == JsonValueKind.Null) { continue; } - systemData = ModelReaderWriter.Read(new BinaryData(Encoding.UTF8.GetBytes(property.Value.GetRawText())), ModelSerializationExtensions.WireOptions, AzureResourceManagerDisconnectedOperationsContext.Default); + properties = DisconnectedOperationsImageProperties.DeserializeDisconnectedOperationsImageProperties(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 DisconnectedOperationsImageData( id, name, - type, + resourceType, systemData, - properties, - serializedAdditionalRawData); + additionalBinaryDataProperties, + properties); } - BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) - { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + /// The client options for reading and writing models. + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) => PersistableModelWriteCore(options); + /// The client options for reading and writing models. + protected virtual BinaryData PersistableModelWriteCore(ModelReaderWriterOptions options) + { + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; switch (format) { case "J": @@ -135,15 +150,20 @@ BinaryData IPersistableModel.Write(ModelReaderW } } - DisconnectedOperationsImageData 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. + DisconnectedOperationsImageData IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) => (DisconnectedOperationsImageData)PersistableModelCreateCore(data, options); + /// The data to parse. + /// The client options for reading and writing models. + protected virtual ResourceData PersistableModelCreateCore(BinaryData data, ModelReaderWriterOptions options) + { + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; switch (format) { case "J": + using (JsonDocument document = JsonDocument.Parse(data, ModelSerializationExtensions.JsonDocumentOptions)) { - using JsonDocument document = JsonDocument.Parse(data, ModelSerializationExtensions.JsonDocumentOptions); return DeserializeDisconnectedOperationsImageData(document.RootElement, options); } default: @@ -151,6 +171,14 @@ DisconnectedOperationsImageData IPersistableModel The client options for reading and writing models. string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + + /// The to deserialize the from. + internal static DisconnectedOperationsImageData FromResponse(Response response) + { + using JsonDocument document = JsonDocument.Parse(response.Content, ModelSerializationExtensions.JsonDocumentOptions); + return DeserializeDisconnectedOperationsImageData(document.RootElement, ModelSerializationExtensions.WireOptions); + } } } diff --git a/sdk/disconnectedoperations/Azure.ResourceManager.DisconnectedOperations/src/Generated/DisconnectedOperationsImageData.cs b/sdk/disconnectedoperations/Azure.ResourceManager.DisconnectedOperations/src/Generated/DisconnectedOperationsImageData.cs index 4925c2cbac58..af11278cde51 100644 --- a/sdk/disconnectedoperations/Azure.ResourceManager.DisconnectedOperations/src/Generated/DisconnectedOperationsImageData.cs +++ b/sdk/disconnectedoperations/Azure.ResourceManager.DisconnectedOperations/src/Generated/DisconnectedOperationsImageData.cs @@ -13,43 +13,11 @@ namespace Azure.ResourceManager.DisconnectedOperations { - /// - /// A class representing the DisconnectedOperationsImage data model. - /// Holds the release information of a disconnected operations image. - /// + /// Holds the release information of a disconnected operations image. public partial class DisconnectedOperationsImageData : ResourceData { - /// - /// Keeps track of any properties unknown to the library. - /// - /// To assign an object to the value of this property use . - /// - /// - /// To assign an already formatted json string to this property use . - /// - /// - /// Examples: - /// - /// - /// BinaryData.FromObjectAsJson("foo") - /// Creates a payload of "foo". - /// - /// - /// BinaryData.FromString("\"foo\"") - /// Creates a payload of "foo". - /// - /// - /// BinaryData.FromObjectAsJson(new { key = "value" }) - /// Creates a payload of { "key": "value" }. - /// - /// - /// BinaryData.FromString("{\"key\": \"value\"}") - /// Creates a payload of { "key": "value" }. - /// - /// - /// - /// - private IDictionary _serializedAdditionalRawData; + /// Keeps track of any properties unknown to the library. + private protected readonly IDictionary _additionalBinaryDataProperties; /// Initializes a new instance of . internal DisconnectedOperationsImageData() @@ -57,16 +25,16 @@ internal DisconnectedOperationsImageData() } /// Initializes a new instance of . - /// The id. - /// The name. - /// The resourceType. - /// The systemData. + /// Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. + /// The name of the resource. + /// The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts". + /// Azure Resource Manager metadata containing createdBy and modifiedBy information. + /// Keeps track of any properties unknown to the library. /// The resource-specific properties for this resource. - /// Keeps track of any properties unknown to the library. - internal DisconnectedOperationsImageData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, DisconnectedOperationsImageProperties properties, IDictionary serializedAdditionalRawData) : base(id, name, resourceType, systemData) + internal DisconnectedOperationsImageData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, IDictionary additionalBinaryDataProperties, DisconnectedOperationsImageProperties properties) : base(id, name, resourceType, systemData) { + _additionalBinaryDataProperties = additionalBinaryDataProperties; Properties = properties; - _serializedAdditionalRawData = serializedAdditionalRawData; } /// The resource-specific properties for this resource. diff --git a/sdk/disconnectedoperations/Azure.ResourceManager.DisconnectedOperations/src/Generated/DisconnectedOperationsImageResource.Serialization.cs b/sdk/disconnectedoperations/Azure.ResourceManager.DisconnectedOperations/src/Generated/DisconnectedOperationsImageResource.Serialization.cs index 382deeb14201..e1c9e250b642 100644 --- a/sdk/disconnectedoperations/Azure.ResourceManager.DisconnectedOperations/src/Generated/DisconnectedOperationsImageResource.Serialization.cs +++ b/sdk/disconnectedoperations/Azure.ResourceManager.DisconnectedOperations/src/Generated/DisconnectedOperationsImageResource.Serialization.cs @@ -11,19 +11,29 @@ namespace Azure.ResourceManager.DisconnectedOperations { + /// public partial class DisconnectedOperationsImageResource : IJsonModel { - private static DisconnectedOperationsImageData s_dataDeserializationInstance; - private static DisconnectedOperationsImageData DataDeserializationInstance => s_dataDeserializationInstance ??= new(); + private static IJsonModel s_dataDeserializationInstance; + private static IJsonModel DataDeserializationInstance => s_dataDeserializationInstance ??= new DisconnectedOperationsImageData(); + + /// 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); - DisconnectedOperationsImageData 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. + DisconnectedOperationsImageData 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, AzureResourceManagerDisconnectedOperationsContext.Default); + /// The binary data to be processed. + /// The client options for reading and writing models. DisconnectedOperationsImageData IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) => ModelReaderWriter.Read(data, options, AzureResourceManagerDisconnectedOperationsContext.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/disconnectedoperations/Azure.ResourceManager.DisconnectedOperations/src/Generated/DisconnectedOperationsImageResource.cs b/sdk/disconnectedoperations/Azure.ResourceManager.DisconnectedOperations/src/Generated/DisconnectedOperationsImageResource.cs index dfbf1823bbf9..5f712db77b17 100644 --- a/sdk/disconnectedoperations/Azure.ResourceManager.DisconnectedOperations/src/Generated/DisconnectedOperationsImageResource.cs +++ b/sdk/disconnectedoperations/Azure.ResourceManager.DisconnectedOperations/src/Generated/DisconnectedOperationsImageResource.cs @@ -6,47 +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.DisconnectedOperations.Models; namespace Azure.ResourceManager.DisconnectedOperations { /// - /// A Class representing a DisconnectedOperationsImage 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 GetDisconnectedOperationsImageResource method. - /// Otherwise you can get one from its parent resource using the GetDisconnectedOperationsImage method. + /// A class representing a DisconnectedOperationsImage 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 GetDisconnectedOperationsImages method. /// public partial class DisconnectedOperationsImageResource : ArmResource { - /// Generate the resource identifier of a instance. - /// The subscriptionId. - /// The resourceGroupName. - /// The name. - /// The imageName. - public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string name, string imageName) - { - var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Edge/disconnectedOperations/{name}/images/{imageName}"; - return new ResourceIdentifier(resourceId); - } - - private readonly ClientDiagnostics _disconnectedOperationsImageImagesClientDiagnostics; - private readonly ImagesRestOperations _disconnectedOperationsImageImagesRestClient; + private readonly ClientDiagnostics _imagesClientDiagnostics; + private readonly Images _imagesRestClient; private readonly DisconnectedOperationsImageData _data; - /// Gets the resource type for the operations. public static readonly ResourceType ResourceType = "Microsoft.Edge/disconnectedOperations/images"; - /// Initializes a new instance of the class for mocking. + /// Initializes a new instance of DisconnectedOperationsImageResource for mocking. protected DisconnectedOperationsImageResource() { } - /// 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 DisconnectedOperationsImageResource(ArmClient client, DisconnectedOperationsImageData data) : this(client, data.Id) @@ -55,140 +44,93 @@ internal DisconnectedOperationsImageResource(ArmClient client, DisconnectedOpera _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 DisconnectedOperationsImageResource(ArmClient client, ResourceIdentifier id) : base(client, id) { - _disconnectedOperationsImageImagesClientDiagnostics = new ClientDiagnostics("Azure.ResourceManager.DisconnectedOperations", ResourceType.Namespace, Diagnostics); - TryGetApiVersion(ResourceType, out string disconnectedOperationsImageImagesApiVersion); - _disconnectedOperationsImageImagesRestClient = new ImagesRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, disconnectedOperationsImageImagesApiVersion); -#if DEBUG - ValidateResourceId(Id); -#endif + TryGetApiVersion(ResourceType, out string disconnectedOperationsImageApiVersion); + _imagesClientDiagnostics = new ClientDiagnostics("Azure.ResourceManager.DisconnectedOperations", ResourceType.Namespace, Diagnostics); + _imagesRestClient = new Images(_imagesClientDiagnostics, Pipeline, Endpoint, disconnectedOperationsImageApiVersion ?? "2025-06-01-preview"); + 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 DisconnectedOperationsImageData 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 DisconnectedOperationsArtifactResources in the DisconnectedOperationsImage. - /// An object representing collection of DisconnectedOperationsArtifactResources and their operations over a DisconnectedOperationsArtifactResource. - public virtual DisconnectedOperationsArtifactCollection GetDisconnectedOperationsArtifacts() - { - return GetCachedClient(client => new DisconnectedOperationsArtifactCollection(client, Id)); - } - - /// - /// Get the resource - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Edge/disconnectedOperations/{name}/images/{imageName}/artifacts/{artifactName} - /// - /// - /// Operation Id - /// Artifact_Get - /// - /// - /// Default Api Version - /// 2025-06-01-preview - /// - /// - /// Resource - /// - /// - /// - /// - /// The name of the Artifact. - /// The cancellation token to use. - /// is null. - /// is an empty string, and was expected to be non-empty. - [ForwardsClientCalls] - public virtual async Task> GetDisconnectedOperationsArtifactAsync(string artifactName, CancellationToken cancellationToken = default) + /// Generate the resource identifier for this resource. + /// The subscriptionId. + /// The resourceGroupName. + /// The name. + /// The imageName. + public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string name, string imageName) { - return await GetDisconnectedOperationsArtifacts().GetAsync(artifactName, cancellationToken).ConfigureAwait(false); + string resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Edge/disconnectedOperations/{name}/images/{imageName}"; + return new ResourceIdentifier(resourceId); } - /// - /// Get the resource - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Edge/disconnectedOperations/{name}/images/{imageName}/artifacts/{artifactName} - /// - /// - /// Operation Id - /// Artifact_Get - /// - /// - /// Default Api Version - /// 2025-06-01-preview - /// - /// - /// Resource - /// - /// - /// - /// - /// The name of the Artifact. - /// The cancellation token to use. - /// is null. - /// is an empty string, and was expected to be non-empty. - [ForwardsClientCalls] - public virtual Response GetDisconnectedOperationsArtifact(string artifactName, CancellationToken cancellationToken = default) + /// + [Conditional("DEBUG")] + internal static void ValidateResourceId(ResourceIdentifier id) { - return GetDisconnectedOperationsArtifacts().Get(artifactName, cancellationToken); + if (id.ResourceType != ResourceType) + { + throw new ArgumentException(string.Format("Invalid resource type {0} expected {1}", id.ResourceType, ResourceType), id); + } } /// /// Get the resource. /// /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Edge/disconnectedOperations/{name}/images/{imageName} + /// Request Path. + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Edge/disconnectedOperations/{name}/images/{imageName}. /// /// - /// Operation Id - /// Image_Get + /// Operation Id. + /// Images_Get. /// /// - /// Default Api Version - /// 2025-06-01-preview + /// Default Api Version. + /// 2025-06-01-preview. /// /// - /// Resource - /// + /// Resource. + /// . /// /// /// /// The cancellation token to use. public virtual async Task> GetAsync(CancellationToken cancellationToken = default) { - using var scope = _disconnectedOperationsImageImagesClientDiagnostics.CreateScope("DisconnectedOperationsImageResource.Get"); + using DiagnosticScope scope = _imagesClientDiagnostics.CreateScope("DisconnectedOperationsImageResource.Get"); scope.Start(); try { - var response = await _disconnectedOperationsImageImagesRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, cancellationToken).ConfigureAwait(false); + RequestContext context = new RequestContext + { + CancellationToken = cancellationToken + }; + HttpMessage message = _imagesRestClient.CreateGetRequest(Guid.Parse(Id.SubscriptionId), Id.ResourceGroupName, Id.Parent.Name, Id.Name, context); + Response result = await Pipeline.ProcessMessageAsync(message, context).ConfigureAwait(false); + Response response = Response.FromValue(DisconnectedOperationsImageData.FromResponse(result), result); if (response.Value == null) + { throw new RequestFailedException(response.GetRawResponse()); + } return Response.FromValue(new DisconnectedOperationsImageResource(Client, response.Value), response.GetRawResponse()); } catch (Exception e) @@ -202,33 +144,41 @@ public virtual async Task> GetAsyn /// Get the resource. /// /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Edge/disconnectedOperations/{name}/images/{imageName} + /// Request Path. + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Edge/disconnectedOperations/{name}/images/{imageName}. /// /// - /// Operation Id - /// Image_Get + /// Operation Id. + /// Images_Get. /// /// - /// Default Api Version - /// 2025-06-01-preview + /// Default Api Version. + /// 2025-06-01-preview. /// /// - /// Resource - /// + /// Resource. + /// . /// /// /// /// The cancellation token to use. public virtual Response Get(CancellationToken cancellationToken = default) { - using var scope = _disconnectedOperationsImageImagesClientDiagnostics.CreateScope("DisconnectedOperationsImageResource.Get"); + using DiagnosticScope scope = _imagesClientDiagnostics.CreateScope("DisconnectedOperationsImageResource.Get"); scope.Start(); try { - var response = _disconnectedOperationsImageImagesRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, cancellationToken); + RequestContext context = new RequestContext + { + CancellationToken = cancellationToken + }; + HttpMessage message = _imagesRestClient.CreateGetRequest(Guid.Parse(Id.SubscriptionId), Id.ResourceGroupName, Id.Parent.Name, Id.Name, context); + Response result = Pipeline.ProcessMessage(message, context); + Response response = Response.FromValue(DisconnectedOperationsImageData.FromResponse(result), result); if (response.Value == null) + { throw new RequestFailedException(response.GetRawResponse()); + } return Response.FromValue(new DisconnectedOperationsImageResource(Client, response.Value), response.GetRawResponse()); } catch (Exception e) @@ -242,31 +192,41 @@ public virtual Response Get(CancellationTok /// Get the URI to download the image. /// /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Edge/disconnectedOperations/{name}/images/{imageName}/listDownloadUri + /// Request Path. + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Edge/disconnectedOperations/{name}/images/{imageName}/listDownloadUri. /// /// - /// Operation Id - /// Images_ListDownloadUri + /// Operation Id. + /// Images_ListDownloadUri. /// /// - /// Default Api Version - /// 2025-06-01-preview + /// Default Api Version. + /// 2025-06-01-preview. /// /// - /// Resource - /// + /// Resource. + /// . /// /// /// /// The cancellation token to use. public virtual async Task> GetDownloadUriAsync(CancellationToken cancellationToken = default) { - using var scope = _disconnectedOperationsImageImagesClientDiagnostics.CreateScope("DisconnectedOperationsImageResource.GetDownloadUri"); + using DiagnosticScope scope = _imagesClientDiagnostics.CreateScope("DisconnectedOperationsImageResource.GetDownloadUri"); scope.Start(); try { - var response = await _disconnectedOperationsImageImagesRestClient.ListDownloadUriAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, cancellationToken).ConfigureAwait(false); + RequestContext context = new RequestContext + { + CancellationToken = cancellationToken + }; + HttpMessage message = _imagesRestClient.CreateGetDownloadUriRequest(Guid.Parse(Id.SubscriptionId), Id.ResourceGroupName, Id.Parent.Name, Id.Name, context); + Response result = await Pipeline.ProcessMessageAsync(message, context).ConfigureAwait(false); + Response response = Response.FromValue(DisconnectedOperationsImageDownloadResult.FromResponse(result), result); + if (response.Value == null) + { + throw new RequestFailedException(response.GetRawResponse()); + } return response; } catch (Exception e) @@ -280,31 +240,41 @@ public virtual async Task> G /// Get the URI to download the image. /// /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Edge/disconnectedOperations/{name}/images/{imageName}/listDownloadUri + /// Request Path. + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Edge/disconnectedOperations/{name}/images/{imageName}/listDownloadUri. /// /// - /// Operation Id - /// Images_ListDownloadUri + /// Operation Id. + /// Images_ListDownloadUri. /// /// - /// Default Api Version - /// 2025-06-01-preview + /// Default Api Version. + /// 2025-06-01-preview. /// /// - /// Resource - /// + /// Resource. + /// . /// /// /// /// The cancellation token to use. public virtual Response GetDownloadUri(CancellationToken cancellationToken = default) { - using var scope = _disconnectedOperationsImageImagesClientDiagnostics.CreateScope("DisconnectedOperationsImageResource.GetDownloadUri"); + using DiagnosticScope scope = _imagesClientDiagnostics.CreateScope("DisconnectedOperationsImageResource.GetDownloadUri"); scope.Start(); try { - var response = _disconnectedOperationsImageImagesRestClient.ListDownloadUri(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, cancellationToken); + RequestContext context = new RequestContext + { + CancellationToken = cancellationToken + }; + HttpMessage message = _imagesRestClient.CreateGetDownloadUriRequest(Guid.Parse(Id.SubscriptionId), Id.ResourceGroupName, Id.Parent.Name, Id.Name, context); + Response result = Pipeline.ProcessMessage(message, context); + Response response = Response.FromValue(DisconnectedOperationsImageDownloadResult.FromResponse(result), result); + if (response.Value == null) + { + throw new RequestFailedException(response.GetRawResponse()); + } return response; } catch (Exception e) @@ -313,5 +283,38 @@ public virtual Response GetDownloadUr throw; } } + + /// Gets a collection of DisconnectedOperationsArtifacts in the . + /// An object representing collection of DisconnectedOperationsArtifacts and their operations over a DisconnectedOperationsArtifactResource. + public virtual DisconnectedOperationsArtifactCollection GetDisconnectedOperationsArtifacts() + { + return GetCachedClient(client => new DisconnectedOperationsArtifactCollection(client, Id)); + } + + /// Get the resource. + /// The name of the Artifact. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public virtual async Task> GetDisconnectedOperationsArtifactAsync(string artifactName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(artifactName, nameof(artifactName)); + + return await GetDisconnectedOperationsArtifacts().GetAsync(artifactName, cancellationToken).ConfigureAwait(false); + } + + /// Get the resource. + /// The name of the Artifact. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public virtual Response GetDisconnectedOperationsArtifact(string artifactName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(artifactName, nameof(artifactName)); + + return GetDisconnectedOperationsArtifacts().Get(artifactName, cancellationToken); + } } } diff --git a/sdk/disconnectedoperations/Azure.ResourceManager.DisconnectedOperations/src/Generated/Extensions/DisconnectedOperationsExtensions.cs b/sdk/disconnectedoperations/Azure.ResourceManager.DisconnectedOperations/src/Generated/Extensions/DisconnectedOperationsExtensions.cs index 2e878bdf31f9..e47b2cd96f79 100644 --- a/sdk/disconnectedoperations/Azure.ResourceManager.DisconnectedOperations/src/Generated/Extensions/DisconnectedOperationsExtensions.cs +++ b/sdk/disconnectedoperations/Azure.ResourceManager.DisconnectedOperations/src/Generated/Extensions/DisconnectedOperationsExtensions.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.DisconnectedOperations.Mocking; using Azure.ResourceManager.Resources; @@ -17,30 +19,32 @@ namespace Azure.ResourceManager.DisconnectedOperations /// A class to add extension methods to Azure.ResourceManager.DisconnectedOperations. public static partial class DisconnectedOperationsExtensions { + /// private static MockableDisconnectedOperationsArmClient GetMockableDisconnectedOperationsArmClient(ArmClient client) { - return client.GetCachedClient(client0 => new MockableDisconnectedOperationsArmClient(client0)); + return client.GetCachedClient(client0 => new MockableDisconnectedOperationsArmClient(client0, ResourceIdentifier.Root)); } - private static MockableDisconnectedOperationsResourceGroupResource GetMockableDisconnectedOperationsResourceGroupResource(ArmResource resource) + /// + private static MockableDisconnectedOperationsResourceGroupResource GetMockableDisconnectedOperationsResourceGroupResource(ResourceGroupResource resourceGroupResource) { - return resource.GetCachedClient(client => new MockableDisconnectedOperationsResourceGroupResource(client, resource.Id)); + return resourceGroupResource.GetCachedClient(client => new MockableDisconnectedOperationsResourceGroupResource(client, resourceGroupResource.Id)); } - private static MockableDisconnectedOperationsSubscriptionResource GetMockableDisconnectedOperationsSubscriptionResource(ArmResource resource) + /// + private static MockableDisconnectedOperationsSubscriptionResource GetMockableDisconnectedOperationsSubscriptionResource(SubscriptionResource subscriptionResource) { - return resource.GetCachedClient(client => new MockableDisconnectedOperationsSubscriptionResource(client, resource.Id)); + return subscriptionResource.GetCachedClient(client => new MockableDisconnectedOperationsSubscriptionResource(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 DisconnectedOperationResource GetDisconnectedOperationResource(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. @@ -71,14 +74,13 @@ public static DisconnectedOperationsImageResource GetDisconnectedOperationsImage } /// - /// 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,15 +92,15 @@ public static DisconnectedOperationsArtifactResource GetDisconnectedOperationsAr } /// - /// Gets a collection of DisconnectedOperationResources in the ResourceGroupResource. + /// Gets a collection of DisconnectedOperations 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 DisconnectedOperationResources and their operations over a DisconnectedOperationResource. + /// An object representing collection of DisconnectedOperations and their operations over a DisconnectedOperationResource. public static DisconnectedOperationCollection GetDisconnectedOperations(this ResourceGroupResource resourceGroupResource) { Argument.AssertNotNull(resourceGroupResource, nameof(resourceGroupResource)); @@ -108,34 +110,15 @@ public static DisconnectedOperationCollection GetDisconnectedOperations(this Res /// /// Get a DisconnectedOperation - /// /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Edge/disconnectedOperations/{name} - /// - /// - /// Operation Id - /// DisconnectedOperation_Get - /// - /// - /// Default Api Version - /// 2025-06-01-preview - /// - /// - /// Resource - /// - /// - /// - /// - /// Mocking - /// To mock this method, please mock instead. + /// Mocking. + /// To mock this method, please mock instead. /// /// - /// The instance the method will execute against. + /// The the method will execute against. /// Name of the resource. /// 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> GetDisconnectedOperationAsync(this ResourceGroupResource resourceGroupResource, string name, CancellationToken cancellationToken = default) { @@ -146,34 +129,15 @@ public static async Task> GetDisconnecte /// /// Get a DisconnectedOperation - /// /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Edge/disconnectedOperations/{name} - /// - /// - /// Operation Id - /// DisconnectedOperation_Get - /// - /// - /// Default Api Version - /// 2025-06-01-preview - /// - /// - /// Resource - /// - /// - /// - /// - /// Mocking - /// To mock this method, please mock instead. + /// Mocking. + /// To mock this method, please mock instead. /// /// - /// The instance the method will execute against. + /// The the method will execute against. /// Name of the resource. /// 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 GetDisconnectedOperation(this ResourceGroupResource resourceGroupResource, string name, CancellationToken cancellationToken = default) { @@ -184,33 +148,15 @@ public static Response GetDisconnectedOperation(t /// /// List DisconnectedOperation resources by subscription ID - /// /// - /// Request Path - /// /subscriptions/{subscriptionId}/providers/Microsoft.Edge/disconnectedOperations - /// - /// - /// Operation Id - /// DisconnectedOperation_ListBySubscription - /// - /// - /// Default Api Version - /// 2025-06-01-preview - /// - /// - /// Resource - /// - /// - /// - /// - /// Mocking - /// To mock this method, please mock instead. + /// Mocking. + /// To mock this method, please mock instead. /// /// - /// The instance the method will execute against. + /// The the method will execute against. /// The cancellation token to use. /// is null. - /// An async collection of that may take multiple service requests to iterate over. + /// A collection of that may take multiple service requests to iterate over. public static AsyncPageable GetDisconnectedOperationsAsync(this SubscriptionResource subscriptionResource, CancellationToken cancellationToken = default) { Argument.AssertNotNull(subscriptionResource, nameof(subscriptionResource)); @@ -220,30 +166,12 @@ public static AsyncPageable GetDisconnectedOperat /// /// List DisconnectedOperation resources by subscription ID - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/providers/Microsoft.Edge/disconnectedOperations - /// - /// - /// Operation Id - /// DisconnectedOperation_ListBySubscription - /// - /// - /// Default Api Version - /// 2025-06-01-preview - /// - /// - /// Resource - /// - /// - /// /// - /// Mocking - /// To mock this method, please mock instead. + /// Mocking. + /// To mock this method, please mock instead. /// /// - /// The instance the method will execute against. + /// The the method will execute against. /// The cancellation token to use. /// is null. /// A collection of that may take multiple service requests to iterate over. diff --git a/sdk/disconnectedoperations/Azure.ResourceManager.DisconnectedOperations/src/Generated/Extensions/MockableDisconnectedOperationsArmClient.cs b/sdk/disconnectedoperations/Azure.ResourceManager.DisconnectedOperations/src/Generated/Extensions/MockableDisconnectedOperationsArmClient.cs index f27954e0178a..2770c7900235 100644 --- a/sdk/disconnectedoperations/Azure.ResourceManager.DisconnectedOperations/src/Generated/Extensions/MockableDisconnectedOperationsArmClient.cs +++ b/sdk/disconnectedoperations/Azure.ResourceManager.DisconnectedOperations/src/Generated/Extensions/MockableDisconnectedOperationsArmClient.cs @@ -6,38 +6,27 @@ #nullable disable using Azure.Core; +using Azure.ResourceManager; +using Azure.ResourceManager.DisconnectedOperations; namespace Azure.ResourceManager.DisconnectedOperations.Mocking { - /// A class to add extension methods to ArmClient. + /// A class to add extension methods to . public partial class MockableDisconnectedOperationsArmClient : ArmResource { - /// Initializes a new instance of the class for mocking. + /// Initializes a new instance of MockableDisconnectedOperationsArmClient for mocking. protected MockableDisconnectedOperationsArmClient() { } - /// 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 MockableDisconnectedOperationsArmClient(ArmClient client, ResourceIdentifier id) : base(client, id) { } - internal MockableDisconnectedOperationsArmClient(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 DisconnectedOperationResource GetDisconnectedOperationResource(ResourceIdentifier id) @@ -46,10 +35,7 @@ public virtual DisconnectedOperationResource GetDisconnectedOperationResource(Re return new DisconnectedOperationResource(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 DisconnectedOperationsImageResource GetDisconnectedOperationsImageResource(ResourceIdentifier id) @@ -58,10 +44,7 @@ public virtual DisconnectedOperationsImageResource GetDisconnectedOperationsImag return new DisconnectedOperationsImageResource(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 DisconnectedOperationsArtifactResource GetDisconnectedOperationsArtifactResource(ResourceIdentifier id) diff --git a/sdk/disconnectedoperations/Azure.ResourceManager.DisconnectedOperations/src/Generated/Extensions/MockableDisconnectedOperationsResourceGroupResource.cs b/sdk/disconnectedoperations/Azure.ResourceManager.DisconnectedOperations/src/Generated/Extensions/MockableDisconnectedOperationsResourceGroupResource.cs index c8c4cdd29fd9..7ef8bd5e13f7 100644 --- a/sdk/disconnectedoperations/Azure.ResourceManager.DisconnectedOperations/src/Generated/Extensions/MockableDisconnectedOperationsResourceGroupResource.cs +++ b/sdk/disconnectedoperations/Azure.ResourceManager.DisconnectedOperations/src/Generated/Extensions/MockableDisconnectedOperationsResourceGroupResource.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.DisconnectedOperations; +using Azure.ResourceManager.Resources; namespace Azure.ResourceManager.DisconnectedOperations.Mocking { - /// A class to add extension methods to ResourceGroupResource. + /// A class to add extension methods to . public partial class MockableDisconnectedOperationsResourceGroupResource : ArmResource { - /// Initializes a new instance of the class for mocking. + /// Initializes a new instance of MockableDisconnectedOperationsResourceGroupResource for mocking. protected MockableDisconnectedOperationsResourceGroupResource() { } - /// 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 MockableDisconnectedOperationsResourceGroupResource(ArmClient client, ResourceIdentifier id) : base(client, id) { } - private string GetApiVersionOrNull(ResourceType resourceType) - { - TryGetApiVersion(resourceType, out string apiVersion); - return apiVersion; - } - - /// Gets a collection of DisconnectedOperationResources in the ResourceGroupResource. - /// An object representing collection of DisconnectedOperationResources and their operations over a DisconnectedOperationResource. + /// Gets a collection of DisconnectedOperations in the . + /// An object representing collection of DisconnectedOperations and their operations over a DisconnectedOperationResource. public virtual DisconnectedOperationCollection GetDisconnectedOperations() { return GetCachedClient(client => new DisconnectedOperationCollection(client, Id)); @@ -44,20 +42,16 @@ public virtual DisconnectedOperationCollection GetDisconnectedOperations() /// Get a DisconnectedOperation /// /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Edge/disconnectedOperations/{name} - /// - /// - /// Operation Id - /// DisconnectedOperation_Get + /// Request Path. + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Edge/disconnectedOperations/{name}. /// /// - /// Default Api Version - /// 2025-06-01-preview + /// Operation Id. + /// DisconnectedOperations_Get. /// /// - /// Resource - /// + /// Default Api Version. + /// 2025-06-01-preview. /// /// /// @@ -68,6 +62,8 @@ public virtual DisconnectedOperationCollection GetDisconnectedOperations() [ForwardsClientCalls] public virtual async Task> GetDisconnectedOperationAsync(string name, CancellationToken cancellationToken = default) { + Argument.AssertNotNullOrEmpty(name, nameof(name)); + return await GetDisconnectedOperations().GetAsync(name, cancellationToken).ConfigureAwait(false); } @@ -75,20 +71,16 @@ public virtual async Task> GetDisconnect /// Get a DisconnectedOperation /// /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Edge/disconnectedOperations/{name} - /// - /// - /// Operation Id - /// DisconnectedOperation_Get + /// Request Path. + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Edge/disconnectedOperations/{name}. /// /// - /// Default Api Version - /// 2025-06-01-preview + /// Operation Id. + /// DisconnectedOperations_Get. /// /// - /// Resource - /// + /// Default Api Version. + /// 2025-06-01-preview. /// /// /// @@ -99,6 +91,8 @@ public virtual async Task> GetDisconnect [ForwardsClientCalls] public virtual Response GetDisconnectedOperation(string name, CancellationToken cancellationToken = default) { + Argument.AssertNotNullOrEmpty(name, nameof(name)); + return GetDisconnectedOperations().Get(name, cancellationToken); } } diff --git a/sdk/disconnectedoperations/Azure.ResourceManager.DisconnectedOperations/src/Generated/Extensions/MockableDisconnectedOperationsSubscriptionResource.cs b/sdk/disconnectedoperations/Azure.ResourceManager.DisconnectedOperations/src/Generated/Extensions/MockableDisconnectedOperationsSubscriptionResource.cs index 5d5bd4a80c7c..05327e588796 100644 --- a/sdk/disconnectedoperations/Azure.ResourceManager.DisconnectedOperations/src/Generated/Extensions/MockableDisconnectedOperationsSubscriptionResource.cs +++ b/sdk/disconnectedoperations/Azure.ResourceManager.DisconnectedOperations/src/Generated/Extensions/MockableDisconnectedOperationsSubscriptionResource.cs @@ -5,88 +5,81 @@ #nullable disable +using System; using System.Threading; -using Autorest.CSharp.Core; +using Azure; using Azure.Core; using Azure.Core.Pipeline; +using Azure.ResourceManager; +using Azure.ResourceManager.DisconnectedOperations; +using Azure.ResourceManager.Resources; namespace Azure.ResourceManager.DisconnectedOperations.Mocking { - /// A class to add extension methods to SubscriptionResource. + /// A class to add extension methods to . public partial class MockableDisconnectedOperationsSubscriptionResource : ArmResource { - private ClientDiagnostics _disconnectedOperationClientDiagnostics; - private DisconnectedRestOperations _disconnectedOperationRestClient; + private ClientDiagnostics _disconnectedOperationsOprsClientDiagnostics; + private DisconnectedOperationsOprs _disconnectedOperationsOprsRestClient; - /// Initializes a new instance of the class for mocking. + /// Initializes a new instance of MockableDisconnectedOperationsSubscriptionResource for mocking. protected MockableDisconnectedOperationsSubscriptionResource() { } - /// 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 MockableDisconnectedOperationsSubscriptionResource(ArmClient client, ResourceIdentifier id) : base(client, id) { } - private ClientDiagnostics DisconnectedOperationClientDiagnostics => _disconnectedOperationClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.DisconnectedOperations", DisconnectedOperationResource.ResourceType.Namespace, Diagnostics); - private DisconnectedRestOperations DisconnectedOperationRestClient => _disconnectedOperationRestClient ??= new DisconnectedRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, GetApiVersionOrNull(DisconnectedOperationResource.ResourceType)); + private ClientDiagnostics DisconnectedOperationsOprsClientDiagnostics => _disconnectedOperationsOprsClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.DisconnectedOperations.Mocking", ProviderConstants.DefaultProviderNamespace, Diagnostics); - private string GetApiVersionOrNull(ResourceType resourceType) - { - TryGetApiVersion(resourceType, out string apiVersion); - return apiVersion; - } + private DisconnectedOperationsOprs DisconnectedOperationsOprsRestClient => _disconnectedOperationsOprsRestClient ??= new DisconnectedOperationsOprs(DisconnectedOperationsOprsClientDiagnostics, Pipeline, Endpoint, "2025-06-01-preview"); /// /// List DisconnectedOperation resources by subscription ID /// /// - /// Request Path - /// /subscriptions/{subscriptionId}/providers/Microsoft.Edge/disconnectedOperations - /// - /// - /// Operation Id - /// DisconnectedOperation_ListBySubscription + /// Request Path. + /// /subscriptions/{subscriptionId}/providers/Microsoft.Edge/disconnectedOperations. /// /// - /// Default Api Version - /// 2025-06-01-preview + /// Operation Id. + /// DisconnectedOperations_ListBySubscription. /// /// - /// Resource - /// + /// Default Api Version. + /// 2025-06-01-preview. /// /// /// /// The cancellation token to use. - /// An async collection of that may take multiple service requests to iterate over. + /// A collection of that may take multiple service requests to iterate over. public virtual AsyncPageable GetDisconnectedOperationsAsync(CancellationToken cancellationToken = default) { - HttpMessage FirstPageRequest(int? pageSizeHint) => DisconnectedOperationRestClient.CreateListBySubscriptionRequest(Id.SubscriptionId); - HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => DisconnectedOperationRestClient.CreateListBySubscriptionNextPageRequest(nextLink, Id.SubscriptionId); - return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new DisconnectedOperationResource(Client, DisconnectedOperationData.DeserializeDisconnectedOperationData(e)), DisconnectedOperationClientDiagnostics, Pipeline, "MockableDisconnectedOperationsSubscriptionResource.GetDisconnectedOperations", "value", "nextLink", cancellationToken); + RequestContext context = new RequestContext + { + CancellationToken = cancellationToken + }; + return new AsyncPageableWrapper(new DisconnectedOperationsOprsGetBySubscriptionAsyncCollectionResultOfT(DisconnectedOperationsOprsRestClient, Guid.Parse(Id.SubscriptionId), context), data => new DisconnectedOperationResource(Client, data)); } /// /// List DisconnectedOperation resources by subscription ID /// /// - /// Request Path - /// /subscriptions/{subscriptionId}/providers/Microsoft.Edge/disconnectedOperations - /// - /// - /// Operation Id - /// DisconnectedOperation_ListBySubscription + /// Request Path. + /// /subscriptions/{subscriptionId}/providers/Microsoft.Edge/disconnectedOperations. /// /// - /// Default Api Version - /// 2025-06-01-preview + /// Operation Id. + /// DisconnectedOperations_ListBySubscription. /// /// - /// Resource - /// + /// Default Api Version. + /// 2025-06-01-preview. /// /// /// @@ -94,9 +87,11 @@ public virtual AsyncPageable GetDisconnectedOpera /// A collection of that may take multiple service requests to iterate over. public virtual Pageable GetDisconnectedOperations(CancellationToken cancellationToken = default) { - HttpMessage FirstPageRequest(int? pageSizeHint) => DisconnectedOperationRestClient.CreateListBySubscriptionRequest(Id.SubscriptionId); - HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => DisconnectedOperationRestClient.CreateListBySubscriptionNextPageRequest(nextLink, Id.SubscriptionId); - return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new DisconnectedOperationResource(Client, DisconnectedOperationData.DeserializeDisconnectedOperationData(e)), DisconnectedOperationClientDiagnostics, Pipeline, "MockableDisconnectedOperationsSubscriptionResource.GetDisconnectedOperations", "value", "nextLink", cancellationToken); + RequestContext context = new RequestContext + { + CancellationToken = cancellationToken + }; + return new PageableWrapper(new DisconnectedOperationsOprsGetBySubscriptionCollectionResultOfT(DisconnectedOperationsOprsRestClient, Guid.Parse(Id.SubscriptionId), context), data => new DisconnectedOperationResource(Client, data)); } } } diff --git a/sdk/disconnectedoperations/Azure.ResourceManager.DisconnectedOperations/src/Generated/Internal/Argument.cs b/sdk/disconnectedoperations/Azure.ResourceManager.DisconnectedOperations/src/Generated/Internal/Argument.cs index 748c9dc254ec..c90cc615ac1a 100644 --- a/sdk/disconnectedoperations/Azure.ResourceManager.DisconnectedOperations/src/Generated/Internal/Argument.cs +++ b/sdk/disconnectedoperations/Azure.ResourceManager.DisconnectedOperations/src/Generated/Internal/Argument.cs @@ -11,8 +11,10 @@ namespace Azure.ResourceManager.DisconnectedOperations { - 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/disconnectedoperations/Azure.ResourceManager.DisconnectedOperations/src/Generated/Internal/AsyncPageableWrapper.cs b/sdk/disconnectedoperations/Azure.ResourceManager.DisconnectedOperations/src/Generated/Internal/AsyncPageableWrapper.cs new file mode 100644 index 000000000000..d47e181412ea --- /dev/null +++ b/sdk/disconnectedoperations/Azure.ResourceManager.DisconnectedOperations/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.DisconnectedOperations +{ + 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/disconnectedoperations/Azure.ResourceManager.DisconnectedOperations/src/Generated/Internal/ChangeTrackingDictionary.cs b/sdk/disconnectedoperations/Azure.ResourceManager.DisconnectedOperations/src/Generated/Internal/ChangeTrackingDictionary.cs index 52caea8f499d..810bcd276c19 100644 --- a/sdk/disconnectedoperations/Azure.ResourceManager.DisconnectedOperations/src/Generated/Internal/ChangeTrackingDictionary.cs +++ b/sdk/disconnectedoperations/Azure.ResourceManager.DisconnectedOperations/src/Generated/Internal/ChangeTrackingDictionary.cs @@ -11,7 +11,8 @@ namespace Azure.ResourceManager.DisconnectedOperations { - 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/disconnectedoperations/Azure.ResourceManager.DisconnectedOperations/src/Generated/Internal/ChangeTrackingList.cs b/sdk/disconnectedoperations/Azure.ResourceManager.DisconnectedOperations/src/Generated/Internal/ChangeTrackingList.cs index 685135143e36..cfe48cdf16a7 100644 --- a/sdk/disconnectedoperations/Azure.ResourceManager.DisconnectedOperations/src/Generated/Internal/ChangeTrackingList.cs +++ b/sdk/disconnectedoperations/Azure.ResourceManager.DisconnectedOperations/src/Generated/Internal/ChangeTrackingList.cs @@ -12,7 +12,7 @@ namespace Azure.ResourceManager.DisconnectedOperations { - 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/disconnectedoperations/Azure.ResourceManager.DisconnectedOperations/src/Generated/Internal/ClientPipelineExtensions.cs b/sdk/disconnectedoperations/Azure.ResourceManager.DisconnectedOperations/src/Generated/Internal/ClientPipelineExtensions.cs new file mode 100644 index 000000000000..d39da6cde30b --- /dev/null +++ b/sdk/disconnectedoperations/Azure.ResourceManager.DisconnectedOperations/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.DisconnectedOperations +{ + 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/disconnectedoperations/Azure.ResourceManager.DisconnectedOperations/src/Generated/Internal/CodeGenMemberAttribute.cs b/sdk/disconnectedoperations/Azure.ResourceManager.DisconnectedOperations/src/Generated/Internal/CodeGenMemberAttribute.cs new file mode 100644 index 000000000000..2675c486e682 --- /dev/null +++ b/sdk/disconnectedoperations/Azure.ResourceManager.DisconnectedOperations/src/Generated/Internal/CodeGenMemberAttribute.cs @@ -0,0 +1,20 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; + +namespace Azure.ResourceManager.DisconnectedOperations +{ + [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/disconnectedoperations/Azure.ResourceManager.DisconnectedOperations/src/Generated/Internal/CodeGenSerializationAttribute.cs b/sdk/disconnectedoperations/Azure.ResourceManager.DisconnectedOperations/src/Generated/Internal/CodeGenSerializationAttribute.cs new file mode 100644 index 000000000000..4d1ecd531f6d --- /dev/null +++ b/sdk/disconnectedoperations/Azure.ResourceManager.DisconnectedOperations/src/Generated/Internal/CodeGenSerializationAttribute.cs @@ -0,0 +1,48 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; + +namespace Azure.ResourceManager.DisconnectedOperations +{ + [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/disconnectedoperations/Azure.ResourceManager.DisconnectedOperations/src/Generated/Internal/CodeGenSuppressAttribute.cs b/sdk/disconnectedoperations/Azure.ResourceManager.DisconnectedOperations/src/Generated/Internal/CodeGenSuppressAttribute.cs new file mode 100644 index 000000000000..7de85961b2cc --- /dev/null +++ b/sdk/disconnectedoperations/Azure.ResourceManager.DisconnectedOperations/src/Generated/Internal/CodeGenSuppressAttribute.cs @@ -0,0 +1,29 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; + +namespace Azure.ResourceManager.DisconnectedOperations +{ + [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/disconnectedoperations/Azure.ResourceManager.DisconnectedOperations/src/Generated/Internal/CodeGenTypeAttribute.cs b/sdk/disconnectedoperations/Azure.ResourceManager.DisconnectedOperations/src/Generated/Internal/CodeGenTypeAttribute.cs new file mode 100644 index 000000000000..cc5716878016 --- /dev/null +++ b/sdk/disconnectedoperations/Azure.ResourceManager.DisconnectedOperations/src/Generated/Internal/CodeGenTypeAttribute.cs @@ -0,0 +1,24 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; + +namespace Azure.ResourceManager.DisconnectedOperations +{ + [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/disconnectedoperations/Azure.ResourceManager.DisconnectedOperations/src/Generated/Internal/ErrorResult.cs b/sdk/disconnectedoperations/Azure.ResourceManager.DisconnectedOperations/src/Generated/Internal/ErrorResult.cs new file mode 100644 index 000000000000..3e8d47805942 --- /dev/null +++ b/sdk/disconnectedoperations/Azure.ResourceManager.DisconnectedOperations/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.DisconnectedOperations +{ + 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/disconnectedoperations/Azure.ResourceManager.DisconnectedOperations/src/Generated/Internal/ModelSerializationExtensions.cs b/sdk/disconnectedoperations/Azure.ResourceManager.DisconnectedOperations/src/Generated/Internal/ModelSerializationExtensions.cs index bfe130bc09d6..059e4c7a8140 100644 --- a/sdk/disconnectedoperations/Azure.ResourceManager.DisconnectedOperations/src/Generated/Internal/ModelSerializationExtensions.cs +++ b/sdk/disconnectedoperations/Azure.ResourceManager.DisconnectedOperations/src/Generated/Internal/ModelSerializationExtensions.cs @@ -11,18 +11,16 @@ using System.Diagnostics; using System.Globalization; using System.Text.Json; -using System.Xml; -using Azure.Core; namespace Azure.ResourceManager.DisconnectedOperations { - internal static class ModelSerializationExtensions + internal static partial class ModelSerializationExtensions { - internal static readonly JsonDocumentOptions JsonDocumentOptions = new JsonDocumentOptions { MaxDepth = 256 }; internal static readonly ModelReaderWriterOptions WireOptions = new ModelReaderWriterOptions("W"); - internal static readonly ModelReaderWriterOptions WireV3Options = new ModelReaderWriterOptions("W|v3"); - internal static readonly ModelReaderWriterOptions JsonV3Options = new ModelReaderWriterOptions("J|v3"); - internal static readonly BinaryData SentinelValue = BinaryData.FromBytes("\"__EMPTY__\""u8.ToArray()); + internal static readonly JsonDocumentOptions JsonDocumentOptions = new JsonDocumentOptions + { + MaxDepth = 256 + }; public static object GetObject(this JsonElement element) { @@ -48,14 +46,14 @@ public static object GetObject(this JsonElement element) case JsonValueKind.Null: return null; case JsonValueKind.Object: - var dictionary = new Dictionary(); + Dictionary dictionary = new Dictionary(); foreach (var jsonProperty in element.EnumerateObject()) { dictionary.Add(jsonProperty.Name, jsonProperty.Value.GetObject()); } return dictionary; case JsonValueKind.Array: - var list = new List(); + List list = new List(); foreach (var item in element.EnumerateArray()) { list.Add(item.GetObject()); @@ -93,7 +91,7 @@ public static char GetChar(this JsonElement element) { if (element.ValueKind == JsonValueKind.String) { - var text = element.GetString(); + string text = element.GetString(); if (text == null || text.Length != 1) { throw new NotSupportedException($"Cannot convert \"{text}\" to a char"); @@ -107,14 +105,14 @@ public static char GetChar(this JsonElement element) } [Conditional("DEBUG")] - public static void ThrowNonNullablePropertyIsNull(this JsonProperty property) + public static void ThrowNonNullablePropertyIsNull(this JsonProperty @property) { - throw new JsonException($"A property '{property.Name}' defined as non-nullable but received as null from the service. This exception only happens in DEBUG builds of the library and would be ignored in the release build"); + throw new JsonException($"A property '{@property.Name}' defined as non-nullable but received as null from the service. This exception only happens in DEBUG builds of the library and would be ignored in the release build"); } public static string GetRequiredString(this JsonElement element) { - var value = element.GetString(); + string value = element.GetString(); if (value == null) { throw new InvalidOperationException($"The requested operation requires an element of type 'String', but the target element has type '{element.ValueKind}'."); @@ -181,9 +179,6 @@ public static void WriteObjectValue(this Utf8JsonWriter writer, T value, Mode case IJsonModel jsonModel: jsonModel.Write(writer, options ?? WireOptions); break; - case IUtf8JsonSerializable serializable: - serializable.Write(writer); - break; case byte[] bytes: writer.WriteBase64StringValue(bytes); break; @@ -259,151 +254,5 @@ public static void WriteObjectValue(this Utf8JsonWriter writer, object value, Mo { writer.WriteObjectValue(value, options); } - - internal static bool IsSentinelValue(BinaryData value) - { - ReadOnlySpan sentinelSpan = SentinelValue.ToMemory().Span; - ReadOnlySpan valueSpan = value.ToMemory().Span; - return sentinelSpan.SequenceEqual(valueSpan); - } - - internal static class TypeFormatters - { - private const string RoundtripZFormat = "yyyy-MM-ddTHH:mm:ss.fffffffZ"; - public const string DefaultNumberFormat = "G"; - - public static string ToString(bool value) => value ? "true" : "false"; - - public static string ToString(DateTime value, string format) => value.Kind switch - { - DateTimeKind.Utc => ToString((DateTimeOffset)value, format), - _ => throw new NotSupportedException($"DateTime {value} has a Kind of {value.Kind}. Azure SDK requires it to be UTC. You can call DateTime.SpecifyKind to change Kind property value to DateTimeKind.Utc.") - }; - - public static string ToString(DateTimeOffset value, string format) => format switch - { - "D" => value.ToString("yyyy-MM-dd", CultureInfo.InvariantCulture), - "U" => value.ToUnixTimeSeconds().ToString(CultureInfo.InvariantCulture), - "O" => value.ToUniversalTime().ToString(RoundtripZFormat, CultureInfo.InvariantCulture), - "o" => value.ToUniversalTime().ToString(RoundtripZFormat, CultureInfo.InvariantCulture), - "R" => value.ToString("r", CultureInfo.InvariantCulture), - _ => value.ToString(format, CultureInfo.InvariantCulture) - }; - - public static string ToString(TimeSpan value, string format) => format switch - { - "P" => XmlConvert.ToString(value), - _ => value.ToString(format, CultureInfo.InvariantCulture) - }; - - public static string ToString(byte[] value, string format) => format switch - { - "U" => ToBase64UrlString(value), - "D" => Convert.ToBase64String(value), - _ => throw new ArgumentException($"Format is not supported: '{format}'", nameof(format)) - }; - - public static string ToBase64UrlString(byte[] value) - { - int numWholeOrPartialInputBlocks = checked(value.Length + 2) / 3; - int size = checked(numWholeOrPartialInputBlocks * 4); - char[] output = new char[size]; - - int numBase64Chars = Convert.ToBase64CharArray(value, 0, value.Length, output, 0); - - int i = 0; - for (; i < numBase64Chars; i++) - { - char ch = output[i]; - if (ch == '+') - { - output[i] = '-'; - } - else - { - if (ch == '/') - { - output[i] = '_'; - } - else - { - if (ch == '=') - { - break; - } - } - } - } - - return new string(output, 0, i); - } - - public static byte[] FromBase64UrlString(string value) - { - int paddingCharsToAdd = (value.Length % 4) switch - { - 0 => 0, - 2 => 2, - 3 => 1, - _ => throw new InvalidOperationException("Malformed input") - }; - char[] output = new char[(value.Length + paddingCharsToAdd)]; - int i = 0; - for (; i < value.Length; i++) - { - char ch = value[i]; - if (ch == '-') - { - output[i] = '+'; - } - else - { - if (ch == '_') - { - output[i] = '/'; - } - else - { - output[i] = ch; - } - } - } - - for (; i < output.Length; i++) - { - output[i] = '='; - } - - return Convert.FromBase64CharArray(output, 0, output.Length); - } - - public static DateTimeOffset ParseDateTimeOffset(string value, string format) => format switch - { - "U" => DateTimeOffset.FromUnixTimeSeconds(long.Parse(value, CultureInfo.InvariantCulture)), - _ => DateTimeOffset.Parse(value, CultureInfo.InvariantCulture, DateTimeStyles.AssumeUniversal) - }; - - public static TimeSpan ParseTimeSpan(string value, string format) => format switch - { - "P" => XmlConvert.ToTimeSpan(value), - _ => TimeSpan.ParseExact(value, format, CultureInfo.InvariantCulture) - }; - - public static string ConvertToString(object value, string format = null) => value switch - { - null => "null", - string s => s, - bool b => ToString(b), - int or float or double or long or decimal => ((IFormattable)value).ToString(DefaultNumberFormat, CultureInfo.InvariantCulture), - byte[] b0 when format != null => ToString(b0, format), - IEnumerable s0 => string.Join(",", s0), - DateTimeOffset dateTime when format != null => ToString(dateTime, format), - TimeSpan timeSpan when format != null => ToString(timeSpan, format), - TimeSpan timeSpan0 => XmlConvert.ToString(timeSpan0), - Guid guid => guid.ToString(), - BinaryData binaryData => ConvertToString(binaryData.ToArray(), format), - _ => value.ToString() - }; - } } } diff --git a/sdk/disconnectedoperations/Azure.ResourceManager.DisconnectedOperations/src/Generated/Internal/Optional.cs b/sdk/disconnectedoperations/Azure.ResourceManager.DisconnectedOperations/src/Generated/Internal/Optional.cs index cc1e54a3fc18..bcee230587e4 100644 --- a/sdk/disconnectedoperations/Azure.ResourceManager.DisconnectedOperations/src/Generated/Internal/Optional.cs +++ b/sdk/disconnectedoperations/Azure.ResourceManager.DisconnectedOperations/src/Generated/Internal/Optional.cs @@ -10,7 +10,7 @@ namespace Azure.ResourceManager.DisconnectedOperations { - 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/disconnectedoperations/Azure.ResourceManager.DisconnectedOperations/src/Generated/Internal/PageableWrapper.cs b/sdk/disconnectedoperations/Azure.ResourceManager.DisconnectedOperations/src/Generated/Internal/PageableWrapper.cs new file mode 100644 index 000000000000..c86e7fe40db0 --- /dev/null +++ b/sdk/disconnectedoperations/Azure.ResourceManager.DisconnectedOperations/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.DisconnectedOperations +{ + 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/disconnectedoperations/Azure.ResourceManager.DisconnectedOperations/src/Generated/Internal/RawRequestUriBuilderExtensions.cs b/sdk/disconnectedoperations/Azure.ResourceManager.DisconnectedOperations/src/Generated/Internal/RawRequestUriBuilderExtensions.cs new file mode 100644 index 000000000000..f3f93dca62ae --- /dev/null +++ b/sdk/disconnectedoperations/Azure.ResourceManager.DisconnectedOperations/src/Generated/Internal/RawRequestUriBuilderExtensions.cs @@ -0,0 +1,23 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Collections.Generic; +using System.Linq; +using Azure.Core; + +namespace Azure.ResourceManager.DisconnectedOperations +{ + internal static partial class RawRequestUriBuilderExtensions + { + public static void AppendQueryDelimited(this RawRequestUriBuilder builder, string name, IEnumerable value, string delimiter, SerializationFormat format = SerializationFormat.Default, bool escape = true) + { + delimiter ??= ","; + IEnumerable stringValues = value.Select(v => TypeFormatters.ConvertToString(v, format)); + builder.AppendQuery(name, string.Join(delimiter, stringValues), escape); + } + } +} diff --git a/sdk/disconnectedoperations/Azure.ResourceManager.DisconnectedOperations/src/Generated/Internal/RequestContextExtensions.cs b/sdk/disconnectedoperations/Azure.ResourceManager.DisconnectedOperations/src/Generated/Internal/RequestContextExtensions.cs new file mode 100644 index 000000000000..3d07469be5a9 --- /dev/null +++ b/sdk/disconnectedoperations/Azure.ResourceManager.DisconnectedOperations/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.DisconnectedOperations +{ + 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/disconnectedoperations/Azure.ResourceManager.DisconnectedOperations/src/Generated/Internal/SerializationFormat.cs b/sdk/disconnectedoperations/Azure.ResourceManager.DisconnectedOperations/src/Generated/Internal/SerializationFormat.cs new file mode 100644 index 000000000000..f61ebcc15013 --- /dev/null +++ b/sdk/disconnectedoperations/Azure.ResourceManager.DisconnectedOperations/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.DisconnectedOperations +{ + 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/disconnectedoperations/Azure.ResourceManager.DisconnectedOperations/src/Generated/Internal/TypeFormatters.cs b/sdk/disconnectedoperations/Azure.ResourceManager.DisconnectedOperations/src/Generated/Internal/TypeFormatters.cs new file mode 100644 index 000000000000..86a9435a4f54 --- /dev/null +++ b/sdk/disconnectedoperations/Azure.ResourceManager.DisconnectedOperations/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.DisconnectedOperations +{ + 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/disconnectedoperations/Azure.ResourceManager.DisconnectedOperations/src/Generated/Internal/Utf8JsonRequestContent.cs b/sdk/disconnectedoperations/Azure.ResourceManager.DisconnectedOperations/src/Generated/Internal/Utf8JsonRequestContent.cs index 5345b960cbf5..5cb8879982f4 100644 --- a/sdk/disconnectedoperations/Azure.ResourceManager.DisconnectedOperations/src/Generated/Internal/Utf8JsonRequestContent.cs +++ b/sdk/disconnectedoperations/Azure.ResourceManager.DisconnectedOperations/src/Generated/Internal/Utf8JsonRequestContent.cs @@ -13,7 +13,7 @@ namespace Azure.ResourceManager.DisconnectedOperations { - 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/disconnectedoperations/Azure.ResourceManager.DisconnectedOperations/src/Generated/LongRunningOperation/DisconnectedOperationOperationSource.cs b/sdk/disconnectedoperations/Azure.ResourceManager.DisconnectedOperations/src/Generated/LongRunningOperation/DisconnectedOperationOperationSource.cs index 73bba9743fac..b6de69f12cbc 100644 --- a/sdk/disconnectedoperations/Azure.ResourceManager.DisconnectedOperations/src/Generated/LongRunningOperation/DisconnectedOperationOperationSource.cs +++ b/sdk/disconnectedoperations/Azure.ResourceManager.DisconnectedOperations/src/Generated/LongRunningOperation/DisconnectedOperationOperationSource.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.DisconnectedOperations { - internal class DisconnectedOperationOperationSource : IOperationSource + /// + internal partial class DisconnectedOperationOperationSource : IOperationSource { private readonly ArmClient _client; + /// + /// internal DisconnectedOperationOperationSource(ArmClient client) { _client = client; } + /// The response from the service. + /// The cancellation token to use. + /// DisconnectedOperationResource IOperationSource.CreateResult(Response response, CancellationToken cancellationToken) { - var data = ModelReaderWriter.Read(response.Content, ModelReaderWriterOptions.Json, AzureResourceManagerDisconnectedOperationsContext.Default); + using JsonDocument document = JsonDocument.Parse(response.ContentStream); + DisconnectedOperationData data = DisconnectedOperationData.DeserializeDisconnectedOperationData(document.RootElement, ModelSerializationExtensions.WireOptions); return new DisconnectedOperationResource(_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, AzureResourceManagerDisconnectedOperationsContext.Default); - return await Task.FromResult(new DisconnectedOperationResource(_client, data)).ConfigureAwait(false); + using JsonDocument document = await JsonDocument.ParseAsync(response.ContentStream, default, cancellationToken).ConfigureAwait(false); + DisconnectedOperationData data = DisconnectedOperationData.DeserializeDisconnectedOperationData(document.RootElement, ModelSerializationExtensions.WireOptions); + return new DisconnectedOperationResource(_client, data); } } } diff --git a/sdk/disconnectedoperations/Azure.ResourceManager.DisconnectedOperations/src/Generated/LongRunningOperation/DisconnectedOperationsArmOperation.cs b/sdk/disconnectedoperations/Azure.ResourceManager.DisconnectedOperations/src/Generated/LongRunningOperation/DisconnectedOperationsArmOperation.cs index 1c082c415806..22ac5cb1d99c 100644 --- a/sdk/disconnectedoperations/Azure.ResourceManager.DisconnectedOperations/src/Generated/LongRunningOperation/DisconnectedOperationsArmOperation.cs +++ b/sdk/disconnectedoperations/Azure.ResourceManager.DisconnectedOperations/src/Generated/LongRunningOperation/DisconnectedOperationsArmOperation.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.DisconnectedOperations { -#pragma warning disable SA1649 // File name should match first type name - internal class DisconnectedOperationsArmOperation : ArmOperation -#pragma warning restore SA1649 // File name should match first type name + internal partial class DisconnectedOperationsArmOperation : ArmOperation { private readonly OperationInternal _operation; private readonly RehydrationToken? _completeRehydrationToken; @@ -29,6 +27,9 @@ protected DisconnectedOperationsArmOperation() { } + /// + /// The operation response. + /// The token to rehydrate the operation. internal DisconnectedOperationsArmOperation(Response response, RehydrationToken? rehydrationToken = null) { _operation = OperationInternal.Succeeded(response); @@ -36,12 +37,20 @@ internal DisconnectedOperationsArmOperation(Response response, RehydrationToken? _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 DisconnectedOperationsArmOperation(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 DisconnectedOperationsArmOperation(ClientDiagnostics clientDiagnostics, _completeRehydrationToken = NextLinkOperationImplementation.GetRehydrationToken(request.Method, request.Uri.ToUri(), response, finalStateVia); _operationId = GetOperationId(_completeRehydrationToken); } - _operation = new OperationInternal(nextLinkOperation, clientDiagnostics, response, "DisconnectedOperationsArmOperation", fallbackStrategy: new SequentialDelayStrategy()); + _operation = new OperationInternal( + nextLinkOperation, + clientDiagnostics, + response, + "DisconnectedOperationsArmOperation", + 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, AzureResourceManagerDisconnectedOperationsContext.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/disconnectedoperations/Azure.ResourceManager.DisconnectedOperations/src/Generated/LongRunningOperation/DisconnectedOperationsArmOperationOfT.cs b/sdk/disconnectedoperations/Azure.ResourceManager.DisconnectedOperations/src/Generated/LongRunningOperation/DisconnectedOperationsArmOperationOfT.cs index 994be1529d39..e35f5455406c 100644 --- a/sdk/disconnectedoperations/Azure.ResourceManager.DisconnectedOperations/src/Generated/LongRunningOperation/DisconnectedOperationsArmOperationOfT.cs +++ b/sdk/disconnectedoperations/Azure.ResourceManager.DisconnectedOperations/src/Generated/LongRunningOperation/DisconnectedOperationsArmOperationOfT.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.DisconnectedOperations { -#pragma warning disable SA1649 // File name should match first type name - internal class DisconnectedOperationsArmOperation : ArmOperation -#pragma warning restore SA1649 // File name should match first type name + internal partial class DisconnectedOperationsArmOperation : ArmOperation { private readonly OperationInternal _operation; private readonly RehydrationToken? _completeRehydrationToken; @@ -29,6 +27,9 @@ protected DisconnectedOperationsArmOperation() { } + /// + /// The operation response. + /// The token to rehydrate the operation. internal DisconnectedOperationsArmOperation(Response response, RehydrationToken? rehydrationToken = null) { _operation = OperationInternal.Succeeded(response.GetRawResponse(), response.Value); @@ -36,12 +37,21 @@ internal DisconnectedOperationsArmOperation(Response response, RehydrationTok _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 DisconnectedOperationsArmOperation(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 DisconnectedOperationsArmOperation(IOperationSource source, ClientDi _completeRehydrationToken = NextLinkOperationImplementation.GetRehydrationToken(request.Method, request.Uri.ToUri(), response, finalStateVia); _operationId = GetOperationId(_completeRehydrationToken); } - _operation = new OperationInternal(NextLinkOperationImplementation.Create(source, nextLinkOperation), clientDiagnostics, response, "DisconnectedOperationsArmOperation", fallbackStrategy: new SequentialDelayStrategy()); + _operation = new OperationInternal( + NextLinkOperationImplementation.Create(source, nextLinkOperation), + clientDiagnostics, + response, + "DisconnectedOperationsArmOperation", + null, + new SequentialDelayStrategy()); } - private string GetOperationId(RehydrationToken? rehydrationToken) - { - if (rehydrationToken is null) - { - return null; - } - var data = ModelReaderWriter.Write(rehydrationToken, ModelReaderWriterOptions.Json, AzureResourceManagerDisconnectedOperationsContext.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/disconnectedoperations/Azure.ResourceManager.DisconnectedOperations/src/Generated/Models/ArtifactListResult.Serialization.cs b/sdk/disconnectedoperations/Azure.ResourceManager.DisconnectedOperations/src/Generated/Models/ArtifactListResult.Serialization.cs index d9e4819511bc..205175dad10d 100644 --- a/sdk/disconnectedoperations/Azure.ResourceManager.DisconnectedOperations/src/Generated/Models/ArtifactListResult.Serialization.cs +++ b/sdk/disconnectedoperations/Azure.ResourceManager.DisconnectedOperations/src/Generated/Models/ArtifactListResult.Serialization.cs @@ -9,14 +9,21 @@ using System.ClientModel.Primitives; using System.Collections.Generic; using System.Text.Json; -using Azure.Core; +using Azure; +using Azure.ResourceManager.DisconnectedOperations; namespace Azure.ResourceManager.DisconnectedOperations.Models { - internal partial class ArtifactListResult : IUtf8JsonSerializable, IJsonModel + /// The response of a Artifact list operation. + internal partial class ArtifactListResult : IJsonModel { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + /// Initializes a new instance of for deserialization. + internal ArtifactListResult() + { + } + /// The JSON writer. + /// The client options for reading and writing models. void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) { writer.WriteStartObject(); @@ -28,15 +35,14 @@ void IJsonModel.Write(Utf8JsonWriter 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(ArtifactListResult)} does not support writing '{format}' format."); } - writer.WritePropertyName("value"u8); writer.WriteStartArray(); - foreach (var item in Value) + foreach (DisconnectedOperationsArtifactData item in Value) { writer.WriteObjectValue(item, options); } @@ -46,15 +52,15 @@ protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWrit writer.WritePropertyName("nextLink"u8); writer.WriteStringValue(NextLink.AbsoluteUri); } - if (options.Format != "W" && _serializedAdditionalRawData != null) + if (options.Format != "W" && _additionalBinaryDataProperties != null) { - foreach (var item in _serializedAdditionalRawData) + foreach (var item in _additionalBinaryDataProperties) { writer.WritePropertyName(item.Key); #if NET6_0_OR_GREATER - writer.WriteRawValue(item.Value); + writer.WriteRawValue(item.Value); #else - using (JsonDocument document = JsonDocument.Parse(item.Value, ModelSerializationExtensions.JsonDocumentOptions)) + using (JsonDocument document = JsonDocument.Parse(item.Value)) { JsonSerializer.Serialize(writer, document.RootElement); } @@ -63,64 +69,70 @@ protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWrit } } - ArtifactListResult IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + /// The JSON reader. + /// The client options for reading and writing models. + ArtifactListResult IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) => JsonModelCreateCore(ref reader, options); + + /// The JSON reader. + /// The client options for reading and writing models. + protected virtual ArtifactListResult 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(ArtifactListResult)} does not support reading '{format}' format."); } - using JsonDocument document = JsonDocument.ParseValue(ref reader); return DeserializeArtifactListResult(document.RootElement, options); } - internal static ArtifactListResult DeserializeArtifactListResult(JsonElement element, ModelReaderWriterOptions options = null) + /// The JSON element to deserialize. + /// The client options for reading and writing models. + internal static ArtifactListResult DeserializeArtifactListResult(JsonElement element, ModelReaderWriterOptions options) { - options ??= ModelSerializationExtensions.WireOptions; - if (element.ValueKind == JsonValueKind.Null) { return null; } - IReadOnlyList value = default; + IList value = default; Uri nextLink = default; - IDictionary serializedAdditionalRawData = default; - Dictionary rawDataDictionary = new Dictionary(); - foreach (var property in element.EnumerateObject()) + IDictionary additionalBinaryDataProperties = new ChangeTrackingDictionary(); + foreach (var prop in element.EnumerateObject()) { - if (property.NameEquals("value"u8)) + if (prop.NameEquals("value"u8)) { List array = new List(); - foreach (var item in property.Value.EnumerateArray()) + foreach (var item in prop.Value.EnumerateArray()) { array.Add(DisconnectedOperationsArtifactData.DeserializeDisconnectedOperationsArtifactData(item, options)); } value = array; continue; } - if (property.NameEquals("nextLink"u8)) + if (prop.NameEquals("nextLink"u8)) { - if (property.Value.ValueKind == JsonValueKind.Null) + if (prop.Value.ValueKind == JsonValueKind.Null) { continue; } - nextLink = new Uri(property.Value.GetString()); + nextLink = new Uri(prop.Value.GetString()); continue; } if (options.Format != "W") { - rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + additionalBinaryDataProperties.Add(prop.Name, BinaryData.FromString(prop.Value.GetRawText())); } } - serializedAdditionalRawData = rawDataDictionary; - return new ArtifactListResult(value, nextLink, serializedAdditionalRawData); + return new ArtifactListResult(value, nextLink, additionalBinaryDataProperties); } - BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) - { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + /// The client options for reading and writing models. + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) => PersistableModelWriteCore(options); + /// The client options for reading and writing models. + protected virtual BinaryData PersistableModelWriteCore(ModelReaderWriterOptions options) + { + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; switch (format) { case "J": @@ -130,15 +142,20 @@ BinaryData IPersistableModel.Write(ModelReaderWriterOptions } } - ArtifactListResult 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. + ArtifactListResult IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) => PersistableModelCreateCore(data, options); + /// The data to parse. + /// The client options for reading and writing models. + protected virtual ArtifactListResult PersistableModelCreateCore(BinaryData data, ModelReaderWriterOptions options) + { + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; switch (format) { case "J": + using (JsonDocument document = JsonDocument.Parse(data, ModelSerializationExtensions.JsonDocumentOptions)) { - using JsonDocument document = JsonDocument.Parse(data, ModelSerializationExtensions.JsonDocumentOptions); return DeserializeArtifactListResult(document.RootElement, options); } default: @@ -146,6 +163,14 @@ ArtifactListResult IPersistableModel.Create(BinaryData data, } } + /// The client options for reading and writing models. string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + + /// The to deserialize the from. + internal static ArtifactListResult FromResponse(Response response) + { + using JsonDocument document = JsonDocument.Parse(response.Content, ModelSerializationExtensions.JsonDocumentOptions); + return DeserializeArtifactListResult(document.RootElement, ModelSerializationExtensions.WireOptions); + } } } diff --git a/sdk/disconnectedoperations/Azure.ResourceManager.DisconnectedOperations/src/Generated/Models/ArtifactListResult.cs b/sdk/disconnectedoperations/Azure.ResourceManager.DisconnectedOperations/src/Generated/Models/ArtifactListResult.cs index 88ddf12b8b30..1bcf72ad3118 100644 --- a/sdk/disconnectedoperations/Azure.ResourceManager.DisconnectedOperations/src/Generated/Models/ArtifactListResult.cs +++ b/sdk/disconnectedoperations/Azure.ResourceManager.DisconnectedOperations/src/Generated/Models/ArtifactListResult.cs @@ -8,72 +8,37 @@ using System; using System.Collections.Generic; using System.Linq; +using Azure.ResourceManager.DisconnectedOperations; namespace Azure.ResourceManager.DisconnectedOperations.Models { /// The response of a Artifact list operation. internal partial class ArtifactListResult { - /// - /// 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 Artifact items on this page. - /// is null. internal ArtifactListResult(IEnumerable value) { - Argument.AssertNotNull(value, nameof(value)); - Value = value.ToList(); } /// Initializes a new instance of . /// The Artifact items on this page. /// The link to the next page of items. - /// Keeps track of any properties unknown to the library. - internal ArtifactListResult(IReadOnlyList value, Uri nextLink, IDictionary serializedAdditionalRawData) + /// Keeps track of any properties unknown to the library. + internal ArtifactListResult(IList value, Uri nextLink, IDictionary additionalBinaryDataProperties) { Value = value; NextLink = nextLink; - _serializedAdditionalRawData = serializedAdditionalRawData; - } - - /// Initializes a new instance of for deserialization. - internal ArtifactListResult() - { + _additionalBinaryDataProperties = additionalBinaryDataProperties; } /// The Artifact items on this page. - public IReadOnlyList Value { get; } + public IList Value { get; } + /// The link to the next page of items. public Uri NextLink { get; } } diff --git a/sdk/disconnectedoperations/Azure.ResourceManager.DisconnectedOperations/src/Generated/Models/AzureResourceManagerDisconnectedOperationsContext.cs b/sdk/disconnectedoperations/Azure.ResourceManager.DisconnectedOperations/src/Generated/Models/AzureResourceManagerDisconnectedOperationsContext.cs index 7a0541adbbbc..05f25c0731c2 100644 --- a/sdk/disconnectedoperations/Azure.ResourceManager.DisconnectedOperations/src/Generated/Models/AzureResourceManagerDisconnectedOperationsContext.cs +++ b/sdk/disconnectedoperations/Azure.ResourceManager.DisconnectedOperations/src/Generated/Models/AzureResourceManagerDisconnectedOperationsContext.cs @@ -6,6 +6,7 @@ #nullable disable using System.ClientModel.Primitives; +using Azure; using Azure.ResourceManager.DisconnectedOperations.Models; using Azure.ResourceManager.Models; @@ -13,7 +14,7 @@ namespace Azure.ResourceManager.DisconnectedOperations { /// /// 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(ArtifactListResult))] [ModelReaderWriterBuildable(typeof(DisconnectedOperationData))] diff --git a/sdk/disconnectedoperations/Azure.ResourceManager.DisconnectedOperations/src/Generated/Models/DisconnectedOperationDeploymentManifest.Serialization.cs b/sdk/disconnectedoperations/Azure.ResourceManager.DisconnectedOperations/src/Generated/Models/DisconnectedOperationDeploymentManifest.Serialization.cs index c7ae96e1accb..ea6a7a44c128 100644 --- a/sdk/disconnectedoperations/Azure.ResourceManager.DisconnectedOperations/src/Generated/Models/DisconnectedOperationDeploymentManifest.Serialization.cs +++ b/sdk/disconnectedoperations/Azure.ResourceManager.DisconnectedOperations/src/Generated/Models/DisconnectedOperationDeploymentManifest.Serialization.cs @@ -9,14 +9,17 @@ using System.ClientModel.Primitives; using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; +using Azure.ResourceManager.DisconnectedOperations; namespace Azure.ResourceManager.DisconnectedOperations.Models { - public partial class DisconnectedOperationDeploymentManifest : IUtf8JsonSerializable, IJsonModel + /// The disconnected operation manifest. + public partial class DisconnectedOperationDeploymentManifest : IJsonModel { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); - + /// The JSON writer. + /// The client options for reading and writing models. void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) { writer.WriteStartObject(); @@ -28,12 +31,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(DisconnectedOperationDeploymentManifest)} does not support writing '{format}' format."); } - if (options.Format != "W") { writer.WritePropertyName("resourceId"u8); @@ -69,15 +71,15 @@ protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWrit writer.WritePropertyName("cloud"u8); writer.WriteStringValue(Cloud); } - 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 +88,27 @@ protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWrit } } - DisconnectedOperationDeploymentManifest IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + /// The JSON reader. + /// The client options for reading and writing models. + DisconnectedOperationDeploymentManifest IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) => JsonModelCreateCore(ref reader, options); + + /// The JSON reader. + /// The client options for reading and writing models. + protected virtual DisconnectedOperationDeploymentManifest 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(DisconnectedOperationDeploymentManifest)} does not support reading '{format}' format."); } - using JsonDocument document = JsonDocument.ParseValue(ref reader); return DeserializeDisconnectedOperationDeploymentManifest(document.RootElement, options); } - internal static DisconnectedOperationDeploymentManifest DeserializeDisconnectedOperationDeploymentManifest(JsonElement element, ModelReaderWriterOptions options = null) + /// The JSON element to deserialize. + /// The client options for reading and writing models. + internal static DisconnectedOperationDeploymentManifest DeserializeDisconnectedOperationDeploymentManifest(JsonElement element, ModelReaderWriterOptions options) { - options ??= ModelSerializationExtensions.WireOptions; - if (element.ValueKind == JsonValueKind.Null) { return null; @@ -113,51 +120,49 @@ internal static DisconnectedOperationDeploymentManifest DeserializeDisconnectedO DisconnectedOperationsBillingModel billingModel = default; DisconnectedOperationsConnectionIntent connectionIntent = default; string cloud = 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)) { - resourceId = new ResourceIdentifier(property.Value.GetString()); + resourceId = new ResourceIdentifier(prop.Value.GetString()); continue; } - if (property.NameEquals("resourceName"u8)) + if (prop.NameEquals("resourceName"u8)) { - resourceName = property.Value.GetString(); + resourceName = prop.Value.GetString(); continue; } - if (property.NameEquals("stampId"u8)) + if (prop.NameEquals("stampId"u8)) { - stampId = property.Value.GetString(); + stampId = prop.Value.GetString(); continue; } - if (property.NameEquals("location"u8)) + if (prop.NameEquals("location"u8)) { - location = property.Value.GetString(); + location = prop.Value.GetString(); continue; } - if (property.NameEquals("billingModel"u8)) + if (prop.NameEquals("billingModel"u8)) { - billingModel = new DisconnectedOperationsBillingModel(property.Value.GetString()); + billingModel = new DisconnectedOperationsBillingModel(prop.Value.GetString()); continue; } - if (property.NameEquals("connectionIntent"u8)) + if (prop.NameEquals("connectionIntent"u8)) { - connectionIntent = new DisconnectedOperationsConnectionIntent(property.Value.GetString()); + connectionIntent = new DisconnectedOperationsConnectionIntent(prop.Value.GetString()); continue; } - if (property.NameEquals("cloud"u8)) + if (prop.NameEquals("cloud"u8)) { - cloud = property.Value.GetString(); + cloud = 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 DisconnectedOperationDeploymentManifest( resourceId, resourceName, @@ -166,13 +171,16 @@ internal static DisconnectedOperationDeploymentManifest DeserializeDisconnectedO billingModel, connectionIntent, cloud, - 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": @@ -182,15 +190,20 @@ BinaryData IPersistableModel.Write(Mode } } - DisconnectedOperationDeploymentManifest 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. + DisconnectedOperationDeploymentManifest IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) => PersistableModelCreateCore(data, options); + /// The data to parse. + /// The client options for reading and writing models. + protected virtual DisconnectedOperationDeploymentManifest PersistableModelCreateCore(BinaryData data, ModelReaderWriterOptions options) + { + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; switch (format) { case "J": + using (JsonDocument document = JsonDocument.Parse(data, ModelSerializationExtensions.JsonDocumentOptions)) { - using JsonDocument document = JsonDocument.Parse(data, ModelSerializationExtensions.JsonDocumentOptions); return DeserializeDisconnectedOperationDeploymentManifest(document.RootElement, options); } default: @@ -198,6 +211,14 @@ DisconnectedOperationDeploymentManifest IPersistableModel The client options for reading and writing models. string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + + /// The to deserialize the from. + internal static DisconnectedOperationDeploymentManifest FromResponse(Response response) + { + using JsonDocument document = JsonDocument.Parse(response.Content, ModelSerializationExtensions.JsonDocumentOptions); + return DeserializeDisconnectedOperationDeploymentManifest(document.RootElement, ModelSerializationExtensions.WireOptions); + } } } diff --git a/sdk/disconnectedoperations/Azure.ResourceManager.DisconnectedOperations/src/Generated/Models/DisconnectedOperationDeploymentManifest.cs b/sdk/disconnectedoperations/Azure.ResourceManager.DisconnectedOperations/src/Generated/Models/DisconnectedOperationDeploymentManifest.cs index 4daa6c441cb7..ab64088b0b7f 100644 --- a/sdk/disconnectedoperations/Azure.ResourceManager.DisconnectedOperations/src/Generated/Models/DisconnectedOperationDeploymentManifest.cs +++ b/sdk/disconnectedoperations/Azure.ResourceManager.DisconnectedOperations/src/Generated/Models/DisconnectedOperationDeploymentManifest.cs @@ -14,53 +14,12 @@ namespace Azure.ResourceManager.DisconnectedOperations.Models /// The disconnected operation manifest. public partial class DisconnectedOperationDeploymentManifest { - /// - /// 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 resource identifier of the disconnected operations resource. - /// The resource name. - /// The unique GUID of the stamp. - /// The resource location. - /// The billing model. - /// The connection intent. - internal DisconnectedOperationDeploymentManifest(ResourceIdentifier resourceId, string resourceName, string stampId, string location, DisconnectedOperationsBillingModel billingModel, DisconnectedOperationsConnectionIntent connectionIntent) + internal DisconnectedOperationDeploymentManifest() { - ResourceId = resourceId; - ResourceName = resourceName; - StampId = stampId; - Location = location; - BillingModel = billingModel; - ConnectionIntent = connectionIntent; } /// Initializes a new instance of . @@ -71,8 +30,8 @@ internal DisconnectedOperationDeploymentManifest(ResourceIdentifier resourceId, /// The billing model. /// The connection intent. /// The cloud in which the resource is registered. - /// Keeps track of any properties unknown to the library. - internal DisconnectedOperationDeploymentManifest(ResourceIdentifier resourceId, string resourceName, string stampId, string location, DisconnectedOperationsBillingModel billingModel, DisconnectedOperationsConnectionIntent connectionIntent, string cloud, IDictionary serializedAdditionalRawData) + /// Keeps track of any properties unknown to the library. + internal DisconnectedOperationDeploymentManifest(ResourceIdentifier resourceId, string resourceName, string stampId, string location, DisconnectedOperationsBillingModel billingModel, DisconnectedOperationsConnectionIntent connectionIntent, string cloud, IDictionary additionalBinaryDataProperties) { ResourceId = resourceId; ResourceName = resourceName; @@ -81,26 +40,27 @@ internal DisconnectedOperationDeploymentManifest(ResourceIdentifier resourceId, BillingModel = billingModel; ConnectionIntent = connectionIntent; Cloud = cloud; - _serializedAdditionalRawData = serializedAdditionalRawData; - } - - /// Initializes a new instance of for deserialization. - internal DisconnectedOperationDeploymentManifest() - { + _additionalBinaryDataProperties = additionalBinaryDataProperties; } /// The resource identifier of the disconnected operations resource. public ResourceIdentifier ResourceId { get; } + /// The resource name. public string ResourceName { get; } + /// The unique GUID of the stamp. public string StampId { get; } + /// The resource location. public string Location { get; } + /// The billing model. public DisconnectedOperationsBillingModel BillingModel { get; } + /// The connection intent. public DisconnectedOperationsConnectionIntent ConnectionIntent { get; } + /// The cloud in which the resource is registered. public string Cloud { get; } } diff --git a/sdk/disconnectedoperations/Azure.ResourceManager.DisconnectedOperations/src/Generated/Models/DisconnectedOperationListResult.Serialization.cs b/sdk/disconnectedoperations/Azure.ResourceManager.DisconnectedOperations/src/Generated/Models/DisconnectedOperationListResult.Serialization.cs index 931cdbe563ca..af4c7392f49f 100644 --- a/sdk/disconnectedoperations/Azure.ResourceManager.DisconnectedOperations/src/Generated/Models/DisconnectedOperationListResult.Serialization.cs +++ b/sdk/disconnectedoperations/Azure.ResourceManager.DisconnectedOperations/src/Generated/Models/DisconnectedOperationListResult.Serialization.cs @@ -9,14 +9,21 @@ using System.ClientModel.Primitives; using System.Collections.Generic; using System.Text.Json; -using Azure.Core; +using Azure; +using Azure.ResourceManager.DisconnectedOperations; namespace Azure.ResourceManager.DisconnectedOperations.Models { - internal partial class DisconnectedOperationListResult : IUtf8JsonSerializable, IJsonModel + /// The response of a DisconnectedOperation list operation. + internal partial class DisconnectedOperationListResult : IJsonModel { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + /// Initializes a new instance of for deserialization. + internal DisconnectedOperationListResult() + { + } + /// The JSON writer. + /// The client options for reading and writing models. void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) { writer.WriteStartObject(); @@ -28,15 +35,14 @@ void IJsonModel.Write(Utf8JsonWriter 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(DisconnectedOperationListResult)} does not support writing '{format}' format."); } - writer.WritePropertyName("value"u8); writer.WriteStartArray(); - foreach (var item in Value) + foreach (DisconnectedOperationData item in Value) { writer.WriteObjectValue(item, options); } @@ -46,15 +52,15 @@ protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWrit writer.WritePropertyName("nextLink"u8); writer.WriteStringValue(NextLink.AbsoluteUri); } - if (options.Format != "W" && _serializedAdditionalRawData != null) + if (options.Format != "W" && _additionalBinaryDataProperties != null) { - foreach (var item in _serializedAdditionalRawData) + foreach (var item in _additionalBinaryDataProperties) { writer.WritePropertyName(item.Key); #if NET6_0_OR_GREATER - writer.WriteRawValue(item.Value); + writer.WriteRawValue(item.Value); #else - using (JsonDocument document = JsonDocument.Parse(item.Value, ModelSerializationExtensions.JsonDocumentOptions)) + using (JsonDocument document = JsonDocument.Parse(item.Value)) { JsonSerializer.Serialize(writer, document.RootElement); } @@ -63,64 +69,70 @@ protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWrit } } - DisconnectedOperationListResult IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + /// The JSON reader. + /// The client options for reading and writing models. + DisconnectedOperationListResult IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) => JsonModelCreateCore(ref reader, options); + + /// The JSON reader. + /// The client options for reading and writing models. + protected virtual DisconnectedOperationListResult 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(DisconnectedOperationListResult)} does not support reading '{format}' format."); } - using JsonDocument document = JsonDocument.ParseValue(ref reader); return DeserializeDisconnectedOperationListResult(document.RootElement, options); } - internal static DisconnectedOperationListResult DeserializeDisconnectedOperationListResult(JsonElement element, ModelReaderWriterOptions options = null) + /// The JSON element to deserialize. + /// The client options for reading and writing models. + internal static DisconnectedOperationListResult DeserializeDisconnectedOperationListResult(JsonElement element, ModelReaderWriterOptions options) { - options ??= ModelSerializationExtensions.WireOptions; - if (element.ValueKind == JsonValueKind.Null) { return null; } - IReadOnlyList value = default; + IList value = default; Uri nextLink = default; - IDictionary serializedAdditionalRawData = default; - Dictionary rawDataDictionary = new Dictionary(); - foreach (var property in element.EnumerateObject()) + IDictionary additionalBinaryDataProperties = new ChangeTrackingDictionary(); + foreach (var prop in element.EnumerateObject()) { - if (property.NameEquals("value"u8)) + if (prop.NameEquals("value"u8)) { List array = new List(); - foreach (var item in property.Value.EnumerateArray()) + foreach (var item in prop.Value.EnumerateArray()) { array.Add(DisconnectedOperationData.DeserializeDisconnectedOperationData(item, options)); } value = array; continue; } - if (property.NameEquals("nextLink"u8)) + if (prop.NameEquals("nextLink"u8)) { - if (property.Value.ValueKind == JsonValueKind.Null) + if (prop.Value.ValueKind == JsonValueKind.Null) { continue; } - nextLink = new Uri(property.Value.GetString()); + nextLink = new Uri(prop.Value.GetString()); continue; } if (options.Format != "W") { - rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + additionalBinaryDataProperties.Add(prop.Name, BinaryData.FromString(prop.Value.GetRawText())); } } - serializedAdditionalRawData = rawDataDictionary; - return new DisconnectedOperationListResult(value, nextLink, serializedAdditionalRawData); + return new DisconnectedOperationListResult(value, nextLink, additionalBinaryDataProperties); } - BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) - { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + /// The client options for reading and writing models. + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) => PersistableModelWriteCore(options); + /// The client options for reading and writing models. + protected virtual BinaryData PersistableModelWriteCore(ModelReaderWriterOptions options) + { + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; switch (format) { case "J": @@ -130,15 +142,20 @@ BinaryData IPersistableModel.Write(ModelReaderW } } - DisconnectedOperationListResult 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. + DisconnectedOperationListResult IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) => PersistableModelCreateCore(data, options); + /// The data to parse. + /// The client options for reading and writing models. + protected virtual DisconnectedOperationListResult PersistableModelCreateCore(BinaryData data, ModelReaderWriterOptions options) + { + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; switch (format) { case "J": + using (JsonDocument document = JsonDocument.Parse(data, ModelSerializationExtensions.JsonDocumentOptions)) { - using JsonDocument document = JsonDocument.Parse(data, ModelSerializationExtensions.JsonDocumentOptions); return DeserializeDisconnectedOperationListResult(document.RootElement, options); } default: @@ -146,6 +163,14 @@ DisconnectedOperationListResult IPersistableModel The client options for reading and writing models. string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + + /// The to deserialize the from. + internal static DisconnectedOperationListResult FromResponse(Response response) + { + using JsonDocument document = JsonDocument.Parse(response.Content, ModelSerializationExtensions.JsonDocumentOptions); + return DeserializeDisconnectedOperationListResult(document.RootElement, ModelSerializationExtensions.WireOptions); + } } } diff --git a/sdk/disconnectedoperations/Azure.ResourceManager.DisconnectedOperations/src/Generated/Models/DisconnectedOperationListResult.cs b/sdk/disconnectedoperations/Azure.ResourceManager.DisconnectedOperations/src/Generated/Models/DisconnectedOperationListResult.cs index 207d63704ef3..9994f314c13c 100644 --- a/sdk/disconnectedoperations/Azure.ResourceManager.DisconnectedOperations/src/Generated/Models/DisconnectedOperationListResult.cs +++ b/sdk/disconnectedoperations/Azure.ResourceManager.DisconnectedOperations/src/Generated/Models/DisconnectedOperationListResult.cs @@ -8,72 +8,37 @@ using System; using System.Collections.Generic; using System.Linq; +using Azure.ResourceManager.DisconnectedOperations; namespace Azure.ResourceManager.DisconnectedOperations.Models { /// The response of a DisconnectedOperation list operation. internal partial class DisconnectedOperationListResult { - /// - /// 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 DisconnectedOperation items on this page. - /// is null. internal DisconnectedOperationListResult(IEnumerable value) { - Argument.AssertNotNull(value, nameof(value)); - Value = value.ToList(); } /// Initializes a new instance of . /// The DisconnectedOperation items on this page. /// The link to the next page of items. - /// Keeps track of any properties unknown to the library. - internal DisconnectedOperationListResult(IReadOnlyList value, Uri nextLink, IDictionary serializedAdditionalRawData) + /// Keeps track of any properties unknown to the library. + internal DisconnectedOperationListResult(IList value, Uri nextLink, IDictionary additionalBinaryDataProperties) { Value = value; NextLink = nextLink; - _serializedAdditionalRawData = serializedAdditionalRawData; - } - - /// Initializes a new instance of for deserialization. - internal DisconnectedOperationListResult() - { + _additionalBinaryDataProperties = additionalBinaryDataProperties; } /// The DisconnectedOperation items on this page. - public IReadOnlyList Value { get; } + public IList Value { get; } + /// The link to the next page of items. public Uri NextLink { get; } } diff --git a/sdk/disconnectedoperations/Azure.ResourceManager.DisconnectedOperations/src/Generated/Models/DisconnectedOperationPatch.Serialization.cs b/sdk/disconnectedoperations/Azure.ResourceManager.DisconnectedOperations/src/Generated/Models/DisconnectedOperationPatch.Serialization.cs index 7f69f1e43faa..6e0f8af603cb 100644 --- a/sdk/disconnectedoperations/Azure.ResourceManager.DisconnectedOperations/src/Generated/Models/DisconnectedOperationPatch.Serialization.cs +++ b/sdk/disconnectedoperations/Azure.ResourceManager.DisconnectedOperations/src/Generated/Models/DisconnectedOperationPatch.Serialization.cs @@ -10,13 +10,15 @@ using System.Collections.Generic; using System.Text.Json; using Azure.Core; +using Azure.ResourceManager.DisconnectedOperations; namespace Azure.ResourceManager.DisconnectedOperations.Models { - public partial class DisconnectedOperationPatch : IUtf8JsonSerializable, IJsonModel + /// The type used for update operations of the DisconnectedOperation. + public partial class DisconnectedOperationPatch : IJsonModel { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); - + /// The JSON writer. + /// The client options for reading and writing models. void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) { writer.WriteStartObject(); @@ -28,12 +30,11 @@ void IJsonModel.Write(Utf8JsonWriter writer, 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(DisconnectedOperationPatch)} does not support writing '{format}' format."); } - if (Optional.IsCollectionDefined(Tags)) { writer.WritePropertyName("tags"u8); @@ -41,6 +42,11 @@ protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWrit foreach (var item in Tags) { writer.WritePropertyName(item.Key); + if (item.Value == null) + { + writer.WriteNullValue(); + continue; + } writer.WriteStringValue(item.Value); } writer.WriteEndObject(); @@ -50,15 +56,15 @@ protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWrit writer.WritePropertyName("properties"u8); writer.WriteObjectValue(Properties, options); } - if (options.Format != "W" && _serializedAdditionalRawData != null) + if (options.Format != "W" && _additionalBinaryDataProperties != null) { - foreach (var item in _serializedAdditionalRawData) + foreach (var item in _additionalBinaryDataProperties) { writer.WritePropertyName(item.Key); #if NET6_0_OR_GREATER - writer.WriteRawValue(item.Value); + writer.WriteRawValue(item.Value); #else - using (JsonDocument document = JsonDocument.Parse(item.Value, ModelSerializationExtensions.JsonDocumentOptions)) + using (JsonDocument document = JsonDocument.Parse(item.Value)) { JsonSerializer.Serialize(writer, document.RootElement); } @@ -67,68 +73,81 @@ protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWrit } } - DisconnectedOperationPatch IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + /// The JSON reader. + /// The client options for reading and writing models. + DisconnectedOperationPatch IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) => JsonModelCreateCore(ref reader, options); + + /// The JSON reader. + /// The client options for reading and writing models. + protected virtual DisconnectedOperationPatch 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(DisconnectedOperationPatch)} does not support reading '{format}' format."); } - using JsonDocument document = JsonDocument.ParseValue(ref reader); return DeserializeDisconnectedOperationPatch(document.RootElement, options); } - internal static DisconnectedOperationPatch DeserializeDisconnectedOperationPatch(JsonElement element, ModelReaderWriterOptions options = null) + /// The JSON element to deserialize. + /// The client options for reading and writing models. + internal static DisconnectedOperationPatch DeserializeDisconnectedOperationPatch(JsonElement element, ModelReaderWriterOptions options) { - options ??= ModelSerializationExtensions.WireOptions; - if (element.ValueKind == JsonValueKind.Null) { return null; } IDictionary tags = default; DisconnectedOperationUpdateProperties properties = 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 (property.NameEquals("properties"u8)) + if (prop.NameEquals("properties"u8)) { - if (property.Value.ValueKind == JsonValueKind.Null) + if (prop.Value.ValueKind == JsonValueKind.Null) { continue; } - properties = DisconnectedOperationUpdateProperties.DeserializeDisconnectedOperationUpdateProperties(property.Value, options); + properties = DisconnectedOperationUpdateProperties.DeserializeDisconnectedOperationUpdateProperties(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 DisconnectedOperationPatch(tags ?? new ChangeTrackingDictionary(), properties, serializedAdditionalRawData); + return new DisconnectedOperationPatch(tags ?? new ChangeTrackingDictionary(), properties, additionalBinaryDataProperties); } - BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) - { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + /// The client options for reading and writing models. + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) => PersistableModelWriteCore(options); + /// The client options for reading and writing models. + protected virtual BinaryData PersistableModelWriteCore(ModelReaderWriterOptions options) + { + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; switch (format) { case "J": @@ -138,15 +157,20 @@ BinaryData IPersistableModel.Write(ModelReaderWriter } } - DisconnectedOperationPatch 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. + DisconnectedOperationPatch IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) => PersistableModelCreateCore(data, options); + /// The data to parse. + /// The client options for reading and writing models. + protected virtual DisconnectedOperationPatch PersistableModelCreateCore(BinaryData data, ModelReaderWriterOptions options) + { + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; switch (format) { case "J": + using (JsonDocument document = JsonDocument.Parse(data, ModelSerializationExtensions.JsonDocumentOptions)) { - using JsonDocument document = JsonDocument.Parse(data, ModelSerializationExtensions.JsonDocumentOptions); return DeserializeDisconnectedOperationPatch(document.RootElement, options); } default: @@ -154,6 +178,19 @@ DisconnectedOperationPatch IPersistableModel.Create( } } + /// The client options for reading and writing models. string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + + /// The to serialize into . + internal static RequestContent ToRequestContent(DisconnectedOperationPatch disconnectedOperationPatch) + { + if (disconnectedOperationPatch == null) + { + return null; + } + Utf8JsonRequestContent content = new Utf8JsonRequestContent(); + content.JsonWriter.WriteObjectValue(disconnectedOperationPatch, ModelSerializationExtensions.WireOptions); + return content; + } } } diff --git a/sdk/disconnectedoperations/Azure.ResourceManager.DisconnectedOperations/src/Generated/Models/DisconnectedOperationPatch.cs b/sdk/disconnectedoperations/Azure.ResourceManager.DisconnectedOperations/src/Generated/Models/DisconnectedOperationPatch.cs index ffbeb4a8dcbf..c0210d04c006 100644 --- a/sdk/disconnectedoperations/Azure.ResourceManager.DisconnectedOperations/src/Generated/Models/DisconnectedOperationPatch.cs +++ b/sdk/disconnectedoperations/Azure.ResourceManager.DisconnectedOperations/src/Generated/Models/DisconnectedOperationPatch.cs @@ -7,43 +7,15 @@ using System; using System.Collections.Generic; +using Azure.ResourceManager.DisconnectedOperations; namespace Azure.ResourceManager.DisconnectedOperations.Models { /// The type used for update operations of the DisconnectedOperation. public partial class DisconnectedOperationPatch { - /// - /// 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 DisconnectedOperationPatch() @@ -54,16 +26,17 @@ public DisconnectedOperationPatch() /// Initializes a new instance of . /// Resource tags. /// The resource-specific properties for this resource. - /// Keeps track of any properties unknown to the library. - internal DisconnectedOperationPatch(IDictionary tags, DisconnectedOperationUpdateProperties properties, IDictionary serializedAdditionalRawData) + /// Keeps track of any properties unknown to the library. + internal DisconnectedOperationPatch(IDictionary tags, DisconnectedOperationUpdateProperties properties, IDictionary additionalBinaryDataProperties) { Tags = tags; Properties = properties; - _serializedAdditionalRawData = serializedAdditionalRawData; + _additionalBinaryDataProperties = additionalBinaryDataProperties; } /// Resource tags. public IDictionary Tags { get; } + /// The resource-specific properties for this resource. public DisconnectedOperationUpdateProperties Properties { get; set; } } diff --git a/sdk/disconnectedoperations/Azure.ResourceManager.DisconnectedOperations/src/Generated/Models/DisconnectedOperationProperties.Serialization.cs b/sdk/disconnectedoperations/Azure.ResourceManager.DisconnectedOperations/src/Generated/Models/DisconnectedOperationProperties.Serialization.cs index 9226eeb47870..0ed7ee98bd5c 100644 --- a/sdk/disconnectedoperations/Azure.ResourceManager.DisconnectedOperations/src/Generated/Models/DisconnectedOperationProperties.Serialization.cs +++ b/sdk/disconnectedoperations/Azure.ResourceManager.DisconnectedOperations/src/Generated/Models/DisconnectedOperationProperties.Serialization.cs @@ -9,14 +9,20 @@ using System.ClientModel.Primitives; using System.Collections.Generic; using System.Text.Json; -using Azure.Core; +using Azure.ResourceManager.DisconnectedOperations; namespace Azure.ResourceManager.DisconnectedOperations.Models { - public partial class DisconnectedOperationProperties : IUtf8JsonSerializable, IJsonModel + /// The disconnected operation properties. + public partial class DisconnectedOperationProperties : IJsonModel { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + /// Initializes a new instance of for deserialization. + internal DisconnectedOperationProperties() + { + } + /// The JSON writer. + /// The client options for reading and writing models. void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) { writer.WriteStartObject(); @@ -28,12 +34,11 @@ void IJsonModel.Write(Utf8JsonWriter writer, 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(DisconnectedOperationProperties)} does not support writing '{format}' format."); } - if (options.Format != "W" && Optional.IsDefined(ProvisioningState)) { writer.WritePropertyName("provisioningState"u8); @@ -66,15 +71,15 @@ protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWrit writer.WritePropertyName("deviceVersion"u8); writer.WriteStringValue(DeviceVersion); } - 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); } @@ -83,22 +88,27 @@ protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWrit } } - DisconnectedOperationProperties IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + /// The JSON reader. + /// The client options for reading and writing models. + DisconnectedOperationProperties IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) => JsonModelCreateCore(ref reader, options); + + /// The JSON reader. + /// The client options for reading and writing models. + protected virtual DisconnectedOperationProperties 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(DisconnectedOperationProperties)} does not support reading '{format}' format."); } - using JsonDocument document = JsonDocument.ParseValue(ref reader); return DeserializeDisconnectedOperationProperties(document.RootElement, options); } - internal static DisconnectedOperationProperties DeserializeDisconnectedOperationProperties(JsonElement element, ModelReaderWriterOptions options = null) + /// The JSON element to deserialize. + /// The client options for reading and writing models. + internal static DisconnectedOperationProperties DeserializeDisconnectedOperationProperties(JsonElement element, ModelReaderWriterOptions options) { - options ??= ModelSerializationExtensions.WireOptions; - if (element.ValueKind == JsonValueKind.Null) { return null; @@ -110,63 +120,61 @@ internal static DisconnectedOperationProperties DeserializeDisconnectedOperation DisconnectedOperationsConnectionStatus? connectionStatus = default; DisconnectedOperationsRegistrationStatus? registrationStatus = default; string deviceVersion = 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("provisioningState"u8)) + if (prop.NameEquals("provisioningState"u8)) { - if (property.Value.ValueKind == JsonValueKind.Null) + if (prop.Value.ValueKind == JsonValueKind.Null) { continue; } - provisioningState = new DisconnectedOperationsResourceProvisioningState(property.Value.GetString()); + provisioningState = new DisconnectedOperationsResourceProvisioningState(prop.Value.GetString()); continue; } - if (property.NameEquals("stampId"u8)) + if (prop.NameEquals("stampId"u8)) { - stampId = property.Value.GetString(); + stampId = prop.Value.GetString(); continue; } - if (property.NameEquals("billingModel"u8)) + if (prop.NameEquals("billingModel"u8)) { - billingModel = new DisconnectedOperationsBillingModel(property.Value.GetString()); + billingModel = new DisconnectedOperationsBillingModel(prop.Value.GetString()); continue; } - if (property.NameEquals("connectionIntent"u8)) + if (prop.NameEquals("connectionIntent"u8)) { - connectionIntent = new DisconnectedOperationsConnectionIntent(property.Value.GetString()); + connectionIntent = new DisconnectedOperationsConnectionIntent(prop.Value.GetString()); continue; } - if (property.NameEquals("connectionStatus"u8)) + if (prop.NameEquals("connectionStatus"u8)) { - if (property.Value.ValueKind == JsonValueKind.Null) + if (prop.Value.ValueKind == JsonValueKind.Null) { continue; } - connectionStatus = new DisconnectedOperationsConnectionStatus(property.Value.GetString()); + connectionStatus = new DisconnectedOperationsConnectionStatus(prop.Value.GetString()); continue; } - if (property.NameEquals("registrationStatus"u8)) + if (prop.NameEquals("registrationStatus"u8)) { - if (property.Value.ValueKind == JsonValueKind.Null) + if (prop.Value.ValueKind == JsonValueKind.Null) { continue; } - registrationStatus = new DisconnectedOperationsRegistrationStatus(property.Value.GetString()); + registrationStatus = new DisconnectedOperationsRegistrationStatus(prop.Value.GetString()); continue; } - if (property.NameEquals("deviceVersion"u8)) + if (prop.NameEquals("deviceVersion"u8)) { - deviceVersion = property.Value.GetString(); + deviceVersion = 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 DisconnectedOperationProperties( provisioningState, stampId, @@ -175,13 +183,16 @@ internal static DisconnectedOperationProperties DeserializeDisconnectedOperation connectionStatus, registrationStatus, deviceVersion, - 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": @@ -191,15 +202,20 @@ BinaryData IPersistableModel.Write(ModelReaderW } } - DisconnectedOperationProperties 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. + DisconnectedOperationProperties IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) => PersistableModelCreateCore(data, options); + /// The data to parse. + /// The client options for reading and writing models. + protected virtual DisconnectedOperationProperties PersistableModelCreateCore(BinaryData data, ModelReaderWriterOptions options) + { + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; switch (format) { case "J": + using (JsonDocument document = JsonDocument.Parse(data, ModelSerializationExtensions.JsonDocumentOptions)) { - using JsonDocument document = JsonDocument.Parse(data, ModelSerializationExtensions.JsonDocumentOptions); return DeserializeDisconnectedOperationProperties(document.RootElement, options); } default: @@ -207,6 +223,7 @@ DisconnectedOperationProperties IPersistableModel The client options for reading and writing models. string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; } } diff --git a/sdk/disconnectedoperations/Azure.ResourceManager.DisconnectedOperations/src/Generated/Models/DisconnectedOperationProperties.cs b/sdk/disconnectedoperations/Azure.ResourceManager.DisconnectedOperations/src/Generated/Models/DisconnectedOperationProperties.cs index 9cc3ae558eaa..e519c728c2ff 100644 --- a/sdk/disconnectedoperations/Azure.ResourceManager.DisconnectedOperations/src/Generated/Models/DisconnectedOperationProperties.cs +++ b/sdk/disconnectedoperations/Azure.ResourceManager.DisconnectedOperations/src/Generated/Models/DisconnectedOperationProperties.cs @@ -13,46 +13,13 @@ namespace Azure.ResourceManager.DisconnectedOperations.Models /// The disconnected operation properties. public partial class DisconnectedOperationProperties { - /// - /// 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 unique GUID of the stamp. - /// The billing model. /// The connection intent. - public DisconnectedOperationProperties(string stampId, DisconnectedOperationsBillingModel billingModel, DisconnectedOperationsConnectionIntent connectionIntent) + public DisconnectedOperationProperties(DisconnectedOperationsConnectionIntent connectionIntent) { - StampId = stampId; - BillingModel = billingModel; ConnectionIntent = connectionIntent; } @@ -64,8 +31,8 @@ public DisconnectedOperationProperties(string stampId, DisconnectedOperationsBil /// The connection status. /// The registration intent. /// The device version. - /// Keeps track of any properties unknown to the library. - internal DisconnectedOperationProperties(DisconnectedOperationsResourceProvisioningState? provisioningState, string stampId, DisconnectedOperationsBillingModel billingModel, DisconnectedOperationsConnectionIntent connectionIntent, DisconnectedOperationsConnectionStatus? connectionStatus, DisconnectedOperationsRegistrationStatus? registrationStatus, string deviceVersion, IDictionary serializedAdditionalRawData) + /// Keeps track of any properties unknown to the library. + internal DisconnectedOperationProperties(DisconnectedOperationsResourceProvisioningState? provisioningState, string stampId, DisconnectedOperationsBillingModel billingModel, DisconnectedOperationsConnectionIntent connectionIntent, DisconnectedOperationsConnectionStatus? connectionStatus, DisconnectedOperationsRegistrationStatus? registrationStatus, string deviceVersion, IDictionary additionalBinaryDataProperties) { ProvisioningState = provisioningState; StampId = stampId; @@ -74,26 +41,27 @@ internal DisconnectedOperationProperties(DisconnectedOperationsResourceProvision ConnectionStatus = connectionStatus; RegistrationStatus = registrationStatus; DeviceVersion = deviceVersion; - _serializedAdditionalRawData = serializedAdditionalRawData; - } - - /// Initializes a new instance of for deserialization. - internal DisconnectedOperationProperties() - { + _additionalBinaryDataProperties = additionalBinaryDataProperties; } /// The resource provisioning state. public DisconnectedOperationsResourceProvisioningState? ProvisioningState { get; } + /// The unique GUID of the stamp. public string StampId { get; } + /// The billing model. public DisconnectedOperationsBillingModel BillingModel { get; } + /// The connection intent. public DisconnectedOperationsConnectionIntent ConnectionIntent { get; set; } + /// The connection status. public DisconnectedOperationsConnectionStatus? ConnectionStatus { get; } + /// The registration intent. public DisconnectedOperationsRegistrationStatus? RegistrationStatus { get; set; } + /// The device version. public string DeviceVersion { get; set; } } diff --git a/sdk/disconnectedoperations/Azure.ResourceManager.DisconnectedOperations/src/Generated/Models/DisconnectedOperationUpdateProperties.Serialization.cs b/sdk/disconnectedoperations/Azure.ResourceManager.DisconnectedOperations/src/Generated/Models/DisconnectedOperationUpdateProperties.Serialization.cs index 4e93d4918822..24823368e94c 100644 --- a/sdk/disconnectedoperations/Azure.ResourceManager.DisconnectedOperations/src/Generated/Models/DisconnectedOperationUpdateProperties.Serialization.cs +++ b/sdk/disconnectedoperations/Azure.ResourceManager.DisconnectedOperations/src/Generated/Models/DisconnectedOperationUpdateProperties.Serialization.cs @@ -9,14 +9,15 @@ using System.ClientModel.Primitives; using System.Collections.Generic; using System.Text.Json; -using Azure.Core; +using Azure.ResourceManager.DisconnectedOperations; namespace Azure.ResourceManager.DisconnectedOperations.Models { - public partial class DisconnectedOperationUpdateProperties : IUtf8JsonSerializable, IJsonModel + /// The updatable properties of the DisconnectedOperation. + public partial class DisconnectedOperationUpdateProperties : IJsonModel { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); - + /// The JSON writer. + /// The client options for reading and writing models. void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) { writer.WriteStartObject(); @@ -28,12 +29,11 @@ void IJsonModel.Write(Utf8JsonWriter writ /// 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(DisconnectedOperationUpdateProperties)} does not support writing '{format}' format."); } - if (Optional.IsDefined(ConnectionIntent)) { writer.WritePropertyName("connectionIntent"u8); @@ -49,15 +49,15 @@ protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWrit writer.WritePropertyName("deviceVersion"u8); writer.WriteStringValue(DeviceVersion); } - 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 +66,27 @@ protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWrit } } - DisconnectedOperationUpdateProperties IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + /// The JSON reader. + /// The client options for reading and writing models. + DisconnectedOperationUpdateProperties IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) => JsonModelCreateCore(ref reader, options); + + /// The JSON reader. + /// The client options for reading and writing models. + protected virtual DisconnectedOperationUpdateProperties 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(DisconnectedOperationUpdateProperties)} does not support reading '{format}' format."); } - using JsonDocument document = JsonDocument.ParseValue(ref reader); return DeserializeDisconnectedOperationUpdateProperties(document.RootElement, options); } - internal static DisconnectedOperationUpdateProperties DeserializeDisconnectedOperationUpdateProperties(JsonElement element, ModelReaderWriterOptions options = null) + /// The JSON element to deserialize. + /// The client options for reading and writing models. + internal static DisconnectedOperationUpdateProperties DeserializeDisconnectedOperationUpdateProperties(JsonElement element, ModelReaderWriterOptions options) { - options ??= ModelSerializationExtensions.WireOptions; - if (element.ValueKind == JsonValueKind.Null) { return null; @@ -89,46 +94,47 @@ internal static DisconnectedOperationUpdateProperties DeserializeDisconnectedOpe DisconnectedOperationsConnectionIntent? connectionIntent = default; DisconnectedOperationsRegistrationStatus? registrationStatus = default; string deviceVersion = 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("connectionIntent"u8)) + if (prop.NameEquals("connectionIntent"u8)) { - if (property.Value.ValueKind == JsonValueKind.Null) + if (prop.Value.ValueKind == JsonValueKind.Null) { continue; } - connectionIntent = new DisconnectedOperationsConnectionIntent(property.Value.GetString()); + connectionIntent = new DisconnectedOperationsConnectionIntent(prop.Value.GetString()); continue; } - if (property.NameEquals("registrationStatus"u8)) + if (prop.NameEquals("registrationStatus"u8)) { - if (property.Value.ValueKind == JsonValueKind.Null) + if (prop.Value.ValueKind == JsonValueKind.Null) { continue; } - registrationStatus = new DisconnectedOperationsRegistrationStatus(property.Value.GetString()); + registrationStatus = new DisconnectedOperationsRegistrationStatus(prop.Value.GetString()); continue; } - if (property.NameEquals("deviceVersion"u8)) + if (prop.NameEquals("deviceVersion"u8)) { - deviceVersion = property.Value.GetString(); + deviceVersion = 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 DisconnectedOperationUpdateProperties(connectionIntent, registrationStatus, deviceVersion, serializedAdditionalRawData); + return new DisconnectedOperationUpdateProperties(connectionIntent, registrationStatus, deviceVersion, additionalBinaryDataProperties); } - BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) - { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + /// The client options for reading and writing models. + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) => PersistableModelWriteCore(options); + /// The client options for reading and writing models. + protected virtual BinaryData PersistableModelWriteCore(ModelReaderWriterOptions options) + { + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; switch (format) { case "J": @@ -138,15 +144,20 @@ BinaryData IPersistableModel.Write(ModelR } } - DisconnectedOperationUpdateProperties 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. + DisconnectedOperationUpdateProperties IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) => PersistableModelCreateCore(data, options); + /// The data to parse. + /// The client options for reading and writing models. + protected virtual DisconnectedOperationUpdateProperties PersistableModelCreateCore(BinaryData data, ModelReaderWriterOptions options) + { + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; switch (format) { case "J": + using (JsonDocument document = JsonDocument.Parse(data, ModelSerializationExtensions.JsonDocumentOptions)) { - using JsonDocument document = JsonDocument.Parse(data, ModelSerializationExtensions.JsonDocumentOptions); return DeserializeDisconnectedOperationUpdateProperties(document.RootElement, options); } default: @@ -154,6 +165,7 @@ DisconnectedOperationUpdateProperties IPersistableModel The client options for reading and writing models. string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; } } diff --git a/sdk/disconnectedoperations/Azure.ResourceManager.DisconnectedOperations/src/Generated/Models/DisconnectedOperationUpdateProperties.cs b/sdk/disconnectedoperations/Azure.ResourceManager.DisconnectedOperations/src/Generated/Models/DisconnectedOperationUpdateProperties.cs index ec4413dd61d2..b0363ebd6003 100644 --- a/sdk/disconnectedoperations/Azure.ResourceManager.DisconnectedOperations/src/Generated/Models/DisconnectedOperationUpdateProperties.cs +++ b/sdk/disconnectedoperations/Azure.ResourceManager.DisconnectedOperations/src/Generated/Models/DisconnectedOperationUpdateProperties.cs @@ -13,37 +13,8 @@ namespace Azure.ResourceManager.DisconnectedOperations.Models /// The updatable properties of the DisconnectedOperation. public partial class DisconnectedOperationUpdateProperties { - /// - /// 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 DisconnectedOperationUpdateProperties() @@ -54,19 +25,21 @@ public DisconnectedOperationUpdateProperties() /// The connection intent. /// The registration intent. /// The device version. - /// Keeps track of any properties unknown to the library. - internal DisconnectedOperationUpdateProperties(DisconnectedOperationsConnectionIntent? connectionIntent, DisconnectedOperationsRegistrationStatus? registrationStatus, string deviceVersion, IDictionary serializedAdditionalRawData) + /// Keeps track of any properties unknown to the library. + internal DisconnectedOperationUpdateProperties(DisconnectedOperationsConnectionIntent? connectionIntent, DisconnectedOperationsRegistrationStatus? registrationStatus, string deviceVersion, IDictionary additionalBinaryDataProperties) { ConnectionIntent = connectionIntent; RegistrationStatus = registrationStatus; DeviceVersion = deviceVersion; - _serializedAdditionalRawData = serializedAdditionalRawData; + _additionalBinaryDataProperties = additionalBinaryDataProperties; } /// The connection intent. public DisconnectedOperationsConnectionIntent? ConnectionIntent { get; set; } + /// The registration intent. public DisconnectedOperationsRegistrationStatus? RegistrationStatus { get; set; } + /// The device version. public string DeviceVersion { get; set; } } diff --git a/sdk/disconnectedoperations/Azure.ResourceManager.DisconnectedOperations/src/Generated/Models/DisconnectedOperationsArtifactDownloadResult.Serialization.cs b/sdk/disconnectedoperations/Azure.ResourceManager.DisconnectedOperations/src/Generated/Models/DisconnectedOperationsArtifactDownloadResult.Serialization.cs index c663751b7fe1..714487612ed8 100644 --- a/sdk/disconnectedoperations/Azure.ResourceManager.DisconnectedOperations/src/Generated/Models/DisconnectedOperationsArtifactDownloadResult.Serialization.cs +++ b/sdk/disconnectedoperations/Azure.ResourceManager.DisconnectedOperations/src/Generated/Models/DisconnectedOperationsArtifactDownloadResult.Serialization.cs @@ -9,14 +9,16 @@ using System.ClientModel.Primitives; using System.Collections.Generic; using System.Text.Json; -using Azure.Core; +using Azure; +using Azure.ResourceManager.DisconnectedOperations; namespace Azure.ResourceManager.DisconnectedOperations.Models { - public partial class DisconnectedOperationsArtifactDownloadResult : IUtf8JsonSerializable, IJsonModel + /// The artifact download properties. + public partial class DisconnectedOperationsArtifactDownloadResult : IJsonModel { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); - + /// The JSON writer. + /// The client options for reading and writing models. void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) { writer.WriteStartObject(); @@ -28,12 +30,11 @@ void IJsonModel.Write(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(DisconnectedOperationsArtifactDownloadResult)} does not support writing '{format}' format."); } - if (options.Format != "W" && Optional.IsDefined(ProvisioningState)) { writer.WritePropertyName("provisioningState"u8); @@ -69,15 +70,15 @@ protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWrit writer.WritePropertyName("linkExpiry"u8); writer.WriteStringValue(LinkExpiry, "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); } @@ -86,22 +87,27 @@ protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWrit } } - DisconnectedOperationsArtifactDownloadResult IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + /// The JSON reader. + /// The client options for reading and writing models. + DisconnectedOperationsArtifactDownloadResult IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) => JsonModelCreateCore(ref reader, options); + + /// The JSON reader. + /// The client options for reading and writing models. + protected virtual DisconnectedOperationsArtifactDownloadResult 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(DisconnectedOperationsArtifactDownloadResult)} does not support reading '{format}' format."); } - using JsonDocument document = JsonDocument.ParseValue(ref reader); return DeserializeDisconnectedOperationsArtifactDownloadResult(document.RootElement, options); } - internal static DisconnectedOperationsArtifactDownloadResult DeserializeDisconnectedOperationsArtifactDownloadResult(JsonElement element, ModelReaderWriterOptions options = null) + /// The JSON element to deserialize. + /// The client options for reading and writing models. + internal static DisconnectedOperationsArtifactDownloadResult DeserializeDisconnectedOperationsArtifactDownloadResult(JsonElement element, ModelReaderWriterOptions options) { - options ??= ModelSerializationExtensions.WireOptions; - if (element.ValueKind == JsonValueKind.Null) { return null; @@ -113,59 +119,57 @@ internal static DisconnectedOperationsArtifactDownloadResult DeserializeDisconne long? size = default; Uri downloadLink = default; DateTimeOffset linkExpiry = 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("provisioningState"u8)) + if (prop.NameEquals("provisioningState"u8)) { - if (property.Value.ValueKind == JsonValueKind.Null) + if (prop.Value.ValueKind == JsonValueKind.Null) { continue; } - provisioningState = new DisconnectedOperationsResourceProvisioningState(property.Value.GetString()); + provisioningState = new DisconnectedOperationsResourceProvisioningState(prop.Value.GetString()); continue; } - if (property.NameEquals("artifactOrder"u8)) + if (prop.NameEquals("artifactOrder"u8)) { - artifactOrder = property.Value.GetInt32(); + artifactOrder = prop.Value.GetInt32(); continue; } - if (property.NameEquals("title"u8)) + if (prop.NameEquals("title"u8)) { - title = property.Value.GetString(); + title = prop.Value.GetString(); continue; } - if (property.NameEquals("description"u8)) + if (prop.NameEquals("description"u8)) { - description = property.Value.GetString(); + description = prop.Value.GetString(); continue; } - if (property.NameEquals("size"u8)) + if (prop.NameEquals("size"u8)) { - if (property.Value.ValueKind == JsonValueKind.Null) + if (prop.Value.ValueKind == JsonValueKind.Null) { continue; } - size = property.Value.GetInt64(); + size = prop.Value.GetInt64(); continue; } - if (property.NameEquals("downloadLink"u8)) + if (prop.NameEquals("downloadLink"u8)) { - downloadLink = new Uri(property.Value.GetString()); + downloadLink = new Uri(prop.Value.GetString()); continue; } - if (property.NameEquals("linkExpiry"u8)) + if (prop.NameEquals("linkExpiry"u8)) { - linkExpiry = property.Value.GetDateTimeOffset("O"); + linkExpiry = 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 DisconnectedOperationsArtifactDownloadResult( provisioningState, artifactOrder, @@ -174,13 +178,16 @@ internal static DisconnectedOperationsArtifactDownloadResult DeserializeDisconne size, downloadLink, linkExpiry, - 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": @@ -190,15 +197,20 @@ BinaryData IPersistableModel.Write } } - DisconnectedOperationsArtifactDownloadResult 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. + DisconnectedOperationsArtifactDownloadResult IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) => PersistableModelCreateCore(data, options); + /// The data to parse. + /// The client options for reading and writing models. + protected virtual DisconnectedOperationsArtifactDownloadResult PersistableModelCreateCore(BinaryData data, ModelReaderWriterOptions options) + { + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; switch (format) { case "J": + using (JsonDocument document = JsonDocument.Parse(data, ModelSerializationExtensions.JsonDocumentOptions)) { - using JsonDocument document = JsonDocument.Parse(data, ModelSerializationExtensions.JsonDocumentOptions); return DeserializeDisconnectedOperationsArtifactDownloadResult(document.RootElement, options); } default: @@ -206,6 +218,14 @@ DisconnectedOperationsArtifactDownloadResult IPersistableModel The client options for reading and writing models. string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + + /// The to deserialize the from. + internal static DisconnectedOperationsArtifactDownloadResult FromResponse(Response response) + { + using JsonDocument document = JsonDocument.Parse(response.Content, ModelSerializationExtensions.JsonDocumentOptions); + return DeserializeDisconnectedOperationsArtifactDownloadResult(document.RootElement, ModelSerializationExtensions.WireOptions); + } } } diff --git a/sdk/disconnectedoperations/Azure.ResourceManager.DisconnectedOperations/src/Generated/Models/DisconnectedOperationsArtifactDownloadResult.cs b/sdk/disconnectedoperations/Azure.ResourceManager.DisconnectedOperations/src/Generated/Models/DisconnectedOperationsArtifactDownloadResult.cs index 275cd32cc5fa..515620670efc 100644 --- a/sdk/disconnectedoperations/Azure.ResourceManager.DisconnectedOperations/src/Generated/Models/DisconnectedOperationsArtifactDownloadResult.cs +++ b/sdk/disconnectedoperations/Azure.ResourceManager.DisconnectedOperations/src/Generated/Models/DisconnectedOperationsArtifactDownloadResult.cs @@ -13,51 +13,12 @@ namespace Azure.ResourceManager.DisconnectedOperations.Models /// The artifact download properties. public partial class DisconnectedOperationsArtifactDownloadResult { - /// - /// 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 artifact display order. - /// The artifact title. - /// The artifact description. - /// The download URI. - /// The download link expiry time. - internal DisconnectedOperationsArtifactDownloadResult(int artifactOrder, string title, string description, Uri downloadLink, DateTimeOffset linkExpiry) + internal DisconnectedOperationsArtifactDownloadResult() { - ArtifactOrder = artifactOrder; - Title = title; - Description = description; - DownloadLink = downloadLink; - LinkExpiry = linkExpiry; } /// Initializes a new instance of . @@ -68,8 +29,8 @@ internal DisconnectedOperationsArtifactDownloadResult(int artifactOrder, string /// The artifact size in MB. /// The download URI. /// The download link expiry time. - /// Keeps track of any properties unknown to the library. - internal DisconnectedOperationsArtifactDownloadResult(DisconnectedOperationsResourceProvisioningState? provisioningState, int artifactOrder, string title, string description, long? size, Uri downloadLink, DateTimeOffset linkExpiry, IDictionary serializedAdditionalRawData) + /// Keeps track of any properties unknown to the library. + internal DisconnectedOperationsArtifactDownloadResult(DisconnectedOperationsResourceProvisioningState? provisioningState, int artifactOrder, string title, string description, long? size, Uri downloadLink, DateTimeOffset linkExpiry, IDictionary additionalBinaryDataProperties) { ProvisioningState = provisioningState; ArtifactOrder = artifactOrder; @@ -78,26 +39,27 @@ internal DisconnectedOperationsArtifactDownloadResult(DisconnectedOperationsReso Size = size; DownloadLink = downloadLink; LinkExpiry = linkExpiry; - _serializedAdditionalRawData = serializedAdditionalRawData; - } - - /// Initializes a new instance of for deserialization. - internal DisconnectedOperationsArtifactDownloadResult() - { + _additionalBinaryDataProperties = additionalBinaryDataProperties; } /// The resource provisioning state. public DisconnectedOperationsResourceProvisioningState? ProvisioningState { get; } + /// The artifact display order. public int ArtifactOrder { get; } + /// The artifact title. public string Title { get; } + /// The artifact description. public string Description { get; } + /// The artifact size in MB. public long? Size { get; } + /// The download URI. public Uri DownloadLink { get; } + /// The download link expiry time. public DateTimeOffset LinkExpiry { get; } } diff --git a/sdk/disconnectedoperations/Azure.ResourceManager.DisconnectedOperations/src/Generated/Models/DisconnectedOperationsArtifactProperties.Serialization.cs b/sdk/disconnectedoperations/Azure.ResourceManager.DisconnectedOperations/src/Generated/Models/DisconnectedOperationsArtifactProperties.Serialization.cs index d717e337a530..72f51938e645 100644 --- a/sdk/disconnectedoperations/Azure.ResourceManager.DisconnectedOperations/src/Generated/Models/DisconnectedOperationsArtifactProperties.Serialization.cs +++ b/sdk/disconnectedoperations/Azure.ResourceManager.DisconnectedOperations/src/Generated/Models/DisconnectedOperationsArtifactProperties.Serialization.cs @@ -9,14 +9,15 @@ using System.ClientModel.Primitives; using System.Collections.Generic; using System.Text.Json; -using Azure.Core; +using Azure.ResourceManager.DisconnectedOperations; namespace Azure.ResourceManager.DisconnectedOperations.Models { - public partial class DisconnectedOperationsArtifactProperties : IUtf8JsonSerializable, IJsonModel + /// The artifact properties. + public partial class DisconnectedOperationsArtifactProperties : IJsonModel { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); - + /// The JSON writer. + /// The client options for reading and writing models. void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) { writer.WriteStartObject(); @@ -28,12 +29,11 @@ void IJsonModel.Write(Utf8JsonWriter 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(DisconnectedOperationsArtifactProperties)} does not support writing '{format}' format."); } - if (options.Format != "W" && Optional.IsDefined(ProvisioningState)) { writer.WritePropertyName("provisioningState"u8); @@ -59,15 +59,15 @@ protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWrit writer.WritePropertyName("size"u8); writer.WriteNumberValue(Size.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); } @@ -76,22 +76,27 @@ protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWrit } } - DisconnectedOperationsArtifactProperties IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + /// The JSON reader. + /// The client options for reading and writing models. + DisconnectedOperationsArtifactProperties IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) => JsonModelCreateCore(ref reader, options); + + /// The JSON reader. + /// The client options for reading and writing models. + protected virtual DisconnectedOperationsArtifactProperties 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(DisconnectedOperationsArtifactProperties)} does not support reading '{format}' format."); } - using JsonDocument document = JsonDocument.ParseValue(ref reader); return DeserializeDisconnectedOperationsArtifactProperties(document.RootElement, options); } - internal static DisconnectedOperationsArtifactProperties DeserializeDisconnectedOperationsArtifactProperties(JsonElement element, ModelReaderWriterOptions options = null) + /// The JSON element to deserialize. + /// The client options for reading and writing models. + internal static DisconnectedOperationsArtifactProperties DeserializeDisconnectedOperationsArtifactProperties(JsonElement element, ModelReaderWriterOptions options) { - options ??= ModelSerializationExtensions.WireOptions; - if (element.ValueKind == JsonValueKind.Null) { return null; @@ -101,62 +106,63 @@ internal static DisconnectedOperationsArtifactProperties DeserializeDisconnected string title = default; string description = default; long? 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("provisioningState"u8)) + if (prop.NameEquals("provisioningState"u8)) { - if (property.Value.ValueKind == JsonValueKind.Null) + if (prop.Value.ValueKind == JsonValueKind.Null) { continue; } - provisioningState = new DisconnectedOperationsResourceProvisioningState(property.Value.GetString()); + provisioningState = new DisconnectedOperationsResourceProvisioningState(prop.Value.GetString()); continue; } - if (property.NameEquals("artifactOrder"u8)) + if (prop.NameEquals("artifactOrder"u8)) { - artifactOrder = property.Value.GetInt32(); + artifactOrder = prop.Value.GetInt32(); continue; } - if (property.NameEquals("title"u8)) + if (prop.NameEquals("title"u8)) { - title = property.Value.GetString(); + title = prop.Value.GetString(); continue; } - if (property.NameEquals("description"u8)) + if (prop.NameEquals("description"u8)) { - description = property.Value.GetString(); + description = prop.Value.GetString(); continue; } - if (property.NameEquals("size"u8)) + if (prop.NameEquals("size"u8)) { - if (property.Value.ValueKind == JsonValueKind.Null) + if (prop.Value.ValueKind == JsonValueKind.Null) { continue; } - size = property.Value.GetInt64(); + size = prop.Value.GetInt64(); continue; } if (options.Format != "W") { - rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + additionalBinaryDataProperties.Add(prop.Name, BinaryData.FromString(prop.Value.GetRawText())); } } - serializedAdditionalRawData = rawDataDictionary; return new DisconnectedOperationsArtifactProperties( provisioningState, artifactOrder, title, description, size, - 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": @@ -166,15 +172,20 @@ BinaryData IPersistableModel.Write(Mod } } - DisconnectedOperationsArtifactProperties 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. + DisconnectedOperationsArtifactProperties IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) => PersistableModelCreateCore(data, options); + /// The data to parse. + /// The client options for reading and writing models. + protected virtual DisconnectedOperationsArtifactProperties PersistableModelCreateCore(BinaryData data, ModelReaderWriterOptions options) + { + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; switch (format) { case "J": + using (JsonDocument document = JsonDocument.Parse(data, ModelSerializationExtensions.JsonDocumentOptions)) { - using JsonDocument document = JsonDocument.Parse(data, ModelSerializationExtensions.JsonDocumentOptions); return DeserializeDisconnectedOperationsArtifactProperties(document.RootElement, options); } default: @@ -182,6 +193,7 @@ DisconnectedOperationsArtifactProperties IPersistableModel The client options for reading and writing models. string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; } } diff --git a/sdk/disconnectedoperations/Azure.ResourceManager.DisconnectedOperations/src/Generated/Models/DisconnectedOperationsArtifactProperties.cs b/sdk/disconnectedoperations/Azure.ResourceManager.DisconnectedOperations/src/Generated/Models/DisconnectedOperationsArtifactProperties.cs index 1af0f60def26..7c3a7823b23a 100644 --- a/sdk/disconnectedoperations/Azure.ResourceManager.DisconnectedOperations/src/Generated/Models/DisconnectedOperationsArtifactProperties.cs +++ b/sdk/disconnectedoperations/Azure.ResourceManager.DisconnectedOperations/src/Generated/Models/DisconnectedOperationsArtifactProperties.cs @@ -13,47 +13,12 @@ namespace Azure.ResourceManager.DisconnectedOperations.Models /// The artifact properties. public partial class DisconnectedOperationsArtifactProperties { - /// - /// 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 artifact display order. - /// The artifact title. - /// The artifact description. - internal DisconnectedOperationsArtifactProperties(int artifactOrder, string title, string description) + internal DisconnectedOperationsArtifactProperties() { - ArtifactOrder = artifactOrder; - Title = title; - Description = description; } /// Initializes a new instance of . @@ -62,30 +27,29 @@ internal DisconnectedOperationsArtifactProperties(int artifactOrder, string titl /// The artifact title. /// The artifact description. /// The artifact size in MB. - /// Keeps track of any properties unknown to the library. - internal DisconnectedOperationsArtifactProperties(DisconnectedOperationsResourceProvisioningState? provisioningState, int artifactOrder, string title, string description, long? size, IDictionary serializedAdditionalRawData) + /// Keeps track of any properties unknown to the library. + internal DisconnectedOperationsArtifactProperties(DisconnectedOperationsResourceProvisioningState? provisioningState, int artifactOrder, string title, string description, long? size, IDictionary additionalBinaryDataProperties) { ProvisioningState = provisioningState; ArtifactOrder = artifactOrder; Title = title; Description = description; Size = size; - _serializedAdditionalRawData = serializedAdditionalRawData; - } - - /// Initializes a new instance of for deserialization. - internal DisconnectedOperationsArtifactProperties() - { + _additionalBinaryDataProperties = additionalBinaryDataProperties; } /// The resource provisioning state. public DisconnectedOperationsResourceProvisioningState? ProvisioningState { get; } + /// The artifact display order. public int ArtifactOrder { get; } + /// The artifact title. public string Title { get; } + /// The artifact description. public string Description { get; } + /// The artifact size in MB. public long? Size { get; } } diff --git a/sdk/disconnectedoperations/Azure.ResourceManager.DisconnectedOperations/src/Generated/Models/DisconnectedOperationsBillingModel.cs b/sdk/disconnectedoperations/Azure.ResourceManager.DisconnectedOperations/src/Generated/Models/DisconnectedOperationsBillingModel.cs index b2ece9d05944..dd0cb520e718 100644 --- a/sdk/disconnectedoperations/Azure.ResourceManager.DisconnectedOperations/src/Generated/Models/DisconnectedOperationsBillingModel.cs +++ b/sdk/disconnectedoperations/Azure.ResourceManager.DisconnectedOperations/src/Generated/Models/DisconnectedOperationsBillingModel.cs @@ -7,6 +7,7 @@ using System; using System.ComponentModel; +using Azure.ResourceManager.DisconnectedOperations; namespace Azure.ResourceManager.DisconnectedOperations.Models { @@ -14,35 +15,52 @@ namespace Azure.ResourceManager.DisconnectedOperations.Models public readonly partial struct DisconnectedOperationsBillingModel : IEquatable { private readonly string _value; + /// Billed on capacity. + private const string CapacityValue = "Capacity"; /// Initializes a new instance of . + /// The value. /// is null. public DisconnectedOperationsBillingModel(string value) { - _value = value ?? throw new ArgumentNullException(nameof(value)); - } + Argument.AssertNotNull(value, nameof(value)); - private const string CapacityValue = "Capacity"; + _value = value; + } /// Billed on capacity. public static DisconnectedOperationsBillingModel Capacity { get; } = new DisconnectedOperationsBillingModel(CapacityValue); + /// Determines if two values are the same. + /// The left value to compare. + /// The right value to compare. public static bool operator ==(DisconnectedOperationsBillingModel left, DisconnectedOperationsBillingModel 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 !=(DisconnectedOperationsBillingModel left, DisconnectedOperationsBillingModel right) => !left.Equals(right); - /// Converts a to a . + + /// Converts a string to a . + /// The value. public static implicit operator DisconnectedOperationsBillingModel(string value) => new DisconnectedOperationsBillingModel(value); - /// + /// Converts a string to a . + /// The value. + public static implicit operator DisconnectedOperationsBillingModel?(string value) => value == null ? null : new DisconnectedOperationsBillingModel(value); + + /// [EditorBrowsable(EditorBrowsableState.Never)] public override bool Equals(object obj) => obj is DisconnectedOperationsBillingModel other && Equals(other); - /// + + /// public bool Equals(DisconnectedOperationsBillingModel 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/disconnectedoperations/Azure.ResourceManager.DisconnectedOperations/src/Generated/Models/DisconnectedOperationsConnectionIntent.cs b/sdk/disconnectedoperations/Azure.ResourceManager.DisconnectedOperations/src/Generated/Models/DisconnectedOperationsConnectionIntent.cs index 465100890acd..76a1f5933f4c 100644 --- a/sdk/disconnectedoperations/Azure.ResourceManager.DisconnectedOperations/src/Generated/Models/DisconnectedOperationsConnectionIntent.cs +++ b/sdk/disconnectedoperations/Azure.ResourceManager.DisconnectedOperations/src/Generated/Models/DisconnectedOperationsConnectionIntent.cs @@ -7,6 +7,7 @@ using System; using System.ComponentModel; +using Azure.ResourceManager.DisconnectedOperations; namespace Azure.ResourceManager.DisconnectedOperations.Models { @@ -14,38 +15,57 @@ namespace Azure.ResourceManager.DisconnectedOperations.Models public readonly partial struct DisconnectedOperationsConnectionIntent : IEquatable { private readonly string _value; + /// Device is connected to cloud. + private const string ConnectedValue = "Connected"; + /// Device is disconnected from cloud. + private const string DisconnectedValue = "Disconnected"; /// Initializes a new instance of . + /// The value. /// is null. public DisconnectedOperationsConnectionIntent(string value) { - _value = value ?? throw new ArgumentNullException(nameof(value)); - } + Argument.AssertNotNull(value, nameof(value)); - private const string ConnectedValue = "Connected"; - private const string DisconnectedValue = "Disconnected"; + _value = value; + } /// Device is connected to cloud. public static DisconnectedOperationsConnectionIntent Connected { get; } = new DisconnectedOperationsConnectionIntent(ConnectedValue); + /// Device is disconnected from cloud. public static DisconnectedOperationsConnectionIntent Disconnected { get; } = new DisconnectedOperationsConnectionIntent(DisconnectedValue); + /// Determines if two values are the same. + /// The left value to compare. + /// The right value to compare. public static bool operator ==(DisconnectedOperationsConnectionIntent left, DisconnectedOperationsConnectionIntent 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 !=(DisconnectedOperationsConnectionIntent left, DisconnectedOperationsConnectionIntent right) => !left.Equals(right); - /// Converts a to a . + + /// Converts a string to a . + /// The value. public static implicit operator DisconnectedOperationsConnectionIntent(string value) => new DisconnectedOperationsConnectionIntent(value); - /// + /// Converts a string to a . + /// The value. + public static implicit operator DisconnectedOperationsConnectionIntent?(string value) => value == null ? null : new DisconnectedOperationsConnectionIntent(value); + + /// [EditorBrowsable(EditorBrowsableState.Never)] public override bool Equals(object obj) => obj is DisconnectedOperationsConnectionIntent other && Equals(other); - /// + + /// public bool Equals(DisconnectedOperationsConnectionIntent 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/disconnectedoperations/Azure.ResourceManager.DisconnectedOperations/src/Generated/Models/DisconnectedOperationsConnectionStatus.cs b/sdk/disconnectedoperations/Azure.ResourceManager.DisconnectedOperations/src/Generated/Models/DisconnectedOperationsConnectionStatus.cs index 9fa2258d193d..2370b3ecc87f 100644 --- a/sdk/disconnectedoperations/Azure.ResourceManager.DisconnectedOperations/src/Generated/Models/DisconnectedOperationsConnectionStatus.cs +++ b/sdk/disconnectedoperations/Azure.ResourceManager.DisconnectedOperations/src/Generated/Models/DisconnectedOperationsConnectionStatus.cs @@ -7,6 +7,7 @@ using System; using System.ComponentModel; +using Azure.ResourceManager.DisconnectedOperations; namespace Azure.ResourceManager.DisconnectedOperations.Models { @@ -14,38 +15,57 @@ namespace Azure.ResourceManager.DisconnectedOperations.Models public readonly partial struct DisconnectedOperationsConnectionStatus : IEquatable { private readonly string _value; + /// Device is connected to cloud. + private const string ConnectedValue = "Connected"; + /// Device is disconnected from cloud. + private const string DisconnectedValue = "Disconnected"; /// Initializes a new instance of . + /// The value. /// is null. public DisconnectedOperationsConnectionStatus(string value) { - _value = value ?? throw new ArgumentNullException(nameof(value)); - } + Argument.AssertNotNull(value, nameof(value)); - private const string ConnectedValue = "Connected"; - private const string DisconnectedValue = "Disconnected"; + _value = value; + } /// Device is connected to cloud. public static DisconnectedOperationsConnectionStatus Connected { get; } = new DisconnectedOperationsConnectionStatus(ConnectedValue); + /// Device is disconnected from cloud. public static DisconnectedOperationsConnectionStatus Disconnected { get; } = new DisconnectedOperationsConnectionStatus(DisconnectedValue); + /// Determines if two values are the same. + /// The left value to compare. + /// The right value to compare. public static bool operator ==(DisconnectedOperationsConnectionStatus left, DisconnectedOperationsConnectionStatus 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 !=(DisconnectedOperationsConnectionStatus left, DisconnectedOperationsConnectionStatus right) => !left.Equals(right); - /// Converts a to a . + + /// Converts a string to a . + /// The value. public static implicit operator DisconnectedOperationsConnectionStatus(string value) => new DisconnectedOperationsConnectionStatus(value); - /// + /// Converts a string to a . + /// The value. + public static implicit operator DisconnectedOperationsConnectionStatus?(string value) => value == null ? null : new DisconnectedOperationsConnectionStatus(value); + + /// [EditorBrowsable(EditorBrowsableState.Never)] public override bool Equals(object obj) => obj is DisconnectedOperationsConnectionStatus other && Equals(other); - /// + + /// public bool Equals(DisconnectedOperationsConnectionStatus 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/disconnectedoperations/Azure.ResourceManager.DisconnectedOperations/src/Generated/Models/DisconnectedOperationsImageDownloadResult.Serialization.cs b/sdk/disconnectedoperations/Azure.ResourceManager.DisconnectedOperations/src/Generated/Models/DisconnectedOperationsImageDownloadResult.Serialization.cs index 789e4afea141..18a3a2a19456 100644 --- a/sdk/disconnectedoperations/Azure.ResourceManager.DisconnectedOperations/src/Generated/Models/DisconnectedOperationsImageDownloadResult.Serialization.cs +++ b/sdk/disconnectedoperations/Azure.ResourceManager.DisconnectedOperations/src/Generated/Models/DisconnectedOperationsImageDownloadResult.Serialization.cs @@ -9,14 +9,16 @@ using System.ClientModel.Primitives; using System.Collections.Generic; using System.Text.Json; -using Azure.Core; +using Azure; +using Azure.ResourceManager.DisconnectedOperations; namespace Azure.ResourceManager.DisconnectedOperations.Models { - public partial class DisconnectedOperationsImageDownloadResult : IUtf8JsonSerializable, IJsonModel + /// The image download properties. + public partial class DisconnectedOperationsImageDownloadResult : IJsonModel { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); - + /// The JSON writer. + /// The client options for reading and writing models. void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) { writer.WriteStartObject(); @@ -28,12 +30,11 @@ void IJsonModel.Write(Utf8JsonWriter /// 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(DisconnectedOperationsImageDownloadResult)} does not support writing '{format}' format."); } - if (options.Format != "W" && Optional.IsDefined(ProvisioningState)) { writer.WritePropertyName("provisioningState"u8); @@ -68,8 +69,13 @@ protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWrit { writer.WritePropertyName("compatibleVersions"u8); writer.WriteStartArray(); - foreach (var item in CompatibleVersions) + foreach (string item in CompatibleVersions) { + if (item == null) + { + writer.WriteNullValue(); + continue; + } writer.WriteStringValue(item); } writer.WriteEndArray(); @@ -89,15 +95,15 @@ protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWrit writer.WritePropertyName("linkExpiry"u8); writer.WriteStringValue(LinkExpiry, "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); } @@ -106,22 +112,27 @@ protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWrit } } - DisconnectedOperationsImageDownloadResult IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + /// The JSON reader. + /// The client options for reading and writing models. + DisconnectedOperationsImageDownloadResult IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) => JsonModelCreateCore(ref reader, options); + + /// The JSON reader. + /// The client options for reading and writing models. + protected virtual DisconnectedOperationsImageDownloadResult 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(DisconnectedOperationsImageDownloadResult)} does not support reading '{format}' format."); } - using JsonDocument document = JsonDocument.ParseValue(ref reader); return DeserializeDisconnectedOperationsImageDownloadResult(document.RootElement, options); } - internal static DisconnectedOperationsImageDownloadResult DeserializeDisconnectedOperationsImageDownloadResult(JsonElement element, ModelReaderWriterOptions options = null) + /// The JSON element to deserialize. + /// The client options for reading and writing models. + internal static DisconnectedOperationsImageDownloadResult DeserializeDisconnectedOperationsImageDownloadResult(JsonElement element, ModelReaderWriterOptions options) { - options ??= ModelSerializationExtensions.WireOptions; - if (element.ValueKind == JsonValueKind.Null) { return null; @@ -130,103 +141,111 @@ internal static DisconnectedOperationsImageDownloadResult DeserializeDisconnecte string releaseVersion = default; string releaseDisplayName = default; string releaseNotes = default; - DateTimeOffset releaseDate = default; + DateTimeOffset releaseOn = default; DisconnectedOperationsReleaseType releaseType = default; IReadOnlyList compatibleVersions = default; string transactionId = default; Uri downloadLink = default; DateTimeOffset linkExpiry = 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("provisioningState"u8)) + if (prop.NameEquals("provisioningState"u8)) { - if (property.Value.ValueKind == JsonValueKind.Null) + if (prop.Value.ValueKind == JsonValueKind.Null) { continue; } - provisioningState = new DisconnectedOperationsResourceProvisioningState(property.Value.GetString()); + provisioningState = new DisconnectedOperationsResourceProvisioningState(prop.Value.GetString()); continue; } - if (property.NameEquals("releaseVersion"u8)) + if (prop.NameEquals("releaseVersion"u8)) { - releaseVersion = property.Value.GetString(); + releaseVersion = prop.Value.GetString(); continue; } - if (property.NameEquals("releaseDisplayName"u8)) + if (prop.NameEquals("releaseDisplayName"u8)) { - releaseDisplayName = property.Value.GetString(); + releaseDisplayName = prop.Value.GetString(); continue; } - if (property.NameEquals("releaseNotes"u8)) + if (prop.NameEquals("releaseNotes"u8)) { - releaseNotes = property.Value.GetString(); + releaseNotes = prop.Value.GetString(); continue; } - if (property.NameEquals("releaseDate"u8)) + if (prop.NameEquals("releaseDate"u8)) { - releaseDate = property.Value.GetDateTimeOffset("D"); + releaseOn = prop.Value.GetDateTimeOffset("D"); continue; } - if (property.NameEquals("releaseType"u8)) + if (prop.NameEquals("releaseType"u8)) { - releaseType = new DisconnectedOperationsReleaseType(property.Value.GetString()); + releaseType = new DisconnectedOperationsReleaseType(prop.Value.GetString()); continue; } - if (property.NameEquals("compatibleVersions"u8)) + if (prop.NameEquals("compatibleVersions"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()); + } } compatibleVersions = array; continue; } - if (property.NameEquals("transactionId"u8)) + if (prop.NameEquals("transactionId"u8)) { - transactionId = property.Value.GetString(); + transactionId = prop.Value.GetString(); continue; } - if (property.NameEquals("downloadLink"u8)) + if (prop.NameEquals("downloadLink"u8)) { - downloadLink = new Uri(property.Value.GetString()); + downloadLink = new Uri(prop.Value.GetString()); continue; } - if (property.NameEquals("linkExpiry"u8)) + if (prop.NameEquals("linkExpiry"u8)) { - linkExpiry = property.Value.GetDateTimeOffset("O"); + linkExpiry = 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 DisconnectedOperationsImageDownloadResult( provisioningState, releaseVersion, releaseDisplayName, releaseNotes, - releaseDate, + releaseOn, releaseType, compatibleVersions ?? new ChangeTrackingList(), transactionId, downloadLink, linkExpiry, - 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": @@ -236,15 +255,20 @@ BinaryData IPersistableModel.Write(Mo } } - DisconnectedOperationsImageDownloadResult 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. + DisconnectedOperationsImageDownloadResult IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) => PersistableModelCreateCore(data, options); + /// The data to parse. + /// The client options for reading and writing models. + protected virtual DisconnectedOperationsImageDownloadResult PersistableModelCreateCore(BinaryData data, ModelReaderWriterOptions options) + { + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; switch (format) { case "J": + using (JsonDocument document = JsonDocument.Parse(data, ModelSerializationExtensions.JsonDocumentOptions)) { - using JsonDocument document = JsonDocument.Parse(data, ModelSerializationExtensions.JsonDocumentOptions); return DeserializeDisconnectedOperationsImageDownloadResult(document.RootElement, options); } default: @@ -252,6 +276,14 @@ DisconnectedOperationsImageDownloadResult IPersistableModel The client options for reading and writing models. string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + + /// The to deserialize the from. + internal static DisconnectedOperationsImageDownloadResult FromResponse(Response response) + { + using JsonDocument document = JsonDocument.Parse(response.Content, ModelSerializationExtensions.JsonDocumentOptions); + return DeserializeDisconnectedOperationsImageDownloadResult(document.RootElement, ModelSerializationExtensions.WireOptions); + } } } diff --git a/sdk/disconnectedoperations/Azure.ResourceManager.DisconnectedOperations/src/Generated/Models/DisconnectedOperationsImageDownloadResult.cs b/sdk/disconnectedoperations/Azure.ResourceManager.DisconnectedOperations/src/Generated/Models/DisconnectedOperationsImageDownloadResult.cs index f12c782dbcb1..bf30673c32c7 100644 --- a/sdk/disconnectedoperations/Azure.ResourceManager.DisconnectedOperations/src/Generated/Models/DisconnectedOperationsImageDownloadResult.cs +++ b/sdk/disconnectedoperations/Azure.ResourceManager.DisconnectedOperations/src/Generated/Models/DisconnectedOperationsImageDownloadResult.cs @@ -7,64 +7,20 @@ using System; using System.Collections.Generic; +using Azure.ResourceManager.DisconnectedOperations; namespace Azure.ResourceManager.DisconnectedOperations.Models { /// The image download properties. public partial class DisconnectedOperationsImageDownloadResult { - /// - /// 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 version of the package in the format 1.1.1. - /// The release name. - /// The release notes. - /// The release date. - /// The release type. - /// The unique identifier of the download. - /// The download URI. - /// The download link expiry time. - internal DisconnectedOperationsImageDownloadResult(string releaseVersion, string releaseDisplayName, string releaseNotes, DateTimeOffset releaseOn, DisconnectedOperationsReleaseType releaseType, string transactionId, Uri downloadLink, DateTimeOffset linkExpiry) + internal DisconnectedOperationsImageDownloadResult() { - ReleaseVersion = releaseVersion; - ReleaseDisplayName = releaseDisplayName; - ReleaseNotes = releaseNotes; - ReleaseOn = releaseOn; - ReleaseType = releaseType; CompatibleVersions = new ChangeTrackingList(); - TransactionId = transactionId; - DownloadLink = downloadLink; - LinkExpiry = linkExpiry; } /// Initializes a new instance of . @@ -78,8 +34,8 @@ internal DisconnectedOperationsImageDownloadResult(string releaseVersion, string /// The unique identifier of the download. /// The download URI. /// The download link expiry time. - /// Keeps track of any properties unknown to the library. - internal DisconnectedOperationsImageDownloadResult(DisconnectedOperationsResourceProvisioningState? provisioningState, string releaseVersion, string releaseDisplayName, string releaseNotes, DateTimeOffset releaseOn, DisconnectedOperationsReleaseType releaseType, IReadOnlyList compatibleVersions, string transactionId, Uri downloadLink, DateTimeOffset linkExpiry, IDictionary serializedAdditionalRawData) + /// Keeps track of any properties unknown to the library. + internal DisconnectedOperationsImageDownloadResult(DisconnectedOperationsResourceProvisioningState? provisioningState, string releaseVersion, string releaseDisplayName, string releaseNotes, DateTimeOffset releaseOn, DisconnectedOperationsReleaseType releaseType, IReadOnlyList compatibleVersions, string transactionId, Uri downloadLink, DateTimeOffset linkExpiry, IDictionary additionalBinaryDataProperties) { ProvisioningState = provisioningState; ReleaseVersion = releaseVersion; @@ -91,32 +47,36 @@ internal DisconnectedOperationsImageDownloadResult(DisconnectedOperationsResourc TransactionId = transactionId; DownloadLink = downloadLink; LinkExpiry = linkExpiry; - _serializedAdditionalRawData = serializedAdditionalRawData; - } - - /// Initializes a new instance of for deserialization. - internal DisconnectedOperationsImageDownloadResult() - { + _additionalBinaryDataProperties = additionalBinaryDataProperties; } /// The resource provisioning state. public DisconnectedOperationsResourceProvisioningState? ProvisioningState { get; } + /// The version of the package in the format 1.1.1. public string ReleaseVersion { get; } + /// The release name. public string ReleaseDisplayName { get; } + /// The release notes. public string ReleaseNotes { get; } + /// The release date. public DateTimeOffset ReleaseOn { get; } + /// The release type. public DisconnectedOperationsReleaseType ReleaseType { get; } + /// The versions that are compatible for this update package. public IReadOnlyList CompatibleVersions { get; } + /// The unique identifier of the download. public string TransactionId { get; } + /// The download URI. public Uri DownloadLink { get; } + /// The download link expiry time. public DateTimeOffset LinkExpiry { get; } } diff --git a/sdk/disconnectedoperations/Azure.ResourceManager.DisconnectedOperations/src/Generated/Models/DisconnectedOperationsImageProperties.Serialization.cs b/sdk/disconnectedoperations/Azure.ResourceManager.DisconnectedOperations/src/Generated/Models/DisconnectedOperationsImageProperties.Serialization.cs index 32bac2a98e12..b8462e12cce3 100644 --- a/sdk/disconnectedoperations/Azure.ResourceManager.DisconnectedOperations/src/Generated/Models/DisconnectedOperationsImageProperties.Serialization.cs +++ b/sdk/disconnectedoperations/Azure.ResourceManager.DisconnectedOperations/src/Generated/Models/DisconnectedOperationsImageProperties.Serialization.cs @@ -9,14 +9,15 @@ using System.ClientModel.Primitives; using System.Collections.Generic; using System.Text.Json; -using Azure.Core; +using Azure.ResourceManager.DisconnectedOperations; namespace Azure.ResourceManager.DisconnectedOperations.Models { - public partial class DisconnectedOperationsImageProperties : IUtf8JsonSerializable, IJsonModel + /// The image properties. + public partial class DisconnectedOperationsImageProperties : IJsonModel { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); - + /// The JSON writer. + /// The client options for reading and writing models. void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) { writer.WriteStartObject(); @@ -28,12 +29,11 @@ void IJsonModel.Write(Utf8JsonWriter writ /// 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(DisconnectedOperationsImageProperties)} does not support writing '{format}' format."); } - if (options.Format != "W" && Optional.IsDefined(ProvisioningState)) { writer.WritePropertyName("provisioningState"u8); @@ -68,21 +68,26 @@ protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWrit { writer.WritePropertyName("compatibleVersions"u8); writer.WriteStartArray(); - foreach (var item in CompatibleVersions) + foreach (string item in CompatibleVersions) { + if (item == null) + { + writer.WriteNullValue(); + continue; + } writer.WriteStringValue(item); } writer.WriteEndArray(); } - if (options.Format != "W" && _serializedAdditionalRawData != null) + if (options.Format != "W" && _additionalBinaryDataProperties != null) { - foreach (var item in _serializedAdditionalRawData) + foreach (var item in _additionalBinaryDataProperties) { writer.WritePropertyName(item.Key); #if NET6_0_OR_GREATER - writer.WriteRawValue(item.Value); + writer.WriteRawValue(item.Value); #else - using (JsonDocument document = JsonDocument.Parse(item.Value, ModelSerializationExtensions.JsonDocumentOptions)) + using (JsonDocument document = JsonDocument.Parse(item.Value)) { JsonSerializer.Serialize(writer, document.RootElement); } @@ -91,22 +96,27 @@ protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWrit } } - DisconnectedOperationsImageProperties IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + /// The JSON reader. + /// The client options for reading and writing models. + DisconnectedOperationsImageProperties IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) => JsonModelCreateCore(ref reader, options); + + /// The JSON reader. + /// The client options for reading and writing models. + protected virtual DisconnectedOperationsImageProperties 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(DisconnectedOperationsImageProperties)} does not support reading '{format}' format."); } - using JsonDocument document = JsonDocument.ParseValue(ref reader); return DeserializeDisconnectedOperationsImageProperties(document.RootElement, options); } - internal static DisconnectedOperationsImageProperties DeserializeDisconnectedOperationsImageProperties(JsonElement element, ModelReaderWriterOptions options = null) + /// The JSON element to deserialize. + /// The client options for reading and writing models. + internal static DisconnectedOperationsImageProperties DeserializeDisconnectedOperationsImageProperties(JsonElement element, ModelReaderWriterOptions options) { - options ??= ModelSerializationExtensions.WireOptions; - if (element.ValueKind == JsonValueKind.Null) { return null; @@ -115,82 +125,90 @@ internal static DisconnectedOperationsImageProperties DeserializeDisconnectedOpe string releaseVersion = default; string releaseDisplayName = default; string releaseNotes = default; - DateTimeOffset releaseDate = default; + DateTimeOffset releaseOn = default; DisconnectedOperationsReleaseType releaseType = default; IReadOnlyList compatibleVersions = 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("provisioningState"u8)) + if (prop.NameEquals("provisioningState"u8)) { - if (property.Value.ValueKind == JsonValueKind.Null) + if (prop.Value.ValueKind == JsonValueKind.Null) { continue; } - provisioningState = new DisconnectedOperationsResourceProvisioningState(property.Value.GetString()); + provisioningState = new DisconnectedOperationsResourceProvisioningState(prop.Value.GetString()); continue; } - if (property.NameEquals("releaseVersion"u8)) + if (prop.NameEquals("releaseVersion"u8)) { - releaseVersion = property.Value.GetString(); + releaseVersion = prop.Value.GetString(); continue; } - if (property.NameEquals("releaseDisplayName"u8)) + if (prop.NameEquals("releaseDisplayName"u8)) { - releaseDisplayName = property.Value.GetString(); + releaseDisplayName = prop.Value.GetString(); continue; } - if (property.NameEquals("releaseNotes"u8)) + if (prop.NameEquals("releaseNotes"u8)) { - releaseNotes = property.Value.GetString(); + releaseNotes = prop.Value.GetString(); continue; } - if (property.NameEquals("releaseDate"u8)) + if (prop.NameEquals("releaseDate"u8)) { - releaseDate = property.Value.GetDateTimeOffset("D"); + releaseOn = prop.Value.GetDateTimeOffset("D"); continue; } - if (property.NameEquals("releaseType"u8)) + if (prop.NameEquals("releaseType"u8)) { - releaseType = new DisconnectedOperationsReleaseType(property.Value.GetString()); + releaseType = new DisconnectedOperationsReleaseType(prop.Value.GetString()); continue; } - if (property.NameEquals("compatibleVersions"u8)) + if (prop.NameEquals("compatibleVersions"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()); + } } compatibleVersions = array; continue; } if (options.Format != "W") { - rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + additionalBinaryDataProperties.Add(prop.Name, BinaryData.FromString(prop.Value.GetRawText())); } } - serializedAdditionalRawData = rawDataDictionary; return new DisconnectedOperationsImageProperties( provisioningState, releaseVersion, releaseDisplayName, releaseNotes, - releaseDate, + releaseOn, releaseType, compatibleVersions ?? 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": @@ -200,15 +218,20 @@ BinaryData IPersistableModel.Write(ModelR } } - DisconnectedOperationsImageProperties 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. + DisconnectedOperationsImageProperties IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) => PersistableModelCreateCore(data, options); + /// The data to parse. + /// The client options for reading and writing models. + protected virtual DisconnectedOperationsImageProperties PersistableModelCreateCore(BinaryData data, ModelReaderWriterOptions options) + { + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; switch (format) { case "J": + using (JsonDocument document = JsonDocument.Parse(data, ModelSerializationExtensions.JsonDocumentOptions)) { - using JsonDocument document = JsonDocument.Parse(data, ModelSerializationExtensions.JsonDocumentOptions); return DeserializeDisconnectedOperationsImageProperties(document.RootElement, options); } default: @@ -216,6 +239,7 @@ DisconnectedOperationsImageProperties IPersistableModel The client options for reading and writing models. string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; } } diff --git a/sdk/disconnectedoperations/Azure.ResourceManager.DisconnectedOperations/src/Generated/Models/DisconnectedOperationsImageProperties.cs b/sdk/disconnectedoperations/Azure.ResourceManager.DisconnectedOperations/src/Generated/Models/DisconnectedOperationsImageProperties.cs index 9129dbf3f245..ec439b016403 100644 --- a/sdk/disconnectedoperations/Azure.ResourceManager.DisconnectedOperations/src/Generated/Models/DisconnectedOperationsImageProperties.cs +++ b/sdk/disconnectedoperations/Azure.ResourceManager.DisconnectedOperations/src/Generated/Models/DisconnectedOperationsImageProperties.cs @@ -7,57 +7,19 @@ using System; using System.Collections.Generic; +using Azure.ResourceManager.DisconnectedOperations; namespace Azure.ResourceManager.DisconnectedOperations.Models { /// The image properties. public partial class DisconnectedOperationsImageProperties { - /// - /// 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 version of the package in the format 1.1.1. - /// The release name. - /// The release notes. - /// The release date. - /// The release type. - internal DisconnectedOperationsImageProperties(string releaseVersion, string releaseDisplayName, string releaseNotes, DateTimeOffset releaseOn, DisconnectedOperationsReleaseType releaseType) + internal DisconnectedOperationsImageProperties() { - ReleaseVersion = releaseVersion; - ReleaseDisplayName = releaseDisplayName; - ReleaseNotes = releaseNotes; - ReleaseOn = releaseOn; - ReleaseType = releaseType; CompatibleVersions = new ChangeTrackingList(); } @@ -69,8 +31,8 @@ internal DisconnectedOperationsImageProperties(string releaseVersion, string rel /// The release date. /// The release type. /// The versions that are compatible for this update package. - /// Keeps track of any properties unknown to the library. - internal DisconnectedOperationsImageProperties(DisconnectedOperationsResourceProvisioningState? provisioningState, string releaseVersion, string releaseDisplayName, string releaseNotes, DateTimeOffset releaseOn, DisconnectedOperationsReleaseType releaseType, IReadOnlyList compatibleVersions, IDictionary serializedAdditionalRawData) + /// Keeps track of any properties unknown to the library. + internal DisconnectedOperationsImageProperties(DisconnectedOperationsResourceProvisioningState? provisioningState, string releaseVersion, string releaseDisplayName, string releaseNotes, DateTimeOffset releaseOn, DisconnectedOperationsReleaseType releaseType, IReadOnlyList compatibleVersions, IDictionary additionalBinaryDataProperties) { ProvisioningState = provisioningState; ReleaseVersion = releaseVersion; @@ -79,26 +41,27 @@ internal DisconnectedOperationsImageProperties(DisconnectedOperationsResourcePro ReleaseOn = releaseOn; ReleaseType = releaseType; CompatibleVersions = compatibleVersions; - _serializedAdditionalRawData = serializedAdditionalRawData; - } - - /// Initializes a new instance of for deserialization. - internal DisconnectedOperationsImageProperties() - { + _additionalBinaryDataProperties = additionalBinaryDataProperties; } /// The resource provisioning state. public DisconnectedOperationsResourceProvisioningState? ProvisioningState { get; } + /// The version of the package in the format 1.1.1. public string ReleaseVersion { get; } + /// The release name. public string ReleaseDisplayName { get; } + /// The release notes. public string ReleaseNotes { get; } + /// The release date. public DateTimeOffset ReleaseOn { get; } + /// The release type. public DisconnectedOperationsReleaseType ReleaseType { get; } + /// The versions that are compatible for this update package. public IReadOnlyList CompatibleVersions { get; } } diff --git a/sdk/disconnectedoperations/Azure.ResourceManager.DisconnectedOperations/src/Generated/Models/DisconnectedOperationsRegistrationStatus.cs b/sdk/disconnectedoperations/Azure.ResourceManager.DisconnectedOperations/src/Generated/Models/DisconnectedOperationsRegistrationStatus.cs index 9e27c8e9c95c..20d500949ad0 100644 --- a/sdk/disconnectedoperations/Azure.ResourceManager.DisconnectedOperations/src/Generated/Models/DisconnectedOperationsRegistrationStatus.cs +++ b/sdk/disconnectedoperations/Azure.ResourceManager.DisconnectedOperations/src/Generated/Models/DisconnectedOperationsRegistrationStatus.cs @@ -7,6 +7,7 @@ using System; using System.ComponentModel; +using Azure.ResourceManager.DisconnectedOperations; namespace Azure.ResourceManager.DisconnectedOperations.Models { @@ -14,38 +15,57 @@ namespace Azure.ResourceManager.DisconnectedOperations.Models public readonly partial struct DisconnectedOperationsRegistrationStatus : IEquatable { private readonly string _value; + /// Device is registered to cloud. + private const string RegisteredValue = "Registered"; + /// Device is not registered to cloud. + private const string UnregisteredValue = "Unregistered"; /// Initializes a new instance of . + /// The value. /// is null. public DisconnectedOperationsRegistrationStatus(string value) { - _value = value ?? throw new ArgumentNullException(nameof(value)); - } + Argument.AssertNotNull(value, nameof(value)); - private const string RegisteredValue = "Registered"; - private const string UnregisteredValue = "Unregistered"; + _value = value; + } /// Device is registered to cloud. public static DisconnectedOperationsRegistrationStatus Registered { get; } = new DisconnectedOperationsRegistrationStatus(RegisteredValue); + /// Device is not registered to cloud. public static DisconnectedOperationsRegistrationStatus Unregistered { get; } = new DisconnectedOperationsRegistrationStatus(UnregisteredValue); + /// Determines if two values are the same. + /// The left value to compare. + /// The right value to compare. public static bool operator ==(DisconnectedOperationsRegistrationStatus left, DisconnectedOperationsRegistrationStatus 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 !=(DisconnectedOperationsRegistrationStatus left, DisconnectedOperationsRegistrationStatus right) => !left.Equals(right); - /// Converts a to a . + + /// Converts a string to a . + /// The value. public static implicit operator DisconnectedOperationsRegistrationStatus(string value) => new DisconnectedOperationsRegistrationStatus(value); - /// + /// Converts a string to a . + /// The value. + public static implicit operator DisconnectedOperationsRegistrationStatus?(string value) => value == null ? null : new DisconnectedOperationsRegistrationStatus(value); + + /// [EditorBrowsable(EditorBrowsableState.Never)] public override bool Equals(object obj) => obj is DisconnectedOperationsRegistrationStatus other && Equals(other); - /// + + /// public bool Equals(DisconnectedOperationsRegistrationStatus 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/disconnectedoperations/Azure.ResourceManager.DisconnectedOperations/src/Generated/Models/DisconnectedOperationsReleaseType.cs b/sdk/disconnectedoperations/Azure.ResourceManager.DisconnectedOperations/src/Generated/Models/DisconnectedOperationsReleaseType.cs index 35ed404f5820..66dd234acce3 100644 --- a/sdk/disconnectedoperations/Azure.ResourceManager.DisconnectedOperations/src/Generated/Models/DisconnectedOperationsReleaseType.cs +++ b/sdk/disconnectedoperations/Azure.ResourceManager.DisconnectedOperations/src/Generated/Models/DisconnectedOperationsReleaseType.cs @@ -7,6 +7,7 @@ using System; using System.ComponentModel; +using Azure.ResourceManager.DisconnectedOperations; namespace Azure.ResourceManager.DisconnectedOperations.Models { @@ -14,38 +15,57 @@ namespace Azure.ResourceManager.DisconnectedOperations.Models public readonly partial struct DisconnectedOperationsReleaseType : IEquatable { private readonly string _value; + /// Release is a new install. + private const string InstallValue = "Install"; + /// Release is update. + private const string UpdateValue = "Update"; /// Initializes a new instance of . + /// The value. /// is null. public DisconnectedOperationsReleaseType(string value) { - _value = value ?? throw new ArgumentNullException(nameof(value)); - } + Argument.AssertNotNull(value, nameof(value)); - private const string InstallValue = "Install"; - private const string UpdateValue = "Update"; + _value = value; + } /// Release is a new install. public static DisconnectedOperationsReleaseType Install { get; } = new DisconnectedOperationsReleaseType(InstallValue); + /// Release is update. public static DisconnectedOperationsReleaseType Update { get; } = new DisconnectedOperationsReleaseType(UpdateValue); + /// Determines if two values are the same. + /// The left value to compare. + /// The right value to compare. public static bool operator ==(DisconnectedOperationsReleaseType left, DisconnectedOperationsReleaseType 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 !=(DisconnectedOperationsReleaseType left, DisconnectedOperationsReleaseType right) => !left.Equals(right); - /// Converts a to a . + + /// Converts a string to a . + /// The value. public static implicit operator DisconnectedOperationsReleaseType(string value) => new DisconnectedOperationsReleaseType(value); - /// + /// Converts a string to a . + /// The value. + public static implicit operator DisconnectedOperationsReleaseType?(string value) => value == null ? null : new DisconnectedOperationsReleaseType(value); + + /// [EditorBrowsable(EditorBrowsableState.Never)] public override bool Equals(object obj) => obj is DisconnectedOperationsReleaseType other && Equals(other); - /// + + /// public bool Equals(DisconnectedOperationsReleaseType 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/disconnectedoperations/Azure.ResourceManager.DisconnectedOperations/src/Generated/Models/DisconnectedOperationsResourceProvisioningState.cs b/sdk/disconnectedoperations/Azure.ResourceManager.DisconnectedOperations/src/Generated/Models/DisconnectedOperationsResourceProvisioningState.cs index 0dc29a3de03d..ec682c122d4c 100644 --- a/sdk/disconnectedoperations/Azure.ResourceManager.DisconnectedOperations/src/Generated/Models/DisconnectedOperationsResourceProvisioningState.cs +++ b/sdk/disconnectedoperations/Azure.ResourceManager.DisconnectedOperations/src/Generated/Models/DisconnectedOperationsResourceProvisioningState.cs @@ -7,6 +7,7 @@ using System; using System.ComponentModel; +using Azure.ResourceManager.DisconnectedOperations; namespace Azure.ResourceManager.DisconnectedOperations.Models { @@ -14,41 +15,62 @@ namespace Azure.ResourceManager.DisconnectedOperations.Models public readonly partial struct DisconnectedOperationsResourceProvisioningState : IEquatable { private readonly string _value; + /// Resource has been created. + private const string SucceededValue = "Succeeded"; + /// Resource creation failed. + private const string FailedValue = "Failed"; + /// Resource creation was canceled. + private const string CanceledValue = "Canceled"; /// Initializes a new instance of . + /// The value. /// is null. public DisconnectedOperationsResourceProvisioningState(string value) { - _value = value ?? throw new ArgumentNullException(nameof(value)); - } + Argument.AssertNotNull(value, nameof(value)); - private const string SucceededValue = "Succeeded"; - private const string FailedValue = "Failed"; - private const string CanceledValue = "Canceled"; + _value = value; + } /// Resource has been created. public static DisconnectedOperationsResourceProvisioningState Succeeded { get; } = new DisconnectedOperationsResourceProvisioningState(SucceededValue); + /// Resource creation failed. public static DisconnectedOperationsResourceProvisioningState Failed { get; } = new DisconnectedOperationsResourceProvisioningState(FailedValue); + /// Resource creation was canceled. public static DisconnectedOperationsResourceProvisioningState Canceled { get; } = new DisconnectedOperationsResourceProvisioningState(CanceledValue); + /// Determines if two values are the same. + /// The left value to compare. + /// The right value to compare. public static bool operator ==(DisconnectedOperationsResourceProvisioningState left, DisconnectedOperationsResourceProvisioningState 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 !=(DisconnectedOperationsResourceProvisioningState left, DisconnectedOperationsResourceProvisioningState right) => !left.Equals(right); - /// Converts a to a . + + /// Converts a string to a . + /// The value. public static implicit operator DisconnectedOperationsResourceProvisioningState(string value) => new DisconnectedOperationsResourceProvisioningState(value); - /// + /// Converts a string to a . + /// The value. + public static implicit operator DisconnectedOperationsResourceProvisioningState?(string value) => value == null ? null : new DisconnectedOperationsResourceProvisioningState(value); + + /// [EditorBrowsable(EditorBrowsableState.Never)] public override bool Equals(object obj) => obj is DisconnectedOperationsResourceProvisioningState other && Equals(other); - /// + + /// public bool Equals(DisconnectedOperationsResourceProvisioningState 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/disconnectedoperations/Azure.ResourceManager.DisconnectedOperations/src/Generated/Models/ImageListResult.Serialization.cs b/sdk/disconnectedoperations/Azure.ResourceManager.DisconnectedOperations/src/Generated/Models/ImageListResult.Serialization.cs index c9fd538b4447..71260d077ad8 100644 --- a/sdk/disconnectedoperations/Azure.ResourceManager.DisconnectedOperations/src/Generated/Models/ImageListResult.Serialization.cs +++ b/sdk/disconnectedoperations/Azure.ResourceManager.DisconnectedOperations/src/Generated/Models/ImageListResult.Serialization.cs @@ -9,14 +9,21 @@ using System.ClientModel.Primitives; using System.Collections.Generic; using System.Text.Json; -using Azure.Core; +using Azure; +using Azure.ResourceManager.DisconnectedOperations; namespace Azure.ResourceManager.DisconnectedOperations.Models { - internal partial class ImageListResult : IUtf8JsonSerializable, IJsonModel + /// The response of a Image list operation. + internal partial class ImageListResult : IJsonModel { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + /// Initializes a new instance of for deserialization. + internal ImageListResult() + { + } + /// The JSON writer. + /// The client options for reading and writing models. void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) { writer.WriteStartObject(); @@ -28,15 +35,14 @@ void IJsonModel.Write(Utf8JsonWriter 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(ImageListResult)} does not support writing '{format}' format."); } - writer.WritePropertyName("value"u8); writer.WriteStartArray(); - foreach (var item in Value) + foreach (DisconnectedOperationsImageData item in Value) { writer.WriteObjectValue(item, options); } @@ -46,15 +52,15 @@ protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWrit writer.WritePropertyName("nextLink"u8); writer.WriteStringValue(NextLink.AbsoluteUri); } - if (options.Format != "W" && _serializedAdditionalRawData != null) + if (options.Format != "W" && _additionalBinaryDataProperties != null) { - foreach (var item in _serializedAdditionalRawData) + foreach (var item in _additionalBinaryDataProperties) { writer.WritePropertyName(item.Key); #if NET6_0_OR_GREATER - writer.WriteRawValue(item.Value); + writer.WriteRawValue(item.Value); #else - using (JsonDocument document = JsonDocument.Parse(item.Value, ModelSerializationExtensions.JsonDocumentOptions)) + using (JsonDocument document = JsonDocument.Parse(item.Value)) { JsonSerializer.Serialize(writer, document.RootElement); } @@ -63,64 +69,70 @@ protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWrit } } - ImageListResult IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + /// The JSON reader. + /// The client options for reading and writing models. + ImageListResult IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) => JsonModelCreateCore(ref reader, options); + + /// The JSON reader. + /// The client options for reading and writing models. + protected virtual ImageListResult 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(ImageListResult)} does not support reading '{format}' format."); } - using JsonDocument document = JsonDocument.ParseValue(ref reader); return DeserializeImageListResult(document.RootElement, options); } - internal static ImageListResult DeserializeImageListResult(JsonElement element, ModelReaderWriterOptions options = null) + /// The JSON element to deserialize. + /// The client options for reading and writing models. + internal static ImageListResult DeserializeImageListResult(JsonElement element, ModelReaderWriterOptions options) { - options ??= ModelSerializationExtensions.WireOptions; - if (element.ValueKind == JsonValueKind.Null) { return null; } - IReadOnlyList value = default; + IList value = default; Uri nextLink = default; - IDictionary serializedAdditionalRawData = default; - Dictionary rawDataDictionary = new Dictionary(); - foreach (var property in element.EnumerateObject()) + IDictionary additionalBinaryDataProperties = new ChangeTrackingDictionary(); + foreach (var prop in element.EnumerateObject()) { - if (property.NameEquals("value"u8)) + if (prop.NameEquals("value"u8)) { List array = new List(); - foreach (var item in property.Value.EnumerateArray()) + foreach (var item in prop.Value.EnumerateArray()) { array.Add(DisconnectedOperationsImageData.DeserializeDisconnectedOperationsImageData(item, options)); } value = array; continue; } - if (property.NameEquals("nextLink"u8)) + if (prop.NameEquals("nextLink"u8)) { - if (property.Value.ValueKind == JsonValueKind.Null) + if (prop.Value.ValueKind == JsonValueKind.Null) { continue; } - nextLink = new Uri(property.Value.GetString()); + nextLink = new Uri(prop.Value.GetString()); continue; } if (options.Format != "W") { - rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + additionalBinaryDataProperties.Add(prop.Name, BinaryData.FromString(prop.Value.GetRawText())); } } - serializedAdditionalRawData = rawDataDictionary; - return new ImageListResult(value, nextLink, serializedAdditionalRawData); + return new ImageListResult(value, nextLink, additionalBinaryDataProperties); } - BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) - { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + /// The client options for reading and writing models. + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) => PersistableModelWriteCore(options); + /// The client options for reading and writing models. + protected virtual BinaryData PersistableModelWriteCore(ModelReaderWriterOptions options) + { + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; switch (format) { case "J": @@ -130,15 +142,20 @@ BinaryData IPersistableModel.Write(ModelReaderWriterOptions opt } } - ImageListResult 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. + ImageListResult IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) => PersistableModelCreateCore(data, options); + /// The data to parse. + /// The client options for reading and writing models. + protected virtual ImageListResult PersistableModelCreateCore(BinaryData data, ModelReaderWriterOptions options) + { + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; switch (format) { case "J": + using (JsonDocument document = JsonDocument.Parse(data, ModelSerializationExtensions.JsonDocumentOptions)) { - using JsonDocument document = JsonDocument.Parse(data, ModelSerializationExtensions.JsonDocumentOptions); return DeserializeImageListResult(document.RootElement, options); } default: @@ -146,6 +163,14 @@ ImageListResult IPersistableModel.Create(BinaryData data, Model } } + /// The client options for reading and writing models. string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + + /// The to deserialize the from. + internal static ImageListResult FromResponse(Response response) + { + using JsonDocument document = JsonDocument.Parse(response.Content, ModelSerializationExtensions.JsonDocumentOptions); + return DeserializeImageListResult(document.RootElement, ModelSerializationExtensions.WireOptions); + } } } diff --git a/sdk/disconnectedoperations/Azure.ResourceManager.DisconnectedOperations/src/Generated/Models/ImageListResult.cs b/sdk/disconnectedoperations/Azure.ResourceManager.DisconnectedOperations/src/Generated/Models/ImageListResult.cs index 948cfca8edf4..163d0365bcfb 100644 --- a/sdk/disconnectedoperations/Azure.ResourceManager.DisconnectedOperations/src/Generated/Models/ImageListResult.cs +++ b/sdk/disconnectedoperations/Azure.ResourceManager.DisconnectedOperations/src/Generated/Models/ImageListResult.cs @@ -8,72 +8,37 @@ using System; using System.Collections.Generic; using System.Linq; +using Azure.ResourceManager.DisconnectedOperations; namespace Azure.ResourceManager.DisconnectedOperations.Models { /// The response of a Image list operation. internal partial class ImageListResult { - /// - /// 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 Image items on this page. - /// is null. internal ImageListResult(IEnumerable value) { - Argument.AssertNotNull(value, nameof(value)); - Value = value.ToList(); } /// Initializes a new instance of . /// The Image items on this page. /// The link to the next page of items. - /// Keeps track of any properties unknown to the library. - internal ImageListResult(IReadOnlyList value, Uri nextLink, IDictionary serializedAdditionalRawData) + /// Keeps track of any properties unknown to the library. + internal ImageListResult(IList value, Uri nextLink, IDictionary additionalBinaryDataProperties) { Value = value; NextLink = nextLink; - _serializedAdditionalRawData = serializedAdditionalRawData; - } - - /// Initializes a new instance of for deserialization. - internal ImageListResult() - { + _additionalBinaryDataProperties = additionalBinaryDataProperties; } /// The Image items on this page. - public IReadOnlyList Value { get; } + public IList Value { get; } + /// The link to the next page of items. public Uri NextLink { get; } } diff --git a/sdk/disconnectedoperations/Azure.ResourceManager.DisconnectedOperations/src/Generated/ProviderConstants.cs b/sdk/disconnectedoperations/Azure.ResourceManager.DisconnectedOperations/src/Generated/ProviderConstants.cs index 7e52e479bc84..4b8cf13821d7 100644 --- a/sdk/disconnectedoperations/Azure.ResourceManager.DisconnectedOperations/src/Generated/ProviderConstants.cs +++ b/sdk/disconnectedoperations/Azure.ResourceManager.DisconnectedOperations/src/Generated/ProviderConstants.cs @@ -9,8 +9,9 @@ namespace Azure.ResourceManager.DisconnectedOperations { - 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/disconnectedoperations/Azure.ResourceManager.DisconnectedOperations/src/Generated/RestOperations/ArtifactsRestOperations.cs b/sdk/disconnectedoperations/Azure.ResourceManager.DisconnectedOperations/src/Generated/RestOperations/ArtifactsRestOperations.cs index b9b3f8a1fe4c..aea80130018c 100644 --- a/sdk/disconnectedoperations/Azure.ResourceManager.DisconnectedOperations/src/Generated/RestOperations/ArtifactsRestOperations.cs +++ b/sdk/disconnectedoperations/Azure.ResourceManager.DisconnectedOperations/src/Generated/RestOperations/ArtifactsRestOperations.cs @@ -6,62 +6,47 @@ #nullable disable using System; -using System.Text.Json; -using System.Threading; -using System.Threading.Tasks; +using Azure; using Azure.Core; using Azure.Core.Pipeline; -using Azure.ResourceManager.DisconnectedOperations.Models; namespace Azure.ResourceManager.DisconnectedOperations { - 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. - /// The HTTP pipeline for sending and receiving REST requests and responses. - /// The application id to use for user agent. - /// Service host. - /// The API version to use for this operation. - /// or is null. - public ArtifactsRestOperations(HttpPipeline pipeline, string applicationId, Uri endpoint = null, string apiVersion = default) + /// Initializes a new instance of Artifacts for mocking. + protected Artifacts() { - _pipeline = pipeline ?? throw new ArgumentNullException(nameof(pipeline)); - _endpoint = endpoint ?? new Uri("https://management.azure.com"); - _apiVersion = apiVersion ?? "2025-06-01-preview"; - _userAgent = new TelemetryDetails(GetType().Assembly, applicationId); } - internal RequestUriBuilder CreateListByParentRequestUri(string subscriptionId, string resourceGroupName, string name, string imageName) + /// 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. + /// Service endpoint. + /// + internal Artifacts(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.Edge/disconnectedOperations/", false); - uri.AppendPath(name, true); - uri.AppendPath("/images/", false); - uri.AppendPath(imageName, true); - uri.AppendPath("/artifacts", false); - uri.AppendQuery("api-version", _apiVersion, true); - return uri; + ClientDiagnostics = clientDiagnostics; + _endpoint = endpoint; + Pipeline = pipeline; + _apiVersion = apiVersion; } - internal HttpMessage CreateListByParentRequest(string subscriptionId, string resourceGroupName, string name, string imageName) + /// 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 CreateGetByParentRequest(Guid subscriptionId, string resourceGroupName, string name, string imageName, RequestContext context) { - var message = _pipeline.CreateMessage(); - var request = message.Request; - request.Method = RequestMethod.Get; - var uri = new RawRequestUriBuilder(); + RawRequestUriBuilder uri = new RawRequestUriBuilder(); uri.Reset(_endpoint); uri.AppendPath("/subscriptions/", false); - uri.AppendPath(subscriptionId, true); + uri.AppendPath(subscriptionId.ToString(), true); uri.AppendPath("/resourceGroups/", false); uri.AppendPath(resourceGroupName, true); uri.AppendPath("/providers/Microsoft.Edge/disconnectedOperations/", false); @@ -70,192 +55,32 @@ internal HttpMessage CreateListByParentRequest(string subscriptionId, string res uri.AppendPath(imageName, true); uri.AppendPath("/artifacts", false); uri.AppendQuery("api-version", _apiVersion, true); + HttpMessage message = Pipeline.CreateMessage(); + Request request = message.Request; request.Uri = uri; - request.Headers.Add("Accept", "application/json"); - _userAgent.Apply(message); + request.Method = RequestMethod.Get; + request.Headers.SetValue("Accept", "application/json"); return message; } - /// List by parent. - /// The ID of the target subscription. The value must be an UUID. - /// The name of the resource group. The name is case insensitive. - /// Name of the resource. - /// The name of the Image. - /// The cancellation token to use. - /// , , or is null. - /// , , or is an empty string, and was expected to be non-empty. - public async Task> ListByParentAsync(string subscriptionId, string resourceGroupName, string name, string imageName, CancellationToken cancellationToken = default) - { - Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); - Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); - Argument.AssertNotNullOrEmpty(name, nameof(name)); - Argument.AssertNotNullOrEmpty(imageName, nameof(imageName)); - - using var message = CreateListByParentRequest(subscriptionId, resourceGroupName, name, imageName); - await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); - switch (message.Response.Status) - { - case 200: - { - ArtifactListResult value = default; - using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, ModelSerializationExtensions.JsonDocumentOptions, cancellationToken).ConfigureAwait(false); - value = ArtifactListResult.DeserializeArtifactListResult(document.RootElement); - return Response.FromValue(value, message.Response); - } - default: - throw new RequestFailedException(message.Response); - } - } - - /// List by parent. - /// The ID of the target subscription. The value must be an UUID. - /// The name of the resource group. The name is case insensitive. - /// Name of the resource. - /// The name of the Image. - /// The cancellation token to use. - /// , , or is null. - /// , , or is an empty string, and was expected to be non-empty. - public Response ListByParent(string subscriptionId, string resourceGroupName, string name, string imageName, CancellationToken cancellationToken = default) - { - Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); - Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); - Argument.AssertNotNullOrEmpty(name, nameof(name)); - Argument.AssertNotNullOrEmpty(imageName, nameof(imageName)); - - using var message = CreateListByParentRequest(subscriptionId, resourceGroupName, name, imageName); - _pipeline.Send(message, cancellationToken); - switch (message.Response.Status) - { - case 200: - { - ArtifactListResult value = default; - using var document = JsonDocument.Parse(message.Response.ContentStream, ModelSerializationExtensions.JsonDocumentOptions); - value = ArtifactListResult.DeserializeArtifactListResult(document.RootElement); - return Response.FromValue(value, message.Response); - } - default: - throw new RequestFailedException(message.Response); - } - } - - internal RequestUriBuilder CreateGetRequestUri(string subscriptionId, string resourceGroupName, string name, string imageName, string artifactName) + internal HttpMessage CreateNextGetByParentRequest(Uri nextPage, Guid subscriptionId, string resourceGroupName, string name, string imageName, 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.Edge/disconnectedOperations/", false); - uri.AppendPath(name, true); - uri.AppendPath("/images/", false); - uri.AppendPath(imageName, true); - uri.AppendPath("/artifacts/", false); - uri.AppendPath(artifactName, true); - uri.AppendQuery("api-version", _apiVersion, true); - return uri; - } - - internal HttpMessage CreateGetRequest(string subscriptionId, string resourceGroupName, string name, string imageName, string artifactName) - { - 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.Edge/disconnectedOperations/", false); - uri.AppendPath(name, true); - uri.AppendPath("/images/", false); - uri.AppendPath(imageName, true); - uri.AppendPath("/artifacts/", false); - uri.AppendPath(artifactName, true); - uri.AppendQuery("api-version", _apiVersion, true); + RawRequestUriBuilder uri = new RawRequestUriBuilder(); + uri.Reset(nextPage); + HttpMessage message = Pipeline.CreateMessage(); + Request request = message.Request; request.Uri = uri; - request.Headers.Add("Accept", "application/json"); - _userAgent.Apply(message); + request.Method = RequestMethod.Get; + request.Headers.SetValue("Accept", "application/json"); return message; } - /// Get the resource. - /// The ID of the target subscription. The value must be an UUID. - /// The name of the resource group. The name is case insensitive. - /// Name of the resource. - /// The name of the Image. - /// The name of the Artifact. - /// 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 imageName, string artifactName, CancellationToken cancellationToken = default) - { - Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); - Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); - Argument.AssertNotNullOrEmpty(name, nameof(name)); - Argument.AssertNotNullOrEmpty(imageName, nameof(imageName)); - Argument.AssertNotNullOrEmpty(artifactName, nameof(artifactName)); - - using var message = CreateGetRequest(subscriptionId, resourceGroupName, name, imageName, artifactName); - await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); - switch (message.Response.Status) - { - case 200: - { - DisconnectedOperationsArtifactData value = default; - using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, ModelSerializationExtensions.JsonDocumentOptions, cancellationToken).ConfigureAwait(false); - value = DisconnectedOperationsArtifactData.DeserializeDisconnectedOperationsArtifactData(document.RootElement); - return Response.FromValue(value, message.Response); - } - case 404: - return Response.FromValue((DisconnectedOperationsArtifactData)null, message.Response); - default: - throw new RequestFailedException(message.Response); - } - } - - /// Get the resource. - /// The ID of the target subscription. The value must be an UUID. - /// The name of the resource group. The name is case insensitive. - /// Name of the resource. - /// The name of the Image. - /// The name of the Artifact. - /// 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 imageName, string artifactName, CancellationToken cancellationToken = default) + internal HttpMessage CreateGetRequest(Guid subscriptionId, string resourceGroupName, string name, string imageName, string artifactName, RequestContext context) { - Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); - Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); - Argument.AssertNotNullOrEmpty(name, nameof(name)); - Argument.AssertNotNullOrEmpty(imageName, nameof(imageName)); - Argument.AssertNotNullOrEmpty(artifactName, nameof(artifactName)); - - using var message = CreateGetRequest(subscriptionId, resourceGroupName, name, imageName, artifactName); - _pipeline.Send(message, cancellationToken); - switch (message.Response.Status) - { - case 200: - { - DisconnectedOperationsArtifactData value = default; - using var document = JsonDocument.Parse(message.Response.ContentStream, ModelSerializationExtensions.JsonDocumentOptions); - value = DisconnectedOperationsArtifactData.DeserializeDisconnectedOperationsArtifactData(document.RootElement); - return Response.FromValue(value, message.Response); - } - case 404: - return Response.FromValue((DisconnectedOperationsArtifactData)null, message.Response); - default: - throw new RequestFailedException(message.Response); - } - } - - internal RequestUriBuilder CreateListDownloadUriRequestUri(string subscriptionId, string resourceGroupName, string name, string imageName, string artifactName) - { - var uri = new RawRequestUriBuilder(); + RawRequestUriBuilder uri = new RawRequestUriBuilder(); uri.Reset(_endpoint); uri.AppendPath("/subscriptions/", false); - uri.AppendPath(subscriptionId, true); + uri.AppendPath(subscriptionId.ToString(), true); uri.AppendPath("/resourceGroups/", false); uri.AppendPath(resourceGroupName, true); uri.AppendPath("/providers/Microsoft.Edge/disconnectedOperations/", false); @@ -264,20 +89,21 @@ internal RequestUriBuilder CreateListDownloadUriRequestUri(string subscriptionId uri.AppendPath(imageName, true); uri.AppendPath("/artifacts/", false); uri.AppendPath(artifactName, true); - uri.AppendPath("/listDownloadUri", false); 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 CreateListDownloadUriRequest(string subscriptionId, string resourceGroupName, string name, string imageName, string artifactName) + internal HttpMessage CreateGetDownloadUriRequest(Guid subscriptionId, string resourceGroupName, string name, string imageName, string artifactName, 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); + uri.AppendPath(subscriptionId.ToString(), true); uri.AppendPath("/resourceGroups/", false); uri.AppendPath(resourceGroupName, true); uri.AppendPath("/providers/Microsoft.Edge/disconnectedOperations/", false); @@ -288,164 +114,12 @@ internal HttpMessage CreateListDownloadUriRequest(string subscriptionId, string uri.AppendPath(artifactName, true); uri.AppendPath("/listDownloadUri", 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; - } - - /// Get artifact download link. - /// The ID of the target subscription. The value must be an UUID. - /// The name of the resource group. The name is case insensitive. - /// Name of the resource. - /// The name of the Image. - /// The name of the Artifact. - /// The cancellation token to use. - /// , , , or is null. - /// , , , or is an empty string, and was expected to be non-empty. - public async Task> ListDownloadUriAsync(string subscriptionId, string resourceGroupName, string name, string imageName, string artifactName, CancellationToken cancellationToken = default) - { - Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); - Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); - Argument.AssertNotNullOrEmpty(name, nameof(name)); - Argument.AssertNotNullOrEmpty(imageName, nameof(imageName)); - Argument.AssertNotNullOrEmpty(artifactName, nameof(artifactName)); - - using var message = CreateListDownloadUriRequest(subscriptionId, resourceGroupName, name, imageName, artifactName); - await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); - switch (message.Response.Status) - { - case 200: - { - DisconnectedOperationsArtifactDownloadResult value = default; - using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, ModelSerializationExtensions.JsonDocumentOptions, cancellationToken).ConfigureAwait(false); - value = DisconnectedOperationsArtifactDownloadResult.DeserializeDisconnectedOperationsArtifactDownloadResult(document.RootElement); - return Response.FromValue(value, message.Response); - } - default: - throw new RequestFailedException(message.Response); - } - } - - /// Get artifact download link. - /// The ID of the target subscription. The value must be an UUID. - /// The name of the resource group. The name is case insensitive. - /// Name of the resource. - /// The name of the Image. - /// The name of the Artifact. - /// The cancellation token to use. - /// , , , or is null. - /// , , , or is an empty string, and was expected to be non-empty. - public Response ListDownloadUri(string subscriptionId, string resourceGroupName, string name, string imageName, string artifactName, CancellationToken cancellationToken = default) - { - Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); - Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); - Argument.AssertNotNullOrEmpty(name, nameof(name)); - Argument.AssertNotNullOrEmpty(imageName, nameof(imageName)); - Argument.AssertNotNullOrEmpty(artifactName, nameof(artifactName)); - - using var message = CreateListDownloadUriRequest(subscriptionId, resourceGroupName, name, imageName, artifactName); - _pipeline.Send(message, cancellationToken); - switch (message.Response.Status) - { - case 200: - { - DisconnectedOperationsArtifactDownloadResult value = default; - using var document = JsonDocument.Parse(message.Response.ContentStream, ModelSerializationExtensions.JsonDocumentOptions); - value = DisconnectedOperationsArtifactDownloadResult.DeserializeDisconnectedOperationsArtifactDownloadResult(document.RootElement); - return Response.FromValue(value, message.Response); - } - default: - throw new RequestFailedException(message.Response); - } - } - - internal RequestUriBuilder CreateListByParentNextPageRequestUri(string nextLink, string subscriptionId, string resourceGroupName, string name, string imageName) - { - var uri = new RawRequestUriBuilder(); - uri.Reset(_endpoint); - uri.AppendRawNextLink(nextLink, false); - return uri; - } - - internal HttpMessage CreateListByParentNextPageRequest(string nextLink, string subscriptionId, string resourceGroupName, string name, string imageName) - { - 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 by parent. - /// The URL to the next page of results. - /// The ID of the target subscription. The value must be an UUID. - /// The name of the resource group. The name is case insensitive. - /// Name of the resource. - /// The name of the Image. - /// The cancellation token to use. - /// , , , or is null. - /// , , or is an empty string, and was expected to be non-empty. - public async Task> ListByParentNextPageAsync(string nextLink, string subscriptionId, string resourceGroupName, string name, string imageName, CancellationToken cancellationToken = default) - { - Argument.AssertNotNull(nextLink, nameof(nextLink)); - Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); - Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); - Argument.AssertNotNullOrEmpty(name, nameof(name)); - Argument.AssertNotNullOrEmpty(imageName, nameof(imageName)); - - using var message = CreateListByParentNextPageRequest(nextLink, subscriptionId, resourceGroupName, name, imageName); - await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); - switch (message.Response.Status) - { - case 200: - { - ArtifactListResult value = default; - using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, ModelSerializationExtensions.JsonDocumentOptions, cancellationToken).ConfigureAwait(false); - value = ArtifactListResult.DeserializeArtifactListResult(document.RootElement); - return Response.FromValue(value, message.Response); - } - default: - throw new RequestFailedException(message.Response); - } - } - - /// List by parent. - /// The URL to the next page of results. - /// The ID of the target subscription. The value must be an UUID. - /// The name of the resource group. The name is case insensitive. - /// Name of the resource. - /// The name of the Image. - /// The cancellation token to use. - /// , , , or is null. - /// , , or is an empty string, and was expected to be non-empty. - public Response ListByParentNextPage(string nextLink, string subscriptionId, string resourceGroupName, string name, string imageName, CancellationToken cancellationToken = default) - { - Argument.AssertNotNull(nextLink, nameof(nextLink)); - Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); - Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); - Argument.AssertNotNullOrEmpty(name, nameof(name)); - Argument.AssertNotNullOrEmpty(imageName, nameof(imageName)); - - using var message = CreateListByParentNextPageRequest(nextLink, subscriptionId, resourceGroupName, name, imageName); - _pipeline.Send(message, cancellationToken); - switch (message.Response.Status) - { - case 200: - { - ArtifactListResult value = default; - using var document = JsonDocument.Parse(message.Response.ContentStream, ModelSerializationExtensions.JsonDocumentOptions); - value = ArtifactListResult.DeserializeArtifactListResult(document.RootElement); - return Response.FromValue(value, message.Response); - } - default: - throw new RequestFailedException(message.Response); - } - } } } diff --git a/sdk/disconnectedoperations/Azure.ResourceManager.DisconnectedOperations/src/Generated/RestOperations/DisconnectedOperationsOprsRestOperations.cs b/sdk/disconnectedoperations/Azure.ResourceManager.DisconnectedOperations/src/Generated/RestOperations/DisconnectedOperationsOprsRestOperations.cs new file mode 100644 index 000000000000..d39cd0cf2737 --- /dev/null +++ b/sdk/disconnectedoperations/Azure.ResourceManager.DisconnectedOperations/src/Generated/RestOperations/DisconnectedOperationsOprsRestOperations.cs @@ -0,0 +1,201 @@ +// 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.DisconnectedOperations +{ + internal partial class DisconnectedOperationsOprs + { + private readonly Uri _endpoint; + private readonly string _apiVersion; + + /// Initializes a new instance of DisconnectedOperationsOprs for mocking. + protected DisconnectedOperationsOprs() + { + } + + /// Initializes a new instance of DisconnectedOperationsOprs. + /// 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 DisconnectedOperationsOprs(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(Guid subscriptionId, string resourceGroupName, string name, RequestContext context) + { + RawRequestUriBuilder uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/subscriptions/", false); + uri.AppendPath(subscriptionId.ToString(), true); + uri.AppendPath("/resourceGroups/", false); + uri.AppendPath(resourceGroupName, true); + uri.AppendPath("/providers/Microsoft.Edge/disconnectedOperations/", 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.Get; + request.Headers.SetValue("Accept", "application/json"); + return message; + } + + internal HttpMessage CreateCreateOrUpdateRequest(Guid subscriptionId, string resourceGroupName, string name, RequestContent content, RequestContext context) + { + RawRequestUriBuilder uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/subscriptions/", false); + uri.AppendPath(subscriptionId.ToString(), true); + uri.AppendPath("/resourceGroups/", false); + uri.AppendPath(resourceGroupName, true); + uri.AppendPath("/providers/Microsoft.Edge/disconnectedOperations/", 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(Guid subscriptionId, string resourceGroupName, string name, RequestContent content, RequestContext context) + { + RawRequestUriBuilder uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/subscriptions/", false); + uri.AppendPath(subscriptionId.ToString(), true); + uri.AppendPath("/resourceGroups/", false); + uri.AppendPath(resourceGroupName, true); + uri.AppendPath("/providers/Microsoft.Edge/disconnectedOperations/", 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(Guid subscriptionId, string resourceGroupName, string name, RequestContext context) + { + RawRequestUriBuilder uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/subscriptions/", false); + uri.AppendPath(subscriptionId.ToString(), true); + uri.AppendPath("/resourceGroups/", false); + uri.AppendPath(resourceGroupName, true); + uri.AppendPath("/providers/Microsoft.Edge/disconnectedOperations/", 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(Guid subscriptionId, string resourceGroupName, RequestContext context) + { + RawRequestUriBuilder uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/subscriptions/", false); + uri.AppendPath(subscriptionId.ToString(), true); + uri.AppendPath("/resourceGroups/", false); + uri.AppendPath(resourceGroupName, true); + uri.AppendPath("/providers/Microsoft.Edge/disconnectedOperations", false); + uri.AppendQuery("api-version", _apiVersion, 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, Guid subscriptionId, string resourceGroupName, RequestContext context) + { + RawRequestUriBuilder uri = new RawRequestUriBuilder(); + uri.Reset(nextPage); + HttpMessage message = Pipeline.CreateMessage(); + Request request = message.Request; + request.Uri = uri; + request.Method = RequestMethod.Get; + request.Headers.SetValue("Accept", "application/json"); + return message; + } + + internal HttpMessage CreateGetBySubscriptionRequest(Guid subscriptionId, RequestContext context) + { + RawRequestUriBuilder uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/subscriptions/", false); + uri.AppendPath(subscriptionId.ToString(), true); + uri.AppendPath("/providers/Microsoft.Edge/disconnectedOperations", false); + uri.AppendQuery("api-version", _apiVersion, 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, Guid subscriptionId, RequestContext context) + { + RawRequestUriBuilder uri = new RawRequestUriBuilder(); + uri.Reset(nextPage); + HttpMessage message = Pipeline.CreateMessage(); + Request request = message.Request; + request.Uri = uri; + request.Method = RequestMethod.Get; + request.Headers.SetValue("Accept", "application/json"); + return message; + } + + internal HttpMessage CreateGetDeploymentManifestRequest(Guid subscriptionId, string resourceGroupName, string name, RequestContext context) + { + RawRequestUriBuilder uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/subscriptions/", false); + uri.AppendPath(subscriptionId.ToString(), true); + uri.AppendPath("/resourceGroups/", false); + uri.AppendPath(resourceGroupName, true); + uri.AppendPath("/providers/Microsoft.Edge/disconnectedOperations/", false); + uri.AppendPath(name, true); + uri.AppendPath("/listDeploymentManifest", 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; + } + } +} diff --git a/sdk/disconnectedoperations/Azure.ResourceManager.DisconnectedOperations/src/Generated/RestOperations/DisconnectedRestOperations.cs b/sdk/disconnectedoperations/Azure.ResourceManager.DisconnectedOperations/src/Generated/RestOperations/DisconnectedRestOperations.cs deleted file mode 100644 index 6df7233c3c25..000000000000 --- a/sdk/disconnectedoperations/Azure.ResourceManager.DisconnectedOperations/src/Generated/RestOperations/DisconnectedRestOperations.cs +++ /dev/null @@ -1,824 +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.DisconnectedOperations.Models; - -namespace Azure.ResourceManager.DisconnectedOperations -{ - internal partial class DisconnectedRestOperations - { - private readonly TelemetryDetails _userAgent; - private readonly HttpPipeline _pipeline; - private readonly Uri _endpoint; - private readonly string _apiVersion; - - /// Initializes a new instance of DisconnectedRestOperations. - /// The HTTP pipeline for sending and receiving REST requests and responses. - /// The application id to use for user agent. - /// Service host. - /// The API version to use for this operation. - /// or is null. - public DisconnectedRestOperations(HttpPipeline pipeline, string applicationId, Uri endpoint = null, string apiVersion = default) - { - _pipeline = pipeline ?? throw new ArgumentNullException(nameof(pipeline)); - _endpoint = endpoint ?? new Uri("https://management.azure.com"); - _apiVersion = apiVersion ?? "2025-06-01-preview"; - _userAgent = new TelemetryDetails(GetType().Assembly, applicationId); - } - - internal RequestUriBuilder CreateGetRequestUri(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.Edge/disconnectedOperations/", false); - uri.AppendPath(name, true); - uri.AppendQuery("api-version", _apiVersion, true); - return uri; - } - - internal HttpMessage CreateGetRequest(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.AppendPath("/subscriptions/", false); - uri.AppendPath(subscriptionId, true); - uri.AppendPath("/resourceGroups/", false); - uri.AppendPath(resourceGroupName, true); - uri.AppendPath("/providers/Microsoft.Edge/disconnectedOperations/", 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 a DisconnectedOperation. - /// The ID of the target subscription. The value must be an UUID. - /// The name of the resource group. The name is case insensitive. - /// Name of the resource. - /// 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, 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); - await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); - switch (message.Response.Status) - { - case 200: - { - DisconnectedOperationData value = default; - using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, ModelSerializationExtensions.JsonDocumentOptions, cancellationToken).ConfigureAwait(false); - value = DisconnectedOperationData.DeserializeDisconnectedOperationData(document.RootElement); - return Response.FromValue(value, message.Response); - } - case 404: - return Response.FromValue((DisconnectedOperationData)null, message.Response); - default: - throw new RequestFailedException(message.Response); - } - } - - /// Get a DisconnectedOperation. - /// The ID of the target subscription. The value must be an UUID. - /// The name of the resource group. The name is case insensitive. - /// Name of the resource. - /// 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, 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); - _pipeline.Send(message, cancellationToken); - switch (message.Response.Status) - { - case 200: - { - DisconnectedOperationData value = default; - using var document = JsonDocument.Parse(message.Response.ContentStream, ModelSerializationExtensions.JsonDocumentOptions); - value = DisconnectedOperationData.DeserializeDisconnectedOperationData(document.RootElement); - return Response.FromValue(value, message.Response); - } - case 404: - return Response.FromValue((DisconnectedOperationData)null, message.Response); - default: - throw new RequestFailedException(message.Response); - } - } - - internal RequestUriBuilder CreateCreateOrUpdateRequestUri(string subscriptionId, string resourceGroupName, string name, DisconnectedOperationData 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.Edge/disconnectedOperations/", false); - uri.AppendPath(name, true); - uri.AppendQuery("api-version", _apiVersion, true); - return uri; - } - - internal HttpMessage CreateCreateOrUpdateRequest(string subscriptionId, string resourceGroupName, string name, DisconnectedOperationData 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.Edge/disconnectedOperations/", 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 a DisconnectedOperation. - /// The ID of the target subscription. The value must be an UUID. - /// The name of the resource group. The name is case insensitive. - /// Name of the resource. - /// Resource create parameters. - /// The cancellation token to use. - /// , , or is null. - /// , or is an empty string, and was expected to be non-empty. - public async Task CreateOrUpdateAsync(string subscriptionId, string resourceGroupName, string name, DisconnectedOperationData 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: - return message.Response; - default: - throw new RequestFailedException(message.Response); - } - } - - /// Create a DisconnectedOperation. - /// The ID of the target subscription. The value must be an UUID. - /// The name of the resource group. The name is case insensitive. - /// Name of the resource. - /// Resource create parameters. - /// The cancellation token to use. - /// , , or is null. - /// , or is an empty string, and was expected to be non-empty. - public Response CreateOrUpdate(string subscriptionId, string resourceGroupName, string name, DisconnectedOperationData 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: - return message.Response; - default: - throw new RequestFailedException(message.Response); - } - } - - internal RequestUriBuilder CreateUpdateRequestUri(string subscriptionId, string resourceGroupName, string name, DisconnectedOperationPatch 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.Edge/disconnectedOperations/", false); - uri.AppendPath(name, true); - uri.AppendQuery("api-version", _apiVersion, true); - return uri; - } - - internal HttpMessage CreateUpdateRequest(string subscriptionId, string resourceGroupName, string name, DisconnectedOperationPatch 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.Edge/disconnectedOperations/", 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; - } - - /// Update a DisconnectedOperation. - /// The ID of the target subscription. The value must be an UUID. - /// The name of the resource group. The name is case insensitive. - /// Name of the resource. - /// The resource properties to be updated. - /// The cancellation token to use. - /// , , or is null. - /// , or is an empty string, and was expected to be non-empty. - public async Task> UpdateAsync(string subscriptionId, string resourceGroupName, string name, DisconnectedOperationPatch 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: - { - DisconnectedOperationData value = default; - using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, ModelSerializationExtensions.JsonDocumentOptions, cancellationToken).ConfigureAwait(false); - value = DisconnectedOperationData.DeserializeDisconnectedOperationData(document.RootElement); - return Response.FromValue(value, message.Response); - } - default: - throw new RequestFailedException(message.Response); - } - } - - /// Update a DisconnectedOperation. - /// The ID of the target subscription. The value must be an UUID. - /// The name of the resource group. The name is case insensitive. - /// Name of the resource. - /// The resource properties to be updated. - /// The cancellation token to use. - /// , , or is null. - /// , or is an empty string, and was expected to be non-empty. - public Response Update(string subscriptionId, string resourceGroupName, string name, DisconnectedOperationPatch 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: - { - DisconnectedOperationData value = default; - using var document = JsonDocument.Parse(message.Response.ContentStream, ModelSerializationExtensions.JsonDocumentOptions); - value = DisconnectedOperationData.DeserializeDisconnectedOperationData(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.Edge/disconnectedOperations/", 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.Edge/disconnectedOperations/", false); - uri.AppendPath(name, true); - uri.AppendQuery("api-version", _apiVersion, true); - request.Uri = uri; - _userAgent.Apply(message); - return message; - } - - /// Delete a DisconnectedOperation. - /// The ID of the target subscription. The value must be an UUID. - /// The name of the resource group. The name is case insensitive. - /// Name of the resource. - /// 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 202: - case 204: - return message.Response; - default: - throw new RequestFailedException(message.Response); - } - } - - /// Delete a DisconnectedOperation. - /// The ID of the target subscription. The value must be an UUID. - /// The name of the resource group. The name is case insensitive. - /// Name of the resource. - /// 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 202: - case 204: - return message.Response; - default: - throw new RequestFailedException(message.Response); - } - } - - internal RequestUriBuilder CreateListByResourceGroupRequestUri(string subscriptionId, string resourceGroupName) - { - 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.Edge/disconnectedOperations", false); - uri.AppendQuery("api-version", _apiVersion, true); - return uri; - } - - internal HttpMessage CreateListByResourceGroupRequest(string subscriptionId, string resourceGroupName) - { - var message = _pipeline.CreateMessage(); - var request = message.Request; - request.Method = RequestMethod.Get; - var uri = new RawRequestUriBuilder(); - uri.Reset(_endpoint); - uri.AppendPath("/subscriptions/", false); - uri.AppendPath(subscriptionId, true); - uri.AppendPath("/resourceGroups/", false); - uri.AppendPath(resourceGroupName, true); - uri.AppendPath("/providers/Microsoft.Edge/disconnectedOperations", false); - uri.AppendQuery("api-version", _apiVersion, true); - request.Uri = uri; - request.Headers.Add("Accept", "application/json"); - _userAgent.Apply(message); - return message; - } - - /// List DisconnectedOperation resources by resource group. - /// The ID of the target subscription. The value must be an UUID. - /// The name of the resource group. The name is case insensitive. - /// The cancellation token to use. - /// or is null. - /// or is an empty string, and was expected to be non-empty. - public async Task> ListByResourceGroupAsync(string subscriptionId, string resourceGroupName, CancellationToken cancellationToken = default) - { - Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); - Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); - - using var message = CreateListByResourceGroupRequest(subscriptionId, resourceGroupName); - await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); - switch (message.Response.Status) - { - case 200: - { - DisconnectedOperationListResult value = default; - using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, ModelSerializationExtensions.JsonDocumentOptions, cancellationToken).ConfigureAwait(false); - value = DisconnectedOperationListResult.DeserializeDisconnectedOperationListResult(document.RootElement); - return Response.FromValue(value, message.Response); - } - default: - throw new RequestFailedException(message.Response); - } - } - - /// List DisconnectedOperation resources by resource group. - /// The ID of the target subscription. The value must be an UUID. - /// The name of the resource group. The name is case insensitive. - /// The cancellation token to use. - /// or is null. - /// or is an empty string, and was expected to be non-empty. - public Response ListByResourceGroup(string subscriptionId, string resourceGroupName, CancellationToken cancellationToken = default) - { - Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); - Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); - - using var message = CreateListByResourceGroupRequest(subscriptionId, resourceGroupName); - _pipeline.Send(message, cancellationToken); - switch (message.Response.Status) - { - case 200: - { - DisconnectedOperationListResult value = default; - using var document = JsonDocument.Parse(message.Response.ContentStream, ModelSerializationExtensions.JsonDocumentOptions); - value = DisconnectedOperationListResult.DeserializeDisconnectedOperationListResult(document.RootElement); - return Response.FromValue(value, message.Response); - } - default: - throw new RequestFailedException(message.Response); - } - } - - internal RequestUriBuilder CreateListBySubscriptionRequestUri(string subscriptionId) - { - var uri = new RawRequestUriBuilder(); - uri.Reset(_endpoint); - uri.AppendPath("/subscriptions/", false); - uri.AppendPath(subscriptionId, true); - uri.AppendPath("/providers/Microsoft.Edge/disconnectedOperations", false); - uri.AppendQuery("api-version", _apiVersion, true); - return uri; - } - - internal HttpMessage CreateListBySubscriptionRequest(string subscriptionId) - { - 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.Edge/disconnectedOperations", false); - uri.AppendQuery("api-version", _apiVersion, true); - request.Uri = uri; - request.Headers.Add("Accept", "application/json"); - _userAgent.Apply(message); - return message; - } - - /// List DisconnectedOperation resources by subscription ID. - /// The ID of the target subscription. The value must be an UUID. - /// The cancellation token to use. - /// is null. - /// is an empty string, and was expected to be non-empty. - public async Task> ListBySubscriptionAsync(string subscriptionId, CancellationToken cancellationToken = default) - { - Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); - - using var message = CreateListBySubscriptionRequest(subscriptionId); - await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); - switch (message.Response.Status) - { - case 200: - { - DisconnectedOperationListResult value = default; - using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, ModelSerializationExtensions.JsonDocumentOptions, cancellationToken).ConfigureAwait(false); - value = DisconnectedOperationListResult.DeserializeDisconnectedOperationListResult(document.RootElement); - return Response.FromValue(value, message.Response); - } - default: - throw new RequestFailedException(message.Response); - } - } - - /// List DisconnectedOperation resources by subscription ID. - /// The ID of the target subscription. The value must be an UUID. - /// The cancellation token to use. - /// is null. - /// is an empty string, and was expected to be non-empty. - public Response ListBySubscription(string subscriptionId, CancellationToken cancellationToken = default) - { - Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); - - using var message = CreateListBySubscriptionRequest(subscriptionId); - _pipeline.Send(message, cancellationToken); - switch (message.Response.Status) - { - case 200: - { - DisconnectedOperationListResult value = default; - using var document = JsonDocument.Parse(message.Response.ContentStream, ModelSerializationExtensions.JsonDocumentOptions); - value = DisconnectedOperationListResult.DeserializeDisconnectedOperationListResult(document.RootElement); - return Response.FromValue(value, message.Response); - } - default: - throw new RequestFailedException(message.Response); - } - } - - internal RequestUriBuilder CreateListDeploymentManifestRequestUri(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.Edge/disconnectedOperations/", false); - uri.AppendPath(name, true); - uri.AppendPath("/listDeploymentManifest", false); - uri.AppendQuery("api-version", _apiVersion, true); - return uri; - } - - internal HttpMessage CreateListDeploymentManifestRequest(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.Edge/disconnectedOperations/", false); - uri.AppendPath(name, true); - uri.AppendPath("/listDeploymentManifest", false); - uri.AppendQuery("api-version", _apiVersion, true); - request.Uri = uri; - request.Headers.Add("Accept", "application/json"); - _userAgent.Apply(message); - return message; - } - - /// get deployment manifest. - /// The ID of the target subscription. The value must be an UUID. - /// The name of the resource group. The name is case insensitive. - /// Name of the resource. - /// The cancellation token to use. - /// , or is null. - /// , or is an empty string, and was expected to be non-empty. - public async Task> ListDeploymentManifestAsync(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 = CreateListDeploymentManifestRequest(subscriptionId, resourceGroupName, name); - await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); - switch (message.Response.Status) - { - case 200: - { - DisconnectedOperationDeploymentManifest value = default; - using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, ModelSerializationExtensions.JsonDocumentOptions, cancellationToken).ConfigureAwait(false); - value = DisconnectedOperationDeploymentManifest.DeserializeDisconnectedOperationDeploymentManifest(document.RootElement); - return Response.FromValue(value, message.Response); - } - default: - throw new RequestFailedException(message.Response); - } - } - - /// get deployment manifest. - /// The ID of the target subscription. The value must be an UUID. - /// The name of the resource group. The name is case insensitive. - /// Name of the resource. - /// The cancellation token to use. - /// , or is null. - /// , or is an empty string, and was expected to be non-empty. - public Response ListDeploymentManifest(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 = CreateListDeploymentManifestRequest(subscriptionId, resourceGroupName, name); - _pipeline.Send(message, cancellationToken); - switch (message.Response.Status) - { - case 200: - { - DisconnectedOperationDeploymentManifest value = default; - using var document = JsonDocument.Parse(message.Response.ContentStream, ModelSerializationExtensions.JsonDocumentOptions); - value = DisconnectedOperationDeploymentManifest.DeserializeDisconnectedOperationDeploymentManifest(document.RootElement); - return Response.FromValue(value, message.Response); - } - default: - throw new RequestFailedException(message.Response); - } - } - - internal RequestUriBuilder CreateListByResourceGroupNextPageRequestUri(string nextLink, string subscriptionId, string resourceGroupName) - { - var uri = new RawRequestUriBuilder(); - uri.Reset(_endpoint); - uri.AppendRawNextLink(nextLink, false); - return uri; - } - - internal HttpMessage CreateListByResourceGroupNextPageRequest(string nextLink, string subscriptionId, string resourceGroupName) - { - var message = _pipeline.CreateMessage(); - var request = message.Request; - request.Method = RequestMethod.Get; - var uri = new RawRequestUriBuilder(); - uri.Reset(_endpoint); - uri.AppendRawNextLink(nextLink, false); - request.Uri = uri; - request.Headers.Add("Accept", "application/json"); - _userAgent.Apply(message); - return message; - } - - /// List DisconnectedOperation resources by resource group. - /// The URL to the next page of results. - /// The ID of the target subscription. The value must be an UUID. - /// The name of the resource group. The name is case insensitive. - /// The cancellation token to use. - /// , or is null. - /// or is an empty string, and was expected to be non-empty. - public async Task> ListByResourceGroupNextPageAsync(string nextLink, string subscriptionId, string resourceGroupName, CancellationToken cancellationToken = default) - { - Argument.AssertNotNull(nextLink, nameof(nextLink)); - Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); - Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); - - using var message = CreateListByResourceGroupNextPageRequest(nextLink, subscriptionId, resourceGroupName); - await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); - switch (message.Response.Status) - { - case 200: - { - DisconnectedOperationListResult value = default; - using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, ModelSerializationExtensions.JsonDocumentOptions, cancellationToken).ConfigureAwait(false); - value = DisconnectedOperationListResult.DeserializeDisconnectedOperationListResult(document.RootElement); - return Response.FromValue(value, message.Response); - } - default: - throw new RequestFailedException(message.Response); - } - } - - /// List DisconnectedOperation resources by resource group. - /// The URL to the next page of results. - /// The ID of the target subscription. The value must be an UUID. - /// The name of the resource group. The name is case insensitive. - /// The cancellation token to use. - /// , or is null. - /// or is an empty string, and was expected to be non-empty. - public Response ListByResourceGroupNextPage(string nextLink, string subscriptionId, string resourceGroupName, CancellationToken cancellationToken = default) - { - Argument.AssertNotNull(nextLink, nameof(nextLink)); - Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); - Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); - - using var message = CreateListByResourceGroupNextPageRequest(nextLink, subscriptionId, resourceGroupName); - _pipeline.Send(message, cancellationToken); - switch (message.Response.Status) - { - case 200: - { - DisconnectedOperationListResult value = default; - using var document = JsonDocument.Parse(message.Response.ContentStream, ModelSerializationExtensions.JsonDocumentOptions); - value = DisconnectedOperationListResult.DeserializeDisconnectedOperationListResult(document.RootElement); - return Response.FromValue(value, message.Response); - } - default: - throw new RequestFailedException(message.Response); - } - } - - internal RequestUriBuilder CreateListBySubscriptionNextPageRequestUri(string nextLink, string subscriptionId) - { - var uri = new RawRequestUriBuilder(); - uri.Reset(_endpoint); - uri.AppendRawNextLink(nextLink, false); - return uri; - } - - internal HttpMessage CreateListBySubscriptionNextPageRequest(string nextLink, string subscriptionId) - { - var message = _pipeline.CreateMessage(); - var request = message.Request; - request.Method = RequestMethod.Get; - var uri = new RawRequestUriBuilder(); - uri.Reset(_endpoint); - uri.AppendRawNextLink(nextLink, false); - request.Uri = uri; - request.Headers.Add("Accept", "application/json"); - _userAgent.Apply(message); - return message; - } - - /// List DisconnectedOperation resources by subscription ID. - /// The URL to the next page of results. - /// The ID of the target subscription. The value must be an UUID. - /// The cancellation token to use. - /// or is null. - /// is an empty string, and was expected to be non-empty. - public async Task> ListBySubscriptionNextPageAsync(string nextLink, string subscriptionId, CancellationToken cancellationToken = default) - { - Argument.AssertNotNull(nextLink, nameof(nextLink)); - Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); - - using var message = CreateListBySubscriptionNextPageRequest(nextLink, subscriptionId); - await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); - switch (message.Response.Status) - { - case 200: - { - DisconnectedOperationListResult value = default; - using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, ModelSerializationExtensions.JsonDocumentOptions, cancellationToken).ConfigureAwait(false); - value = DisconnectedOperationListResult.DeserializeDisconnectedOperationListResult(document.RootElement); - return Response.FromValue(value, message.Response); - } - default: - throw new RequestFailedException(message.Response); - } - } - - /// List DisconnectedOperation resources by subscription ID. - /// The URL to the next page of results. - /// The ID of the target subscription. The value must be an UUID. - /// The cancellation token to use. - /// or is null. - /// is an empty string, and was expected to be non-empty. - public Response ListBySubscriptionNextPage(string nextLink, string subscriptionId, CancellationToken cancellationToken = default) - { - Argument.AssertNotNull(nextLink, nameof(nextLink)); - Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); - - using var message = CreateListBySubscriptionNextPageRequest(nextLink, subscriptionId); - _pipeline.Send(message, cancellationToken); - switch (message.Response.Status) - { - case 200: - { - DisconnectedOperationListResult value = default; - using var document = JsonDocument.Parse(message.Response.ContentStream, ModelSerializationExtensions.JsonDocumentOptions); - value = DisconnectedOperationListResult.DeserializeDisconnectedOperationListResult(document.RootElement); - return Response.FromValue(value, message.Response); - } - default: - throw new RequestFailedException(message.Response); - } - } - } -} diff --git a/sdk/disconnectedoperations/Azure.ResourceManager.DisconnectedOperations/src/Generated/RestOperations/ImagesRestOperations.cs b/sdk/disconnectedoperations/Azure.ResourceManager.DisconnectedOperations/src/Generated/RestOperations/ImagesRestOperations.cs index be3cec863d2d..a13f246cda5b 100644 --- a/sdk/disconnectedoperations/Azure.ResourceManager.DisconnectedOperations/src/Generated/RestOperations/ImagesRestOperations.cs +++ b/sdk/disconnectedoperations/Azure.ResourceManager.DisconnectedOperations/src/Generated/RestOperations/ImagesRestOperations.cs @@ -6,72 +6,47 @@ #nullable disable using System; -using System.Text.Json; -using System.Threading; -using System.Threading.Tasks; +using Azure; using Azure.Core; using Azure.Core.Pipeline; -using Azure.ResourceManager.DisconnectedOperations.Models; namespace Azure.ResourceManager.DisconnectedOperations { - internal partial class ImagesRestOperations + internal partial class Images { - private readonly TelemetryDetails _userAgent; - private readonly HttpPipeline _pipeline; private readonly Uri _endpoint; private readonly string _apiVersion; - /// Initializes a new instance of ImagesRestOperations. - /// The HTTP pipeline for sending and receiving REST requests and responses. - /// The application id to use for user agent. - /// Service host. - /// The API version to use for this operation. - /// or is null. - public ImagesRestOperations(HttpPipeline pipeline, string applicationId, Uri endpoint = null, string apiVersion = default) + /// Initializes a new instance of Images for mocking. + protected Images() { - _pipeline = pipeline ?? throw new ArgumentNullException(nameof(pipeline)); - _endpoint = endpoint ?? new Uri("https://management.azure.com"); - _apiVersion = apiVersion ?? "2025-06-01-preview"; - _userAgent = new TelemetryDetails(GetType().Assembly, applicationId); } - internal RequestUriBuilder CreateListByDisconnectedOperationRequestUri(string subscriptionId, string resourceGroupName, string name, string filter, int? top, int? skip) + /// Initializes a new instance of Images. + /// 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 Images(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.Edge/disconnectedOperations/", false); - uri.AppendPath(name, true); - uri.AppendPath("/images", false); - uri.AppendQuery("api-version", _apiVersion, true); - if (filter != null) - { - uri.AppendQuery("$filter", filter, true); - } - if (top != null) - { - uri.AppendQuery("$top", top.Value, true); - } - if (skip != null) - { - uri.AppendQuery("$skip", skip.Value, true); - } - return uri; + ClientDiagnostics = clientDiagnostics; + _endpoint = endpoint; + Pipeline = pipeline; + _apiVersion = apiVersion; } - internal HttpMessage CreateListByDisconnectedOperationRequest(string subscriptionId, string resourceGroupName, string name, string filter, int? top, int? skip) + /// 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 CreateGetByDisconnectedOperationRequest(Guid subscriptionId, string resourceGroupName, string name, string filter, int? top, int? skip, RequestContext context) { - var message = _pipeline.CreateMessage(); - var request = message.Request; - request.Method = RequestMethod.Get; - var uri = new RawRequestUriBuilder(); + RawRequestUriBuilder uri = new RawRequestUriBuilder(); uri.Reset(_endpoint); uri.AppendPath("/subscriptions/", false); - uri.AppendPath(subscriptionId, true); + uri.AppendPath(subscriptionId.ToString(), true); uri.AppendPath("/resourceGroups/", false); uri.AppendPath(resourceGroupName, true); uri.AppendPath("/providers/Microsoft.Edge/disconnectedOperations/", false); @@ -84,212 +59,59 @@ internal HttpMessage CreateListByDisconnectedOperationRequest(string subscriptio } if (top != null) { - uri.AppendQuery("$top", top.Value, true); + uri.AppendQuery("$top", TypeFormatters.ConvertToString(top), true); } if (skip != null) { - uri.AppendQuery("$skip", skip.Value, true); + uri.AppendQuery("$skip", TypeFormatters.ConvertToString(skip), 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 by disconnected operation. - /// The ID of the target subscription. The value must be an UUID. - /// The name of the resource group. The name is case insensitive. - /// Name of the resource. - /// Filter the result list using the given expression. - /// The number of result items to return. - /// The number of result items to skip. - /// The cancellation token to use. - /// , or is null. - /// , or is an empty string, and was expected to be non-empty. - public async Task> ListByDisconnectedOperationAsync(string subscriptionId, string resourceGroupName, string name, string filter = null, int? top = null, int? skip = null, CancellationToken cancellationToken = default) - { - Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); - Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); - Argument.AssertNotNullOrEmpty(name, nameof(name)); - - using var message = CreateListByDisconnectedOperationRequest(subscriptionId, resourceGroupName, name, filter, top, skip); - await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); - switch (message.Response.Status) - { - case 200: - { - ImageListResult value = default; - using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, ModelSerializationExtensions.JsonDocumentOptions, cancellationToken).ConfigureAwait(false); - value = ImageListResult.DeserializeImageListResult(document.RootElement); - return Response.FromValue(value, message.Response); - } - default: - throw new RequestFailedException(message.Response); - } - } - - /// List by disconnected operation. - /// The ID of the target subscription. The value must be an UUID. - /// The name of the resource group. The name is case insensitive. - /// Name of the resource. - /// Filter the result list using the given expression. - /// The number of result items to return. - /// The number of result items to skip. - /// The cancellation token to use. - /// , or is null. - /// , or is an empty string, and was expected to be non-empty. - public Response ListByDisconnectedOperation(string subscriptionId, string resourceGroupName, string name, string filter = null, int? top = null, int? skip = null, CancellationToken cancellationToken = default) - { - Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); - Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); - Argument.AssertNotNullOrEmpty(name, nameof(name)); - - using var message = CreateListByDisconnectedOperationRequest(subscriptionId, resourceGroupName, name, filter, top, skip); - _pipeline.Send(message, cancellationToken); - switch (message.Response.Status) - { - case 200: - { - ImageListResult value = default; - using var document = JsonDocument.Parse(message.Response.ContentStream, ModelSerializationExtensions.JsonDocumentOptions); - value = ImageListResult.DeserializeImageListResult(document.RootElement); - return Response.FromValue(value, message.Response); - } - default: - throw new RequestFailedException(message.Response); - } - } - - internal RequestUriBuilder CreateGetRequestUri(string subscriptionId, string resourceGroupName, string name, string imageName) - { - 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.Edge/disconnectedOperations/", false); - uri.AppendPath(name, true); - uri.AppendPath("/images/", false); - uri.AppendPath(imageName, true); - uri.AppendQuery("api-version", _apiVersion, true); - return uri; - } - - internal HttpMessage CreateGetRequest(string subscriptionId, string resourceGroupName, string name, string imageName) + internal HttpMessage CreateNextGetByDisconnectedOperationRequest(Uri nextPage, Guid subscriptionId, string resourceGroupName, string name, string filter, int? top, int? skip, RequestContext context) { - 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.Edge/disconnectedOperations/", false); - uri.AppendPath(name, true); - uri.AppendPath("/images/", false); - uri.AppendPath(imageName, true); - uri.AppendQuery("api-version", _apiVersion, true); + RawRequestUriBuilder uri = new RawRequestUriBuilder(); + uri.Reset(nextPage); + HttpMessage message = Pipeline.CreateMessage(); + Request request = message.Request; request.Uri = uri; - request.Headers.Add("Accept", "application/json"); - _userAgent.Apply(message); + request.Method = RequestMethod.Get; + request.Headers.SetValue("Accept", "application/json"); return message; } - /// Get the resource. - /// The ID of the target subscription. The value must be an UUID. - /// The name of the resource group. The name is case insensitive. - /// Name of the resource. - /// The name of the Image. - /// 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 imageName, CancellationToken cancellationToken = default) - { - Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); - Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); - Argument.AssertNotNullOrEmpty(name, nameof(name)); - Argument.AssertNotNullOrEmpty(imageName, nameof(imageName)); - - using var message = CreateGetRequest(subscriptionId, resourceGroupName, name, imageName); - await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); - switch (message.Response.Status) - { - case 200: - { - DisconnectedOperationsImageData value = default; - using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, ModelSerializationExtensions.JsonDocumentOptions, cancellationToken).ConfigureAwait(false); - value = DisconnectedOperationsImageData.DeserializeDisconnectedOperationsImageData(document.RootElement); - return Response.FromValue(value, message.Response); - } - case 404: - return Response.FromValue((DisconnectedOperationsImageData)null, message.Response); - default: - throw new RequestFailedException(message.Response); - } - } - - /// Get the resource. - /// The ID of the target subscription. The value must be an UUID. - /// The name of the resource group. The name is case insensitive. - /// Name of the resource. - /// The name of the Image. - /// 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 imageName, CancellationToken cancellationToken = default) - { - Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); - Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); - Argument.AssertNotNullOrEmpty(name, nameof(name)); - Argument.AssertNotNullOrEmpty(imageName, nameof(imageName)); - - using var message = CreateGetRequest(subscriptionId, resourceGroupName, name, imageName); - _pipeline.Send(message, cancellationToken); - switch (message.Response.Status) - { - case 200: - { - DisconnectedOperationsImageData value = default; - using var document = JsonDocument.Parse(message.Response.ContentStream, ModelSerializationExtensions.JsonDocumentOptions); - value = DisconnectedOperationsImageData.DeserializeDisconnectedOperationsImageData(document.RootElement); - return Response.FromValue(value, message.Response); - } - case 404: - return Response.FromValue((DisconnectedOperationsImageData)null, message.Response); - default: - throw new RequestFailedException(message.Response); - } - } - - internal RequestUriBuilder CreateListDownloadUriRequestUri(string subscriptionId, string resourceGroupName, string name, string imageName) + internal HttpMessage CreateGetRequest(Guid subscriptionId, string resourceGroupName, string name, string imageName, RequestContext context) { - var uri = new RawRequestUriBuilder(); + RawRequestUriBuilder uri = new RawRequestUriBuilder(); uri.Reset(_endpoint); uri.AppendPath("/subscriptions/", false); - uri.AppendPath(subscriptionId, true); + uri.AppendPath(subscriptionId.ToString(), true); uri.AppendPath("/resourceGroups/", false); uri.AppendPath(resourceGroupName, true); uri.AppendPath("/providers/Microsoft.Edge/disconnectedOperations/", false); uri.AppendPath(name, true); uri.AppendPath("/images/", false); uri.AppendPath(imageName, true); - uri.AppendPath("/listDownloadUri", false); 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 CreateListDownloadUriRequest(string subscriptionId, string resourceGroupName, string name, string imageName) + internal HttpMessage CreateGetDownloadUriRequest(Guid subscriptionId, string resourceGroupName, string name, string imageName, 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); + uri.AppendPath(subscriptionId.ToString(), true); uri.AppendPath("/resourceGroups/", false); uri.AppendPath(resourceGroupName, true); uri.AppendPath("/providers/Microsoft.Edge/disconnectedOperations/", false); @@ -298,162 +120,12 @@ internal HttpMessage CreateListDownloadUriRequest(string subscriptionId, string uri.AppendPath(imageName, true); uri.AppendPath("/listDownloadUri", 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; - } - - /// Get the URI to download the image. - /// The ID of the target subscription. The value must be an UUID. - /// The name of the resource group. The name is case insensitive. - /// Name of the resource. - /// The name of the Image. - /// The cancellation token to use. - /// , , or is null. - /// , , or is an empty string, and was expected to be non-empty. - public async Task> ListDownloadUriAsync(string subscriptionId, string resourceGroupName, string name, string imageName, CancellationToken cancellationToken = default) - { - Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); - Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); - Argument.AssertNotNullOrEmpty(name, nameof(name)); - Argument.AssertNotNullOrEmpty(imageName, nameof(imageName)); - - using var message = CreateListDownloadUriRequest(subscriptionId, resourceGroupName, name, imageName); - await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); - switch (message.Response.Status) - { - case 200: - { - DisconnectedOperationsImageDownloadResult value = default; - using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, ModelSerializationExtensions.JsonDocumentOptions, cancellationToken).ConfigureAwait(false); - value = DisconnectedOperationsImageDownloadResult.DeserializeDisconnectedOperationsImageDownloadResult(document.RootElement); - return Response.FromValue(value, message.Response); - } - default: - throw new RequestFailedException(message.Response); - } - } - - /// Get the URI to download the image. - /// The ID of the target subscription. The value must be an UUID. - /// The name of the resource group. The name is case insensitive. - /// Name of the resource. - /// The name of the Image. - /// The cancellation token to use. - /// , , or is null. - /// , , or is an empty string, and was expected to be non-empty. - public Response ListDownloadUri(string subscriptionId, string resourceGroupName, string name, string imageName, CancellationToken cancellationToken = default) - { - Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); - Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); - Argument.AssertNotNullOrEmpty(name, nameof(name)); - Argument.AssertNotNullOrEmpty(imageName, nameof(imageName)); - - using var message = CreateListDownloadUriRequest(subscriptionId, resourceGroupName, name, imageName); - _pipeline.Send(message, cancellationToken); - switch (message.Response.Status) - { - case 200: - { - DisconnectedOperationsImageDownloadResult value = default; - using var document = JsonDocument.Parse(message.Response.ContentStream, ModelSerializationExtensions.JsonDocumentOptions); - value = DisconnectedOperationsImageDownloadResult.DeserializeDisconnectedOperationsImageDownloadResult(document.RootElement); - return Response.FromValue(value, message.Response); - } - default: - throw new RequestFailedException(message.Response); - } - } - - internal RequestUriBuilder CreateListByDisconnectedOperationNextPageRequestUri(string nextLink, string subscriptionId, string resourceGroupName, string name, string filter, int? top, int? skip) - { - var uri = new RawRequestUriBuilder(); - uri.Reset(_endpoint); - uri.AppendRawNextLink(nextLink, false); - return uri; - } - - internal HttpMessage CreateListByDisconnectedOperationNextPageRequest(string nextLink, string subscriptionId, string resourceGroupName, string name, string filter, int? top, int? skip) - { - 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 by disconnected operation. - /// The URL to the next page of results. - /// The ID of the target subscription. The value must be an UUID. - /// The name of the resource group. The name is case insensitive. - /// Name of the resource. - /// Filter the result list using the given expression. - /// The number of result items to return. - /// The number of result items to skip. - /// The cancellation token to use. - /// , , or is null. - /// , or is an empty string, and was expected to be non-empty. - public async Task> ListByDisconnectedOperationNextPageAsync(string nextLink, string subscriptionId, string resourceGroupName, string name, string filter = null, int? top = null, int? skip = null, 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 = CreateListByDisconnectedOperationNextPageRequest(nextLink, subscriptionId, resourceGroupName, name, filter, top, skip); - await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); - switch (message.Response.Status) - { - case 200: - { - ImageListResult value = default; - using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, ModelSerializationExtensions.JsonDocumentOptions, cancellationToken).ConfigureAwait(false); - value = ImageListResult.DeserializeImageListResult(document.RootElement); - return Response.FromValue(value, message.Response); - } - default: - throw new RequestFailedException(message.Response); - } - } - - /// List by disconnected operation. - /// The URL to the next page of results. - /// The ID of the target subscription. The value must be an UUID. - /// The name of the resource group. The name is case insensitive. - /// Name of the resource. - /// Filter the result list using the given expression. - /// The number of result items to return. - /// The number of result items to skip. - /// The cancellation token to use. - /// , , or is null. - /// , or is an empty string, and was expected to be non-empty. - public Response ListByDisconnectedOperationNextPage(string nextLink, string subscriptionId, string resourceGroupName, string name, string filter = null, int? top = null, int? skip = null, 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 = CreateListByDisconnectedOperationNextPageRequest(nextLink, subscriptionId, resourceGroupName, name, filter, top, skip); - _pipeline.Send(message, cancellationToken); - switch (message.Response.Status) - { - case 200: - { - ImageListResult value = default; - using var document = JsonDocument.Parse(message.Response.ContentStream, ModelSerializationExtensions.JsonDocumentOptions); - value = ImageListResult.DeserializeImageListResult(document.RootElement); - return Response.FromValue(value, message.Response); - } - default: - throw new RequestFailedException(message.Response); - } - } } } diff --git a/sdk/disconnectedoperations/Azure.ResourceManager.DisconnectedOperations/tsp-location.yaml b/sdk/disconnectedoperations/Azure.ResourceManager.DisconnectedOperations/tsp-location.yaml index 26428a57108e..76041853ad8e 100644 --- a/sdk/disconnectedoperations/Azure.ResourceManager.DisconnectedOperations/tsp-location.yaml +++ b/sdk/disconnectedoperations/Azure.ResourceManager.DisconnectedOperations/tsp-location.yaml @@ -1,5 +1,6 @@ directory: specification/edge/Microsoft.Edge.DisconnectedOperations.Management -commit: f19bec6b8f2d2ca2ea4911f85e5228ba0af8c323 +commit: 46c51b03d99b113ecc3b38883e3cb2d395fe94a4 repo: Azure/azure-rest-api-specs additionalDirectories: - specification/edge/Microsoft.Edge.Shared +emitterPackageJsonPath: "eng/azure-typespec-http-client-csharp-mgmt-emitter-package.json" From 90ec0aa9457bb87a6444c200e8291a59814603f4 Mon Sep 17 00:00:00 2001 From: RodgeFu Date: Wed, 17 Dec 2025 14:07:13 +0800 Subject: [PATCH 2/6] regen --- ...eManager.DisconnectedOperations.net10.0.cs | 482 ++++++++++++++++++ ...ceManager.DisconnectedOperations.net8.0.cs | 1 + ...r.DisconnectedOperations.netstandard2.0.cs | 1 + .../Models/DisconnectedOperationProperties.cs | 27 + .../DisconnectedOperationCollection.cs | 8 +- ...isconnectedOperationsArtifactCollection.cs | 8 +- .../DisconnectedOperationsImageCollection.cs | 8 +- .../Internal/CodeGenMemberAttribute.cs | 2 +- .../Internal/CodeGenSerializationAttribute.cs | 2 +- .../Internal/CodeGenSuppressAttribute.cs | 2 +- .../Internal/CodeGenTypeAttribute.cs | 2 +- .../Internal/ModelSerializationExtensions.cs | 10 + 12 files changed, 537 insertions(+), 16 deletions(-) create mode 100644 sdk/disconnectedoperations/Azure.ResourceManager.DisconnectedOperations/api/Azure.ResourceManager.DisconnectedOperations.net10.0.cs create mode 100644 sdk/disconnectedoperations/Azure.ResourceManager.DisconnectedOperations/src/Custom/Models/DisconnectedOperationProperties.cs diff --git a/sdk/disconnectedoperations/Azure.ResourceManager.DisconnectedOperations/api/Azure.ResourceManager.DisconnectedOperations.net10.0.cs b/sdk/disconnectedoperations/Azure.ResourceManager.DisconnectedOperations/api/Azure.ResourceManager.DisconnectedOperations.net10.0.cs new file mode 100644 index 000000000000..20e56cf9a903 --- /dev/null +++ b/sdk/disconnectedoperations/Azure.ResourceManager.DisconnectedOperations/api/Azure.ResourceManager.DisconnectedOperations.net10.0.cs @@ -0,0 +1,482 @@ +namespace Azure.ResourceManager.DisconnectedOperations +{ + public partial class AzureResourceManagerDisconnectedOperationsContext : System.ClientModel.Primitives.ModelReaderWriterContext + { + internal AzureResourceManagerDisconnectedOperationsContext() { } + public static Azure.ResourceManager.DisconnectedOperations.AzureResourceManagerDisconnectedOperationsContext Default { get { throw null; } } + protected override bool TryGetTypeBuilderCore(System.Type type, out System.ClientModel.Primitives.ModelReaderWriterTypeBuilder builder) { throw null; } + } + public partial class DisconnectedOperationCollection : Azure.ResourceManager.ArmCollection, System.Collections.Generic.IAsyncEnumerable, System.Collections.Generic.IEnumerable, System.Collections.IEnumerable + { + protected DisconnectedOperationCollection() { } + public virtual Azure.ResourceManager.ArmOperation CreateOrUpdate(Azure.WaitUntil waitUntil, string name, Azure.ResourceManager.DisconnectedOperations.DisconnectedOperationData data, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> CreateOrUpdateAsync(Azure.WaitUntil waitUntil, string name, Azure.ResourceManager.DisconnectedOperations.DisconnectedOperationData data, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Response Exists(string name, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> ExistsAsync(string name, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Response Get(string name, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Pageable GetAll(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.AsyncPageable GetAllAsync(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> GetAsync(string name, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.NullableResponse GetIfExists(string name, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> GetIfExistsAsync(string name, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + System.Collections.Generic.IAsyncEnumerator System.Collections.Generic.IAsyncEnumerable.GetAsyncEnumerator(System.Threading.CancellationToken cancellationToken) { throw null; } + System.Collections.Generic.IEnumerator System.Collections.Generic.IEnumerable.GetEnumerator() { throw null; } + System.Collections.IEnumerator System.Collections.IEnumerable.GetEnumerator() { throw null; } + } + public partial class DisconnectedOperationData : Azure.ResourceManager.Models.TrackedResourceData, System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel + { + public DisconnectedOperationData(Azure.Core.AzureLocation location) { } + public Azure.ResourceManager.DisconnectedOperations.Models.DisconnectedOperationProperties Properties { 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.DisconnectedOperations.DisconnectedOperationData System.ClientModel.Primitives.IJsonModel.Create(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + void System.ClientModel.Primitives.IJsonModel.Write(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.ResourceManager.DisconnectedOperations.DisconnectedOperationData 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 DisconnectedOperationResource : Azure.ResourceManager.ArmResource, System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel + { + public static readonly Azure.Core.ResourceType ResourceType; + protected DisconnectedOperationResource() { } + public virtual Azure.ResourceManager.DisconnectedOperations.DisconnectedOperationData Data { get { throw null; } } + public virtual bool HasData { get { throw null; } } + public virtual Azure.Response AddTag(string key, string value, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> AddTagAsync(string key, string value, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public static Azure.Core.ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string name) { throw null; } + public virtual Azure.ResourceManager.ArmOperation Delete(Azure.WaitUntil waitUntil, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task DeleteAsync(Azure.WaitUntil waitUntil, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Response Get(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> GetAsync(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Response GetDeploymentManifest(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> GetDeploymentManifestAsync(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Response GetDisconnectedOperationsImage(string imageName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> GetDisconnectedOperationsImageAsync(string imageName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.ResourceManager.DisconnectedOperations.DisconnectedOperationsImageCollection GetDisconnectedOperationsImages() { 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; } + public virtual Azure.Response SetTags(System.Collections.Generic.IDictionary tags, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> SetTagsAsync(System.Collections.Generic.IDictionary tags, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + Azure.ResourceManager.DisconnectedOperations.DisconnectedOperationData System.ClientModel.Primitives.IJsonModel.Create(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + void System.ClientModel.Primitives.IJsonModel.Write(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.ResourceManager.DisconnectedOperations.DisconnectedOperationData 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 virtual Azure.Response Update(Azure.ResourceManager.DisconnectedOperations.Models.DisconnectedOperationPatch patch, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> UpdateAsync(Azure.ResourceManager.DisconnectedOperations.Models.DisconnectedOperationPatch patch, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + } + public partial class DisconnectedOperationsArtifactCollection : Azure.ResourceManager.ArmCollection, System.Collections.Generic.IAsyncEnumerable, System.Collections.Generic.IEnumerable, System.Collections.IEnumerable + { + protected DisconnectedOperationsArtifactCollection() { } + public virtual Azure.Response Exists(string artifactName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> ExistsAsync(string artifactName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Response Get(string artifactName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Pageable GetAll(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.AsyncPageable GetAllAsync(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> GetAsync(string artifactName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.NullableResponse GetIfExists(string artifactName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> GetIfExistsAsync(string artifactName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + System.Collections.Generic.IAsyncEnumerator System.Collections.Generic.IAsyncEnumerable.GetAsyncEnumerator(System.Threading.CancellationToken cancellationToken) { throw null; } + System.Collections.Generic.IEnumerator System.Collections.Generic.IEnumerable.GetEnumerator() { throw null; } + System.Collections.IEnumerator System.Collections.IEnumerable.GetEnumerator() { throw null; } + } + public partial class DisconnectedOperationsArtifactData : Azure.ResourceManager.Models.ResourceData, System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel + { + internal DisconnectedOperationsArtifactData() { } + public Azure.ResourceManager.DisconnectedOperations.Models.DisconnectedOperationsArtifactProperties Properties { 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.DisconnectedOperations.DisconnectedOperationsArtifactData System.ClientModel.Primitives.IJsonModel.Create(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + void System.ClientModel.Primitives.IJsonModel.Write(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.ResourceManager.DisconnectedOperations.DisconnectedOperationsArtifactData 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 DisconnectedOperationsArtifactResource : Azure.ResourceManager.ArmResource, System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel + { + public static readonly Azure.Core.ResourceType ResourceType; + protected DisconnectedOperationsArtifactResource() { } + public virtual Azure.ResourceManager.DisconnectedOperations.DisconnectedOperationsArtifactData Data { get { throw null; } } + public virtual bool HasData { get { throw null; } } + public static Azure.Core.ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string name, string imageName, string artifactName) { throw null; } + public virtual Azure.Response Get(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> GetAsync(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Response GetDownloadUri(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> GetDownloadUriAsync(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + Azure.ResourceManager.DisconnectedOperations.DisconnectedOperationsArtifactData System.ClientModel.Primitives.IJsonModel.Create(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + void System.ClientModel.Primitives.IJsonModel.Write(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.ResourceManager.DisconnectedOperations.DisconnectedOperationsArtifactData 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 static partial class DisconnectedOperationsExtensions + { + public static Azure.Response GetDisconnectedOperation(this Azure.ResourceManager.Resources.ResourceGroupResource resourceGroupResource, string name, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public static System.Threading.Tasks.Task> GetDisconnectedOperationAsync(this Azure.ResourceManager.Resources.ResourceGroupResource resourceGroupResource, string name, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public static Azure.ResourceManager.DisconnectedOperations.DisconnectedOperationResource GetDisconnectedOperationResource(this Azure.ResourceManager.ArmClient client, Azure.Core.ResourceIdentifier id) { throw null; } + public static Azure.ResourceManager.DisconnectedOperations.DisconnectedOperationCollection GetDisconnectedOperations(this Azure.ResourceManager.Resources.ResourceGroupResource resourceGroupResource) { throw null; } + public static Azure.Pageable GetDisconnectedOperations(this Azure.ResourceManager.Resources.SubscriptionResource subscriptionResource, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public static Azure.ResourceManager.DisconnectedOperations.DisconnectedOperationsArtifactResource GetDisconnectedOperationsArtifactResource(this Azure.ResourceManager.ArmClient client, Azure.Core.ResourceIdentifier id) { throw null; } + public static Azure.AsyncPageable GetDisconnectedOperationsAsync(this Azure.ResourceManager.Resources.SubscriptionResource subscriptionResource, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public static Azure.ResourceManager.DisconnectedOperations.DisconnectedOperationsImageResource GetDisconnectedOperationsImageResource(this Azure.ResourceManager.ArmClient client, Azure.Core.ResourceIdentifier id) { throw null; } + } + public partial class DisconnectedOperationsImageCollection : Azure.ResourceManager.ArmCollection, System.Collections.Generic.IAsyncEnumerable, System.Collections.Generic.IEnumerable, System.Collections.IEnumerable + { + protected DisconnectedOperationsImageCollection() { } + public virtual Azure.Response Exists(string imageName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> ExistsAsync(string imageName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Response Get(string imageName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Pageable GetAll(string filter = null, int? top = default(int?), int? skip = default(int?), System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.AsyncPageable GetAllAsync(string filter = null, int? top = default(int?), int? skip = default(int?), System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> GetAsync(string imageName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.NullableResponse GetIfExists(string imageName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> GetIfExistsAsync(string imageName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + System.Collections.Generic.IAsyncEnumerator System.Collections.Generic.IAsyncEnumerable.GetAsyncEnumerator(System.Threading.CancellationToken cancellationToken) { throw null; } + System.Collections.Generic.IEnumerator System.Collections.Generic.IEnumerable.GetEnumerator() { throw null; } + System.Collections.IEnumerator System.Collections.IEnumerable.GetEnumerator() { throw null; } + } + public partial class DisconnectedOperationsImageData : Azure.ResourceManager.Models.ResourceData, System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel + { + internal DisconnectedOperationsImageData() { } + public Azure.ResourceManager.DisconnectedOperations.Models.DisconnectedOperationsImageProperties Properties { 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.DisconnectedOperations.DisconnectedOperationsImageData System.ClientModel.Primitives.IJsonModel.Create(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + void System.ClientModel.Primitives.IJsonModel.Write(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.ResourceManager.DisconnectedOperations.DisconnectedOperationsImageData 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 DisconnectedOperationsImageResource : Azure.ResourceManager.ArmResource, System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel + { + public static readonly Azure.Core.ResourceType ResourceType; + protected DisconnectedOperationsImageResource() { } + public virtual Azure.ResourceManager.DisconnectedOperations.DisconnectedOperationsImageData Data { get { throw null; } } + public virtual bool HasData { get { throw null; } } + public static Azure.Core.ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string name, string imageName) { throw null; } + public virtual Azure.Response Get(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> GetAsync(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Response GetDisconnectedOperationsArtifact(string artifactName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> GetDisconnectedOperationsArtifactAsync(string artifactName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.ResourceManager.DisconnectedOperations.DisconnectedOperationsArtifactCollection GetDisconnectedOperationsArtifacts() { throw null; } + public virtual Azure.Response GetDownloadUri(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> GetDownloadUriAsync(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + Azure.ResourceManager.DisconnectedOperations.DisconnectedOperationsImageData System.ClientModel.Primitives.IJsonModel.Create(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + void System.ClientModel.Primitives.IJsonModel.Write(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.ResourceManager.DisconnectedOperations.DisconnectedOperationsImageData 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; } + } +} +namespace Azure.ResourceManager.DisconnectedOperations.Mocking +{ + public partial class MockableDisconnectedOperationsArmClient : Azure.ResourceManager.ArmResource + { + protected MockableDisconnectedOperationsArmClient() { } + public virtual Azure.ResourceManager.DisconnectedOperations.DisconnectedOperationResource GetDisconnectedOperationResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.DisconnectedOperations.DisconnectedOperationsArtifactResource GetDisconnectedOperationsArtifactResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.DisconnectedOperations.DisconnectedOperationsImageResource GetDisconnectedOperationsImageResource(Azure.Core.ResourceIdentifier id) { throw null; } + } + public partial class MockableDisconnectedOperationsResourceGroupResource : Azure.ResourceManager.ArmResource + { + protected MockableDisconnectedOperationsResourceGroupResource() { } + public virtual Azure.Response GetDisconnectedOperation(string name, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> GetDisconnectedOperationAsync(string name, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.ResourceManager.DisconnectedOperations.DisconnectedOperationCollection GetDisconnectedOperations() { throw null; } + } + public partial class MockableDisconnectedOperationsSubscriptionResource : Azure.ResourceManager.ArmResource + { + protected MockableDisconnectedOperationsSubscriptionResource() { } + public virtual Azure.Pageable GetDisconnectedOperations(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.AsyncPageable GetDisconnectedOperationsAsync(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + } +} +namespace Azure.ResourceManager.DisconnectedOperations.Models +{ + public static partial class ArmDisconnectedOperationsModelFactory + { + public static Azure.ResourceManager.DisconnectedOperations.DisconnectedOperationData DisconnectedOperationData(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.DisconnectedOperations.Models.DisconnectedOperationProperties properties = null) { throw null; } + public static Azure.ResourceManager.DisconnectedOperations.Models.DisconnectedOperationDeploymentManifest DisconnectedOperationDeploymentManifest(Azure.Core.ResourceIdentifier resourceId = null, string resourceName = null, string stampId = null, string location = null, Azure.ResourceManager.DisconnectedOperations.Models.DisconnectedOperationsBillingModel billingModel = default(Azure.ResourceManager.DisconnectedOperations.Models.DisconnectedOperationsBillingModel), Azure.ResourceManager.DisconnectedOperations.Models.DisconnectedOperationsConnectionIntent connectionIntent = default(Azure.ResourceManager.DisconnectedOperations.Models.DisconnectedOperationsConnectionIntent), string cloud = null) { throw null; } + public static Azure.ResourceManager.DisconnectedOperations.Models.DisconnectedOperationPatch DisconnectedOperationPatch(System.Collections.Generic.IDictionary tags = null, Azure.ResourceManager.DisconnectedOperations.Models.DisconnectedOperationUpdateProperties properties = null) { throw null; } + public static Azure.ResourceManager.DisconnectedOperations.Models.DisconnectedOperationProperties DisconnectedOperationProperties(Azure.ResourceManager.DisconnectedOperations.Models.DisconnectedOperationsResourceProvisioningState? provisioningState = default(Azure.ResourceManager.DisconnectedOperations.Models.DisconnectedOperationsResourceProvisioningState?), string stampId = null, Azure.ResourceManager.DisconnectedOperations.Models.DisconnectedOperationsBillingModel billingModel = default(Azure.ResourceManager.DisconnectedOperations.Models.DisconnectedOperationsBillingModel), Azure.ResourceManager.DisconnectedOperations.Models.DisconnectedOperationsConnectionIntent connectionIntent = default(Azure.ResourceManager.DisconnectedOperations.Models.DisconnectedOperationsConnectionIntent), Azure.ResourceManager.DisconnectedOperations.Models.DisconnectedOperationsConnectionStatus? connectionStatus = default(Azure.ResourceManager.DisconnectedOperations.Models.DisconnectedOperationsConnectionStatus?), Azure.ResourceManager.DisconnectedOperations.Models.DisconnectedOperationsRegistrationStatus? registrationStatus = default(Azure.ResourceManager.DisconnectedOperations.Models.DisconnectedOperationsRegistrationStatus?), string deviceVersion = null) { throw null; } + public static Azure.ResourceManager.DisconnectedOperations.DisconnectedOperationsArtifactData DisconnectedOperationsArtifactData(Azure.Core.ResourceIdentifier id = null, string name = null, Azure.Core.ResourceType resourceType = default(Azure.Core.ResourceType), Azure.ResourceManager.Models.SystemData systemData = null, Azure.ResourceManager.DisconnectedOperations.Models.DisconnectedOperationsArtifactProperties properties = null) { throw null; } + public static Azure.ResourceManager.DisconnectedOperations.Models.DisconnectedOperationsArtifactDownloadResult DisconnectedOperationsArtifactDownloadResult(Azure.ResourceManager.DisconnectedOperations.Models.DisconnectedOperationsResourceProvisioningState? provisioningState = default(Azure.ResourceManager.DisconnectedOperations.Models.DisconnectedOperationsResourceProvisioningState?), int artifactOrder = 0, string title = null, string description = null, long? size = default(long?), System.Uri downloadLink = null, System.DateTimeOffset linkExpiry = default(System.DateTimeOffset)) { throw null; } + public static Azure.ResourceManager.DisconnectedOperations.Models.DisconnectedOperationsArtifactProperties DisconnectedOperationsArtifactProperties(Azure.ResourceManager.DisconnectedOperations.Models.DisconnectedOperationsResourceProvisioningState? provisioningState = default(Azure.ResourceManager.DisconnectedOperations.Models.DisconnectedOperationsResourceProvisioningState?), int artifactOrder = 0, string title = null, string description = null, long? size = default(long?)) { throw null; } + public static Azure.ResourceManager.DisconnectedOperations.DisconnectedOperationsImageData DisconnectedOperationsImageData(Azure.Core.ResourceIdentifier id = null, string name = null, Azure.Core.ResourceType resourceType = default(Azure.Core.ResourceType), Azure.ResourceManager.Models.SystemData systemData = null, Azure.ResourceManager.DisconnectedOperations.Models.DisconnectedOperationsImageProperties properties = null) { throw null; } + public static Azure.ResourceManager.DisconnectedOperations.Models.DisconnectedOperationsImageDownloadResult DisconnectedOperationsImageDownloadResult(Azure.ResourceManager.DisconnectedOperations.Models.DisconnectedOperationsResourceProvisioningState? provisioningState = default(Azure.ResourceManager.DisconnectedOperations.Models.DisconnectedOperationsResourceProvisioningState?), string releaseVersion = null, string releaseDisplayName = null, string releaseNotes = null, System.DateTimeOffset releaseOn = default(System.DateTimeOffset), Azure.ResourceManager.DisconnectedOperations.Models.DisconnectedOperationsReleaseType releaseType = default(Azure.ResourceManager.DisconnectedOperations.Models.DisconnectedOperationsReleaseType), System.Collections.Generic.IEnumerable compatibleVersions = null, string transactionId = null, System.Uri downloadLink = null, System.DateTimeOffset linkExpiry = default(System.DateTimeOffset)) { throw null; } + public static Azure.ResourceManager.DisconnectedOperations.Models.DisconnectedOperationsImageProperties DisconnectedOperationsImageProperties(Azure.ResourceManager.DisconnectedOperations.Models.DisconnectedOperationsResourceProvisioningState? provisioningState = default(Azure.ResourceManager.DisconnectedOperations.Models.DisconnectedOperationsResourceProvisioningState?), string releaseVersion = null, string releaseDisplayName = null, string releaseNotes = null, System.DateTimeOffset releaseOn = default(System.DateTimeOffset), Azure.ResourceManager.DisconnectedOperations.Models.DisconnectedOperationsReleaseType releaseType = default(Azure.ResourceManager.DisconnectedOperations.Models.DisconnectedOperationsReleaseType), System.Collections.Generic.IEnumerable compatibleVersions = null) { throw null; } + } + public partial class DisconnectedOperationDeploymentManifest : System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel + { + internal DisconnectedOperationDeploymentManifest() { } + public Azure.ResourceManager.DisconnectedOperations.Models.DisconnectedOperationsBillingModel BillingModel { get { throw null; } } + public string Cloud { get { throw null; } } + public Azure.ResourceManager.DisconnectedOperations.Models.DisconnectedOperationsConnectionIntent ConnectionIntent { get { throw null; } } + public string Location { get { throw null; } } + public Azure.Core.ResourceIdentifier ResourceId { get { throw null; } } + public string ResourceName { get { throw null; } } + public string StampId { get { throw null; } } + protected virtual Azure.ResourceManager.DisconnectedOperations.Models.DisconnectedOperationDeploymentManifest 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.DisconnectedOperations.Models.DisconnectedOperationDeploymentManifest 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.DisconnectedOperations.Models.DisconnectedOperationDeploymentManifest System.ClientModel.Primitives.IJsonModel.Create(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + void System.ClientModel.Primitives.IJsonModel.Write(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.ResourceManager.DisconnectedOperations.Models.DisconnectedOperationDeploymentManifest 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 DisconnectedOperationPatch : System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel + { + public DisconnectedOperationPatch() { } + public Azure.ResourceManager.DisconnectedOperations.Models.DisconnectedOperationUpdateProperties Properties { get { throw null; } set { } } + public System.Collections.Generic.IDictionary Tags { get { throw null; } } + protected virtual Azure.ResourceManager.DisconnectedOperations.Models.DisconnectedOperationPatch 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.DisconnectedOperations.Models.DisconnectedOperationPatch 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.DisconnectedOperations.Models.DisconnectedOperationPatch System.ClientModel.Primitives.IJsonModel.Create(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + void System.ClientModel.Primitives.IJsonModel.Write(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.ResourceManager.DisconnectedOperations.Models.DisconnectedOperationPatch 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 DisconnectedOperationProperties : System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel + { + public DisconnectedOperationProperties(Azure.ResourceManager.DisconnectedOperations.Models.DisconnectedOperationsConnectionIntent connectionIntent) { } + public DisconnectedOperationProperties(string stampId, Azure.ResourceManager.DisconnectedOperations.Models.DisconnectedOperationsBillingModel billingModel, Azure.ResourceManager.DisconnectedOperations.Models.DisconnectedOperationsConnectionIntent connectionIntent) { } + public Azure.ResourceManager.DisconnectedOperations.Models.DisconnectedOperationsBillingModel BillingModel { get { throw null; } } + public Azure.ResourceManager.DisconnectedOperations.Models.DisconnectedOperationsConnectionIntent ConnectionIntent { get { throw null; } set { } } + public Azure.ResourceManager.DisconnectedOperations.Models.DisconnectedOperationsConnectionStatus? ConnectionStatus { get { throw null; } } + public string DeviceVersion { get { throw null; } set { } } + public Azure.ResourceManager.DisconnectedOperations.Models.DisconnectedOperationsResourceProvisioningState? ProvisioningState { get { throw null; } } + public Azure.ResourceManager.DisconnectedOperations.Models.DisconnectedOperationsRegistrationStatus? RegistrationStatus { get { throw null; } set { } } + public string StampId { get { throw null; } } + protected virtual Azure.ResourceManager.DisconnectedOperations.Models.DisconnectedOperationProperties 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.DisconnectedOperations.Models.DisconnectedOperationProperties 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.DisconnectedOperations.Models.DisconnectedOperationProperties System.ClientModel.Primitives.IJsonModel.Create(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + void System.ClientModel.Primitives.IJsonModel.Write(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.ResourceManager.DisconnectedOperations.Models.DisconnectedOperationProperties 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 DisconnectedOperationsArtifactDownloadResult : System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel + { + internal DisconnectedOperationsArtifactDownloadResult() { } + public int ArtifactOrder { get { throw null; } } + public string Description { get { throw null; } } + public System.Uri DownloadLink { get { throw null; } } + public System.DateTimeOffset LinkExpiry { get { throw null; } } + public Azure.ResourceManager.DisconnectedOperations.Models.DisconnectedOperationsResourceProvisioningState? ProvisioningState { get { throw null; } } + public long? Size { get { throw null; } } + public string Title { get { throw null; } } + protected virtual Azure.ResourceManager.DisconnectedOperations.Models.DisconnectedOperationsArtifactDownloadResult 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.DisconnectedOperations.Models.DisconnectedOperationsArtifactDownloadResult 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.DisconnectedOperations.Models.DisconnectedOperationsArtifactDownloadResult System.ClientModel.Primitives.IJsonModel.Create(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + void System.ClientModel.Primitives.IJsonModel.Write(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.ResourceManager.DisconnectedOperations.Models.DisconnectedOperationsArtifactDownloadResult 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 DisconnectedOperationsArtifactProperties : System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel + { + internal DisconnectedOperationsArtifactProperties() { } + public int ArtifactOrder { get { throw null; } } + public string Description { get { throw null; } } + public Azure.ResourceManager.DisconnectedOperations.Models.DisconnectedOperationsResourceProvisioningState? ProvisioningState { get { throw null; } } + public long? Size { get { throw null; } } + public string Title { get { throw null; } } + protected virtual Azure.ResourceManager.DisconnectedOperations.Models.DisconnectedOperationsArtifactProperties 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.DisconnectedOperations.Models.DisconnectedOperationsArtifactProperties 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.DisconnectedOperations.Models.DisconnectedOperationsArtifactProperties System.ClientModel.Primitives.IJsonModel.Create(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + void System.ClientModel.Primitives.IJsonModel.Write(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.ResourceManager.DisconnectedOperations.Models.DisconnectedOperationsArtifactProperties 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; } + } + [System.Runtime.InteropServices.StructLayoutAttribute(System.Runtime.InteropServices.LayoutKind.Sequential)] + public readonly partial struct DisconnectedOperationsBillingModel : System.IEquatable + { + private readonly object _dummy; + private readonly int _dummyPrimitive; + public DisconnectedOperationsBillingModel(string value) { throw null; } + public static Azure.ResourceManager.DisconnectedOperations.Models.DisconnectedOperationsBillingModel Capacity { get { throw null; } } + public bool Equals(Azure.ResourceManager.DisconnectedOperations.Models.DisconnectedOperationsBillingModel other) { throw null; } + [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] + public override bool Equals(object obj) { throw null; } + [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] + public override int GetHashCode() { throw null; } + public static bool operator ==(Azure.ResourceManager.DisconnectedOperations.Models.DisconnectedOperationsBillingModel left, Azure.ResourceManager.DisconnectedOperations.Models.DisconnectedOperationsBillingModel right) { throw null; } + public static implicit operator Azure.ResourceManager.DisconnectedOperations.Models.DisconnectedOperationsBillingModel (string value) { throw null; } + public static implicit operator Azure.ResourceManager.DisconnectedOperations.Models.DisconnectedOperationsBillingModel? (string value) { throw null; } + public static bool operator !=(Azure.ResourceManager.DisconnectedOperations.Models.DisconnectedOperationsBillingModel left, Azure.ResourceManager.DisconnectedOperations.Models.DisconnectedOperationsBillingModel right) { throw null; } + public override string ToString() { throw null; } + } + [System.Runtime.InteropServices.StructLayoutAttribute(System.Runtime.InteropServices.LayoutKind.Sequential)] + public readonly partial struct DisconnectedOperationsConnectionIntent : System.IEquatable + { + private readonly object _dummy; + private readonly int _dummyPrimitive; + public DisconnectedOperationsConnectionIntent(string value) { throw null; } + public static Azure.ResourceManager.DisconnectedOperations.Models.DisconnectedOperationsConnectionIntent Connected { get { throw null; } } + public static Azure.ResourceManager.DisconnectedOperations.Models.DisconnectedOperationsConnectionIntent Disconnected { get { throw null; } } + public bool Equals(Azure.ResourceManager.DisconnectedOperations.Models.DisconnectedOperationsConnectionIntent other) { throw null; } + [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] + public override bool Equals(object obj) { throw null; } + [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] + public override int GetHashCode() { throw null; } + public static bool operator ==(Azure.ResourceManager.DisconnectedOperations.Models.DisconnectedOperationsConnectionIntent left, Azure.ResourceManager.DisconnectedOperations.Models.DisconnectedOperationsConnectionIntent right) { throw null; } + public static implicit operator Azure.ResourceManager.DisconnectedOperations.Models.DisconnectedOperationsConnectionIntent (string value) { throw null; } + public static implicit operator Azure.ResourceManager.DisconnectedOperations.Models.DisconnectedOperationsConnectionIntent? (string value) { throw null; } + public static bool operator !=(Azure.ResourceManager.DisconnectedOperations.Models.DisconnectedOperationsConnectionIntent left, Azure.ResourceManager.DisconnectedOperations.Models.DisconnectedOperationsConnectionIntent right) { throw null; } + public override string ToString() { throw null; } + } + [System.Runtime.InteropServices.StructLayoutAttribute(System.Runtime.InteropServices.LayoutKind.Sequential)] + public readonly partial struct DisconnectedOperationsConnectionStatus : System.IEquatable + { + private readonly object _dummy; + private readonly int _dummyPrimitive; + public DisconnectedOperationsConnectionStatus(string value) { throw null; } + public static Azure.ResourceManager.DisconnectedOperations.Models.DisconnectedOperationsConnectionStatus Connected { get { throw null; } } + public static Azure.ResourceManager.DisconnectedOperations.Models.DisconnectedOperationsConnectionStatus Disconnected { get { throw null; } } + public bool Equals(Azure.ResourceManager.DisconnectedOperations.Models.DisconnectedOperationsConnectionStatus other) { throw null; } + [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] + public override bool Equals(object obj) { throw null; } + [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] + public override int GetHashCode() { throw null; } + public static bool operator ==(Azure.ResourceManager.DisconnectedOperations.Models.DisconnectedOperationsConnectionStatus left, Azure.ResourceManager.DisconnectedOperations.Models.DisconnectedOperationsConnectionStatus right) { throw null; } + public static implicit operator Azure.ResourceManager.DisconnectedOperations.Models.DisconnectedOperationsConnectionStatus (string value) { throw null; } + public static implicit operator Azure.ResourceManager.DisconnectedOperations.Models.DisconnectedOperationsConnectionStatus? (string value) { throw null; } + public static bool operator !=(Azure.ResourceManager.DisconnectedOperations.Models.DisconnectedOperationsConnectionStatus left, Azure.ResourceManager.DisconnectedOperations.Models.DisconnectedOperationsConnectionStatus right) { throw null; } + public override string ToString() { throw null; } + } + public partial class DisconnectedOperationsImageDownloadResult : System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel + { + internal DisconnectedOperationsImageDownloadResult() { } + public System.Collections.Generic.IReadOnlyList CompatibleVersions { get { throw null; } } + public System.Uri DownloadLink { get { throw null; } } + public System.DateTimeOffset LinkExpiry { get { throw null; } } + public Azure.ResourceManager.DisconnectedOperations.Models.DisconnectedOperationsResourceProvisioningState? ProvisioningState { get { throw null; } } + public string ReleaseDisplayName { get { throw null; } } + public string ReleaseNotes { get { throw null; } } + public System.DateTimeOffset ReleaseOn { get { throw null; } } + public Azure.ResourceManager.DisconnectedOperations.Models.DisconnectedOperationsReleaseType ReleaseType { get { throw null; } } + public string ReleaseVersion { get { throw null; } } + public string TransactionId { get { throw null; } } + protected virtual Azure.ResourceManager.DisconnectedOperations.Models.DisconnectedOperationsImageDownloadResult 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.DisconnectedOperations.Models.DisconnectedOperationsImageDownloadResult 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.DisconnectedOperations.Models.DisconnectedOperationsImageDownloadResult System.ClientModel.Primitives.IJsonModel.Create(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + void System.ClientModel.Primitives.IJsonModel.Write(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.ResourceManager.DisconnectedOperations.Models.DisconnectedOperationsImageDownloadResult 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 DisconnectedOperationsImageProperties : System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel + { + internal DisconnectedOperationsImageProperties() { } + public System.Collections.Generic.IReadOnlyList CompatibleVersions { get { throw null; } } + public Azure.ResourceManager.DisconnectedOperations.Models.DisconnectedOperationsResourceProvisioningState? ProvisioningState { get { throw null; } } + public string ReleaseDisplayName { get { throw null; } } + public string ReleaseNotes { get { throw null; } } + public System.DateTimeOffset ReleaseOn { get { throw null; } } + public Azure.ResourceManager.DisconnectedOperations.Models.DisconnectedOperationsReleaseType ReleaseType { get { throw null; } } + public string ReleaseVersion { get { throw null; } } + protected virtual Azure.ResourceManager.DisconnectedOperations.Models.DisconnectedOperationsImageProperties 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.DisconnectedOperations.Models.DisconnectedOperationsImageProperties 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.DisconnectedOperations.Models.DisconnectedOperationsImageProperties System.ClientModel.Primitives.IJsonModel.Create(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + void System.ClientModel.Primitives.IJsonModel.Write(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.ResourceManager.DisconnectedOperations.Models.DisconnectedOperationsImageProperties 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; } + } + [System.Runtime.InteropServices.StructLayoutAttribute(System.Runtime.InteropServices.LayoutKind.Sequential)] + public readonly partial struct DisconnectedOperationsRegistrationStatus : System.IEquatable + { + private readonly object _dummy; + private readonly int _dummyPrimitive; + public DisconnectedOperationsRegistrationStatus(string value) { throw null; } + public static Azure.ResourceManager.DisconnectedOperations.Models.DisconnectedOperationsRegistrationStatus Registered { get { throw null; } } + public static Azure.ResourceManager.DisconnectedOperations.Models.DisconnectedOperationsRegistrationStatus Unregistered { get { throw null; } } + public bool Equals(Azure.ResourceManager.DisconnectedOperations.Models.DisconnectedOperationsRegistrationStatus other) { throw null; } + [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] + public override bool Equals(object obj) { throw null; } + [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] + public override int GetHashCode() { throw null; } + public static bool operator ==(Azure.ResourceManager.DisconnectedOperations.Models.DisconnectedOperationsRegistrationStatus left, Azure.ResourceManager.DisconnectedOperations.Models.DisconnectedOperationsRegistrationStatus right) { throw null; } + public static implicit operator Azure.ResourceManager.DisconnectedOperations.Models.DisconnectedOperationsRegistrationStatus (string value) { throw null; } + public static implicit operator Azure.ResourceManager.DisconnectedOperations.Models.DisconnectedOperationsRegistrationStatus? (string value) { throw null; } + public static bool operator !=(Azure.ResourceManager.DisconnectedOperations.Models.DisconnectedOperationsRegistrationStatus left, Azure.ResourceManager.DisconnectedOperations.Models.DisconnectedOperationsRegistrationStatus right) { throw null; } + public override string ToString() { throw null; } + } + [System.Runtime.InteropServices.StructLayoutAttribute(System.Runtime.InteropServices.LayoutKind.Sequential)] + public readonly partial struct DisconnectedOperationsReleaseType : System.IEquatable + { + private readonly object _dummy; + private readonly int _dummyPrimitive; + public DisconnectedOperationsReleaseType(string value) { throw null; } + public static Azure.ResourceManager.DisconnectedOperations.Models.DisconnectedOperationsReleaseType Install { get { throw null; } } + public static Azure.ResourceManager.DisconnectedOperations.Models.DisconnectedOperationsReleaseType Update { get { throw null; } } + public bool Equals(Azure.ResourceManager.DisconnectedOperations.Models.DisconnectedOperationsReleaseType other) { throw null; } + [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] + public override bool Equals(object obj) { throw null; } + [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] + public override int GetHashCode() { throw null; } + public static bool operator ==(Azure.ResourceManager.DisconnectedOperations.Models.DisconnectedOperationsReleaseType left, Azure.ResourceManager.DisconnectedOperations.Models.DisconnectedOperationsReleaseType right) { throw null; } + public static implicit operator Azure.ResourceManager.DisconnectedOperations.Models.DisconnectedOperationsReleaseType (string value) { throw null; } + public static implicit operator Azure.ResourceManager.DisconnectedOperations.Models.DisconnectedOperationsReleaseType? (string value) { throw null; } + public static bool operator !=(Azure.ResourceManager.DisconnectedOperations.Models.DisconnectedOperationsReleaseType left, Azure.ResourceManager.DisconnectedOperations.Models.DisconnectedOperationsReleaseType right) { throw null; } + public override string ToString() { throw null; } + } + [System.Runtime.InteropServices.StructLayoutAttribute(System.Runtime.InteropServices.LayoutKind.Sequential)] + public readonly partial struct DisconnectedOperationsResourceProvisioningState : System.IEquatable + { + private readonly object _dummy; + private readonly int _dummyPrimitive; + public DisconnectedOperationsResourceProvisioningState(string value) { throw null; } + public static Azure.ResourceManager.DisconnectedOperations.Models.DisconnectedOperationsResourceProvisioningState Canceled { get { throw null; } } + public static Azure.ResourceManager.DisconnectedOperations.Models.DisconnectedOperationsResourceProvisioningState Failed { get { throw null; } } + public static Azure.ResourceManager.DisconnectedOperations.Models.DisconnectedOperationsResourceProvisioningState Succeeded { get { throw null; } } + public bool Equals(Azure.ResourceManager.DisconnectedOperations.Models.DisconnectedOperationsResourceProvisioningState other) { throw null; } + [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] + public override bool Equals(object obj) { throw null; } + [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] + public override int GetHashCode() { throw null; } + public static bool operator ==(Azure.ResourceManager.DisconnectedOperations.Models.DisconnectedOperationsResourceProvisioningState left, Azure.ResourceManager.DisconnectedOperations.Models.DisconnectedOperationsResourceProvisioningState right) { throw null; } + public static implicit operator Azure.ResourceManager.DisconnectedOperations.Models.DisconnectedOperationsResourceProvisioningState (string value) { throw null; } + public static implicit operator Azure.ResourceManager.DisconnectedOperations.Models.DisconnectedOperationsResourceProvisioningState? (string value) { throw null; } + public static bool operator !=(Azure.ResourceManager.DisconnectedOperations.Models.DisconnectedOperationsResourceProvisioningState left, Azure.ResourceManager.DisconnectedOperations.Models.DisconnectedOperationsResourceProvisioningState right) { throw null; } + public override string ToString() { throw null; } + } + public partial class DisconnectedOperationUpdateProperties : System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel + { + public DisconnectedOperationUpdateProperties() { } + public Azure.ResourceManager.DisconnectedOperations.Models.DisconnectedOperationsConnectionIntent? ConnectionIntent { get { throw null; } set { } } + public string DeviceVersion { get { throw null; } set { } } + public Azure.ResourceManager.DisconnectedOperations.Models.DisconnectedOperationsRegistrationStatus? RegistrationStatus { get { throw null; } set { } } + protected virtual Azure.ResourceManager.DisconnectedOperations.Models.DisconnectedOperationUpdateProperties 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.DisconnectedOperations.Models.DisconnectedOperationUpdateProperties 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.DisconnectedOperations.Models.DisconnectedOperationUpdateProperties System.ClientModel.Primitives.IJsonModel.Create(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + void System.ClientModel.Primitives.IJsonModel.Write(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.ResourceManager.DisconnectedOperations.Models.DisconnectedOperationUpdateProperties 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; } + } +} diff --git a/sdk/disconnectedoperations/Azure.ResourceManager.DisconnectedOperations/api/Azure.ResourceManager.DisconnectedOperations.net8.0.cs b/sdk/disconnectedoperations/Azure.ResourceManager.DisconnectedOperations/api/Azure.ResourceManager.DisconnectedOperations.net8.0.cs index ac8af320a647..20e56cf9a903 100644 --- a/sdk/disconnectedoperations/Azure.ResourceManager.DisconnectedOperations/api/Azure.ResourceManager.DisconnectedOperations.net8.0.cs +++ b/sdk/disconnectedoperations/Azure.ResourceManager.DisconnectedOperations/api/Azure.ResourceManager.DisconnectedOperations.net8.0.cs @@ -250,6 +250,7 @@ protected virtual void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer public partial class DisconnectedOperationProperties : System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel { public DisconnectedOperationProperties(Azure.ResourceManager.DisconnectedOperations.Models.DisconnectedOperationsConnectionIntent connectionIntent) { } + public DisconnectedOperationProperties(string stampId, Azure.ResourceManager.DisconnectedOperations.Models.DisconnectedOperationsBillingModel billingModel, Azure.ResourceManager.DisconnectedOperations.Models.DisconnectedOperationsConnectionIntent connectionIntent) { } public Azure.ResourceManager.DisconnectedOperations.Models.DisconnectedOperationsBillingModel BillingModel { get { throw null; } } public Azure.ResourceManager.DisconnectedOperations.Models.DisconnectedOperationsConnectionIntent ConnectionIntent { get { throw null; } set { } } public Azure.ResourceManager.DisconnectedOperations.Models.DisconnectedOperationsConnectionStatus? ConnectionStatus { get { throw null; } } diff --git a/sdk/disconnectedoperations/Azure.ResourceManager.DisconnectedOperations/api/Azure.ResourceManager.DisconnectedOperations.netstandard2.0.cs b/sdk/disconnectedoperations/Azure.ResourceManager.DisconnectedOperations/api/Azure.ResourceManager.DisconnectedOperations.netstandard2.0.cs index ac8af320a647..20e56cf9a903 100644 --- a/sdk/disconnectedoperations/Azure.ResourceManager.DisconnectedOperations/api/Azure.ResourceManager.DisconnectedOperations.netstandard2.0.cs +++ b/sdk/disconnectedoperations/Azure.ResourceManager.DisconnectedOperations/api/Azure.ResourceManager.DisconnectedOperations.netstandard2.0.cs @@ -250,6 +250,7 @@ protected virtual void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer public partial class DisconnectedOperationProperties : System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel { public DisconnectedOperationProperties(Azure.ResourceManager.DisconnectedOperations.Models.DisconnectedOperationsConnectionIntent connectionIntent) { } + public DisconnectedOperationProperties(string stampId, Azure.ResourceManager.DisconnectedOperations.Models.DisconnectedOperationsBillingModel billingModel, Azure.ResourceManager.DisconnectedOperations.Models.DisconnectedOperationsConnectionIntent connectionIntent) { } public Azure.ResourceManager.DisconnectedOperations.Models.DisconnectedOperationsBillingModel BillingModel { get { throw null; } } public Azure.ResourceManager.DisconnectedOperations.Models.DisconnectedOperationsConnectionIntent ConnectionIntent { get { throw null; } set { } } public Azure.ResourceManager.DisconnectedOperations.Models.DisconnectedOperationsConnectionStatus? ConnectionStatus { get { throw null; } } diff --git a/sdk/disconnectedoperations/Azure.ResourceManager.DisconnectedOperations/src/Custom/Models/DisconnectedOperationProperties.cs b/sdk/disconnectedoperations/Azure.ResourceManager.DisconnectedOperations/src/Custom/Models/DisconnectedOperationProperties.cs new file mode 100644 index 000000000000..737f17ed31c4 --- /dev/null +++ b/sdk/disconnectedoperations/Azure.ResourceManager.DisconnectedOperations/src/Custom/Models/DisconnectedOperationProperties.cs @@ -0,0 +1,27 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; + +namespace Azure.ResourceManager.DisconnectedOperations.Models +{ + /// The disconnected operation properties. + public partial class DisconnectedOperationProperties + { + /// Initializes a new instance of . + /// The unique GUID of the stamp. + /// The billing model. + /// The connection intent. + public DisconnectedOperationProperties(string stampId, DisconnectedOperationsBillingModel billingModel, DisconnectedOperationsConnectionIntent connectionIntent) + { + StampId = stampId; + BillingModel = billingModel; + ConnectionIntent = connectionIntent; + } + } +} diff --git a/sdk/disconnectedoperations/Azure.ResourceManager.DisconnectedOperations/src/Generated/DisconnectedOperationCollection.cs b/sdk/disconnectedoperations/Azure.ResourceManager.DisconnectedOperations/src/Generated/DisconnectedOperationCollection.cs index c12e5f4eb2f5..f12ebb514f61 100644 --- a/sdk/disconnectedoperations/Azure.ResourceManager.DisconnectedOperations/src/Generated/DisconnectedOperationCollection.cs +++ b/sdk/disconnectedoperations/Azure.ResourceManager.DisconnectedOperations/src/Generated/DisconnectedOperationCollection.cs @@ -326,7 +326,7 @@ public virtual Pageable GetAll(CancellationToken } /// - /// Get a DisconnectedOperation + /// Checks to see if the resource exists in azure. /// /// /// Request Path. @@ -383,7 +383,7 @@ public virtual async Task> ExistsAsync(string name, CancellationT } /// - /// Get a DisconnectedOperation + /// Checks to see if the resource exists in azure. /// /// /// Request Path. @@ -440,7 +440,7 @@ public virtual Response Exists(string name, CancellationToken cancellation } /// - /// Get a DisconnectedOperation + /// Tries to get details for this resource from the service. /// /// /// Request Path. @@ -501,7 +501,7 @@ public virtual async Task> GetIf } /// - /// Get a DisconnectedOperation + /// Tries to get details for this resource from the service. /// /// /// Request Path. diff --git a/sdk/disconnectedoperations/Azure.ResourceManager.DisconnectedOperations/src/Generated/DisconnectedOperationsArtifactCollection.cs b/sdk/disconnectedoperations/Azure.ResourceManager.DisconnectedOperations/src/Generated/DisconnectedOperationsArtifactCollection.cs index c84cfc6de7fe..e93f09b7481f 100644 --- a/sdk/disconnectedoperations/Azure.ResourceManager.DisconnectedOperations/src/Generated/DisconnectedOperationsArtifactCollection.cs +++ b/sdk/disconnectedoperations/Azure.ResourceManager.DisconnectedOperations/src/Generated/DisconnectedOperationsArtifactCollection.cs @@ -221,7 +221,7 @@ public virtual Pageable GetAll(Cancellat } /// - /// Get the resource + /// Checks to see if the resource exists in azure. /// /// /// Request Path. @@ -278,7 +278,7 @@ public virtual async Task> ExistsAsync(string artifactName, Cance } /// - /// Get the resource + /// Checks to see if the resource exists in azure. /// /// /// Request Path. @@ -335,7 +335,7 @@ public virtual Response Exists(string artifactName, CancellationToken canc } /// - /// Get the resource + /// Tries to get details for this resource from the service. /// /// /// Request Path. @@ -396,7 +396,7 @@ public virtual async Task - /// Get the resource + /// Tries to get details for this resource from the service. /// /// /// Request Path. diff --git a/sdk/disconnectedoperations/Azure.ResourceManager.DisconnectedOperations/src/Generated/DisconnectedOperationsImageCollection.cs b/sdk/disconnectedoperations/Azure.ResourceManager.DisconnectedOperations/src/Generated/DisconnectedOperationsImageCollection.cs index 37aca7b030eb..1e3ced76c190 100644 --- a/sdk/disconnectedoperations/Azure.ResourceManager.DisconnectedOperations/src/Generated/DisconnectedOperationsImageCollection.cs +++ b/sdk/disconnectedoperations/Azure.ResourceManager.DisconnectedOperations/src/Generated/DisconnectedOperationsImageCollection.cs @@ -231,7 +231,7 @@ public virtual Pageable GetAll(string filte } /// - /// Get the resource. + /// Checks to see if the resource exists in azure. /// /// /// Request Path. @@ -288,7 +288,7 @@ public virtual async Task> ExistsAsync(string imageName, Cancella } /// - /// Get the resource. + /// Checks to see if the resource exists in azure. /// /// /// Request Path. @@ -345,7 +345,7 @@ public virtual Response Exists(string imageName, CancellationToken cancell } /// - /// Get the resource. + /// Tries to get details for this resource from the service. /// /// /// Request Path. @@ -406,7 +406,7 @@ public virtual async Task> } /// - /// Get the resource. + /// Tries to get details for this resource from the service. /// /// /// Request Path. diff --git a/sdk/disconnectedoperations/Azure.ResourceManager.DisconnectedOperations/src/Generated/Internal/CodeGenMemberAttribute.cs b/sdk/disconnectedoperations/Azure.ResourceManager.DisconnectedOperations/src/Generated/Internal/CodeGenMemberAttribute.cs index 2675c486e682..72778edeb7e4 100644 --- a/sdk/disconnectedoperations/Azure.ResourceManager.DisconnectedOperations/src/Generated/Internal/CodeGenMemberAttribute.cs +++ b/sdk/disconnectedoperations/Azure.ResourceManager.DisconnectedOperations/src/Generated/Internal/CodeGenMemberAttribute.cs @@ -7,7 +7,7 @@ using System; -namespace Azure.ResourceManager.DisconnectedOperations +namespace Microsoft.TypeSpec.Generator.Customizations { [AttributeUsage((AttributeTargets.Property | AttributeTargets.Field))] internal partial class CodeGenMemberAttribute : CodeGenTypeAttribute diff --git a/sdk/disconnectedoperations/Azure.ResourceManager.DisconnectedOperations/src/Generated/Internal/CodeGenSerializationAttribute.cs b/sdk/disconnectedoperations/Azure.ResourceManager.DisconnectedOperations/src/Generated/Internal/CodeGenSerializationAttribute.cs index 4d1ecd531f6d..dfcabf517497 100644 --- a/sdk/disconnectedoperations/Azure.ResourceManager.DisconnectedOperations/src/Generated/Internal/CodeGenSerializationAttribute.cs +++ b/sdk/disconnectedoperations/Azure.ResourceManager.DisconnectedOperations/src/Generated/Internal/CodeGenSerializationAttribute.cs @@ -7,7 +7,7 @@ using System; -namespace Azure.ResourceManager.DisconnectedOperations +namespace Microsoft.TypeSpec.Generator.Customizations { [AttributeUsage((AttributeTargets.Class | AttributeTargets.Struct), AllowMultiple = true, Inherited = true)] internal partial class CodeGenSerializationAttribute : Attribute diff --git a/sdk/disconnectedoperations/Azure.ResourceManager.DisconnectedOperations/src/Generated/Internal/CodeGenSuppressAttribute.cs b/sdk/disconnectedoperations/Azure.ResourceManager.DisconnectedOperations/src/Generated/Internal/CodeGenSuppressAttribute.cs index 7de85961b2cc..38d536e69173 100644 --- a/sdk/disconnectedoperations/Azure.ResourceManager.DisconnectedOperations/src/Generated/Internal/CodeGenSuppressAttribute.cs +++ b/sdk/disconnectedoperations/Azure.ResourceManager.DisconnectedOperations/src/Generated/Internal/CodeGenSuppressAttribute.cs @@ -7,7 +7,7 @@ using System; -namespace Azure.ResourceManager.DisconnectedOperations +namespace Microsoft.TypeSpec.Generator.Customizations { [AttributeUsage((AttributeTargets.Class | AttributeTargets.Enum | AttributeTargets.Struct), AllowMultiple = true)] internal partial class CodeGenSuppressAttribute : Attribute diff --git a/sdk/disconnectedoperations/Azure.ResourceManager.DisconnectedOperations/src/Generated/Internal/CodeGenTypeAttribute.cs b/sdk/disconnectedoperations/Azure.ResourceManager.DisconnectedOperations/src/Generated/Internal/CodeGenTypeAttribute.cs index cc5716878016..f36b5f513173 100644 --- a/sdk/disconnectedoperations/Azure.ResourceManager.DisconnectedOperations/src/Generated/Internal/CodeGenTypeAttribute.cs +++ b/sdk/disconnectedoperations/Azure.ResourceManager.DisconnectedOperations/src/Generated/Internal/CodeGenTypeAttribute.cs @@ -7,7 +7,7 @@ using System; -namespace Azure.ResourceManager.DisconnectedOperations +namespace Microsoft.TypeSpec.Generator.Customizations { [AttributeUsage((AttributeTargets.Class | AttributeTargets.Enum | AttributeTargets.Struct))] internal partial class CodeGenTypeAttribute : Attribute diff --git a/sdk/disconnectedoperations/Azure.ResourceManager.DisconnectedOperations/src/Generated/Internal/ModelSerializationExtensions.cs b/sdk/disconnectedoperations/Azure.ResourceManager.DisconnectedOperations/src/Generated/Internal/ModelSerializationExtensions.cs index 059e4c7a8140..e6492e4c662c 100644 --- a/sdk/disconnectedoperations/Azure.ResourceManager.DisconnectedOperations/src/Generated/Internal/ModelSerializationExtensions.cs +++ b/sdk/disconnectedoperations/Azure.ResourceManager.DisconnectedOperations/src/Generated/Internal/ModelSerializationExtensions.cs @@ -10,6 +10,7 @@ using System.Collections.Generic; using System.Diagnostics; using System.Globalization; +using System.Runtime.InteropServices; using System.Text.Json; namespace Azure.ResourceManager.DisconnectedOperations @@ -254,5 +255,14 @@ public static void WriteObjectValue(this Utf8JsonWriter writer, object value, Mo { writer.WriteObjectValue(value, options); } + + public static BinaryData GetUtf8Bytes(this JsonElement element) + { +#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 + } } } From 8427afa51b9c77f8f9b86e87388d93fd4704c5b1 Mon Sep 17 00:00:00 2001 From: RodgeFu Date: Wed, 17 Dec 2025 15:45:38 +0800 Subject: [PATCH 3/6] regen --- ...ourceManager.DisconnectedOperations.csproj | 1 - ...yResourceGroupAsyncCollectionResultOfT.cs} | 14 ++-- ...dGetByResourceGroupCollectionResultOfT.cs} | 14 ++-- ...BySubscriptionAsyncCollectionResultOfT.cs} | 14 ++-- ...edGetBySubscriptionCollectionResultOfT.cs} | 14 ++-- .../DisconnectedOperationCollection.cs | 48 ++++++------- .../DisconnectedOperationResource.cs | 68 +++++++++---------- ...connectedOperationsSubscriptionResource.cs | 12 ++-- ...tions.cs => DisconnectedRestOperations.cs} | 10 +-- 9 files changed, 97 insertions(+), 98 deletions(-) rename sdk/disconnectedoperations/Azure.ResourceManager.DisconnectedOperations/src/Generated/CollectionResults/{DisconnectedOperationsOprsGetByResourceGroupAsyncCollectionResultOfT.cs => DisconnectedGetByResourceGroupAsyncCollectionResultOfT.cs} (77%) rename sdk/disconnectedoperations/Azure.ResourceManager.DisconnectedOperations/src/Generated/CollectionResults/{DisconnectedOperationsOprsGetByResourceGroupCollectionResultOfT.cs => DisconnectedGetByResourceGroupCollectionResultOfT.cs} (77%) rename sdk/disconnectedoperations/Azure.ResourceManager.DisconnectedOperations/src/Generated/CollectionResults/{DisconnectedOperationsOprsGetBySubscriptionAsyncCollectionResultOfT.cs => DisconnectedGetBySubscriptionAsyncCollectionResultOfT.cs} (76%) rename sdk/disconnectedoperations/Azure.ResourceManager.DisconnectedOperations/src/Generated/CollectionResults/{DisconnectedOperationsOprsGetBySubscriptionCollectionResultOfT.cs => DisconnectedGetBySubscriptionCollectionResultOfT.cs} (76%) rename sdk/disconnectedoperations/Azure.ResourceManager.DisconnectedOperations/src/Generated/RestOperations/{DisconnectedOperationsOprsRestOperations.cs => DisconnectedRestOperations.cs} (96%) diff --git a/sdk/disconnectedoperations/Azure.ResourceManager.DisconnectedOperations/src/Azure.ResourceManager.DisconnectedOperations.csproj b/sdk/disconnectedoperations/Azure.ResourceManager.DisconnectedOperations/src/Azure.ResourceManager.DisconnectedOperations.csproj index df05c525c987..ae37dbd6d05b 100644 --- a/sdk/disconnectedoperations/Azure.ResourceManager.DisconnectedOperations/src/Azure.ResourceManager.DisconnectedOperations.csproj +++ b/sdk/disconnectedoperations/Azure.ResourceManager.DisconnectedOperations/src/Azure.ResourceManager.DisconnectedOperations.csproj @@ -4,6 +4,5 @@ 1.0.0-beta.2 azure;management;arm;resource manager;disconnectedoperations Azure.ResourceManager.DisconnectedOperations - true diff --git a/sdk/disconnectedoperations/Azure.ResourceManager.DisconnectedOperations/src/Generated/CollectionResults/DisconnectedOperationsOprsGetByResourceGroupAsyncCollectionResultOfT.cs b/sdk/disconnectedoperations/Azure.ResourceManager.DisconnectedOperations/src/Generated/CollectionResults/DisconnectedGetByResourceGroupAsyncCollectionResultOfT.cs similarity index 77% rename from sdk/disconnectedoperations/Azure.ResourceManager.DisconnectedOperations/src/Generated/CollectionResults/DisconnectedOperationsOprsGetByResourceGroupAsyncCollectionResultOfT.cs rename to sdk/disconnectedoperations/Azure.ResourceManager.DisconnectedOperations/src/Generated/CollectionResults/DisconnectedGetByResourceGroupAsyncCollectionResultOfT.cs index 1a18539442db..d1b7077fceb6 100644 --- a/sdk/disconnectedoperations/Azure.ResourceManager.DisconnectedOperations/src/Generated/CollectionResults/DisconnectedOperationsOprsGetByResourceGroupAsyncCollectionResultOfT.cs +++ b/sdk/disconnectedoperations/Azure.ResourceManager.DisconnectedOperations/src/Generated/CollectionResults/DisconnectedGetByResourceGroupAsyncCollectionResultOfT.cs @@ -15,19 +15,19 @@ namespace Azure.ResourceManager.DisconnectedOperations { - internal partial class DisconnectedOperationsOprsGetByResourceGroupAsyncCollectionResultOfT : AsyncPageable + internal partial class DisconnectedGetByResourceGroupAsyncCollectionResultOfT : AsyncPageable { - private readonly DisconnectedOperationsOprs _client; + private readonly Disconnected _client; private readonly Guid _subscriptionId; private readonly string _resourceGroupName; private readonly RequestContext _context; - /// Initializes a new instance of DisconnectedOperationsOprsGetByResourceGroupAsyncCollectionResultOfT, which is used to iterate over the pages of a collection. - /// The DisconnectedOperationsOprs client used to send requests. + /// Initializes a new instance of DisconnectedGetByResourceGroupAsyncCollectionResultOfT, which is used to iterate over the pages of a collection. + /// The Disconnected client used to send requests. /// The ID of the target subscription. The value must be an UUID. /// The name of the resource group. The name is case insensitive. /// The request options, which can override default behaviors of the client pipeline on a per-call basis. - public DisconnectedOperationsOprsGetByResourceGroupAsyncCollectionResultOfT(DisconnectedOperationsOprs client, Guid subscriptionId, string resourceGroupName, RequestContext context) : base(context?.CancellationToken ?? default) + public DisconnectedGetByResourceGroupAsyncCollectionResultOfT(Disconnected client, Guid subscriptionId, string resourceGroupName, RequestContext context) : base(context?.CancellationToken ?? default) { _client = client; _subscriptionId = subscriptionId; @@ -35,10 +35,10 @@ public DisconnectedOperationsOprsGetByResourceGroupAsyncCollectionResultOfT(Disc _context = context; } - /// Gets the pages of DisconnectedOperationsOprsGetByResourceGroupAsyncCollectionResultOfT as an enumerable collection. + /// Gets the pages of DisconnectedGetByResourceGroupAsyncCollectionResultOfT as an enumerable collection. /// A continuation token indicating where to resume paging. /// The number of items per page. - /// The pages of DisconnectedOperationsOprsGetByResourceGroupAsyncCollectionResultOfT as an enumerable collection. + /// The pages of DisconnectedGetByResourceGroupAsyncCollectionResultOfT as an enumerable collection. public override async IAsyncEnumerable> AsPages(string continuationToken, int? pageSizeHint) { Uri nextPage = continuationToken != null ? new Uri(continuationToken) : null; diff --git a/sdk/disconnectedoperations/Azure.ResourceManager.DisconnectedOperations/src/Generated/CollectionResults/DisconnectedOperationsOprsGetByResourceGroupCollectionResultOfT.cs b/sdk/disconnectedoperations/Azure.ResourceManager.DisconnectedOperations/src/Generated/CollectionResults/DisconnectedGetByResourceGroupCollectionResultOfT.cs similarity index 77% rename from sdk/disconnectedoperations/Azure.ResourceManager.DisconnectedOperations/src/Generated/CollectionResults/DisconnectedOperationsOprsGetByResourceGroupCollectionResultOfT.cs rename to sdk/disconnectedoperations/Azure.ResourceManager.DisconnectedOperations/src/Generated/CollectionResults/DisconnectedGetByResourceGroupCollectionResultOfT.cs index bf9b7a170335..db42eb3343c9 100644 --- a/sdk/disconnectedoperations/Azure.ResourceManager.DisconnectedOperations/src/Generated/CollectionResults/DisconnectedOperationsOprsGetByResourceGroupCollectionResultOfT.cs +++ b/sdk/disconnectedoperations/Azure.ResourceManager.DisconnectedOperations/src/Generated/CollectionResults/DisconnectedGetByResourceGroupCollectionResultOfT.cs @@ -14,19 +14,19 @@ namespace Azure.ResourceManager.DisconnectedOperations { - internal partial class DisconnectedOperationsOprsGetByResourceGroupCollectionResultOfT : Pageable + internal partial class DisconnectedGetByResourceGroupCollectionResultOfT : Pageable { - private readonly DisconnectedOperationsOprs _client; + private readonly Disconnected _client; private readonly Guid _subscriptionId; private readonly string _resourceGroupName; private readonly RequestContext _context; - /// Initializes a new instance of DisconnectedOperationsOprsGetByResourceGroupCollectionResultOfT, which is used to iterate over the pages of a collection. - /// The DisconnectedOperationsOprs client used to send requests. + /// Initializes a new instance of DisconnectedGetByResourceGroupCollectionResultOfT, which is used to iterate over the pages of a collection. + /// The Disconnected client used to send requests. /// The ID of the target subscription. The value must be an UUID. /// The name of the resource group. The name is case insensitive. /// The request options, which can override default behaviors of the client pipeline on a per-call basis. - public DisconnectedOperationsOprsGetByResourceGroupCollectionResultOfT(DisconnectedOperationsOprs client, Guid subscriptionId, string resourceGroupName, RequestContext context) : base(context?.CancellationToken ?? default) + public DisconnectedGetByResourceGroupCollectionResultOfT(Disconnected client, Guid subscriptionId, string resourceGroupName, RequestContext context) : base(context?.CancellationToken ?? default) { _client = client; _subscriptionId = subscriptionId; @@ -34,10 +34,10 @@ public DisconnectedOperationsOprsGetByResourceGroupCollectionResultOfT(Disconnec _context = context; } - /// Gets the pages of DisconnectedOperationsOprsGetByResourceGroupCollectionResultOfT as an enumerable collection. + /// Gets the pages of DisconnectedGetByResourceGroupCollectionResultOfT as an enumerable collection. /// A continuation token indicating where to resume paging. /// The number of items per page. - /// The pages of DisconnectedOperationsOprsGetByResourceGroupCollectionResultOfT as an enumerable collection. + /// The pages of DisconnectedGetByResourceGroupCollectionResultOfT as an enumerable collection. public override IEnumerable> AsPages(string continuationToken, int? pageSizeHint) { Uri nextPage = continuationToken != null ? new Uri(continuationToken) : null; diff --git a/sdk/disconnectedoperations/Azure.ResourceManager.DisconnectedOperations/src/Generated/CollectionResults/DisconnectedOperationsOprsGetBySubscriptionAsyncCollectionResultOfT.cs b/sdk/disconnectedoperations/Azure.ResourceManager.DisconnectedOperations/src/Generated/CollectionResults/DisconnectedGetBySubscriptionAsyncCollectionResultOfT.cs similarity index 76% rename from sdk/disconnectedoperations/Azure.ResourceManager.DisconnectedOperations/src/Generated/CollectionResults/DisconnectedOperationsOprsGetBySubscriptionAsyncCollectionResultOfT.cs rename to sdk/disconnectedoperations/Azure.ResourceManager.DisconnectedOperations/src/Generated/CollectionResults/DisconnectedGetBySubscriptionAsyncCollectionResultOfT.cs index 7855cd25df38..ca5ccf2f4b57 100644 --- a/sdk/disconnectedoperations/Azure.ResourceManager.DisconnectedOperations/src/Generated/CollectionResults/DisconnectedOperationsOprsGetBySubscriptionAsyncCollectionResultOfT.cs +++ b/sdk/disconnectedoperations/Azure.ResourceManager.DisconnectedOperations/src/Generated/CollectionResults/DisconnectedGetBySubscriptionAsyncCollectionResultOfT.cs @@ -15,27 +15,27 @@ namespace Azure.ResourceManager.DisconnectedOperations { - internal partial class DisconnectedOperationsOprsGetBySubscriptionAsyncCollectionResultOfT : AsyncPageable + internal partial class DisconnectedGetBySubscriptionAsyncCollectionResultOfT : AsyncPageable { - private readonly DisconnectedOperationsOprs _client; + private readonly Disconnected _client; private readonly Guid _subscriptionId; private readonly RequestContext _context; - /// Initializes a new instance of DisconnectedOperationsOprsGetBySubscriptionAsyncCollectionResultOfT, which is used to iterate over the pages of a collection. - /// The DisconnectedOperationsOprs client used to send requests. + /// Initializes a new instance of DisconnectedGetBySubscriptionAsyncCollectionResultOfT, which is used to iterate over the pages of a collection. + /// The Disconnected client used to send requests. /// The ID of the target subscription. The value must be an UUID. /// The request options, which can override default behaviors of the client pipeline on a per-call basis. - public DisconnectedOperationsOprsGetBySubscriptionAsyncCollectionResultOfT(DisconnectedOperationsOprs client, Guid subscriptionId, RequestContext context) : base(context?.CancellationToken ?? default) + public DisconnectedGetBySubscriptionAsyncCollectionResultOfT(Disconnected client, Guid subscriptionId, RequestContext context) : base(context?.CancellationToken ?? default) { _client = client; _subscriptionId = subscriptionId; _context = context; } - /// Gets the pages of DisconnectedOperationsOprsGetBySubscriptionAsyncCollectionResultOfT as an enumerable collection. + /// Gets the pages of DisconnectedGetBySubscriptionAsyncCollectionResultOfT as an enumerable collection. /// A continuation token indicating where to resume paging. /// The number of items per page. - /// The pages of DisconnectedOperationsOprsGetBySubscriptionAsyncCollectionResultOfT as an enumerable collection. + /// The pages of DisconnectedGetBySubscriptionAsyncCollectionResultOfT as an enumerable collection. public override async IAsyncEnumerable> AsPages(string continuationToken, int? pageSizeHint) { Uri nextPage = continuationToken != null ? new Uri(continuationToken) : null; diff --git a/sdk/disconnectedoperations/Azure.ResourceManager.DisconnectedOperations/src/Generated/CollectionResults/DisconnectedOperationsOprsGetBySubscriptionCollectionResultOfT.cs b/sdk/disconnectedoperations/Azure.ResourceManager.DisconnectedOperations/src/Generated/CollectionResults/DisconnectedGetBySubscriptionCollectionResultOfT.cs similarity index 76% rename from sdk/disconnectedoperations/Azure.ResourceManager.DisconnectedOperations/src/Generated/CollectionResults/DisconnectedOperationsOprsGetBySubscriptionCollectionResultOfT.cs rename to sdk/disconnectedoperations/Azure.ResourceManager.DisconnectedOperations/src/Generated/CollectionResults/DisconnectedGetBySubscriptionCollectionResultOfT.cs index 1c53cc676aa9..a1708ae64128 100644 --- a/sdk/disconnectedoperations/Azure.ResourceManager.DisconnectedOperations/src/Generated/CollectionResults/DisconnectedOperationsOprsGetBySubscriptionCollectionResultOfT.cs +++ b/sdk/disconnectedoperations/Azure.ResourceManager.DisconnectedOperations/src/Generated/CollectionResults/DisconnectedGetBySubscriptionCollectionResultOfT.cs @@ -14,27 +14,27 @@ namespace Azure.ResourceManager.DisconnectedOperations { - internal partial class DisconnectedOperationsOprsGetBySubscriptionCollectionResultOfT : Pageable + internal partial class DisconnectedGetBySubscriptionCollectionResultOfT : Pageable { - private readonly DisconnectedOperationsOprs _client; + private readonly Disconnected _client; private readonly Guid _subscriptionId; private readonly RequestContext _context; - /// Initializes a new instance of DisconnectedOperationsOprsGetBySubscriptionCollectionResultOfT, which is used to iterate over the pages of a collection. - /// The DisconnectedOperationsOprs client used to send requests. + /// Initializes a new instance of DisconnectedGetBySubscriptionCollectionResultOfT, which is used to iterate over the pages of a collection. + /// The Disconnected client used to send requests. /// The ID of the target subscription. The value must be an UUID. /// The request options, which can override default behaviors of the client pipeline on a per-call basis. - public DisconnectedOperationsOprsGetBySubscriptionCollectionResultOfT(DisconnectedOperationsOprs client, Guid subscriptionId, RequestContext context) : base(context?.CancellationToken ?? default) + public DisconnectedGetBySubscriptionCollectionResultOfT(Disconnected client, Guid subscriptionId, RequestContext context) : base(context?.CancellationToken ?? default) { _client = client; _subscriptionId = subscriptionId; _context = context; } - /// Gets the pages of DisconnectedOperationsOprsGetBySubscriptionCollectionResultOfT as an enumerable collection. + /// Gets the pages of DisconnectedGetBySubscriptionCollectionResultOfT as an enumerable collection. /// A continuation token indicating where to resume paging. /// The number of items per page. - /// The pages of DisconnectedOperationsOprsGetBySubscriptionCollectionResultOfT as an enumerable collection. + /// The pages of DisconnectedGetBySubscriptionCollectionResultOfT as an enumerable collection. public override IEnumerable> AsPages(string continuationToken, int? pageSizeHint) { Uri nextPage = continuationToken != null ? new Uri(continuationToken) : null; diff --git a/sdk/disconnectedoperations/Azure.ResourceManager.DisconnectedOperations/src/Generated/DisconnectedOperationCollection.cs b/sdk/disconnectedoperations/Azure.ResourceManager.DisconnectedOperations/src/Generated/DisconnectedOperationCollection.cs index f12ebb514f61..960d39894395 100644 --- a/sdk/disconnectedoperations/Azure.ResourceManager.DisconnectedOperations/src/Generated/DisconnectedOperationCollection.cs +++ b/sdk/disconnectedoperations/Azure.ResourceManager.DisconnectedOperations/src/Generated/DisconnectedOperationCollection.cs @@ -26,8 +26,8 @@ namespace Azure.ResourceManager.DisconnectedOperations /// public partial class DisconnectedOperationCollection : ArmCollection, IEnumerable, IAsyncEnumerable { - private readonly ClientDiagnostics _disconnectedOperationsOprsClientDiagnostics; - private readonly DisconnectedOperationsOprs _disconnectedOperationsOprsRestClient; + private readonly ClientDiagnostics _disconnectedClientDiagnostics; + private readonly Disconnected _disconnectedRestClient; /// Initializes a new instance of DisconnectedOperationCollection for mocking. protected DisconnectedOperationCollection() @@ -40,8 +40,8 @@ protected DisconnectedOperationCollection() internal DisconnectedOperationCollection(ArmClient client, ResourceIdentifier id) : base(client, id) { TryGetApiVersion(DisconnectedOperationResource.ResourceType, out string disconnectedOperationApiVersion); - _disconnectedOperationsOprsClientDiagnostics = new ClientDiagnostics("Azure.ResourceManager.DisconnectedOperations", DisconnectedOperationResource.ResourceType.Namespace, Diagnostics); - _disconnectedOperationsOprsRestClient = new DisconnectedOperationsOprs(_disconnectedOperationsOprsClientDiagnostics, Pipeline, Endpoint, disconnectedOperationApiVersion ?? "2025-06-01-preview"); + _disconnectedClientDiagnostics = new ClientDiagnostics("Azure.ResourceManager.DisconnectedOperations", DisconnectedOperationResource.ResourceType.Namespace, Diagnostics); + _disconnectedRestClient = new Disconnected(_disconnectedClientDiagnostics, Pipeline, Endpoint, disconnectedOperationApiVersion ?? "2025-06-01-preview"); ValidateResourceId(id); } @@ -83,7 +83,7 @@ public virtual async Task> CreateOrU Argument.AssertNotNullOrEmpty(name, nameof(name)); Argument.AssertNotNull(data, nameof(data)); - using DiagnosticScope scope = _disconnectedOperationsOprsClientDiagnostics.CreateScope("DisconnectedOperationCollection.CreateOrUpdate"); + using DiagnosticScope scope = _disconnectedClientDiagnostics.CreateScope("DisconnectedOperationCollection.CreateOrUpdate"); scope.Start(); try { @@ -91,11 +91,11 @@ public virtual async Task> CreateOrU { CancellationToken = cancellationToken }; - HttpMessage message = _disconnectedOperationsOprsRestClient.CreateCreateOrUpdateRequest(Guid.Parse(Id.SubscriptionId), Id.ResourceGroupName, name, DisconnectedOperationData.ToRequestContent(data), context); + HttpMessage message = _disconnectedRestClient.CreateCreateOrUpdateRequest(Guid.Parse(Id.SubscriptionId), Id.ResourceGroupName, name, DisconnectedOperationData.ToRequestContent(data), context); Response response = await Pipeline.ProcessMessageAsync(message, context).ConfigureAwait(false); DisconnectedOperationsArmOperation operation = new DisconnectedOperationsArmOperation( new DisconnectedOperationOperationSource(Client), - _disconnectedOperationsOprsClientDiagnostics, + _disconnectedClientDiagnostics, Pipeline, message.Request, response, @@ -141,7 +141,7 @@ public virtual ArmOperation CreateOrUpdate(WaitUn Argument.AssertNotNullOrEmpty(name, nameof(name)); Argument.AssertNotNull(data, nameof(data)); - using DiagnosticScope scope = _disconnectedOperationsOprsClientDiagnostics.CreateScope("DisconnectedOperationCollection.CreateOrUpdate"); + using DiagnosticScope scope = _disconnectedClientDiagnostics.CreateScope("DisconnectedOperationCollection.CreateOrUpdate"); scope.Start(); try { @@ -149,11 +149,11 @@ public virtual ArmOperation CreateOrUpdate(WaitUn { CancellationToken = cancellationToken }; - HttpMessage message = _disconnectedOperationsOprsRestClient.CreateCreateOrUpdateRequest(Guid.Parse(Id.SubscriptionId), Id.ResourceGroupName, name, DisconnectedOperationData.ToRequestContent(data), context); + HttpMessage message = _disconnectedRestClient.CreateCreateOrUpdateRequest(Guid.Parse(Id.SubscriptionId), Id.ResourceGroupName, name, DisconnectedOperationData.ToRequestContent(data), context); Response response = Pipeline.ProcessMessage(message, context); DisconnectedOperationsArmOperation operation = new DisconnectedOperationsArmOperation( new DisconnectedOperationOperationSource(Client), - _disconnectedOperationsOprsClientDiagnostics, + _disconnectedClientDiagnostics, Pipeline, message.Request, response, @@ -196,7 +196,7 @@ public virtual async Task> GetAsync(stri { Argument.AssertNotNullOrEmpty(name, nameof(name)); - using DiagnosticScope scope = _disconnectedOperationsOprsClientDiagnostics.CreateScope("DisconnectedOperationCollection.Get"); + using DiagnosticScope scope = _disconnectedClientDiagnostics.CreateScope("DisconnectedOperationCollection.Get"); scope.Start(); try { @@ -204,7 +204,7 @@ public virtual async Task> GetAsync(stri { CancellationToken = cancellationToken }; - HttpMessage message = _disconnectedOperationsOprsRestClient.CreateGetRequest(Guid.Parse(Id.SubscriptionId), Id.ResourceGroupName, name, context); + HttpMessage message = _disconnectedRestClient.CreateGetRequest(Guid.Parse(Id.SubscriptionId), Id.ResourceGroupName, name, context); Response result = await Pipeline.ProcessMessageAsync(message, context).ConfigureAwait(false); Response response = Response.FromValue(DisconnectedOperationData.FromResponse(result), result); if (response.Value == null) @@ -245,7 +245,7 @@ public virtual Response Get(string name, Cancella { Argument.AssertNotNullOrEmpty(name, nameof(name)); - using DiagnosticScope scope = _disconnectedOperationsOprsClientDiagnostics.CreateScope("DisconnectedOperationCollection.Get"); + using DiagnosticScope scope = _disconnectedClientDiagnostics.CreateScope("DisconnectedOperationCollection.Get"); scope.Start(); try { @@ -253,7 +253,7 @@ public virtual Response Get(string name, Cancella { CancellationToken = cancellationToken }; - HttpMessage message = _disconnectedOperationsOprsRestClient.CreateGetRequest(Guid.Parse(Id.SubscriptionId), Id.ResourceGroupName, name, context); + HttpMessage message = _disconnectedRestClient.CreateGetRequest(Guid.Parse(Id.SubscriptionId), Id.ResourceGroupName, name, context); Response result = Pipeline.ProcessMessage(message, context); Response response = Response.FromValue(DisconnectedOperationData.FromResponse(result), result); if (response.Value == null) @@ -294,7 +294,7 @@ public virtual AsyncPageable GetAllAsync(Cancella { CancellationToken = cancellationToken }; - return new AsyncPageableWrapper(new DisconnectedOperationsOprsGetByResourceGroupAsyncCollectionResultOfT(_disconnectedOperationsOprsRestClient, Guid.Parse(Id.SubscriptionId), Id.ResourceGroupName, context), data => new DisconnectedOperationResource(Client, data)); + return new AsyncPageableWrapper(new DisconnectedGetByResourceGroupAsyncCollectionResultOfT(_disconnectedRestClient, Guid.Parse(Id.SubscriptionId), Id.ResourceGroupName, context), data => new DisconnectedOperationResource(Client, data)); } /// @@ -322,7 +322,7 @@ public virtual Pageable GetAll(CancellationToken { CancellationToken = cancellationToken }; - return new PageableWrapper(new DisconnectedOperationsOprsGetByResourceGroupCollectionResultOfT(_disconnectedOperationsOprsRestClient, Guid.Parse(Id.SubscriptionId), Id.ResourceGroupName, context), data => new DisconnectedOperationResource(Client, data)); + return new PageableWrapper(new DisconnectedGetByResourceGroupCollectionResultOfT(_disconnectedRestClient, Guid.Parse(Id.SubscriptionId), Id.ResourceGroupName, context), data => new DisconnectedOperationResource(Client, data)); } /// @@ -350,7 +350,7 @@ public virtual async Task> ExistsAsync(string name, CancellationT { Argument.AssertNotNullOrEmpty(name, nameof(name)); - using DiagnosticScope scope = _disconnectedOperationsOprsClientDiagnostics.CreateScope("DisconnectedOperationCollection.Exists"); + using DiagnosticScope scope = _disconnectedClientDiagnostics.CreateScope("DisconnectedOperationCollection.Exists"); scope.Start(); try { @@ -358,7 +358,7 @@ public virtual async Task> ExistsAsync(string name, CancellationT { CancellationToken = cancellationToken }; - HttpMessage message = _disconnectedOperationsOprsRestClient.CreateGetRequest(Guid.Parse(Id.SubscriptionId), Id.ResourceGroupName, name, context); + HttpMessage message = _disconnectedRestClient.CreateGetRequest(Guid.Parse(Id.SubscriptionId), Id.ResourceGroupName, name, context); await Pipeline.SendAsync(message, context.CancellationToken).ConfigureAwait(false); Response result = message.Response; Response response = default; @@ -407,7 +407,7 @@ public virtual Response Exists(string name, CancellationToken cancellation { Argument.AssertNotNullOrEmpty(name, nameof(name)); - using DiagnosticScope scope = _disconnectedOperationsOprsClientDiagnostics.CreateScope("DisconnectedOperationCollection.Exists"); + using DiagnosticScope scope = _disconnectedClientDiagnostics.CreateScope("DisconnectedOperationCollection.Exists"); scope.Start(); try { @@ -415,7 +415,7 @@ public virtual Response Exists(string name, CancellationToken cancellation { CancellationToken = cancellationToken }; - HttpMessage message = _disconnectedOperationsOprsRestClient.CreateGetRequest(Guid.Parse(Id.SubscriptionId), Id.ResourceGroupName, name, context); + HttpMessage message = _disconnectedRestClient.CreateGetRequest(Guid.Parse(Id.SubscriptionId), Id.ResourceGroupName, name, context); Pipeline.Send(message, context.CancellationToken); Response result = message.Response; Response response = default; @@ -464,7 +464,7 @@ public virtual async Task> GetIf { Argument.AssertNotNullOrEmpty(name, nameof(name)); - using DiagnosticScope scope = _disconnectedOperationsOprsClientDiagnostics.CreateScope("DisconnectedOperationCollection.GetIfExists"); + using DiagnosticScope scope = _disconnectedClientDiagnostics.CreateScope("DisconnectedOperationCollection.GetIfExists"); scope.Start(); try { @@ -472,7 +472,7 @@ public virtual async Task> GetIf { CancellationToken = cancellationToken }; - HttpMessage message = _disconnectedOperationsOprsRestClient.CreateGetRequest(Guid.Parse(Id.SubscriptionId), Id.ResourceGroupName, name, context); + HttpMessage message = _disconnectedRestClient.CreateGetRequest(Guid.Parse(Id.SubscriptionId), Id.ResourceGroupName, name, context); await Pipeline.SendAsync(message, context.CancellationToken).ConfigureAwait(false); Response result = message.Response; Response response = default; @@ -525,7 +525,7 @@ public virtual NullableResponse GetIfExists(strin { Argument.AssertNotNullOrEmpty(name, nameof(name)); - using DiagnosticScope scope = _disconnectedOperationsOprsClientDiagnostics.CreateScope("DisconnectedOperationCollection.GetIfExists"); + using DiagnosticScope scope = _disconnectedClientDiagnostics.CreateScope("DisconnectedOperationCollection.GetIfExists"); scope.Start(); try { @@ -533,7 +533,7 @@ public virtual NullableResponse GetIfExists(strin { CancellationToken = cancellationToken }; - HttpMessage message = _disconnectedOperationsOprsRestClient.CreateGetRequest(Guid.Parse(Id.SubscriptionId), Id.ResourceGroupName, name, context); + HttpMessage message = _disconnectedRestClient.CreateGetRequest(Guid.Parse(Id.SubscriptionId), Id.ResourceGroupName, name, context); Pipeline.Send(message, context.CancellationToken); Response result = message.Response; Response response = default; diff --git a/sdk/disconnectedoperations/Azure.ResourceManager.DisconnectedOperations/src/Generated/DisconnectedOperationResource.cs b/sdk/disconnectedoperations/Azure.ResourceManager.DisconnectedOperations/src/Generated/DisconnectedOperationResource.cs index fe22708ef5b1..f2de402e8e4c 100644 --- a/sdk/disconnectedoperations/Azure.ResourceManager.DisconnectedOperations/src/Generated/DisconnectedOperationResource.cs +++ b/sdk/disconnectedoperations/Azure.ResourceManager.DisconnectedOperations/src/Generated/DisconnectedOperationResource.cs @@ -26,8 +26,8 @@ namespace Azure.ResourceManager.DisconnectedOperations /// public partial class DisconnectedOperationResource : ArmResource { - private readonly ClientDiagnostics _disconnectedOperationsOprsClientDiagnostics; - private readonly DisconnectedOperationsOprs _disconnectedOperationsOprsRestClient; + private readonly ClientDiagnostics _disconnectedClientDiagnostics; + private readonly Disconnected _disconnectedRestClient; private readonly DisconnectedOperationData _data; /// Gets the resource type for the operations. public static readonly ResourceType ResourceType = "Microsoft.Edge/disconnectedOperations"; @@ -52,8 +52,8 @@ internal DisconnectedOperationResource(ArmClient client, DisconnectedOperationDa internal DisconnectedOperationResource(ArmClient client, ResourceIdentifier id) : base(client, id) { TryGetApiVersion(ResourceType, out string disconnectedOperationApiVersion); - _disconnectedOperationsOprsClientDiagnostics = new ClientDiagnostics("Azure.ResourceManager.DisconnectedOperations", ResourceType.Namespace, Diagnostics); - _disconnectedOperationsOprsRestClient = new DisconnectedOperationsOprs(_disconnectedOperationsOprsClientDiagnostics, Pipeline, Endpoint, disconnectedOperationApiVersion ?? "2025-06-01-preview"); + _disconnectedClientDiagnostics = new ClientDiagnostics("Azure.ResourceManager.DisconnectedOperations", ResourceType.Namespace, Diagnostics); + _disconnectedRestClient = new Disconnected(_disconnectedClientDiagnostics, Pipeline, Endpoint, disconnectedOperationApiVersion ?? "2025-06-01-preview"); ValidateResourceId(id); } @@ -117,7 +117,7 @@ internal static void ValidateResourceId(ResourceIdentifier id) /// The cancellation token to use. public virtual async Task> GetAsync(CancellationToken cancellationToken = default) { - using DiagnosticScope scope = _disconnectedOperationsOprsClientDiagnostics.CreateScope("DisconnectedOperationResource.Get"); + using DiagnosticScope scope = _disconnectedClientDiagnostics.CreateScope("DisconnectedOperationResource.Get"); scope.Start(); try { @@ -125,7 +125,7 @@ public virtual async Task> GetAsync(Canc { CancellationToken = cancellationToken }; - HttpMessage message = _disconnectedOperationsOprsRestClient.CreateGetRequest(Guid.Parse(Id.SubscriptionId), Id.ResourceGroupName, Id.Name, context); + HttpMessage message = _disconnectedRestClient.CreateGetRequest(Guid.Parse(Id.SubscriptionId), Id.ResourceGroupName, Id.Name, context); Response result = await Pipeline.ProcessMessageAsync(message, context).ConfigureAwait(false); Response response = Response.FromValue(DisconnectedOperationData.FromResponse(result), result); if (response.Value == null) @@ -165,7 +165,7 @@ public virtual async Task> GetAsync(Canc /// The cancellation token to use. public virtual Response Get(CancellationToken cancellationToken = default) { - using DiagnosticScope scope = _disconnectedOperationsOprsClientDiagnostics.CreateScope("DisconnectedOperationResource.Get"); + using DiagnosticScope scope = _disconnectedClientDiagnostics.CreateScope("DisconnectedOperationResource.Get"); scope.Start(); try { @@ -173,7 +173,7 @@ public virtual Response Get(CancellationToken can { CancellationToken = cancellationToken }; - HttpMessage message = _disconnectedOperationsOprsRestClient.CreateGetRequest(Guid.Parse(Id.SubscriptionId), Id.ResourceGroupName, Id.Name, context); + HttpMessage message = _disconnectedRestClient.CreateGetRequest(Guid.Parse(Id.SubscriptionId), Id.ResourceGroupName, Id.Name, context); Response result = Pipeline.ProcessMessage(message, context); Response response = Response.FromValue(DisconnectedOperationData.FromResponse(result), result); if (response.Value == null) @@ -217,7 +217,7 @@ public virtual async Task> UpdateAsync(D { Argument.AssertNotNull(patch, nameof(patch)); - using DiagnosticScope scope = _disconnectedOperationsOprsClientDiagnostics.CreateScope("DisconnectedOperationResource.Update"); + using DiagnosticScope scope = _disconnectedClientDiagnostics.CreateScope("DisconnectedOperationResource.Update"); scope.Start(); try { @@ -225,7 +225,7 @@ public virtual async Task> UpdateAsync(D { CancellationToken = cancellationToken }; - HttpMessage message = _disconnectedOperationsOprsRestClient.CreateUpdateRequest(Guid.Parse(Id.SubscriptionId), Id.ResourceGroupName, Id.Name, DisconnectedOperationPatch.ToRequestContent(patch), context); + HttpMessage message = _disconnectedRestClient.CreateUpdateRequest(Guid.Parse(Id.SubscriptionId), Id.ResourceGroupName, Id.Name, DisconnectedOperationPatch.ToRequestContent(patch), context); Response result = await Pipeline.ProcessMessageAsync(message, context).ConfigureAwait(false); Response response = Response.FromValue(DisconnectedOperationData.FromResponse(result), result); if (response.Value == null) @@ -269,7 +269,7 @@ public virtual Response Update(DisconnectedOperat { Argument.AssertNotNull(patch, nameof(patch)); - using DiagnosticScope scope = _disconnectedOperationsOprsClientDiagnostics.CreateScope("DisconnectedOperationResource.Update"); + using DiagnosticScope scope = _disconnectedClientDiagnostics.CreateScope("DisconnectedOperationResource.Update"); scope.Start(); try { @@ -277,7 +277,7 @@ public virtual Response Update(DisconnectedOperat { CancellationToken = cancellationToken }; - HttpMessage message = _disconnectedOperationsOprsRestClient.CreateUpdateRequest(Guid.Parse(Id.SubscriptionId), Id.ResourceGroupName, Id.Name, DisconnectedOperationPatch.ToRequestContent(patch), context); + HttpMessage message = _disconnectedRestClient.CreateUpdateRequest(Guid.Parse(Id.SubscriptionId), Id.ResourceGroupName, Id.Name, DisconnectedOperationPatch.ToRequestContent(patch), context); Response result = Pipeline.ProcessMessage(message, context); Response response = Response.FromValue(DisconnectedOperationData.FromResponse(result), result); if (response.Value == null) @@ -318,7 +318,7 @@ public virtual Response Update(DisconnectedOperat /// The cancellation token to use. public virtual async Task DeleteAsync(WaitUntil waitUntil, CancellationToken cancellationToken = default) { - using DiagnosticScope scope = _disconnectedOperationsOprsClientDiagnostics.CreateScope("DisconnectedOperationResource.Delete"); + using DiagnosticScope scope = _disconnectedClientDiagnostics.CreateScope("DisconnectedOperationResource.Delete"); scope.Start(); try { @@ -326,9 +326,9 @@ public virtual async Task DeleteAsync(WaitUntil waitUntil, Cancell { CancellationToken = cancellationToken }; - HttpMessage message = _disconnectedOperationsOprsRestClient.CreateDeleteRequest(Guid.Parse(Id.SubscriptionId), Id.ResourceGroupName, Id.Name, context); + HttpMessage message = _disconnectedRestClient.CreateDeleteRequest(Guid.Parse(Id.SubscriptionId), Id.ResourceGroupName, Id.Name, context); Response response = await Pipeline.ProcessMessageAsync(message, context).ConfigureAwait(false); - DisconnectedOperationsArmOperation operation = new DisconnectedOperationsArmOperation(_disconnectedOperationsOprsClientDiagnostics, Pipeline, message.Request, response, OperationFinalStateVia.Location); + DisconnectedOperationsArmOperation operation = new DisconnectedOperationsArmOperation(_disconnectedClientDiagnostics, Pipeline, message.Request, response, OperationFinalStateVia.Location); if (waitUntil == WaitUntil.Completed) { await operation.WaitForCompletionResponseAsync(cancellationToken).ConfigureAwait(false); @@ -367,7 +367,7 @@ public virtual async Task DeleteAsync(WaitUntil waitUntil, Cancell /// The cancellation token to use. public virtual ArmOperation Delete(WaitUntil waitUntil, CancellationToken cancellationToken = default) { - using DiagnosticScope scope = _disconnectedOperationsOprsClientDiagnostics.CreateScope("DisconnectedOperationResource.Delete"); + using DiagnosticScope scope = _disconnectedClientDiagnostics.CreateScope("DisconnectedOperationResource.Delete"); scope.Start(); try { @@ -375,9 +375,9 @@ public virtual ArmOperation Delete(WaitUntil waitUntil, CancellationToken cancel { CancellationToken = cancellationToken }; - HttpMessage message = _disconnectedOperationsOprsRestClient.CreateDeleteRequest(Guid.Parse(Id.SubscriptionId), Id.ResourceGroupName, Id.Name, context); + HttpMessage message = _disconnectedRestClient.CreateDeleteRequest(Guid.Parse(Id.SubscriptionId), Id.ResourceGroupName, Id.Name, context); Response response = Pipeline.ProcessMessage(message, context); - DisconnectedOperationsArmOperation operation = new DisconnectedOperationsArmOperation(_disconnectedOperationsOprsClientDiagnostics, Pipeline, message.Request, response, OperationFinalStateVia.Location); + DisconnectedOperationsArmOperation operation = new DisconnectedOperationsArmOperation(_disconnectedClientDiagnostics, Pipeline, message.Request, response, OperationFinalStateVia.Location); if (waitUntil == WaitUntil.Completed) { operation.WaitForCompletionResponse(cancellationToken); @@ -415,7 +415,7 @@ public virtual ArmOperation Delete(WaitUntil waitUntil, CancellationToken cancel /// The cancellation token to use. public virtual async Task> GetDeploymentManifestAsync(CancellationToken cancellationToken = default) { - using DiagnosticScope scope = _disconnectedOperationsOprsClientDiagnostics.CreateScope("DisconnectedOperationResource.GetDeploymentManifest"); + using DiagnosticScope scope = _disconnectedClientDiagnostics.CreateScope("DisconnectedOperationResource.GetDeploymentManifest"); scope.Start(); try { @@ -423,7 +423,7 @@ public virtual async Task> Get { CancellationToken = cancellationToken }; - HttpMessage message = _disconnectedOperationsOprsRestClient.CreateGetDeploymentManifestRequest(Guid.Parse(Id.SubscriptionId), Id.ResourceGroupName, Id.Name, context); + HttpMessage message = _disconnectedRestClient.CreateGetDeploymentManifestRequest(Guid.Parse(Id.SubscriptionId), Id.ResourceGroupName, Id.Name, context); Response result = await Pipeline.ProcessMessageAsync(message, context).ConfigureAwait(false); Response response = Response.FromValue(DisconnectedOperationDeploymentManifest.FromResponse(result), result); if (response.Value == null) @@ -463,7 +463,7 @@ public virtual async Task> Get /// The cancellation token to use. public virtual Response GetDeploymentManifest(CancellationToken cancellationToken = default) { - using DiagnosticScope scope = _disconnectedOperationsOprsClientDiagnostics.CreateScope("DisconnectedOperationResource.GetDeploymentManifest"); + using DiagnosticScope scope = _disconnectedClientDiagnostics.CreateScope("DisconnectedOperationResource.GetDeploymentManifest"); scope.Start(); try { @@ -471,7 +471,7 @@ public virtual Response GetDeploymentMa { CancellationToken = cancellationToken }; - HttpMessage message = _disconnectedOperationsOprsRestClient.CreateGetDeploymentManifestRequest(Guid.Parse(Id.SubscriptionId), Id.ResourceGroupName, Id.Name, context); + HttpMessage message = _disconnectedRestClient.CreateGetDeploymentManifestRequest(Guid.Parse(Id.SubscriptionId), Id.ResourceGroupName, Id.Name, context); Response result = Pipeline.ProcessMessage(message, context); Response response = Response.FromValue(DisconnectedOperationDeploymentManifest.FromResponse(result), result); if (response.Value == null) @@ -497,7 +497,7 @@ public virtual async Task> AddTagAsync(s Argument.AssertNotNull(key, nameof(key)); Argument.AssertNotNull(value, nameof(value)); - using DiagnosticScope scope = _disconnectedOperationsOprsClientDiagnostics.CreateScope("DisconnectedOperationResource.AddTag"); + using DiagnosticScope scope = _disconnectedClientDiagnostics.CreateScope("DisconnectedOperationResource.AddTag"); scope.Start(); try { @@ -510,7 +510,7 @@ public virtual async Task> AddTagAsync(s { CancellationToken = cancellationToken }; - HttpMessage message = _disconnectedOperationsOprsRestClient.CreateGetRequest(Guid.Parse(Id.SubscriptionId), Id.ResourceGroupName, Id.Name, context); + HttpMessage message = _disconnectedRestClient.CreateGetRequest(Guid.Parse(Id.SubscriptionId), Id.ResourceGroupName, Id.Name, context); Response result = await Pipeline.ProcessMessageAsync(message, context).ConfigureAwait(false); Response response = Response.FromValue(DisconnectedOperationData.FromResponse(result), result); return Response.FromValue(new DisconnectedOperationResource(Client, response.Value), response.GetRawResponse()); @@ -545,7 +545,7 @@ public virtual Response AddTag(string key, string Argument.AssertNotNull(key, nameof(key)); Argument.AssertNotNull(value, nameof(value)); - using DiagnosticScope scope = _disconnectedOperationsOprsClientDiagnostics.CreateScope("DisconnectedOperationResource.AddTag"); + using DiagnosticScope scope = _disconnectedClientDiagnostics.CreateScope("DisconnectedOperationResource.AddTag"); scope.Start(); try { @@ -558,7 +558,7 @@ public virtual Response AddTag(string key, string { CancellationToken = cancellationToken }; - HttpMessage message = _disconnectedOperationsOprsRestClient.CreateGetRequest(Guid.Parse(Id.SubscriptionId), Id.ResourceGroupName, Id.Name, context); + HttpMessage message = _disconnectedRestClient.CreateGetRequest(Guid.Parse(Id.SubscriptionId), Id.ResourceGroupName, Id.Name, context); Response result = Pipeline.ProcessMessage(message, context); Response response = Response.FromValue(DisconnectedOperationData.FromResponse(result), result); return Response.FromValue(new DisconnectedOperationResource(Client, response.Value), response.GetRawResponse()); @@ -591,7 +591,7 @@ public virtual async Task> SetTagsAsync( { Argument.AssertNotNull(tags, nameof(tags)); - using DiagnosticScope scope = _disconnectedOperationsOprsClientDiagnostics.CreateScope("DisconnectedOperationResource.SetTags"); + using DiagnosticScope scope = _disconnectedClientDiagnostics.CreateScope("DisconnectedOperationResource.SetTags"); scope.Start(); try { @@ -605,7 +605,7 @@ public virtual async Task> SetTagsAsync( { CancellationToken = cancellationToken }; - HttpMessage message = _disconnectedOperationsOprsRestClient.CreateGetRequest(Guid.Parse(Id.SubscriptionId), Id.ResourceGroupName, Id.Name, context); + HttpMessage message = _disconnectedRestClient.CreateGetRequest(Guid.Parse(Id.SubscriptionId), Id.ResourceGroupName, Id.Name, context); Response result = await Pipeline.ProcessMessageAsync(message, context).ConfigureAwait(false); Response response = Response.FromValue(DisconnectedOperationData.FromResponse(result), result); return Response.FromValue(new DisconnectedOperationResource(Client, response.Value), response.GetRawResponse()); @@ -634,7 +634,7 @@ public virtual Response SetTags(IDictionary SetTags(IDictionary response = Response.FromValue(DisconnectedOperationData.FromResponse(result), result); return Response.FromValue(new DisconnectedOperationResource(Client, response.Value), response.GetRawResponse()); @@ -677,7 +677,7 @@ public virtual async Task> RemoveTagAsyn { Argument.AssertNotNull(key, nameof(key)); - using DiagnosticScope scope = _disconnectedOperationsOprsClientDiagnostics.CreateScope("DisconnectedOperationResource.RemoveTag"); + using DiagnosticScope scope = _disconnectedClientDiagnostics.CreateScope("DisconnectedOperationResource.RemoveTag"); scope.Start(); try { @@ -690,7 +690,7 @@ public virtual async Task> RemoveTagAsyn { CancellationToken = cancellationToken }; - HttpMessage message = _disconnectedOperationsOprsRestClient.CreateGetRequest(Guid.Parse(Id.SubscriptionId), Id.ResourceGroupName, Id.Name, context); + HttpMessage message = _disconnectedRestClient.CreateGetRequest(Guid.Parse(Id.SubscriptionId), Id.ResourceGroupName, Id.Name, context); Response result = await Pipeline.ProcessMessageAsync(message, context).ConfigureAwait(false); Response response = Response.FromValue(DisconnectedOperationData.FromResponse(result), result); return Response.FromValue(new DisconnectedOperationResource(Client, response.Value), response.GetRawResponse()); @@ -723,7 +723,7 @@ public virtual Response RemoveTag(string key, Can { Argument.AssertNotNull(key, nameof(key)); - using DiagnosticScope scope = _disconnectedOperationsOprsClientDiagnostics.CreateScope("DisconnectedOperationResource.RemoveTag"); + using DiagnosticScope scope = _disconnectedClientDiagnostics.CreateScope("DisconnectedOperationResource.RemoveTag"); scope.Start(); try { @@ -736,7 +736,7 @@ public virtual Response RemoveTag(string key, Can { CancellationToken = cancellationToken }; - HttpMessage message = _disconnectedOperationsOprsRestClient.CreateGetRequest(Guid.Parse(Id.SubscriptionId), Id.ResourceGroupName, Id.Name, context); + HttpMessage message = _disconnectedRestClient.CreateGetRequest(Guid.Parse(Id.SubscriptionId), Id.ResourceGroupName, Id.Name, context); Response result = Pipeline.ProcessMessage(message, context); Response response = Response.FromValue(DisconnectedOperationData.FromResponse(result), result); return Response.FromValue(new DisconnectedOperationResource(Client, response.Value), response.GetRawResponse()); diff --git a/sdk/disconnectedoperations/Azure.ResourceManager.DisconnectedOperations/src/Generated/Extensions/MockableDisconnectedOperationsSubscriptionResource.cs b/sdk/disconnectedoperations/Azure.ResourceManager.DisconnectedOperations/src/Generated/Extensions/MockableDisconnectedOperationsSubscriptionResource.cs index 05327e588796..824c19008a09 100644 --- a/sdk/disconnectedoperations/Azure.ResourceManager.DisconnectedOperations/src/Generated/Extensions/MockableDisconnectedOperationsSubscriptionResource.cs +++ b/sdk/disconnectedoperations/Azure.ResourceManager.DisconnectedOperations/src/Generated/Extensions/MockableDisconnectedOperationsSubscriptionResource.cs @@ -19,8 +19,8 @@ namespace Azure.ResourceManager.DisconnectedOperations.Mocking /// A class to add extension methods to . public partial class MockableDisconnectedOperationsSubscriptionResource : ArmResource { - private ClientDiagnostics _disconnectedOperationsOprsClientDiagnostics; - private DisconnectedOperationsOprs _disconnectedOperationsOprsRestClient; + private ClientDiagnostics _disconnectedClientDiagnostics; + private Disconnected _disconnectedRestClient; /// Initializes a new instance of MockableDisconnectedOperationsSubscriptionResource for mocking. protected MockableDisconnectedOperationsSubscriptionResource() @@ -34,9 +34,9 @@ internal MockableDisconnectedOperationsSubscriptionResource(ArmClient client, Re { } - private ClientDiagnostics DisconnectedOperationsOprsClientDiagnostics => _disconnectedOperationsOprsClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.DisconnectedOperations.Mocking", ProviderConstants.DefaultProviderNamespace, Diagnostics); + private ClientDiagnostics DisconnectedClientDiagnostics => _disconnectedClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.DisconnectedOperations.Mocking", ProviderConstants.DefaultProviderNamespace, Diagnostics); - private DisconnectedOperationsOprs DisconnectedOperationsOprsRestClient => _disconnectedOperationsOprsRestClient ??= new DisconnectedOperationsOprs(DisconnectedOperationsOprsClientDiagnostics, Pipeline, Endpoint, "2025-06-01-preview"); + private Disconnected DisconnectedRestClient => _disconnectedRestClient ??= new Disconnected(DisconnectedClientDiagnostics, Pipeline, Endpoint, "2025-06-01-preview"); /// /// List DisconnectedOperation resources by subscription ID @@ -63,7 +63,7 @@ public virtual AsyncPageable GetDisconnectedOpera { CancellationToken = cancellationToken }; - return new AsyncPageableWrapper(new DisconnectedOperationsOprsGetBySubscriptionAsyncCollectionResultOfT(DisconnectedOperationsOprsRestClient, Guid.Parse(Id.SubscriptionId), context), data => new DisconnectedOperationResource(Client, data)); + return new AsyncPageableWrapper(new DisconnectedGetBySubscriptionAsyncCollectionResultOfT(DisconnectedRestClient, Guid.Parse(Id.SubscriptionId), context), data => new DisconnectedOperationResource(Client, data)); } /// @@ -91,7 +91,7 @@ public virtual Pageable GetDisconnectedOperations { CancellationToken = cancellationToken }; - return new PageableWrapper(new DisconnectedOperationsOprsGetBySubscriptionCollectionResultOfT(DisconnectedOperationsOprsRestClient, Guid.Parse(Id.SubscriptionId), context), data => new DisconnectedOperationResource(Client, data)); + return new PageableWrapper(new DisconnectedGetBySubscriptionCollectionResultOfT(DisconnectedRestClient, Guid.Parse(Id.SubscriptionId), context), data => new DisconnectedOperationResource(Client, data)); } } } diff --git a/sdk/disconnectedoperations/Azure.ResourceManager.DisconnectedOperations/src/Generated/RestOperations/DisconnectedOperationsOprsRestOperations.cs b/sdk/disconnectedoperations/Azure.ResourceManager.DisconnectedOperations/src/Generated/RestOperations/DisconnectedRestOperations.cs similarity index 96% rename from sdk/disconnectedoperations/Azure.ResourceManager.DisconnectedOperations/src/Generated/RestOperations/DisconnectedOperationsOprsRestOperations.cs rename to sdk/disconnectedoperations/Azure.ResourceManager.DisconnectedOperations/src/Generated/RestOperations/DisconnectedRestOperations.cs index d39cd0cf2737..5f5ae242153b 100644 --- a/sdk/disconnectedoperations/Azure.ResourceManager.DisconnectedOperations/src/Generated/RestOperations/DisconnectedOperationsOprsRestOperations.cs +++ b/sdk/disconnectedoperations/Azure.ResourceManager.DisconnectedOperations/src/Generated/RestOperations/DisconnectedRestOperations.cs @@ -12,22 +12,22 @@ namespace Azure.ResourceManager.DisconnectedOperations { - internal partial class DisconnectedOperationsOprs + internal partial class Disconnected { private readonly Uri _endpoint; private readonly string _apiVersion; - /// Initializes a new instance of DisconnectedOperationsOprs for mocking. - protected DisconnectedOperationsOprs() + /// Initializes a new instance of Disconnected for mocking. + protected Disconnected() { } - /// Initializes a new instance of DisconnectedOperationsOprs. + /// Initializes a new instance of Disconnected. /// 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 DisconnectedOperationsOprs(ClientDiagnostics clientDiagnostics, HttpPipeline pipeline, Uri endpoint, string apiVersion) + internal Disconnected(ClientDiagnostics clientDiagnostics, HttpPipeline pipeline, Uri endpoint, string apiVersion) { ClientDiagnostics = clientDiagnostics; _endpoint = endpoint; From e6a45a299ae0e90056ba17edef95c8c2973079cb Mon Sep 17 00:00:00 2001 From: RodgeFu Date: Mon, 29 Dec 2025 15:18:44 +0800 Subject: [PATCH 4/6] regen --- ...eManager.DisconnectedOperations.net10.0.cs | 1 - ...ceManager.DisconnectedOperations.net8.0.cs | 1 - ...r.DisconnectedOperations.netstandard2.0.cs | 1 - .../Models/DisconnectedOperationProperties.cs | 27 --- .../Sample_DisconnectedOperationCollection.cs | 200 ++++++++++++++++++ .../Sample_DisconnectedOperationResource.cs | 0 ...isconnectedOperationsArtifactCollection.cs | 0 ..._DisconnectedOperationsArtifactResource.cs | 0 ...e_DisconnectedOperationsImageCollection.cs | 0 ...ple_DisconnectedOperationsImageResource.cs | 0 .../Sample_SubscriptionResourceExtensions.cs | 0 11 files changed, 200 insertions(+), 30 deletions(-) delete mode 100644 sdk/disconnectedoperations/Azure.ResourceManager.DisconnectedOperations/src/Custom/Models/DisconnectedOperationProperties.cs create mode 100644 sdk/disconnectedoperations/Azure.ResourceManager.DisconnectedOperations/tests/Samples/Sample_DisconnectedOperationCollection.cs rename sdk/disconnectedoperations/Azure.ResourceManager.DisconnectedOperations/tests/{Generated => }/Samples/Sample_DisconnectedOperationResource.cs (100%) rename sdk/disconnectedoperations/Azure.ResourceManager.DisconnectedOperations/tests/{Generated => }/Samples/Sample_DisconnectedOperationsArtifactCollection.cs (100%) rename sdk/disconnectedoperations/Azure.ResourceManager.DisconnectedOperations/tests/{Generated => }/Samples/Sample_DisconnectedOperationsArtifactResource.cs (100%) rename sdk/disconnectedoperations/Azure.ResourceManager.DisconnectedOperations/tests/{Generated => }/Samples/Sample_DisconnectedOperationsImageCollection.cs (100%) rename sdk/disconnectedoperations/Azure.ResourceManager.DisconnectedOperations/tests/{Generated => }/Samples/Sample_DisconnectedOperationsImageResource.cs (100%) rename sdk/disconnectedoperations/Azure.ResourceManager.DisconnectedOperations/tests/{Generated => }/Samples/Sample_SubscriptionResourceExtensions.cs (100%) diff --git a/sdk/disconnectedoperations/Azure.ResourceManager.DisconnectedOperations/api/Azure.ResourceManager.DisconnectedOperations.net10.0.cs b/sdk/disconnectedoperations/Azure.ResourceManager.DisconnectedOperations/api/Azure.ResourceManager.DisconnectedOperations.net10.0.cs index 20e56cf9a903..ac8af320a647 100644 --- a/sdk/disconnectedoperations/Azure.ResourceManager.DisconnectedOperations/api/Azure.ResourceManager.DisconnectedOperations.net10.0.cs +++ b/sdk/disconnectedoperations/Azure.ResourceManager.DisconnectedOperations/api/Azure.ResourceManager.DisconnectedOperations.net10.0.cs @@ -250,7 +250,6 @@ protected virtual void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer public partial class DisconnectedOperationProperties : System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel { public DisconnectedOperationProperties(Azure.ResourceManager.DisconnectedOperations.Models.DisconnectedOperationsConnectionIntent connectionIntent) { } - public DisconnectedOperationProperties(string stampId, Azure.ResourceManager.DisconnectedOperations.Models.DisconnectedOperationsBillingModel billingModel, Azure.ResourceManager.DisconnectedOperations.Models.DisconnectedOperationsConnectionIntent connectionIntent) { } public Azure.ResourceManager.DisconnectedOperations.Models.DisconnectedOperationsBillingModel BillingModel { get { throw null; } } public Azure.ResourceManager.DisconnectedOperations.Models.DisconnectedOperationsConnectionIntent ConnectionIntent { get { throw null; } set { } } public Azure.ResourceManager.DisconnectedOperations.Models.DisconnectedOperationsConnectionStatus? ConnectionStatus { get { throw null; } } diff --git a/sdk/disconnectedoperations/Azure.ResourceManager.DisconnectedOperations/api/Azure.ResourceManager.DisconnectedOperations.net8.0.cs b/sdk/disconnectedoperations/Azure.ResourceManager.DisconnectedOperations/api/Azure.ResourceManager.DisconnectedOperations.net8.0.cs index 20e56cf9a903..ac8af320a647 100644 --- a/sdk/disconnectedoperations/Azure.ResourceManager.DisconnectedOperations/api/Azure.ResourceManager.DisconnectedOperations.net8.0.cs +++ b/sdk/disconnectedoperations/Azure.ResourceManager.DisconnectedOperations/api/Azure.ResourceManager.DisconnectedOperations.net8.0.cs @@ -250,7 +250,6 @@ protected virtual void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer public partial class DisconnectedOperationProperties : System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel { public DisconnectedOperationProperties(Azure.ResourceManager.DisconnectedOperations.Models.DisconnectedOperationsConnectionIntent connectionIntent) { } - public DisconnectedOperationProperties(string stampId, Azure.ResourceManager.DisconnectedOperations.Models.DisconnectedOperationsBillingModel billingModel, Azure.ResourceManager.DisconnectedOperations.Models.DisconnectedOperationsConnectionIntent connectionIntent) { } public Azure.ResourceManager.DisconnectedOperations.Models.DisconnectedOperationsBillingModel BillingModel { get { throw null; } } public Azure.ResourceManager.DisconnectedOperations.Models.DisconnectedOperationsConnectionIntent ConnectionIntent { get { throw null; } set { } } public Azure.ResourceManager.DisconnectedOperations.Models.DisconnectedOperationsConnectionStatus? ConnectionStatus { get { throw null; } } diff --git a/sdk/disconnectedoperations/Azure.ResourceManager.DisconnectedOperations/api/Azure.ResourceManager.DisconnectedOperations.netstandard2.0.cs b/sdk/disconnectedoperations/Azure.ResourceManager.DisconnectedOperations/api/Azure.ResourceManager.DisconnectedOperations.netstandard2.0.cs index 20e56cf9a903..ac8af320a647 100644 --- a/sdk/disconnectedoperations/Azure.ResourceManager.DisconnectedOperations/api/Azure.ResourceManager.DisconnectedOperations.netstandard2.0.cs +++ b/sdk/disconnectedoperations/Azure.ResourceManager.DisconnectedOperations/api/Azure.ResourceManager.DisconnectedOperations.netstandard2.0.cs @@ -250,7 +250,6 @@ protected virtual void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer public partial class DisconnectedOperationProperties : System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel { public DisconnectedOperationProperties(Azure.ResourceManager.DisconnectedOperations.Models.DisconnectedOperationsConnectionIntent connectionIntent) { } - public DisconnectedOperationProperties(string stampId, Azure.ResourceManager.DisconnectedOperations.Models.DisconnectedOperationsBillingModel billingModel, Azure.ResourceManager.DisconnectedOperations.Models.DisconnectedOperationsConnectionIntent connectionIntent) { } public Azure.ResourceManager.DisconnectedOperations.Models.DisconnectedOperationsBillingModel BillingModel { get { throw null; } } public Azure.ResourceManager.DisconnectedOperations.Models.DisconnectedOperationsConnectionIntent ConnectionIntent { get { throw null; } set { } } public Azure.ResourceManager.DisconnectedOperations.Models.DisconnectedOperationsConnectionStatus? ConnectionStatus { get { throw null; } } diff --git a/sdk/disconnectedoperations/Azure.ResourceManager.DisconnectedOperations/src/Custom/Models/DisconnectedOperationProperties.cs b/sdk/disconnectedoperations/Azure.ResourceManager.DisconnectedOperations/src/Custom/Models/DisconnectedOperationProperties.cs deleted file mode 100644 index 737f17ed31c4..000000000000 --- a/sdk/disconnectedoperations/Azure.ResourceManager.DisconnectedOperations/src/Custom/Models/DisconnectedOperationProperties.cs +++ /dev/null @@ -1,27 +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.DisconnectedOperations.Models -{ - /// The disconnected operation properties. - public partial class DisconnectedOperationProperties - { - /// Initializes a new instance of . - /// The unique GUID of the stamp. - /// The billing model. - /// The connection intent. - public DisconnectedOperationProperties(string stampId, DisconnectedOperationsBillingModel billingModel, DisconnectedOperationsConnectionIntent connectionIntent) - { - StampId = stampId; - BillingModel = billingModel; - ConnectionIntent = connectionIntent; - } - } -} diff --git a/sdk/disconnectedoperations/Azure.ResourceManager.DisconnectedOperations/tests/Samples/Sample_DisconnectedOperationCollection.cs b/sdk/disconnectedoperations/Azure.ResourceManager.DisconnectedOperations/tests/Samples/Sample_DisconnectedOperationCollection.cs new file mode 100644 index 000000000000..bc4786d28130 --- /dev/null +++ b/sdk/disconnectedoperations/Azure.ResourceManager.DisconnectedOperations/tests/Samples/Sample_DisconnectedOperationCollection.cs @@ -0,0 +1,200 @@ +// 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.DisconnectedOperations.Models; +using Azure.ResourceManager.Resources; +using NUnit.Framework; + +namespace Azure.ResourceManager.DisconnectedOperations.Samples +{ + public partial class Sample_DisconnectedOperationCollection + { + [Test] + [Ignore("Only validating compilation of examples")] + public async Task CreateOrUpdate_DisconnectedOperationsCreateOrUpdate() + { + // Generated from example definition: 2025-06-01-preview/DisconnectedOperations_CreateOrUpdate_MaximumSet_Gen.json + // this example is just showing the usage of "DisconnectedOperation_CreateOrUpdate" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this ResourceGroupResource created on azure + // for more information of creating ResourceGroupResource, please refer to the document of ResourceGroupResource + string subscriptionId = "51DB5DE7-A66C-4789-BFFF-9F75C95A0201"; + string resourceGroupName = "rgdisconnectedOperations"; + ResourceIdentifier resourceGroupResourceId = ResourceGroupResource.CreateResourceIdentifier(subscriptionId, resourceGroupName); + ResourceGroupResource resourceGroupResource = client.GetResourceGroupResource(resourceGroupResourceId); + + // get the collection of this DisconnectedOperationResource + DisconnectedOperationCollection collection = resourceGroupResource.GetDisconnectedOperations(); + + // invoke the operation + string name = "demo-resource"; + DisconnectedOperationData data = new DisconnectedOperationData(new AzureLocation("eastus")) + { + Properties = new DisconnectedOperationProperties(DisconnectedOperationsConnectionIntent.Disconnected), + Tags = +{ +["key1"] = "value1" +}, + }; + ArmOperation lro = await collection.CreateOrUpdateAsync(WaitUntil.Completed, name, data); + DisconnectedOperationResource result = lro.Value; + + // the variable result is a resource, you could call other operations on this instance as well + // but just for demo, we get its data from this resource instance + DisconnectedOperationData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async Task Get_DisconnectedOperationsGet() + { + // Generated from example definition: 2025-06-01-preview/DisconnectedOperations_Get_MaximumSet_Gen.json + // this example is just showing the usage of "DisconnectedOperation_Get" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this ResourceGroupResource created on azure + // for more information of creating ResourceGroupResource, please refer to the document of ResourceGroupResource + string subscriptionId = "301DCB09-82EC-4777-A56C-6FFF26BCC814"; + string resourceGroupName = "rgdisconnectedoperations"; + ResourceIdentifier resourceGroupResourceId = ResourceGroupResource.CreateResourceIdentifier(subscriptionId, resourceGroupName); + ResourceGroupResource resourceGroupResource = client.GetResourceGroupResource(resourceGroupResourceId); + + // get the collection of this DisconnectedOperationResource + DisconnectedOperationCollection collection = resourceGroupResource.GetDisconnectedOperations(); + + // invoke the operation + string name = "demo-resource"; + DisconnectedOperationResource result = await collection.GetAsync(name); + + // 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 + DisconnectedOperationData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async Task GetAll_DisconnectedOperationsListByResourceGroup() + { + // Generated from example definition: 2025-06-01-preview/DisconnectedOperations_ListByResourceGroup_MaximumSet_Gen.json + // this example is just showing the usage of "DisconnectedOperation_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(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this ResourceGroupResource created on azure + // for more information of creating ResourceGroupResource, please refer to the document of ResourceGroupResource + string subscriptionId = "301DCB09-82EC-4777-A56C-6FFF26BCC814"; + string resourceGroupName = "rgdisconnectedoperations"; + ResourceIdentifier resourceGroupResourceId = ResourceGroupResource.CreateResourceIdentifier(subscriptionId, resourceGroupName); + ResourceGroupResource resourceGroupResource = client.GetResourceGroupResource(resourceGroupResourceId); + + // get the collection of this DisconnectedOperationResource + DisconnectedOperationCollection collection = resourceGroupResource.GetDisconnectedOperations(); + + // invoke the operation and iterate over the result + await foreach (DisconnectedOperationResource item in collection.GetAllAsync()) + { + // the variable item is a resource, you could call other operations on this instance as well + // but just for demo, we get its data from this resource instance + DisconnectedOperationData resourceData = item.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + + Console.WriteLine("Succeeded"); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async Task Exists_DisconnectedOperationsGet() + { + // Generated from example definition: 2025-06-01-preview/DisconnectedOperations_Get_MaximumSet_Gen.json + // this example is just showing the usage of "DisconnectedOperation_Get" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this ResourceGroupResource created on azure + // for more information of creating ResourceGroupResource, please refer to the document of ResourceGroupResource + string subscriptionId = "301DCB09-82EC-4777-A56C-6FFF26BCC814"; + string resourceGroupName = "rgdisconnectedoperations"; + ResourceIdentifier resourceGroupResourceId = ResourceGroupResource.CreateResourceIdentifier(subscriptionId, resourceGroupName); + ResourceGroupResource resourceGroupResource = client.GetResourceGroupResource(resourceGroupResourceId); + + // get the collection of this DisconnectedOperationResource + DisconnectedOperationCollection collection = resourceGroupResource.GetDisconnectedOperations(); + + // invoke the operation + string name = "demo-resource"; + bool result = await collection.ExistsAsync(name); + + Console.WriteLine($"Succeeded: {result}"); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async Task GetIfExists_DisconnectedOperationsGet() + { + // Generated from example definition: 2025-06-01-preview/DisconnectedOperations_Get_MaximumSet_Gen.json + // this example is just showing the usage of "DisconnectedOperation_Get" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this ResourceGroupResource created on azure + // for more information of creating ResourceGroupResource, please refer to the document of ResourceGroupResource + string subscriptionId = "301DCB09-82EC-4777-A56C-6FFF26BCC814"; + string resourceGroupName = "rgdisconnectedoperations"; + ResourceIdentifier resourceGroupResourceId = ResourceGroupResource.CreateResourceIdentifier(subscriptionId, resourceGroupName); + ResourceGroupResource resourceGroupResource = client.GetResourceGroupResource(resourceGroupResourceId); + + // get the collection of this DisconnectedOperationResource + DisconnectedOperationCollection collection = resourceGroupResource.GetDisconnectedOperations(); + + // invoke the operation + string name = "demo-resource"; + NullableResponse response = await collection.GetIfExistsAsync(name); + DisconnectedOperationResource result = response.HasValue ? response.Value : null; + + if (result == null) + { + Console.WriteLine("Succeeded with null as result"); + } + else + { + // 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 + DisconnectedOperationData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } + } +} diff --git a/sdk/disconnectedoperations/Azure.ResourceManager.DisconnectedOperations/tests/Generated/Samples/Sample_DisconnectedOperationResource.cs b/sdk/disconnectedoperations/Azure.ResourceManager.DisconnectedOperations/tests/Samples/Sample_DisconnectedOperationResource.cs similarity index 100% rename from sdk/disconnectedoperations/Azure.ResourceManager.DisconnectedOperations/tests/Generated/Samples/Sample_DisconnectedOperationResource.cs rename to sdk/disconnectedoperations/Azure.ResourceManager.DisconnectedOperations/tests/Samples/Sample_DisconnectedOperationResource.cs diff --git a/sdk/disconnectedoperations/Azure.ResourceManager.DisconnectedOperations/tests/Generated/Samples/Sample_DisconnectedOperationsArtifactCollection.cs b/sdk/disconnectedoperations/Azure.ResourceManager.DisconnectedOperations/tests/Samples/Sample_DisconnectedOperationsArtifactCollection.cs similarity index 100% rename from sdk/disconnectedoperations/Azure.ResourceManager.DisconnectedOperations/tests/Generated/Samples/Sample_DisconnectedOperationsArtifactCollection.cs rename to sdk/disconnectedoperations/Azure.ResourceManager.DisconnectedOperations/tests/Samples/Sample_DisconnectedOperationsArtifactCollection.cs diff --git a/sdk/disconnectedoperations/Azure.ResourceManager.DisconnectedOperations/tests/Generated/Samples/Sample_DisconnectedOperationsArtifactResource.cs b/sdk/disconnectedoperations/Azure.ResourceManager.DisconnectedOperations/tests/Samples/Sample_DisconnectedOperationsArtifactResource.cs similarity index 100% rename from sdk/disconnectedoperations/Azure.ResourceManager.DisconnectedOperations/tests/Generated/Samples/Sample_DisconnectedOperationsArtifactResource.cs rename to sdk/disconnectedoperations/Azure.ResourceManager.DisconnectedOperations/tests/Samples/Sample_DisconnectedOperationsArtifactResource.cs diff --git a/sdk/disconnectedoperations/Azure.ResourceManager.DisconnectedOperations/tests/Generated/Samples/Sample_DisconnectedOperationsImageCollection.cs b/sdk/disconnectedoperations/Azure.ResourceManager.DisconnectedOperations/tests/Samples/Sample_DisconnectedOperationsImageCollection.cs similarity index 100% rename from sdk/disconnectedoperations/Azure.ResourceManager.DisconnectedOperations/tests/Generated/Samples/Sample_DisconnectedOperationsImageCollection.cs rename to sdk/disconnectedoperations/Azure.ResourceManager.DisconnectedOperations/tests/Samples/Sample_DisconnectedOperationsImageCollection.cs diff --git a/sdk/disconnectedoperations/Azure.ResourceManager.DisconnectedOperations/tests/Generated/Samples/Sample_DisconnectedOperationsImageResource.cs b/sdk/disconnectedoperations/Azure.ResourceManager.DisconnectedOperations/tests/Samples/Sample_DisconnectedOperationsImageResource.cs similarity index 100% rename from sdk/disconnectedoperations/Azure.ResourceManager.DisconnectedOperations/tests/Generated/Samples/Sample_DisconnectedOperationsImageResource.cs rename to sdk/disconnectedoperations/Azure.ResourceManager.DisconnectedOperations/tests/Samples/Sample_DisconnectedOperationsImageResource.cs diff --git a/sdk/disconnectedoperations/Azure.ResourceManager.DisconnectedOperations/tests/Generated/Samples/Sample_SubscriptionResourceExtensions.cs b/sdk/disconnectedoperations/Azure.ResourceManager.DisconnectedOperations/tests/Samples/Sample_SubscriptionResourceExtensions.cs similarity index 100% rename from sdk/disconnectedoperations/Azure.ResourceManager.DisconnectedOperations/tests/Generated/Samples/Sample_SubscriptionResourceExtensions.cs rename to sdk/disconnectedoperations/Azure.ResourceManager.DisconnectedOperations/tests/Samples/Sample_SubscriptionResourceExtensions.cs From c80c0f952fd247be1d8f9e5ff61fc44de8a75a4c Mon Sep 17 00:00:00 2001 From: RodgeFu Date: Mon, 29 Dec 2025 16:12:13 +0800 Subject: [PATCH 5/6] remove dup --- .../Sample_DisconnectedOperationCollection.cs | 200 ------------------ 1 file changed, 200 deletions(-) delete mode 100644 sdk/disconnectedoperations/Azure.ResourceManager.DisconnectedOperations/tests/Generated/Samples/Sample_DisconnectedOperationCollection.cs diff --git a/sdk/disconnectedoperations/Azure.ResourceManager.DisconnectedOperations/tests/Generated/Samples/Sample_DisconnectedOperationCollection.cs b/sdk/disconnectedoperations/Azure.ResourceManager.DisconnectedOperations/tests/Generated/Samples/Sample_DisconnectedOperationCollection.cs deleted file mode 100644 index d4a8a06b219e..000000000000 --- a/sdk/disconnectedoperations/Azure.ResourceManager.DisconnectedOperations/tests/Generated/Samples/Sample_DisconnectedOperationCollection.cs +++ /dev/null @@ -1,200 +0,0 @@ -// 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.DisconnectedOperations.Models; -using Azure.ResourceManager.Resources; -using NUnit.Framework; - -namespace Azure.ResourceManager.DisconnectedOperations.Samples -{ - public partial class Sample_DisconnectedOperationCollection - { - [Test] - [Ignore("Only validating compilation of examples")] - public async Task CreateOrUpdate_DisconnectedOperationsCreateOrUpdate() - { - // Generated from example definition: 2025-06-01-preview/DisconnectedOperations_CreateOrUpdate_MaximumSet_Gen.json - // this example is just showing the usage of "DisconnectedOperation_CreateOrUpdate" operation, for the dependent resources, they will have to be created separately. - - // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line - TokenCredential cred = new DefaultAzureCredential(); - // authenticate your client - ArmClient client = new ArmClient(cred); - - // this example assumes you already have this ResourceGroupResource created on azure - // for more information of creating ResourceGroupResource, please refer to the document of ResourceGroupResource - string subscriptionId = "51DB5DE7-A66C-4789-BFFF-9F75C95A0201"; - string resourceGroupName = "rgdisconnectedOperations"; - ResourceIdentifier resourceGroupResourceId = ResourceGroupResource.CreateResourceIdentifier(subscriptionId, resourceGroupName); - ResourceGroupResource resourceGroupResource = client.GetResourceGroupResource(resourceGroupResourceId); - - // get the collection of this DisconnectedOperationResource - DisconnectedOperationCollection collection = resourceGroupResource.GetDisconnectedOperations(); - - // invoke the operation - string name = "demo-resource"; - DisconnectedOperationData data = new DisconnectedOperationData(new AzureLocation("eastus")) - { - Properties = new DisconnectedOperationProperties(null, DisconnectedOperationsBillingModel.Capacity, DisconnectedOperationsConnectionIntent.Disconnected), - Tags = -{ -["key1"] = "value1" -}, - }; - ArmOperation lro = await collection.CreateOrUpdateAsync(WaitUntil.Completed, name, data); - DisconnectedOperationResource result = lro.Value; - - // the variable result is a resource, you could call other operations on this instance as well - // but just for demo, we get its data from this resource instance - DisconnectedOperationData resourceData = result.Data; - // for demo we just print out the id - Console.WriteLine($"Succeeded on id: {resourceData.Id}"); - } - - [Test] - [Ignore("Only validating compilation of examples")] - public async Task Get_DisconnectedOperationsGet() - { - // Generated from example definition: 2025-06-01-preview/DisconnectedOperations_Get_MaximumSet_Gen.json - // this example is just showing the usage of "DisconnectedOperation_Get" operation, for the dependent resources, they will have to be created separately. - - // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line - TokenCredential cred = new DefaultAzureCredential(); - // authenticate your client - ArmClient client = new ArmClient(cred); - - // this example assumes you already have this ResourceGroupResource created on azure - // for more information of creating ResourceGroupResource, please refer to the document of ResourceGroupResource - string subscriptionId = "301DCB09-82EC-4777-A56C-6FFF26BCC814"; - string resourceGroupName = "rgdisconnectedoperations"; - ResourceIdentifier resourceGroupResourceId = ResourceGroupResource.CreateResourceIdentifier(subscriptionId, resourceGroupName); - ResourceGroupResource resourceGroupResource = client.GetResourceGroupResource(resourceGroupResourceId); - - // get the collection of this DisconnectedOperationResource - DisconnectedOperationCollection collection = resourceGroupResource.GetDisconnectedOperations(); - - // invoke the operation - string name = "demo-resource"; - DisconnectedOperationResource result = await collection.GetAsync(name); - - // 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 - DisconnectedOperationData resourceData = result.Data; - // for demo we just print out the id - Console.WriteLine($"Succeeded on id: {resourceData.Id}"); - } - - [Test] - [Ignore("Only validating compilation of examples")] - public async Task GetAll_DisconnectedOperationsListByResourceGroup() - { - // Generated from example definition: 2025-06-01-preview/DisconnectedOperations_ListByResourceGroup_MaximumSet_Gen.json - // this example is just showing the usage of "DisconnectedOperation_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(); - // authenticate your client - ArmClient client = new ArmClient(cred); - - // this example assumes you already have this ResourceGroupResource created on azure - // for more information of creating ResourceGroupResource, please refer to the document of ResourceGroupResource - string subscriptionId = "301DCB09-82EC-4777-A56C-6FFF26BCC814"; - string resourceGroupName = "rgdisconnectedoperations"; - ResourceIdentifier resourceGroupResourceId = ResourceGroupResource.CreateResourceIdentifier(subscriptionId, resourceGroupName); - ResourceGroupResource resourceGroupResource = client.GetResourceGroupResource(resourceGroupResourceId); - - // get the collection of this DisconnectedOperationResource - DisconnectedOperationCollection collection = resourceGroupResource.GetDisconnectedOperations(); - - // invoke the operation and iterate over the result - await foreach (DisconnectedOperationResource item in collection.GetAllAsync()) - { - // the variable item is a resource, you could call other operations on this instance as well - // but just for demo, we get its data from this resource instance - DisconnectedOperationData resourceData = item.Data; - // for demo we just print out the id - Console.WriteLine($"Succeeded on id: {resourceData.Id}"); - } - - Console.WriteLine("Succeeded"); - } - - [Test] - [Ignore("Only validating compilation of examples")] - public async Task Exists_DisconnectedOperationsGet() - { - // Generated from example definition: 2025-06-01-preview/DisconnectedOperations_Get_MaximumSet_Gen.json - // this example is just showing the usage of "DisconnectedOperation_Get" operation, for the dependent resources, they will have to be created separately. - - // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line - TokenCredential cred = new DefaultAzureCredential(); - // authenticate your client - ArmClient client = new ArmClient(cred); - - // this example assumes you already have this ResourceGroupResource created on azure - // for more information of creating ResourceGroupResource, please refer to the document of ResourceGroupResource - string subscriptionId = "301DCB09-82EC-4777-A56C-6FFF26BCC814"; - string resourceGroupName = "rgdisconnectedoperations"; - ResourceIdentifier resourceGroupResourceId = ResourceGroupResource.CreateResourceIdentifier(subscriptionId, resourceGroupName); - ResourceGroupResource resourceGroupResource = client.GetResourceGroupResource(resourceGroupResourceId); - - // get the collection of this DisconnectedOperationResource - DisconnectedOperationCollection collection = resourceGroupResource.GetDisconnectedOperations(); - - // invoke the operation - string name = "demo-resource"; - bool result = await collection.ExistsAsync(name); - - Console.WriteLine($"Succeeded: {result}"); - } - - [Test] - [Ignore("Only validating compilation of examples")] - public async Task GetIfExists_DisconnectedOperationsGet() - { - // Generated from example definition: 2025-06-01-preview/DisconnectedOperations_Get_MaximumSet_Gen.json - // this example is just showing the usage of "DisconnectedOperation_Get" operation, for the dependent resources, they will have to be created separately. - - // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line - TokenCredential cred = new DefaultAzureCredential(); - // authenticate your client - ArmClient client = new ArmClient(cred); - - // this example assumes you already have this ResourceGroupResource created on azure - // for more information of creating ResourceGroupResource, please refer to the document of ResourceGroupResource - string subscriptionId = "301DCB09-82EC-4777-A56C-6FFF26BCC814"; - string resourceGroupName = "rgdisconnectedoperations"; - ResourceIdentifier resourceGroupResourceId = ResourceGroupResource.CreateResourceIdentifier(subscriptionId, resourceGroupName); - ResourceGroupResource resourceGroupResource = client.GetResourceGroupResource(resourceGroupResourceId); - - // get the collection of this DisconnectedOperationResource - DisconnectedOperationCollection collection = resourceGroupResource.GetDisconnectedOperations(); - - // invoke the operation - string name = "demo-resource"; - NullableResponse response = await collection.GetIfExistsAsync(name); - DisconnectedOperationResource result = response.HasValue ? response.Value : null; - - if (result == null) - { - Console.WriteLine("Succeeded with null as result"); - } - else - { - // 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 - DisconnectedOperationData resourceData = result.Data; - // for demo we just print out the id - Console.WriteLine($"Succeeded on id: {resourceData.Id}"); - } - } - } -} From 89f9da024d2600ba5c3dfbdc5c4d813d5893ec18 Mon Sep 17 00:00:00 2001 From: Rodge Fu Date: Sun, 4 Jan 2026 12:52:50 +0800 Subject: [PATCH 6/6] Update commit hash in tsp-location.yaml --- .../tsp-location.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sdk/disconnectedoperations/Azure.ResourceManager.DisconnectedOperations/tsp-location.yaml b/sdk/disconnectedoperations/Azure.ResourceManager.DisconnectedOperations/tsp-location.yaml index c045845dfc8d..c1d0ec107a4b 100644 --- a/sdk/disconnectedoperations/Azure.ResourceManager.DisconnectedOperations/tsp-location.yaml +++ b/sdk/disconnectedoperations/Azure.ResourceManager.DisconnectedOperations/tsp-location.yaml @@ -1,5 +1,5 @@ directory: specification/edge/Microsoft.Edge.DisconnectedOperations.Management -commit: 46c51b03d99b113ecc3b38883e3cb2d395fe94a4 +commit: b19b668697a05c42a12eef434e0e294df0be4a51 repo: Azure/azure-rest-api-specs additionalDirectories: - specification/edge/Microsoft.Edge.Shared