diff --git a/sdk/mongodbatlas/Azure.ResourceManager.MongoDBAtlas/api/Azure.ResourceManager.MongoDBAtlas.net8.0.cs b/sdk/mongodbatlas/Azure.ResourceManager.MongoDBAtlas/api/Azure.ResourceManager.MongoDBAtlas.net8.0.cs index e28b5f5d0544..ea9357a9186d 100644 --- a/sdk/mongodbatlas/Azure.ResourceManager.MongoDBAtlas/api/Azure.ResourceManager.MongoDBAtlas.net8.0.cs +++ b/sdk/mongodbatlas/Azure.ResourceManager.MongoDBAtlas/api/Azure.ResourceManager.MongoDBAtlas.net8.0.cs @@ -12,8 +12,6 @@ public static partial class MongoDBAtlasExtensions public static System.Threading.Tasks.Task> GetMongoDBAtlasOrganizationAsync(this Azure.ResourceManager.Resources.ResourceGroupResource resourceGroupResource, string organizationName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } public static Azure.ResourceManager.MongoDBAtlas.MongoDBAtlasOrganizationResource GetMongoDBAtlasOrganizationResource(this Azure.ResourceManager.ArmClient client, Azure.Core.ResourceIdentifier id) { throw null; } public static Azure.ResourceManager.MongoDBAtlas.MongoDBAtlasOrganizationCollection GetMongoDBAtlasOrganizations(this Azure.ResourceManager.Resources.ResourceGroupResource resourceGroupResource) { throw null; } - public static Azure.Pageable GetMongoDBAtlasOrganizations(this Azure.ResourceManager.Resources.SubscriptionResource subscriptionResource, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } - public static Azure.AsyncPageable GetMongoDBAtlasOrganizationsAsync(this Azure.ResourceManager.Resources.SubscriptionResource subscriptionResource, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } } public partial class MongoDBAtlasOrganizationCollection : Azure.ResourceManager.ArmCollection, System.Collections.Generic.IAsyncEnumerable, System.Collections.Generic.IEnumerable, System.Collections.IEnumerable { @@ -34,10 +32,13 @@ protected MongoDBAtlasOrganizationCollection() { } } public partial class MongoDBAtlasOrganizationData : Azure.ResourceManager.Models.TrackedResourceData, System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel { - public MongoDBAtlasOrganizationData(Azure.Core.AzureLocation location) { } + public MongoDBAtlasOrganizationData(string location) { } public Azure.ResourceManager.Models.ManagedServiceIdentity Identity { get { throw null; } set { } } public Azure.ResourceManager.MongoDBAtlas.Models.MongoDBAtlasOrganizationProperties 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.MongoDBAtlas.MongoDBAtlasOrganizationData System.ClientModel.Primitives.IJsonModel.Create(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } void System.ClientModel.Primitives.IJsonModel.Write(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } Azure.ResourceManager.MongoDBAtlas.MongoDBAtlasOrganizationData System.ClientModel.Primitives.IPersistableModel.Create(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } @@ -84,19 +85,14 @@ protected MockableMongoDBAtlasResourceGroupResource() { } public virtual System.Threading.Tasks.Task> GetMongoDBAtlasOrganizationAsync(string organizationName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } public virtual Azure.ResourceManager.MongoDBAtlas.MongoDBAtlasOrganizationCollection GetMongoDBAtlasOrganizations() { throw null; } } - public partial class MockableMongoDBAtlasSubscriptionResource : Azure.ResourceManager.ArmResource - { - protected MockableMongoDBAtlasSubscriptionResource() { } - public virtual Azure.Pageable GetMongoDBAtlasOrganizations(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } - public virtual Azure.AsyncPageable GetMongoDBAtlasOrganizationsAsync(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } - } } namespace Azure.ResourceManager.MongoDBAtlas.Models { public static partial class ArmMongoDBAtlasModelFactory { public static Azure.ResourceManager.MongoDBAtlas.Models.MongoDBAtlasMarketplaceDetails MongoDBAtlasMarketplaceDetails(string subscriptionId = null, Azure.ResourceManager.MongoDBAtlas.Models.MarketplaceSubscriptionStatus? subscriptionStatus = default(Azure.ResourceManager.MongoDBAtlas.Models.MarketplaceSubscriptionStatus?), Azure.ResourceManager.MongoDBAtlas.Models.MongoDBAtlasOfferDetails offerDetails = null) { throw null; } - public static Azure.ResourceManager.MongoDBAtlas.MongoDBAtlasOrganizationData MongoDBAtlasOrganizationData(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.MongoDBAtlas.Models.MongoDBAtlasOrganizationProperties properties = null, Azure.ResourceManager.Models.ManagedServiceIdentity identity = null) { throw null; } + public static Azure.ResourceManager.MongoDBAtlas.MongoDBAtlasOrganizationData MongoDBAtlasOrganizationData(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, string location = null, Azure.ResourceManager.MongoDBAtlas.Models.MongoDBAtlasOrganizationProperties properties = null, Azure.ResourceManager.Models.ManagedServiceIdentity identity = null) { throw null; } + public static Azure.ResourceManager.MongoDBAtlas.Models.MongoDBAtlasOrganizationPatch MongoDBAtlasOrganizationPatch(Azure.ResourceManager.Models.ManagedServiceIdentity identity = null, System.Collections.Generic.IDictionary tags = null, Azure.ResourceManager.MongoDBAtlas.Models.OrganizationResourceUpdateProperties properties = null) { throw null; } public static Azure.ResourceManager.MongoDBAtlas.Models.MongoDBAtlasOrganizationProperties MongoDBAtlasOrganizationProperties(Azure.ResourceManager.MongoDBAtlas.Models.MongoDBAtlasMarketplaceDetails marketplace = null, Azure.ResourceManager.MongoDBAtlas.Models.MongoDBAtlasUserDetails user = null, Azure.ResourceManager.MongoDBAtlas.Models.MongoDBAtlasResourceProvisioningState? provisioningState = default(Azure.ResourceManager.MongoDBAtlas.Models.MongoDBAtlasResourceProvisioningState?), Azure.ResourceManager.MongoDBAtlas.Models.MongoDBAtlasPartnerProperties partnerProperties = null) { throw null; } } [System.Runtime.InteropServices.StructLayoutAttribute(System.Runtime.InteropServices.LayoutKind.Sequential)] @@ -116,6 +112,7 @@ public static partial class ArmMongoDBAtlasModelFactory public override int GetHashCode() { throw null; } public static bool operator ==(Azure.ResourceManager.MongoDBAtlas.Models.MarketplaceSubscriptionStatus left, Azure.ResourceManager.MongoDBAtlas.Models.MarketplaceSubscriptionStatus right) { throw null; } public static implicit operator Azure.ResourceManager.MongoDBAtlas.Models.MarketplaceSubscriptionStatus (string value) { throw null; } + public static implicit operator Azure.ResourceManager.MongoDBAtlas.Models.MarketplaceSubscriptionStatus? (string value) { throw null; } public static bool operator !=(Azure.ResourceManager.MongoDBAtlas.Models.MarketplaceSubscriptionStatus left, Azure.ResourceManager.MongoDBAtlas.Models.MarketplaceSubscriptionStatus right) { throw null; } public override string ToString() { throw null; } } @@ -125,7 +122,10 @@ public MongoDBAtlasMarketplaceDetails(string subscriptionId, Azure.ResourceManag public Azure.ResourceManager.MongoDBAtlas.Models.MongoDBAtlasOfferDetails OfferDetails { get { throw null; } set { } } public string SubscriptionId { get { throw null; } set { } } public Azure.ResourceManager.MongoDBAtlas.Models.MarketplaceSubscriptionStatus? SubscriptionStatus { get { throw null; } } + protected virtual Azure.ResourceManager.MongoDBAtlas.Models.MongoDBAtlasMarketplaceDetails 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.MongoDBAtlas.Models.MongoDBAtlasMarketplaceDetails PersistableModelCreateCore(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + protected virtual System.BinaryData PersistableModelWriteCore(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } Azure.ResourceManager.MongoDBAtlas.Models.MongoDBAtlasMarketplaceDetails System.ClientModel.Primitives.IJsonModel.Create(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } void System.ClientModel.Primitives.IJsonModel.Write(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } Azure.ResourceManager.MongoDBAtlas.Models.MongoDBAtlasMarketplaceDetails System.ClientModel.Primitives.IPersistableModel.Create(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } @@ -141,7 +141,10 @@ public MongoDBAtlasOfferDetails(string publisherId, string offerId, string planI public string PublisherId { get { throw null; } set { } } public string TermId { get { throw null; } set { } } public string TermUnit { get { throw null; } set { } } + protected virtual Azure.ResourceManager.MongoDBAtlas.Models.MongoDBAtlasOfferDetails 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.MongoDBAtlas.Models.MongoDBAtlasOfferDetails PersistableModelCreateCore(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + protected virtual System.BinaryData PersistableModelWriteCore(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } Azure.ResourceManager.MongoDBAtlas.Models.MongoDBAtlasOfferDetails System.ClientModel.Primitives.IJsonModel.Create(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } void System.ClientModel.Primitives.IJsonModel.Write(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } Azure.ResourceManager.MongoDBAtlas.Models.MongoDBAtlasOfferDetails System.ClientModel.Primitives.IPersistableModel.Create(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } @@ -152,9 +155,12 @@ public partial class MongoDBAtlasOrganizationPatch : System.ClientModel.Primitiv { public MongoDBAtlasOrganizationPatch() { } public Azure.ResourceManager.Models.ManagedServiceIdentity Identity { get { throw null; } set { } } - public Azure.ResourceManager.MongoDBAtlas.Models.MongoDBAtlasOrganizationUpdateProperties Properties { get { throw null; } set { } } + public Azure.ResourceManager.MongoDBAtlas.Models.OrganizationResourceUpdateProperties Properties { get { throw null; } set { } } public System.Collections.Generic.IDictionary Tags { get { throw null; } } + protected virtual Azure.ResourceManager.MongoDBAtlas.Models.MongoDBAtlasOrganizationPatch 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.MongoDBAtlas.Models.MongoDBAtlasOrganizationPatch PersistableModelCreateCore(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + protected virtual System.BinaryData PersistableModelWriteCore(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } Azure.ResourceManager.MongoDBAtlas.Models.MongoDBAtlasOrganizationPatch System.ClientModel.Primitives.IJsonModel.Create(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } void System.ClientModel.Primitives.IJsonModel.Write(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } Azure.ResourceManager.MongoDBAtlas.Models.MongoDBAtlasOrganizationPatch System.ClientModel.Primitives.IPersistableModel.Create(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } @@ -168,24 +174,19 @@ public MongoDBAtlasOrganizationProperties(Azure.ResourceManager.MongoDBAtlas.Mod public Azure.ResourceManager.MongoDBAtlas.Models.MongoDBAtlasPartnerProperties PartnerProperties { get { throw null; } set { } } public Azure.ResourceManager.MongoDBAtlas.Models.MongoDBAtlasResourceProvisioningState? ProvisioningState { get { throw null; } } public Azure.ResourceManager.MongoDBAtlas.Models.MongoDBAtlasUserDetails User { get { throw null; } set { } } + protected virtual Azure.ResourceManager.MongoDBAtlas.Models.MongoDBAtlasOrganizationProperties 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.MongoDBAtlas.Models.MongoDBAtlasOrganizationProperties PersistableModelCreateCore(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + protected virtual System.BinaryData PersistableModelWriteCore(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } Azure.ResourceManager.MongoDBAtlas.Models.MongoDBAtlasOrganizationProperties System.ClientModel.Primitives.IJsonModel.Create(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } void System.ClientModel.Primitives.IJsonModel.Write(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } Azure.ResourceManager.MongoDBAtlas.Models.MongoDBAtlasOrganizationProperties 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 MongoDBAtlasOrganizationUpdateProperties : System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel + public partial class MongoDBAtlasOrganizationUpdateProperties { public MongoDBAtlasOrganizationUpdateProperties() { } - public Azure.ResourceManager.MongoDBAtlas.Models.MongoDBAtlasPartnerProperties PartnerProperties { get { throw null; } set { } } - public Azure.ResourceManager.MongoDBAtlas.Models.MongoDBAtlasUserDetails User { get { throw null; } set { } } - protected virtual void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } - Azure.ResourceManager.MongoDBAtlas.Models.MongoDBAtlasOrganizationUpdateProperties System.ClientModel.Primitives.IJsonModel.Create(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } - void System.ClientModel.Primitives.IJsonModel.Write(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } - Azure.ResourceManager.MongoDBAtlas.Models.MongoDBAtlasOrganizationUpdateProperties 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 MongoDBAtlasPartnerProperties : System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel { @@ -193,7 +194,10 @@ public MongoDBAtlasPartnerProperties(string organizationName) { } public string OrganizationId { get { throw null; } set { } } public string OrganizationName { get { throw null; } set { } } public string RedirectUri { get { throw null; } set { } } + protected virtual Azure.ResourceManager.MongoDBAtlas.Models.MongoDBAtlasPartnerProperties 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.MongoDBAtlas.Models.MongoDBAtlasPartnerProperties PersistableModelCreateCore(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + protected virtual System.BinaryData PersistableModelWriteCore(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } Azure.ResourceManager.MongoDBAtlas.Models.MongoDBAtlasPartnerProperties System.ClientModel.Primitives.IJsonModel.Create(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } void System.ClientModel.Primitives.IJsonModel.Write(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } Azure.ResourceManager.MongoDBAtlas.Models.MongoDBAtlasPartnerProperties System.ClientModel.Primitives.IPersistableModel.Create(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } @@ -216,6 +220,7 @@ protected virtual void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer public override int GetHashCode() { throw null; } public static bool operator ==(Azure.ResourceManager.MongoDBAtlas.Models.MongoDBAtlasResourceProvisioningState left, Azure.ResourceManager.MongoDBAtlas.Models.MongoDBAtlasResourceProvisioningState right) { throw null; } public static implicit operator Azure.ResourceManager.MongoDBAtlas.Models.MongoDBAtlasResourceProvisioningState (string value) { throw null; } + public static implicit operator Azure.ResourceManager.MongoDBAtlas.Models.MongoDBAtlasResourceProvisioningState? (string value) { throw null; } public static bool operator !=(Azure.ResourceManager.MongoDBAtlas.Models.MongoDBAtlasResourceProvisioningState left, Azure.ResourceManager.MongoDBAtlas.Models.MongoDBAtlasResourceProvisioningState right) { throw null; } public override string ToString() { throw null; } } @@ -228,11 +233,29 @@ public MongoDBAtlasUserDetails(string firstName, string lastName, string emailAd public string LastName { get { throw null; } set { } } public string PhoneNumber { get { throw null; } set { } } public string Upn { get { throw null; } set { } } + protected virtual Azure.ResourceManager.MongoDBAtlas.Models.MongoDBAtlasUserDetails 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.MongoDBAtlas.Models.MongoDBAtlasUserDetails PersistableModelCreateCore(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + protected virtual System.BinaryData PersistableModelWriteCore(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } Azure.ResourceManager.MongoDBAtlas.Models.MongoDBAtlasUserDetails System.ClientModel.Primitives.IJsonModel.Create(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } void System.ClientModel.Primitives.IJsonModel.Write(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } Azure.ResourceManager.MongoDBAtlas.Models.MongoDBAtlasUserDetails 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 OrganizationResourceUpdateProperties : System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel + { + public OrganizationResourceUpdateProperties() { } + public Azure.ResourceManager.MongoDBAtlas.Models.MongoDBAtlasPartnerProperties PartnerProperties { get { throw null; } set { } } + public Azure.ResourceManager.MongoDBAtlas.Models.MongoDBAtlasUserDetails User { get { throw null; } set { } } + protected virtual Azure.ResourceManager.MongoDBAtlas.Models.OrganizationResourceUpdateProperties 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.MongoDBAtlas.Models.OrganizationResourceUpdateProperties PersistableModelCreateCore(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + protected virtual System.BinaryData PersistableModelWriteCore(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + Azure.ResourceManager.MongoDBAtlas.Models.OrganizationResourceUpdateProperties System.ClientModel.Primitives.IJsonModel.Create(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + void System.ClientModel.Primitives.IJsonModel.Write(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.ResourceManager.MongoDBAtlas.Models.OrganizationResourceUpdateProperties 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/mongodbatlas/Azure.ResourceManager.MongoDBAtlas/api/Azure.ResourceManager.MongoDBAtlas.netstandard2.0.cs b/sdk/mongodbatlas/Azure.ResourceManager.MongoDBAtlas/api/Azure.ResourceManager.MongoDBAtlas.netstandard2.0.cs index e28b5f5d0544..ea9357a9186d 100644 --- a/sdk/mongodbatlas/Azure.ResourceManager.MongoDBAtlas/api/Azure.ResourceManager.MongoDBAtlas.netstandard2.0.cs +++ b/sdk/mongodbatlas/Azure.ResourceManager.MongoDBAtlas/api/Azure.ResourceManager.MongoDBAtlas.netstandard2.0.cs @@ -12,8 +12,6 @@ public static partial class MongoDBAtlasExtensions public static System.Threading.Tasks.Task> GetMongoDBAtlasOrganizationAsync(this Azure.ResourceManager.Resources.ResourceGroupResource resourceGroupResource, string organizationName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } public static Azure.ResourceManager.MongoDBAtlas.MongoDBAtlasOrganizationResource GetMongoDBAtlasOrganizationResource(this Azure.ResourceManager.ArmClient client, Azure.Core.ResourceIdentifier id) { throw null; } public static Azure.ResourceManager.MongoDBAtlas.MongoDBAtlasOrganizationCollection GetMongoDBAtlasOrganizations(this Azure.ResourceManager.Resources.ResourceGroupResource resourceGroupResource) { throw null; } - public static Azure.Pageable GetMongoDBAtlasOrganizations(this Azure.ResourceManager.Resources.SubscriptionResource subscriptionResource, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } - public static Azure.AsyncPageable GetMongoDBAtlasOrganizationsAsync(this Azure.ResourceManager.Resources.SubscriptionResource subscriptionResource, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } } public partial class MongoDBAtlasOrganizationCollection : Azure.ResourceManager.ArmCollection, System.Collections.Generic.IAsyncEnumerable, System.Collections.Generic.IEnumerable, System.Collections.IEnumerable { @@ -34,10 +32,13 @@ protected MongoDBAtlasOrganizationCollection() { } } public partial class MongoDBAtlasOrganizationData : Azure.ResourceManager.Models.TrackedResourceData, System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel { - public MongoDBAtlasOrganizationData(Azure.Core.AzureLocation location) { } + public MongoDBAtlasOrganizationData(string location) { } public Azure.ResourceManager.Models.ManagedServiceIdentity Identity { get { throw null; } set { } } public Azure.ResourceManager.MongoDBAtlas.Models.MongoDBAtlasOrganizationProperties 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.MongoDBAtlas.MongoDBAtlasOrganizationData System.ClientModel.Primitives.IJsonModel.Create(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } void System.ClientModel.Primitives.IJsonModel.Write(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } Azure.ResourceManager.MongoDBAtlas.MongoDBAtlasOrganizationData System.ClientModel.Primitives.IPersistableModel.Create(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } @@ -84,19 +85,14 @@ protected MockableMongoDBAtlasResourceGroupResource() { } public virtual System.Threading.Tasks.Task> GetMongoDBAtlasOrganizationAsync(string organizationName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } public virtual Azure.ResourceManager.MongoDBAtlas.MongoDBAtlasOrganizationCollection GetMongoDBAtlasOrganizations() { throw null; } } - public partial class MockableMongoDBAtlasSubscriptionResource : Azure.ResourceManager.ArmResource - { - protected MockableMongoDBAtlasSubscriptionResource() { } - public virtual Azure.Pageable GetMongoDBAtlasOrganizations(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } - public virtual Azure.AsyncPageable GetMongoDBAtlasOrganizationsAsync(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } - } } namespace Azure.ResourceManager.MongoDBAtlas.Models { public static partial class ArmMongoDBAtlasModelFactory { public static Azure.ResourceManager.MongoDBAtlas.Models.MongoDBAtlasMarketplaceDetails MongoDBAtlasMarketplaceDetails(string subscriptionId = null, Azure.ResourceManager.MongoDBAtlas.Models.MarketplaceSubscriptionStatus? subscriptionStatus = default(Azure.ResourceManager.MongoDBAtlas.Models.MarketplaceSubscriptionStatus?), Azure.ResourceManager.MongoDBAtlas.Models.MongoDBAtlasOfferDetails offerDetails = null) { throw null; } - public static Azure.ResourceManager.MongoDBAtlas.MongoDBAtlasOrganizationData MongoDBAtlasOrganizationData(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.MongoDBAtlas.Models.MongoDBAtlasOrganizationProperties properties = null, Azure.ResourceManager.Models.ManagedServiceIdentity identity = null) { throw null; } + public static Azure.ResourceManager.MongoDBAtlas.MongoDBAtlasOrganizationData MongoDBAtlasOrganizationData(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, string location = null, Azure.ResourceManager.MongoDBAtlas.Models.MongoDBAtlasOrganizationProperties properties = null, Azure.ResourceManager.Models.ManagedServiceIdentity identity = null) { throw null; } + public static Azure.ResourceManager.MongoDBAtlas.Models.MongoDBAtlasOrganizationPatch MongoDBAtlasOrganizationPatch(Azure.ResourceManager.Models.ManagedServiceIdentity identity = null, System.Collections.Generic.IDictionary tags = null, Azure.ResourceManager.MongoDBAtlas.Models.OrganizationResourceUpdateProperties properties = null) { throw null; } public static Azure.ResourceManager.MongoDBAtlas.Models.MongoDBAtlasOrganizationProperties MongoDBAtlasOrganizationProperties(Azure.ResourceManager.MongoDBAtlas.Models.MongoDBAtlasMarketplaceDetails marketplace = null, Azure.ResourceManager.MongoDBAtlas.Models.MongoDBAtlasUserDetails user = null, Azure.ResourceManager.MongoDBAtlas.Models.MongoDBAtlasResourceProvisioningState? provisioningState = default(Azure.ResourceManager.MongoDBAtlas.Models.MongoDBAtlasResourceProvisioningState?), Azure.ResourceManager.MongoDBAtlas.Models.MongoDBAtlasPartnerProperties partnerProperties = null) { throw null; } } [System.Runtime.InteropServices.StructLayoutAttribute(System.Runtime.InteropServices.LayoutKind.Sequential)] @@ -116,6 +112,7 @@ public static partial class ArmMongoDBAtlasModelFactory public override int GetHashCode() { throw null; } public static bool operator ==(Azure.ResourceManager.MongoDBAtlas.Models.MarketplaceSubscriptionStatus left, Azure.ResourceManager.MongoDBAtlas.Models.MarketplaceSubscriptionStatus right) { throw null; } public static implicit operator Azure.ResourceManager.MongoDBAtlas.Models.MarketplaceSubscriptionStatus (string value) { throw null; } + public static implicit operator Azure.ResourceManager.MongoDBAtlas.Models.MarketplaceSubscriptionStatus? (string value) { throw null; } public static bool operator !=(Azure.ResourceManager.MongoDBAtlas.Models.MarketplaceSubscriptionStatus left, Azure.ResourceManager.MongoDBAtlas.Models.MarketplaceSubscriptionStatus right) { throw null; } public override string ToString() { throw null; } } @@ -125,7 +122,10 @@ public MongoDBAtlasMarketplaceDetails(string subscriptionId, Azure.ResourceManag public Azure.ResourceManager.MongoDBAtlas.Models.MongoDBAtlasOfferDetails OfferDetails { get { throw null; } set { } } public string SubscriptionId { get { throw null; } set { } } public Azure.ResourceManager.MongoDBAtlas.Models.MarketplaceSubscriptionStatus? SubscriptionStatus { get { throw null; } } + protected virtual Azure.ResourceManager.MongoDBAtlas.Models.MongoDBAtlasMarketplaceDetails 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.MongoDBAtlas.Models.MongoDBAtlasMarketplaceDetails PersistableModelCreateCore(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + protected virtual System.BinaryData PersistableModelWriteCore(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } Azure.ResourceManager.MongoDBAtlas.Models.MongoDBAtlasMarketplaceDetails System.ClientModel.Primitives.IJsonModel.Create(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } void System.ClientModel.Primitives.IJsonModel.Write(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } Azure.ResourceManager.MongoDBAtlas.Models.MongoDBAtlasMarketplaceDetails System.ClientModel.Primitives.IPersistableModel.Create(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } @@ -141,7 +141,10 @@ public MongoDBAtlasOfferDetails(string publisherId, string offerId, string planI public string PublisherId { get { throw null; } set { } } public string TermId { get { throw null; } set { } } public string TermUnit { get { throw null; } set { } } + protected virtual Azure.ResourceManager.MongoDBAtlas.Models.MongoDBAtlasOfferDetails 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.MongoDBAtlas.Models.MongoDBAtlasOfferDetails PersistableModelCreateCore(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + protected virtual System.BinaryData PersistableModelWriteCore(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } Azure.ResourceManager.MongoDBAtlas.Models.MongoDBAtlasOfferDetails System.ClientModel.Primitives.IJsonModel.Create(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } void System.ClientModel.Primitives.IJsonModel.Write(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } Azure.ResourceManager.MongoDBAtlas.Models.MongoDBAtlasOfferDetails System.ClientModel.Primitives.IPersistableModel.Create(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } @@ -152,9 +155,12 @@ public partial class MongoDBAtlasOrganizationPatch : System.ClientModel.Primitiv { public MongoDBAtlasOrganizationPatch() { } public Azure.ResourceManager.Models.ManagedServiceIdentity Identity { get { throw null; } set { } } - public Azure.ResourceManager.MongoDBAtlas.Models.MongoDBAtlasOrganizationUpdateProperties Properties { get { throw null; } set { } } + public Azure.ResourceManager.MongoDBAtlas.Models.OrganizationResourceUpdateProperties Properties { get { throw null; } set { } } public System.Collections.Generic.IDictionary Tags { get { throw null; } } + protected virtual Azure.ResourceManager.MongoDBAtlas.Models.MongoDBAtlasOrganizationPatch 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.MongoDBAtlas.Models.MongoDBAtlasOrganizationPatch PersistableModelCreateCore(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + protected virtual System.BinaryData PersistableModelWriteCore(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } Azure.ResourceManager.MongoDBAtlas.Models.MongoDBAtlasOrganizationPatch System.ClientModel.Primitives.IJsonModel.Create(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } void System.ClientModel.Primitives.IJsonModel.Write(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } Azure.ResourceManager.MongoDBAtlas.Models.MongoDBAtlasOrganizationPatch System.ClientModel.Primitives.IPersistableModel.Create(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } @@ -168,24 +174,19 @@ public MongoDBAtlasOrganizationProperties(Azure.ResourceManager.MongoDBAtlas.Mod public Azure.ResourceManager.MongoDBAtlas.Models.MongoDBAtlasPartnerProperties PartnerProperties { get { throw null; } set { } } public Azure.ResourceManager.MongoDBAtlas.Models.MongoDBAtlasResourceProvisioningState? ProvisioningState { get { throw null; } } public Azure.ResourceManager.MongoDBAtlas.Models.MongoDBAtlasUserDetails User { get { throw null; } set { } } + protected virtual Azure.ResourceManager.MongoDBAtlas.Models.MongoDBAtlasOrganizationProperties 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.MongoDBAtlas.Models.MongoDBAtlasOrganizationProperties PersistableModelCreateCore(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + protected virtual System.BinaryData PersistableModelWriteCore(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } Azure.ResourceManager.MongoDBAtlas.Models.MongoDBAtlasOrganizationProperties System.ClientModel.Primitives.IJsonModel.Create(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } void System.ClientModel.Primitives.IJsonModel.Write(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } Azure.ResourceManager.MongoDBAtlas.Models.MongoDBAtlasOrganizationProperties 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 MongoDBAtlasOrganizationUpdateProperties : System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel + public partial class MongoDBAtlasOrganizationUpdateProperties { public MongoDBAtlasOrganizationUpdateProperties() { } - public Azure.ResourceManager.MongoDBAtlas.Models.MongoDBAtlasPartnerProperties PartnerProperties { get { throw null; } set { } } - public Azure.ResourceManager.MongoDBAtlas.Models.MongoDBAtlasUserDetails User { get { throw null; } set { } } - protected virtual void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } - Azure.ResourceManager.MongoDBAtlas.Models.MongoDBAtlasOrganizationUpdateProperties System.ClientModel.Primitives.IJsonModel.Create(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } - void System.ClientModel.Primitives.IJsonModel.Write(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } - Azure.ResourceManager.MongoDBAtlas.Models.MongoDBAtlasOrganizationUpdateProperties 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 MongoDBAtlasPartnerProperties : System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel { @@ -193,7 +194,10 @@ public MongoDBAtlasPartnerProperties(string organizationName) { } public string OrganizationId { get { throw null; } set { } } public string OrganizationName { get { throw null; } set { } } public string RedirectUri { get { throw null; } set { } } + protected virtual Azure.ResourceManager.MongoDBAtlas.Models.MongoDBAtlasPartnerProperties 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.MongoDBAtlas.Models.MongoDBAtlasPartnerProperties PersistableModelCreateCore(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + protected virtual System.BinaryData PersistableModelWriteCore(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } Azure.ResourceManager.MongoDBAtlas.Models.MongoDBAtlasPartnerProperties System.ClientModel.Primitives.IJsonModel.Create(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } void System.ClientModel.Primitives.IJsonModel.Write(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } Azure.ResourceManager.MongoDBAtlas.Models.MongoDBAtlasPartnerProperties System.ClientModel.Primitives.IPersistableModel.Create(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } @@ -216,6 +220,7 @@ protected virtual void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer public override int GetHashCode() { throw null; } public static bool operator ==(Azure.ResourceManager.MongoDBAtlas.Models.MongoDBAtlasResourceProvisioningState left, Azure.ResourceManager.MongoDBAtlas.Models.MongoDBAtlasResourceProvisioningState right) { throw null; } public static implicit operator Azure.ResourceManager.MongoDBAtlas.Models.MongoDBAtlasResourceProvisioningState (string value) { throw null; } + public static implicit operator Azure.ResourceManager.MongoDBAtlas.Models.MongoDBAtlasResourceProvisioningState? (string value) { throw null; } public static bool operator !=(Azure.ResourceManager.MongoDBAtlas.Models.MongoDBAtlasResourceProvisioningState left, Azure.ResourceManager.MongoDBAtlas.Models.MongoDBAtlasResourceProvisioningState right) { throw null; } public override string ToString() { throw null; } } @@ -228,11 +233,29 @@ public MongoDBAtlasUserDetails(string firstName, string lastName, string emailAd public string LastName { get { throw null; } set { } } public string PhoneNumber { get { throw null; } set { } } public string Upn { get { throw null; } set { } } + protected virtual Azure.ResourceManager.MongoDBAtlas.Models.MongoDBAtlasUserDetails 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.MongoDBAtlas.Models.MongoDBAtlasUserDetails PersistableModelCreateCore(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + protected virtual System.BinaryData PersistableModelWriteCore(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } Azure.ResourceManager.MongoDBAtlas.Models.MongoDBAtlasUserDetails System.ClientModel.Primitives.IJsonModel.Create(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } void System.ClientModel.Primitives.IJsonModel.Write(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } Azure.ResourceManager.MongoDBAtlas.Models.MongoDBAtlasUserDetails 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 OrganizationResourceUpdateProperties : System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel + { + public OrganizationResourceUpdateProperties() { } + public Azure.ResourceManager.MongoDBAtlas.Models.MongoDBAtlasPartnerProperties PartnerProperties { get { throw null; } set { } } + public Azure.ResourceManager.MongoDBAtlas.Models.MongoDBAtlasUserDetails User { get { throw null; } set { } } + protected virtual Azure.ResourceManager.MongoDBAtlas.Models.OrganizationResourceUpdateProperties 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.MongoDBAtlas.Models.OrganizationResourceUpdateProperties PersistableModelCreateCore(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + protected virtual System.BinaryData PersistableModelWriteCore(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + Azure.ResourceManager.MongoDBAtlas.Models.OrganizationResourceUpdateProperties System.ClientModel.Primitives.IJsonModel.Create(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + void System.ClientModel.Primitives.IJsonModel.Write(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.ResourceManager.MongoDBAtlas.Models.OrganizationResourceUpdateProperties 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/mongodbatlas/Azure.ResourceManager.MongoDBAtlas/src/Customize/MongoDBAtlasOrganizationUpdateProperties.cs b/sdk/mongodbatlas/Azure.ResourceManager.MongoDBAtlas/src/Customize/MongoDBAtlasOrganizationUpdateProperties.cs index 3cce1829e0e5..e2fe55671b8a 100644 --- a/sdk/mongodbatlas/Azure.ResourceManager.MongoDBAtlas/src/Customize/MongoDBAtlasOrganizationUpdateProperties.cs +++ b/sdk/mongodbatlas/Azure.ResourceManager.MongoDBAtlas/src/Customize/MongoDBAtlasOrganizationUpdateProperties.cs @@ -7,6 +7,9 @@ namespace Azure.ResourceManager.MongoDBAtlas.Models { + /// + /// Properties for updating a MongoDB Atlas Organization. + /// [CodeGenModel("OrganizationResourceUpdateProperties")] public partial class MongoDBAtlasOrganizationUpdateProperties { } } diff --git a/sdk/mongodbatlas/Azure.ResourceManager.MongoDBAtlas/src/Generated/ArmMongoDBAtlasModelFactory.cs b/sdk/mongodbatlas/Azure.ResourceManager.MongoDBAtlas/src/Generated/ArmMongoDBAtlasModelFactory.cs index a74094f4e040..50c10c061c96 100644 --- a/sdk/mongodbatlas/Azure.ResourceManager.MongoDBAtlas/src/Generated/ArmMongoDBAtlasModelFactory.cs +++ b/sdk/mongodbatlas/Azure.ResourceManager.MongoDBAtlas/src/Generated/ArmMongoDBAtlasModelFactory.cs @@ -10,57 +10,71 @@ using System.Linq; using Azure.Core; using Azure.ResourceManager.Models; +using Azure.ResourceManager.MongoDBAtlas; namespace Azure.ResourceManager.MongoDBAtlas.Models { - /// Model factory for models. + /// A factory class for creating instances of the models for mocking. public static partial class ArmMongoDBAtlasModelFactory { - /// Initializes a new instance of . - /// The id. - /// The name. - /// The resourceType. - /// The systemData. - /// The tags. - /// The location. + + /// The resource model definition for an Azure Organization. + /// 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. /// The managed service identities assigned to this resource. /// A new instance for mocking. - public static MongoDBAtlasOrganizationData MongoDBAtlasOrganizationData(ResourceIdentifier id = null, string name = null, ResourceType resourceType = default, SystemData systemData = null, IDictionary tags = null, AzureLocation location = default, MongoDBAtlasOrganizationProperties properties = null, ManagedServiceIdentity identity = null) + public static MongoDBAtlasOrganizationData MongoDBAtlasOrganizationData(ResourceIdentifier id = default, string name = default, ResourceType resourceType = default, SystemData systemData = default, IDictionary tags = default, string location = default, MongoDBAtlasOrganizationProperties properties = default, ManagedServiceIdentity identity = default) { - tags ??= new Dictionary(); + tags ??= new ChangeTrackingDictionary(); return new MongoDBAtlasOrganizationData( id, name, resourceType, systemData, + additionalBinaryDataProperties: null, tags, location, properties, - identity, - serializedAdditionalRawData: null); + identity); } - /// Initializes a new instance of . + /// Properties specific to Organization. /// Marketplace details of the resource. /// Details of the user. /// Provisioning state of the resource. /// MongoDB properties. /// A new instance for mocking. - public static MongoDBAtlasOrganizationProperties MongoDBAtlasOrganizationProperties(MongoDBAtlasMarketplaceDetails marketplace = null, MongoDBAtlasUserDetails user = null, MongoDBAtlasResourceProvisioningState? provisioningState = null, MongoDBAtlasPartnerProperties partnerProperties = null) + public static MongoDBAtlasOrganizationProperties MongoDBAtlasOrganizationProperties(MongoDBAtlasMarketplaceDetails marketplace = default, MongoDBAtlasUserDetails user = default, MongoDBAtlasResourceProvisioningState? provisioningState = default, MongoDBAtlasPartnerProperties partnerProperties = default) { - return new MongoDBAtlasOrganizationProperties(marketplace, user, provisioningState, partnerProperties, serializedAdditionalRawData: null); + return new MongoDBAtlasOrganizationProperties(marketplace, user, provisioningState, partnerProperties, additionalBinaryDataProperties: null); } - /// Initializes a new instance of . + /// Marketplace details for an organization. /// Azure subscription id for the the marketplace offer is purchased from. /// Marketplace subscription status. /// Offer details for the marketplace that is selected by the user. /// A new instance for mocking. - public static MongoDBAtlasMarketplaceDetails MongoDBAtlasMarketplaceDetails(string subscriptionId = null, MarketplaceSubscriptionStatus? subscriptionStatus = null, MongoDBAtlasOfferDetails offerDetails = null) + public static MongoDBAtlasMarketplaceDetails MongoDBAtlasMarketplaceDetails(string subscriptionId = default, MarketplaceSubscriptionStatus? subscriptionStatus = default, MongoDBAtlasOfferDetails offerDetails = default) { - return new MongoDBAtlasMarketplaceDetails(subscriptionId, subscriptionStatus, offerDetails, serializedAdditionalRawData: null); + return new MongoDBAtlasMarketplaceDetails(subscriptionId, subscriptionStatus, offerDetails, additionalBinaryDataProperties: null); + } + + /// The type used for update operations of the OrganizationResource. + /// The managed service identities assigned to this resource. + /// Resource tags. + /// The resource-specific properties for this resource. + /// A new instance for mocking. + public static MongoDBAtlasOrganizationPatch MongoDBAtlasOrganizationPatch(ManagedServiceIdentity identity = default, IDictionary tags = default, OrganizationResourceUpdateProperties properties = default) + { + tags ??= new ChangeTrackingDictionary(); + + return new MongoDBAtlasOrganizationPatch(identity, tags, properties, additionalBinaryDataProperties: null); } } } diff --git a/sdk/mongodbatlas/Azure.ResourceManager.MongoDBAtlas/src/Generated/Extensions/MockableMongoDBAtlasArmClient.cs b/sdk/mongodbatlas/Azure.ResourceManager.MongoDBAtlas/src/Generated/Extensions/MockableMongoDBAtlasArmClient.cs index 2d9caa5a14c7..3f6938541ca9 100644 --- a/sdk/mongodbatlas/Azure.ResourceManager.MongoDBAtlas/src/Generated/Extensions/MockableMongoDBAtlasArmClient.cs +++ b/sdk/mongodbatlas/Azure.ResourceManager.MongoDBAtlas/src/Generated/Extensions/MockableMongoDBAtlasArmClient.cs @@ -6,38 +6,27 @@ #nullable disable using Azure.Core; +using Azure.ResourceManager; +using Azure.ResourceManager.MongoDBAtlas; namespace Azure.ResourceManager.MongoDBAtlas.Mocking { - /// A class to add extension methods to ArmClient. + /// A class to add extension methods to . public partial class MockableMongoDBAtlasArmClient : ArmResource { - /// Initializes a new instance of the class for mocking. + /// Initializes a new instance of MockableMongoDBAtlasArmClient for mocking. protected MockableMongoDBAtlasArmClient() { } - /// 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 MockableMongoDBAtlasArmClient(ArmClient client, ResourceIdentifier id) : base(client, id) { } - internal MockableMongoDBAtlasArmClient(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 MongoDBAtlasOrganizationResource GetMongoDBAtlasOrganizationResource(ResourceIdentifier id) diff --git a/sdk/mongodbatlas/Azure.ResourceManager.MongoDBAtlas/src/Generated/Extensions/MockableMongoDBAtlasResourceGroupResource.cs b/sdk/mongodbatlas/Azure.ResourceManager.MongoDBAtlas/src/Generated/Extensions/MockableMongoDBAtlasResourceGroupResource.cs index fdbad028cebf..d9dcad19d1fb 100644 --- a/sdk/mongodbatlas/Azure.ResourceManager.MongoDBAtlas/src/Generated/Extensions/MockableMongoDBAtlasResourceGroupResource.cs +++ b/sdk/mongodbatlas/Azure.ResourceManager.MongoDBAtlas/src/Generated/Extensions/MockableMongoDBAtlasResourceGroupResource.cs @@ -8,59 +8,37 @@ using System; using System.Threading; using System.Threading.Tasks; +using Azure; using Azure.Core; +using Azure.ResourceManager; +using Azure.ResourceManager.MongoDBAtlas; +using Azure.ResourceManager.Resources; namespace Azure.ResourceManager.MongoDBAtlas.Mocking { - /// A class to add extension methods to ResourceGroupResource. + /// A class to add extension methods to . public partial class MockableMongoDBAtlasResourceGroupResource : ArmResource { - /// Initializes a new instance of the class for mocking. + /// Initializes a new instance of MockableMongoDBAtlasResourceGroupResource for mocking. protected MockableMongoDBAtlasResourceGroupResource() { } - /// 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 MockableMongoDBAtlasResourceGroupResource(ArmClient client, ResourceIdentifier id) : base(client, id) { } - private string GetApiVersionOrNull(ResourceType resourceType) - { - TryGetApiVersion(resourceType, out string apiVersion); - return apiVersion; - } - - /// Gets a collection of MongoDBAtlasOrganizationResources in the ResourceGroupResource. - /// An object representing collection of MongoDBAtlasOrganizationResources and their operations over a MongoDBAtlasOrganizationResource. + /// Gets a collection of MongoDBAtlasOrganizations in the . + /// An object representing collection of MongoDBAtlasOrganizations and their operations over a MongoDBAtlasOrganizationResource. public virtual MongoDBAtlasOrganizationCollection GetMongoDBAtlasOrganizations() { return GetCachedClient(client => new MongoDBAtlasOrganizationCollection(client, Id)); } - /// - /// Get a OrganizationResource - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/MongoDB.Atlas/organizations/{organizationName} - /// - /// - /// Operation Id - /// OrganizationResource_Get - /// - /// - /// Default Api Version - /// 2025-06-01 - /// - /// - /// Resource - /// - /// - /// - /// + /// Get a OrganizationResource. /// Name of the Organization resource. /// The cancellation token to use. /// is null. @@ -68,30 +46,12 @@ public virtual MongoDBAtlasOrganizationCollection GetMongoDBAtlasOrganizations() [ForwardsClientCalls] public virtual async Task> GetMongoDBAtlasOrganizationAsync(string organizationName, CancellationToken cancellationToken = default) { + Argument.AssertNotNullOrEmpty(organizationName, nameof(organizationName)); + return await GetMongoDBAtlasOrganizations().GetAsync(organizationName, cancellationToken).ConfigureAwait(false); } - /// - /// Get a OrganizationResource - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/MongoDB.Atlas/organizations/{organizationName} - /// - /// - /// Operation Id - /// OrganizationResource_Get - /// - /// - /// Default Api Version - /// 2025-06-01 - /// - /// - /// Resource - /// - /// - /// - /// + /// Get a OrganizationResource. /// Name of the Organization resource. /// The cancellation token to use. /// is null. @@ -99,6 +59,8 @@ public virtual async Task> GetMongoDB [ForwardsClientCalls] public virtual Response GetMongoDBAtlasOrganization(string organizationName, CancellationToken cancellationToken = default) { + Argument.AssertNotNullOrEmpty(organizationName, nameof(organizationName)); + return GetMongoDBAtlasOrganizations().Get(organizationName, cancellationToken); } } diff --git a/sdk/mongodbatlas/Azure.ResourceManager.MongoDBAtlas/src/Generated/Extensions/MockableMongoDBAtlasSubscriptionResource.cs b/sdk/mongodbatlas/Azure.ResourceManager.MongoDBAtlas/src/Generated/Extensions/MockableMongoDBAtlasSubscriptionResource.cs deleted file mode 100644 index 4b43fc91ba11..000000000000 --- a/sdk/mongodbatlas/Azure.ResourceManager.MongoDBAtlas/src/Generated/Extensions/MockableMongoDBAtlasSubscriptionResource.cs +++ /dev/null @@ -1,102 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System.Threading; -using Autorest.CSharp.Core; -using Azure.Core; -using Azure.Core.Pipeline; - -namespace Azure.ResourceManager.MongoDBAtlas.Mocking -{ - /// A class to add extension methods to SubscriptionResource. - public partial class MockableMongoDBAtlasSubscriptionResource : ArmResource - { - private ClientDiagnostics _mongoDBAtlasOrganizationOrganizationsClientDiagnostics; - private OrganizationsRestOperations _mongoDBAtlasOrganizationOrganizationsRestClient; - - /// Initializes a new instance of the class for mocking. - protected MockableMongoDBAtlasSubscriptionResource() - { - } - - /// Initializes a new instance of the class. - /// The client parameters to use in these operations. - /// The identifier of the resource that is the target of operations. - internal MockableMongoDBAtlasSubscriptionResource(ArmClient client, ResourceIdentifier id) : base(client, id) - { - } - - private ClientDiagnostics MongoDBAtlasOrganizationOrganizationsClientDiagnostics => _mongoDBAtlasOrganizationOrganizationsClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.MongoDBAtlas", MongoDBAtlasOrganizationResource.ResourceType.Namespace, Diagnostics); - private OrganizationsRestOperations MongoDBAtlasOrganizationOrganizationsRestClient => _mongoDBAtlasOrganizationOrganizationsRestClient ??= new OrganizationsRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, GetApiVersionOrNull(MongoDBAtlasOrganizationResource.ResourceType)); - - private string GetApiVersionOrNull(ResourceType resourceType) - { - TryGetApiVersion(resourceType, out string apiVersion); - return apiVersion; - } - - /// - /// List OrganizationResource resources by subscription ID - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/providers/MongoDB.Atlas/organizations - /// - /// - /// Operation Id - /// OrganizationResource_ListBySubscription - /// - /// - /// Default Api Version - /// 2025-06-01 - /// - /// - /// Resource - /// - /// - /// - /// - /// The cancellation token to use. - /// An async collection of that may take multiple service requests to iterate over. - public virtual AsyncPageable GetMongoDBAtlasOrganizationsAsync(CancellationToken cancellationToken = default) - { - HttpMessage FirstPageRequest(int? pageSizeHint) => MongoDBAtlasOrganizationOrganizationsRestClient.CreateListBySubscriptionRequest(Id.SubscriptionId); - HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => MongoDBAtlasOrganizationOrganizationsRestClient.CreateListBySubscriptionNextPageRequest(nextLink, Id.SubscriptionId); - return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new MongoDBAtlasOrganizationResource(Client, MongoDBAtlasOrganizationData.DeserializeMongoDBAtlasOrganizationData(e)), MongoDBAtlasOrganizationOrganizationsClientDiagnostics, Pipeline, "MockableMongoDBAtlasSubscriptionResource.GetMongoDBAtlasOrganizations", "value", "nextLink", cancellationToken); - } - - /// - /// List OrganizationResource resources by subscription ID - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/providers/MongoDB.Atlas/organizations - /// - /// - /// Operation Id - /// OrganizationResource_ListBySubscription - /// - /// - /// Default Api Version - /// 2025-06-01 - /// - /// - /// Resource - /// - /// - /// - /// - /// The cancellation token to use. - /// A collection of that may take multiple service requests to iterate over. - public virtual Pageable GetMongoDBAtlasOrganizations(CancellationToken cancellationToken = default) - { - HttpMessage FirstPageRequest(int? pageSizeHint) => MongoDBAtlasOrganizationOrganizationsRestClient.CreateListBySubscriptionRequest(Id.SubscriptionId); - HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => MongoDBAtlasOrganizationOrganizationsRestClient.CreateListBySubscriptionNextPageRequest(nextLink, Id.SubscriptionId); - return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new MongoDBAtlasOrganizationResource(Client, MongoDBAtlasOrganizationData.DeserializeMongoDBAtlasOrganizationData(e)), MongoDBAtlasOrganizationOrganizationsClientDiagnostics, Pipeline, "MockableMongoDBAtlasSubscriptionResource.GetMongoDBAtlasOrganizations", "value", "nextLink", cancellationToken); - } - } -} diff --git a/sdk/mongodbatlas/Azure.ResourceManager.MongoDBAtlas/src/Generated/Extensions/MongoDBAtlasExtensions.cs b/sdk/mongodbatlas/Azure.ResourceManager.MongoDBAtlas/src/Generated/Extensions/MongoDBAtlasExtensions.cs index 8c5d4f89a507..3e9c2831d0ab 100644 --- a/sdk/mongodbatlas/Azure.ResourceManager.MongoDBAtlas/src/Generated/Extensions/MongoDBAtlasExtensions.cs +++ b/sdk/mongodbatlas/Azure.ResourceManager.MongoDBAtlas/src/Generated/Extensions/MongoDBAtlasExtensions.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.MongoDBAtlas.Mocking; using Azure.ResourceManager.Resources; @@ -17,30 +19,20 @@ namespace Azure.ResourceManager.MongoDBAtlas /// A class to add extension methods to Azure.ResourceManager.MongoDBAtlas. public static partial class MongoDBAtlasExtensions { + /// private static MockableMongoDBAtlasArmClient GetMockableMongoDBAtlasArmClient(ArmClient client) { - return client.GetCachedClient(client0 => new MockableMongoDBAtlasArmClient(client0)); + return client.GetCachedClient(client0 => new MockableMongoDBAtlasArmClient(client0, ResourceIdentifier.Root)); } - private static MockableMongoDBAtlasResourceGroupResource GetMockableMongoDBAtlasResourceGroupResource(ArmResource resource) + /// + private static MockableMongoDBAtlasResourceGroupResource GetMockableMongoDBAtlasResourceGroupResource(ResourceGroupResource resourceGroupResource) { - return resource.GetCachedClient(client => new MockableMongoDBAtlasResourceGroupResource(client, resource.Id)); + return resourceGroupResource.GetCachedClient(client => new MockableMongoDBAtlasResourceGroupResource(client, resourceGroupResource.Id)); } - private static MockableMongoDBAtlasSubscriptionResource GetMockableMongoDBAtlasSubscriptionResource(ArmResource resource) - { - return resource.GetCachedClient(client => new MockableMongoDBAtlasSubscriptionResource(client, resource.Id)); - } - - /// - /// Gets an object representing a along with the instance operations that can be performed on it but with no data. - /// You can use to create a from its components. - /// - /// Mocking - /// To mock this method, please mock instead. - /// - /// - /// The instance the method will execute against. + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// The the method will execute against. /// The resource ID of the resource to get. /// is null. /// Returns a object. @@ -51,16 +43,10 @@ public static MongoDBAtlasOrganizationResource GetMongoDBAtlasOrganizationResour return GetMockableMongoDBAtlasArmClient(client).GetMongoDBAtlasOrganizationResource(id); } - /// - /// Gets a collection of MongoDBAtlasOrganizationResources in the ResourceGroupResource. - /// - /// Mocking - /// To mock this method, please mock instead. - /// - /// - /// The instance the method will execute against. + /// Gets a collection of MongoDBAtlasOrganizations in the . + /// The the method will execute against. /// is null. - /// An object representing collection of MongoDBAtlasOrganizationResources and their operations over a MongoDBAtlasOrganizationResource. + /// An object representing collection of MongoDBAtlasOrganizations and their operations over a MongoDBAtlasOrganizationResource. public static MongoDBAtlasOrganizationCollection GetMongoDBAtlasOrganizations(this ResourceGroupResource resourceGroupResource) { Argument.AssertNotNull(resourceGroupResource, nameof(resourceGroupResource)); @@ -68,36 +54,11 @@ public static MongoDBAtlasOrganizationCollection GetMongoDBAtlasOrganizations(th return GetMockableMongoDBAtlasResourceGroupResource(resourceGroupResource).GetMongoDBAtlasOrganizations(); } - /// - /// Get a OrganizationResource - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/MongoDB.Atlas/organizations/{organizationName} - /// - /// - /// Operation Id - /// OrganizationResource_Get - /// - /// - /// Default Api Version - /// 2025-06-01 - /// - /// - /// Resource - /// - /// - /// - /// - /// Mocking - /// To mock this method, please mock instead. - /// - /// - /// The instance the method will execute against. + /// Get a OrganizationResource. + /// The the method will execute against. /// Name of the Organization 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> GetMongoDBAtlasOrganizationAsync(this ResourceGroupResource resourceGroupResource, string organizationName, CancellationToken cancellationToken = default) { @@ -106,36 +67,11 @@ public static async Task> GetMongoDBA return await GetMockableMongoDBAtlasResourceGroupResource(resourceGroupResource).GetMongoDBAtlasOrganizationAsync(organizationName, cancellationToken).ConfigureAwait(false); } - /// - /// Get a OrganizationResource - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/MongoDB.Atlas/organizations/{organizationName} - /// - /// - /// Operation Id - /// OrganizationResource_Get - /// - /// - /// Default Api Version - /// 2025-06-01 - /// - /// - /// Resource - /// - /// - /// - /// - /// Mocking - /// To mock this method, please mock instead. - /// - /// - /// The instance the method will execute against. + /// Get a OrganizationResource. + /// The the method will execute against. /// Name of the Organization 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 GetMongoDBAtlasOrganization(this ResourceGroupResource resourceGroupResource, string organizationName, CancellationToken cancellationToken = default) { @@ -143,77 +79,5 @@ public static Response GetMongoDBAtlasOrganiza return GetMockableMongoDBAtlasResourceGroupResource(resourceGroupResource).GetMongoDBAtlasOrganization(organizationName, cancellationToken); } - - /// - /// List OrganizationResource resources by subscription ID - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/providers/MongoDB.Atlas/organizations - /// - /// - /// Operation Id - /// OrganizationResource_ListBySubscription - /// - /// - /// Default Api Version - /// 2025-06-01 - /// - /// - /// Resource - /// - /// - /// - /// - /// Mocking - /// To mock this method, please mock instead. - /// - /// - /// The instance 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. - public static AsyncPageable GetMongoDBAtlasOrganizationsAsync(this SubscriptionResource subscriptionResource, CancellationToken cancellationToken = default) - { - Argument.AssertNotNull(subscriptionResource, nameof(subscriptionResource)); - - return GetMockableMongoDBAtlasSubscriptionResource(subscriptionResource).GetMongoDBAtlasOrganizationsAsync(cancellationToken); - } - - /// - /// List OrganizationResource resources by subscription ID - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/providers/MongoDB.Atlas/organizations - /// - /// - /// Operation Id - /// OrganizationResource_ListBySubscription - /// - /// - /// Default Api Version - /// 2025-06-01 - /// - /// - /// Resource - /// - /// - /// - /// - /// Mocking - /// To mock this method, please mock instead. - /// - /// - /// The instance the method will execute against. - /// The cancellation token to use. - /// is null. - /// A collection of that may take multiple service requests to iterate over. - public static Pageable GetMongoDBAtlasOrganizations(this SubscriptionResource subscriptionResource, CancellationToken cancellationToken = default) - { - Argument.AssertNotNull(subscriptionResource, nameof(subscriptionResource)); - - return GetMockableMongoDBAtlasSubscriptionResource(subscriptionResource).GetMongoDBAtlasOrganizations(cancellationToken); - } } } diff --git a/sdk/mongodbatlas/Azure.ResourceManager.MongoDBAtlas/src/Generated/Internal/Argument.cs b/sdk/mongodbatlas/Azure.ResourceManager.MongoDBAtlas/src/Generated/Internal/Argument.cs index 8617e7d4048c..44d35efcfea4 100644 --- a/sdk/mongodbatlas/Azure.ResourceManager.MongoDBAtlas/src/Generated/Internal/Argument.cs +++ b/sdk/mongodbatlas/Azure.ResourceManager.MongoDBAtlas/src/Generated/Internal/Argument.cs @@ -11,8 +11,10 @@ namespace Azure.ResourceManager.MongoDBAtlas { - 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/mongodbatlas/Azure.ResourceManager.MongoDBAtlas/src/Generated/Internal/AsyncPageableWrapper.cs b/sdk/mongodbatlas/Azure.ResourceManager.MongoDBAtlas/src/Generated/Internal/AsyncPageableWrapper.cs new file mode 100644 index 000000000000..229904bda645 --- /dev/null +++ b/sdk/mongodbatlas/Azure.ResourceManager.MongoDBAtlas/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.MongoDBAtlas +{ + 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/mongodbatlas/Azure.ResourceManager.MongoDBAtlas/src/Generated/Internal/ChangeTrackingDictionary.cs b/sdk/mongodbatlas/Azure.ResourceManager.MongoDBAtlas/src/Generated/Internal/ChangeTrackingDictionary.cs index 9c926f199b1f..9cdeeea02cc4 100644 --- a/sdk/mongodbatlas/Azure.ResourceManager.MongoDBAtlas/src/Generated/Internal/ChangeTrackingDictionary.cs +++ b/sdk/mongodbatlas/Azure.ResourceManager.MongoDBAtlas/src/Generated/Internal/ChangeTrackingDictionary.cs @@ -11,7 +11,8 @@ namespace Azure.ResourceManager.MongoDBAtlas { - 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/mongodbatlas/Azure.ResourceManager.MongoDBAtlas/src/Generated/Internal/ChangeTrackingList.cs b/sdk/mongodbatlas/Azure.ResourceManager.MongoDBAtlas/src/Generated/Internal/ChangeTrackingList.cs index f4a383302d51..a004203cb62b 100644 --- a/sdk/mongodbatlas/Azure.ResourceManager.MongoDBAtlas/src/Generated/Internal/ChangeTrackingList.cs +++ b/sdk/mongodbatlas/Azure.ResourceManager.MongoDBAtlas/src/Generated/Internal/ChangeTrackingList.cs @@ -12,7 +12,7 @@ namespace Azure.ResourceManager.MongoDBAtlas { - 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/mongodbatlas/Azure.ResourceManager.MongoDBAtlas/src/Generated/Internal/ClientPipelineExtensions.cs b/sdk/mongodbatlas/Azure.ResourceManager.MongoDBAtlas/src/Generated/Internal/ClientPipelineExtensions.cs new file mode 100644 index 000000000000..fda0a6e8a27d --- /dev/null +++ b/sdk/mongodbatlas/Azure.ResourceManager.MongoDBAtlas/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.MongoDBAtlas +{ + 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/mongodbatlas/Azure.ResourceManager.MongoDBAtlas/src/Generated/Internal/CodeGenMemberAttribute.cs b/sdk/mongodbatlas/Azure.ResourceManager.MongoDBAtlas/src/Generated/Internal/CodeGenMemberAttribute.cs new file mode 100644 index 000000000000..a94d3522d141 --- /dev/null +++ b/sdk/mongodbatlas/Azure.ResourceManager.MongoDBAtlas/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.MongoDBAtlas +{ + [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/mongodbatlas/Azure.ResourceManager.MongoDBAtlas/src/Generated/Internal/CodeGenSerializationAttribute.cs b/sdk/mongodbatlas/Azure.ResourceManager.MongoDBAtlas/src/Generated/Internal/CodeGenSerializationAttribute.cs new file mode 100644 index 000000000000..94304ecbb83c --- /dev/null +++ b/sdk/mongodbatlas/Azure.ResourceManager.MongoDBAtlas/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.MongoDBAtlas +{ + [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 propertySerializationName) + { + PropertyName = propertyName; + PropertySerializationName = propertySerializationName; + } + + /// 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 PropertySerializationName { 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/mongodbatlas/Azure.ResourceManager.MongoDBAtlas/src/Generated/Internal/CodeGenSuppressAttribute.cs b/sdk/mongodbatlas/Azure.ResourceManager.MongoDBAtlas/src/Generated/Internal/CodeGenSuppressAttribute.cs new file mode 100644 index 000000000000..d460378e8658 --- /dev/null +++ b/sdk/mongodbatlas/Azure.ResourceManager.MongoDBAtlas/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.MongoDBAtlas +{ + [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/mongodbatlas/Azure.ResourceManager.MongoDBAtlas/src/Generated/Internal/CodeGenTypeAttribute.cs b/sdk/mongodbatlas/Azure.ResourceManager.MongoDBAtlas/src/Generated/Internal/CodeGenTypeAttribute.cs new file mode 100644 index 000000000000..d3b58bc592a5 --- /dev/null +++ b/sdk/mongodbatlas/Azure.ResourceManager.MongoDBAtlas/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.MongoDBAtlas +{ + [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/mongodbatlas/Azure.ResourceManager.MongoDBAtlas/src/Generated/Internal/ErrorResult.cs b/sdk/mongodbatlas/Azure.ResourceManager.MongoDBAtlas/src/Generated/Internal/ErrorResult.cs new file mode 100644 index 000000000000..48644c96d2c0 --- /dev/null +++ b/sdk/mongodbatlas/Azure.ResourceManager.MongoDBAtlas/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.MongoDBAtlas +{ + 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/mongodbatlas/Azure.ResourceManager.MongoDBAtlas/src/Generated/Internal/ModelSerializationExtensions.cs b/sdk/mongodbatlas/Azure.ResourceManager.MongoDBAtlas/src/Generated/Internal/ModelSerializationExtensions.cs index 6f67c920f620..02a21f92ed48 100644 --- a/sdk/mongodbatlas/Azure.ResourceManager.MongoDBAtlas/src/Generated/Internal/ModelSerializationExtensions.cs +++ b/sdk/mongodbatlas/Azure.ResourceManager.MongoDBAtlas/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.MongoDBAtlas { - 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/mongodbatlas/Azure.ResourceManager.MongoDBAtlas/src/Generated/Internal/Optional.cs b/sdk/mongodbatlas/Azure.ResourceManager.MongoDBAtlas/src/Generated/Internal/Optional.cs index c3179211abb1..2fbc98796886 100644 --- a/sdk/mongodbatlas/Azure.ResourceManager.MongoDBAtlas/src/Generated/Internal/Optional.cs +++ b/sdk/mongodbatlas/Azure.ResourceManager.MongoDBAtlas/src/Generated/Internal/Optional.cs @@ -10,7 +10,7 @@ namespace Azure.ResourceManager.MongoDBAtlas { - 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/mongodbatlas/Azure.ResourceManager.MongoDBAtlas/src/Generated/Internal/PageableWrapper.cs b/sdk/mongodbatlas/Azure.ResourceManager.MongoDBAtlas/src/Generated/Internal/PageableWrapper.cs new file mode 100644 index 000000000000..9c3fb851130d --- /dev/null +++ b/sdk/mongodbatlas/Azure.ResourceManager.MongoDBAtlas/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.MongoDBAtlas +{ + 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/mongodbatlas/Azure.ResourceManager.MongoDBAtlas/src/Generated/Internal/RequestContextExtensions.cs b/sdk/mongodbatlas/Azure.ResourceManager.MongoDBAtlas/src/Generated/Internal/RequestContextExtensions.cs new file mode 100644 index 000000000000..39e3a376fde7 --- /dev/null +++ b/sdk/mongodbatlas/Azure.ResourceManager.MongoDBAtlas/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.MongoDBAtlas +{ + 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/mongodbatlas/Azure.ResourceManager.MongoDBAtlas/src/Generated/Internal/TypeFormatters.cs b/sdk/mongodbatlas/Azure.ResourceManager.MongoDBAtlas/src/Generated/Internal/TypeFormatters.cs new file mode 100644 index 000000000000..06b480e94d71 --- /dev/null +++ b/sdk/mongodbatlas/Azure.ResourceManager.MongoDBAtlas/src/Generated/Internal/TypeFormatters.cs @@ -0,0 +1,153 @@ +// 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.MongoDBAtlas +{ + 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 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/mongodbatlas/Azure.ResourceManager.MongoDBAtlas/src/Generated/Internal/Utf8JsonRequestContent.cs b/sdk/mongodbatlas/Azure.ResourceManager.MongoDBAtlas/src/Generated/Internal/Utf8JsonRequestContent.cs index 11b5fde2bb19..73e8b38e6ed3 100644 --- a/sdk/mongodbatlas/Azure.ResourceManager.MongoDBAtlas/src/Generated/Internal/Utf8JsonRequestContent.cs +++ b/sdk/mongodbatlas/Azure.ResourceManager.MongoDBAtlas/src/Generated/Internal/Utf8JsonRequestContent.cs @@ -13,7 +13,7 @@ namespace Azure.ResourceManager.MongoDBAtlas { - 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/mongodbatlas/Azure.ResourceManager.MongoDBAtlas/src/Generated/LongRunningOperation/MongoDBAtlasArmOperation.cs b/sdk/mongodbatlas/Azure.ResourceManager.MongoDBAtlas/src/Generated/LongRunningOperation/MongoDBAtlasArmOperation.cs index 339e3a9add14..303c2479dd07 100644 --- a/sdk/mongodbatlas/Azure.ResourceManager.MongoDBAtlas/src/Generated/LongRunningOperation/MongoDBAtlasArmOperation.cs +++ b/sdk/mongodbatlas/Azure.ResourceManager.MongoDBAtlas/src/Generated/LongRunningOperation/MongoDBAtlasArmOperation.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.MongoDBAtlas { -#pragma warning disable SA1649 // File name should match first type name - internal class MongoDBAtlasArmOperation : ArmOperation -#pragma warning restore SA1649 // File name should match first type name + internal partial class MongoDBAtlasArmOperation : ArmOperation { private readonly OperationInternal _operation; private readonly RehydrationToken? _completeRehydrationToken; @@ -29,6 +27,9 @@ protected MongoDBAtlasArmOperation() { } + /// + /// The operation response. + /// The token to rehydrate the operation. internal MongoDBAtlasArmOperation(Response response, RehydrationToken? rehydrationToken = null) { _operation = OperationInternal.Succeeded(response); @@ -36,12 +37,20 @@ internal MongoDBAtlasArmOperation(Response response, RehydrationToken? rehydrati _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 MongoDBAtlasArmOperation(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 MongoDBAtlasArmOperation(ClientDiagnostics clientDiagnostics, HttpPipel _completeRehydrationToken = NextLinkOperationImplementation.GetRehydrationToken(request.Method, request.Uri.ToUri(), response, finalStateVia); _operationId = GetOperationId(_completeRehydrationToken); } - _operation = new OperationInternal(nextLinkOperation, clientDiagnostics, response, "MongoDBAtlasArmOperation", fallbackStrategy: new SequentialDelayStrategy()); + _operation = new OperationInternal( + nextLinkOperation, + clientDiagnostics, + response, + "MongoDBAtlasArmOperation", + 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, AzureResourceManagerMongoDBAtlasContext.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/mongodbatlas/Azure.ResourceManager.MongoDBAtlas/src/Generated/LongRunningOperation/MongoDBAtlasArmOperationOfT.cs b/sdk/mongodbatlas/Azure.ResourceManager.MongoDBAtlas/src/Generated/LongRunningOperation/MongoDBAtlasArmOperationOfT.cs index 7aff84c95497..8028c4c0ba89 100644 --- a/sdk/mongodbatlas/Azure.ResourceManager.MongoDBAtlas/src/Generated/LongRunningOperation/MongoDBAtlasArmOperationOfT.cs +++ b/sdk/mongodbatlas/Azure.ResourceManager.MongoDBAtlas/src/Generated/LongRunningOperation/MongoDBAtlasArmOperationOfT.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.MongoDBAtlas { -#pragma warning disable SA1649 // File name should match first type name - internal class MongoDBAtlasArmOperation : ArmOperation -#pragma warning restore SA1649 // File name should match first type name + internal partial class MongoDBAtlasArmOperation : ArmOperation { private readonly OperationInternal _operation; private readonly RehydrationToken? _completeRehydrationToken; @@ -29,6 +27,9 @@ protected MongoDBAtlasArmOperation() { } + /// + /// The operation response. + /// The token to rehydrate the operation. internal MongoDBAtlasArmOperation(Response response, RehydrationToken? rehydrationToken = null) { _operation = OperationInternal.Succeeded(response.GetRawResponse(), response.Value); @@ -36,12 +37,21 @@ internal MongoDBAtlasArmOperation(Response response, RehydrationToken? rehydr _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 MongoDBAtlasArmOperation(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 MongoDBAtlasArmOperation(IOperationSource source, ClientDiagnostics _completeRehydrationToken = NextLinkOperationImplementation.GetRehydrationToken(request.Method, request.Uri.ToUri(), response, finalStateVia); _operationId = GetOperationId(_completeRehydrationToken); } - _operation = new OperationInternal(NextLinkOperationImplementation.Create(source, nextLinkOperation), clientDiagnostics, response, "MongoDBAtlasArmOperation", fallbackStrategy: new SequentialDelayStrategy()); + _operation = new OperationInternal( + NextLinkOperationImplementation.Create(source, nextLinkOperation), + clientDiagnostics, + response, + "MongoDBAtlasArmOperation", + null, + new SequentialDelayStrategy()); } - private string GetOperationId(RehydrationToken? rehydrationToken) - { - if (rehydrationToken is null) - { - return null; - } - var data = ModelReaderWriter.Write(rehydrationToken, ModelReaderWriterOptions.Json, AzureResourceManagerMongoDBAtlasContext.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/mongodbatlas/Azure.ResourceManager.MongoDBAtlas/src/Generated/LongRunningOperation/MongoDBAtlasOrganizationOperationSource.cs b/sdk/mongodbatlas/Azure.ResourceManager.MongoDBAtlas/src/Generated/LongRunningOperation/MongoDBAtlasOrganizationOperationSource.cs index 0355d54de91d..7dc190e7d6f5 100644 --- a/sdk/mongodbatlas/Azure.ResourceManager.MongoDBAtlas/src/Generated/LongRunningOperation/MongoDBAtlasOrganizationOperationSource.cs +++ b/sdk/mongodbatlas/Azure.ResourceManager.MongoDBAtlas/src/Generated/LongRunningOperation/MongoDBAtlasOrganizationOperationSource.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.MongoDBAtlas { - internal class MongoDBAtlasOrganizationOperationSource : IOperationSource + /// + internal partial class MongoDBAtlasOrganizationOperationSource : IOperationSource { private readonly ArmClient _client; + /// + /// internal MongoDBAtlasOrganizationOperationSource(ArmClient client) { _client = client; } + /// The response from the service. + /// The cancellation token to use. + /// MongoDBAtlasOrganizationResource IOperationSource.CreateResult(Response response, CancellationToken cancellationToken) { - var data = ModelReaderWriter.Read(response.Content, ModelReaderWriterOptions.Json, AzureResourceManagerMongoDBAtlasContext.Default); + using JsonDocument document = JsonDocument.Parse(response.ContentStream); + MongoDBAtlasOrganizationData data = MongoDBAtlasOrganizationData.DeserializeMongoDBAtlasOrganizationData(document.RootElement, ModelSerializationExtensions.WireOptions); return new MongoDBAtlasOrganizationResource(_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, AzureResourceManagerMongoDBAtlasContext.Default); - return await Task.FromResult(new MongoDBAtlasOrganizationResource(_client, data)).ConfigureAwait(false); + using JsonDocument document = await JsonDocument.ParseAsync(response.ContentStream, default, cancellationToken).ConfigureAwait(false); + MongoDBAtlasOrganizationData data = MongoDBAtlasOrganizationData.DeserializeMongoDBAtlasOrganizationData(document.RootElement, ModelSerializationExtensions.WireOptions); + return new MongoDBAtlasOrganizationResource(_client, data); } } } diff --git a/sdk/mongodbatlas/Azure.ResourceManager.MongoDBAtlas/src/Generated/Models/AzureResourceManagerMongoDBAtlasContext.cs b/sdk/mongodbatlas/Azure.ResourceManager.MongoDBAtlas/src/Generated/Models/AzureResourceManagerMongoDBAtlasContext.cs index c82c680ed6ab..567176cfc03a 100644 --- a/sdk/mongodbatlas/Azure.ResourceManager.MongoDBAtlas/src/Generated/Models/AzureResourceManagerMongoDBAtlasContext.cs +++ b/sdk/mongodbatlas/Azure.ResourceManager.MongoDBAtlas/src/Generated/Models/AzureResourceManagerMongoDBAtlasContext.cs @@ -13,22 +13,20 @@ namespace Azure.ResourceManager.MongoDBAtlas { /// /// 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(ManagedServiceIdentity))] - [ModelReaderWriterBuildable(typeof(MongoDBAtlasMarketplaceDetails))] - [ModelReaderWriterBuildable(typeof(MongoDBAtlasOfferDetails))] [ModelReaderWriterBuildable(typeof(MongoDBAtlasOrganizationData))] - [ModelReaderWriterBuildable(typeof(MongoDBAtlasOrganizationPatch))] [ModelReaderWriterBuildable(typeof(MongoDBAtlasOrganizationProperties))] - [ModelReaderWriterBuildable(typeof(MongoDBAtlasOrganizationResource))] - [ModelReaderWriterBuildable(typeof(MongoDBAtlasOrganizationUpdateProperties))] - [ModelReaderWriterBuildable(typeof(MongoDBAtlasPartnerProperties))] + [ModelReaderWriterBuildable(typeof(MongoDBAtlasMarketplaceDetails))] + [ModelReaderWriterBuildable(typeof(MongoDBAtlasOfferDetails))] [ModelReaderWriterBuildable(typeof(MongoDBAtlasUserDetails))] - [ModelReaderWriterBuildable(typeof(OrganizationResourceListResult))] - [ModelReaderWriterBuildable(typeof(ResponseError))] - [ModelReaderWriterBuildable(typeof(SystemData))] + [ModelReaderWriterBuildable(typeof(MongoDBAtlasPartnerProperties))] + [ModelReaderWriterBuildable(typeof(ManagedServiceIdentity))] [ModelReaderWriterBuildable(typeof(UserAssignedIdentity))] + [ModelReaderWriterBuildable(typeof(MongoDBAtlasOrganizationPatch))] + [ModelReaderWriterBuildable(typeof(OrganizationResourceUpdateProperties))] + [ModelReaderWriterBuildable(typeof(OrganizationResourceListResult))] + [ModelReaderWriterBuildable(typeof(MongoDBAtlasOrganizationResource))] public partial class AzureResourceManagerMongoDBAtlasContext : ModelReaderWriterContext { } diff --git a/sdk/mongodbatlas/Azure.ResourceManager.MongoDBAtlas/src/Generated/Models/MarketplaceSubscriptionStatus.cs b/sdk/mongodbatlas/Azure.ResourceManager.MongoDBAtlas/src/Generated/Models/MarketplaceSubscriptionStatus.cs index e9fd89f339e5..ac89f3914136 100644 --- a/sdk/mongodbatlas/Azure.ResourceManager.MongoDBAtlas/src/Generated/Models/MarketplaceSubscriptionStatus.cs +++ b/sdk/mongodbatlas/Azure.ResourceManager.MongoDBAtlas/src/Generated/Models/MarketplaceSubscriptionStatus.cs @@ -7,6 +7,7 @@ using System; using System.ComponentModel; +using Azure.ResourceManager.MongoDBAtlas; namespace Azure.ResourceManager.MongoDBAtlas.Models { @@ -14,44 +15,67 @@ namespace Azure.ResourceManager.MongoDBAtlas.Models public readonly partial struct MarketplaceSubscriptionStatus : IEquatable { private readonly string _value; + /// Purchased but not yet activated. + private const string PendingFulfillmentStartValue = "PendingFulfillmentStart"; + /// Marketplace subscription is activated. + private const string SubscribedValue = "Subscribed"; + /// This state indicates that a customer's payment for the Marketplace service was not received. + private const string SuspendedValue = "Suspended"; + /// Customer has cancelled the subscription. + private const string UnsubscribedValue = "Unsubscribed"; /// Initializes a new instance of . + /// The value. /// is null. public MarketplaceSubscriptionStatus(string value) { - _value = value ?? throw new ArgumentNullException(nameof(value)); - } + Argument.AssertNotNull(value, nameof(value)); - private const string PendingFulfillmentStartValue = "PendingFulfillmentStart"; - private const string SubscribedValue = "Subscribed"; - private const string SuspendedValue = "Suspended"; - private const string UnsubscribedValue = "Unsubscribed"; + _value = value; + } /// Purchased but not yet activated. public static MarketplaceSubscriptionStatus PendingFulfillmentStart { get; } = new MarketplaceSubscriptionStatus(PendingFulfillmentStartValue); + /// Marketplace subscription is activated. public static MarketplaceSubscriptionStatus Subscribed { get; } = new MarketplaceSubscriptionStatus(SubscribedValue); + /// This state indicates that a customer's payment for the Marketplace service was not received. public static MarketplaceSubscriptionStatus Suspended { get; } = new MarketplaceSubscriptionStatus(SuspendedValue); + /// Customer has cancelled the subscription. public static MarketplaceSubscriptionStatus Unsubscribed { get; } = new MarketplaceSubscriptionStatus(UnsubscribedValue); + /// Determines if two values are the same. + /// The left value to compare. + /// The right value to compare. public static bool operator ==(MarketplaceSubscriptionStatus left, MarketplaceSubscriptionStatus 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 !=(MarketplaceSubscriptionStatus left, MarketplaceSubscriptionStatus right) => !left.Equals(right); - /// Converts a to a . + + /// Converts a string to a . + /// The value. public static implicit operator MarketplaceSubscriptionStatus(string value) => new MarketplaceSubscriptionStatus(value); - /// + /// Converts a string to a . + /// The value. + public static implicit operator MarketplaceSubscriptionStatus?(string value) => value == null ? null : new MarketplaceSubscriptionStatus(value); + + /// [EditorBrowsable(EditorBrowsableState.Never)] public override bool Equals(object obj) => obj is MarketplaceSubscriptionStatus other && Equals(other); - /// + + /// public bool Equals(MarketplaceSubscriptionStatus 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/mongodbatlas/Azure.ResourceManager.MongoDBAtlas/src/Generated/Models/MongoDBAtlasMarketplaceDetails.Serialization.cs b/sdk/mongodbatlas/Azure.ResourceManager.MongoDBAtlas/src/Generated/Models/MongoDBAtlasMarketplaceDetails.Serialization.cs index bf7c78265dcd..d568dbe887ba 100644 --- a/sdk/mongodbatlas/Azure.ResourceManager.MongoDBAtlas/src/Generated/Models/MongoDBAtlasMarketplaceDetails.Serialization.cs +++ b/sdk/mongodbatlas/Azure.ResourceManager.MongoDBAtlas/src/Generated/Models/MongoDBAtlasMarketplaceDetails.Serialization.cs @@ -9,14 +9,20 @@ using System.ClientModel.Primitives; using System.Collections.Generic; using System.Text.Json; -using Azure.Core; +using Azure.ResourceManager.MongoDBAtlas; namespace Azure.ResourceManager.MongoDBAtlas.Models { - public partial class MongoDBAtlasMarketplaceDetails : IUtf8JsonSerializable, IJsonModel + /// Marketplace details for an organization. + public partial class MongoDBAtlasMarketplaceDetails : IJsonModel { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + /// Initializes a new instance of for deserialization. + internal MongoDBAtlasMarketplaceDetails() + { + } + /// 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, Mod /// The client options for reading and writing models. protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; if (format != "J") { throw new FormatException($"The model {nameof(MongoDBAtlasMarketplaceDetails)} does not support writing '{format}' format."); } - writer.WritePropertyName("subscriptionId"u8); writer.WriteStringValue(SubscriptionId); if (options.Format != "W" && Optional.IsDefined(SubscriptionStatus)) @@ -43,15 +48,15 @@ protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWrit } writer.WritePropertyName("offerDetails"u8); writer.WriteObjectValue(OfferDetails, 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); } @@ -60,22 +65,27 @@ protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWrit } } - MongoDBAtlasMarketplaceDetails IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + /// The JSON reader. + /// The client options for reading and writing models. + MongoDBAtlasMarketplaceDetails IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) => JsonModelCreateCore(ref reader, options); + + /// The JSON reader. + /// The client options for reading and writing models. + protected virtual MongoDBAtlasMarketplaceDetails 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(MongoDBAtlasMarketplaceDetails)} does not support reading '{format}' format."); } - using JsonDocument document = JsonDocument.ParseValue(ref reader); return DeserializeMongoDBAtlasMarketplaceDetails(document.RootElement, options); } - internal static MongoDBAtlasMarketplaceDetails DeserializeMongoDBAtlasMarketplaceDetails(JsonElement element, ModelReaderWriterOptions options = null) + /// The JSON element to deserialize. + /// The client options for reading and writing models. + internal static MongoDBAtlasMarketplaceDetails DeserializeMongoDBAtlasMarketplaceDetails(JsonElement element, ModelReaderWriterOptions options) { - options ??= ModelSerializationExtensions.WireOptions; - if (element.ValueKind == JsonValueKind.Null) { return null; @@ -83,42 +93,43 @@ internal static MongoDBAtlasMarketplaceDetails DeserializeMongoDBAtlasMarketplac string subscriptionId = default; MarketplaceSubscriptionStatus? subscriptionStatus = default; MongoDBAtlasOfferDetails offerDetails = 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("subscriptionId"u8)) + if (prop.NameEquals("subscriptionId"u8)) { - subscriptionId = property.Value.GetString(); + subscriptionId = prop.Value.GetString(); continue; } - if (property.NameEquals("subscriptionStatus"u8)) + if (prop.NameEquals("subscriptionStatus"u8)) { - if (property.Value.ValueKind == JsonValueKind.Null) + if (prop.Value.ValueKind == JsonValueKind.Null) { continue; } - subscriptionStatus = new MarketplaceSubscriptionStatus(property.Value.GetString()); + subscriptionStatus = new MarketplaceSubscriptionStatus(prop.Value.GetString()); continue; } - if (property.NameEquals("offerDetails"u8)) + if (prop.NameEquals("offerDetails"u8)) { - offerDetails = MongoDBAtlasOfferDetails.DeserializeMongoDBAtlasOfferDetails(property.Value, options); + offerDetails = MongoDBAtlasOfferDetails.DeserializeMongoDBAtlasOfferDetails(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 MongoDBAtlasMarketplaceDetails(subscriptionId, subscriptionStatus, offerDetails, serializedAdditionalRawData); + return new MongoDBAtlasMarketplaceDetails(subscriptionId, subscriptionStatus, offerDetails, 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": @@ -128,15 +139,20 @@ BinaryData IPersistableModel.Write(ModelReaderWr } } - MongoDBAtlasMarketplaceDetails 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. + MongoDBAtlasMarketplaceDetails IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) => PersistableModelCreateCore(data, options); + /// The data to parse. + /// The client options for reading and writing models. + protected virtual MongoDBAtlasMarketplaceDetails 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)) { - using JsonDocument document = JsonDocument.Parse(data, ModelSerializationExtensions.JsonDocumentOptions); return DeserializeMongoDBAtlasMarketplaceDetails(document.RootElement, options); } default: @@ -144,6 +160,7 @@ MongoDBAtlasMarketplaceDetails IPersistableModel } } + /// The client options for reading and writing models. string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; } } diff --git a/sdk/mongodbatlas/Azure.ResourceManager.MongoDBAtlas/src/Generated/Models/MongoDBAtlasMarketplaceDetails.cs b/sdk/mongodbatlas/Azure.ResourceManager.MongoDBAtlas/src/Generated/Models/MongoDBAtlasMarketplaceDetails.cs index 876392681720..abd48c2c0bff 100644 --- a/sdk/mongodbatlas/Azure.ResourceManager.MongoDBAtlas/src/Generated/Models/MongoDBAtlasMarketplaceDetails.cs +++ b/sdk/mongodbatlas/Azure.ResourceManager.MongoDBAtlas/src/Generated/Models/MongoDBAtlasMarketplaceDetails.cs @@ -7,43 +7,15 @@ using System; using System.Collections.Generic; +using Azure.ResourceManager.MongoDBAtlas; namespace Azure.ResourceManager.MongoDBAtlas.Models { /// Marketplace details for an organization. public partial class MongoDBAtlasMarketplaceDetails { - /// - /// 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 . /// Azure subscription id for the the marketplace offer is purchased from. @@ -62,24 +34,21 @@ public MongoDBAtlasMarketplaceDetails(string subscriptionId, MongoDBAtlasOfferDe /// Azure subscription id for the the marketplace offer is purchased from. /// Marketplace subscription status. /// Offer details for the marketplace that is selected by the user. - /// Keeps track of any properties unknown to the library. - internal MongoDBAtlasMarketplaceDetails(string subscriptionId, MarketplaceSubscriptionStatus? subscriptionStatus, MongoDBAtlasOfferDetails offerDetails, IDictionary serializedAdditionalRawData) + /// Keeps track of any properties unknown to the library. + internal MongoDBAtlasMarketplaceDetails(string subscriptionId, MarketplaceSubscriptionStatus? subscriptionStatus, MongoDBAtlasOfferDetails offerDetails, IDictionary additionalBinaryDataProperties) { SubscriptionId = subscriptionId; SubscriptionStatus = subscriptionStatus; OfferDetails = offerDetails; - _serializedAdditionalRawData = serializedAdditionalRawData; - } - - /// Initializes a new instance of for deserialization. - internal MongoDBAtlasMarketplaceDetails() - { + _additionalBinaryDataProperties = additionalBinaryDataProperties; } /// Azure subscription id for the the marketplace offer is purchased from. public string SubscriptionId { get; set; } + /// Marketplace subscription status. public MarketplaceSubscriptionStatus? SubscriptionStatus { get; } + /// Offer details for the marketplace that is selected by the user. public MongoDBAtlasOfferDetails OfferDetails { get; set; } } diff --git a/sdk/mongodbatlas/Azure.ResourceManager.MongoDBAtlas/src/Generated/Models/MongoDBAtlasOfferDetails.Serialization.cs b/sdk/mongodbatlas/Azure.ResourceManager.MongoDBAtlas/src/Generated/Models/MongoDBAtlasOfferDetails.Serialization.cs index 63a9fb679474..dcf98e942373 100644 --- a/sdk/mongodbatlas/Azure.ResourceManager.MongoDBAtlas/src/Generated/Models/MongoDBAtlasOfferDetails.Serialization.cs +++ b/sdk/mongodbatlas/Azure.ResourceManager.MongoDBAtlas/src/Generated/Models/MongoDBAtlasOfferDetails.Serialization.cs @@ -9,14 +9,20 @@ using System.ClientModel.Primitives; using System.Collections.Generic; using System.Text.Json; -using Azure.Core; +using Azure.ResourceManager.MongoDBAtlas; namespace Azure.ResourceManager.MongoDBAtlas.Models { - public partial class MongoDBAtlasOfferDetails : IUtf8JsonSerializable, IJsonModel + /// Offer details for the marketplace that is selected by the user. + public partial class MongoDBAtlasOfferDetails : IJsonModel { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + /// Initializes a new instance of for deserialization. + internal MongoDBAtlasOfferDetails() + { + } + /// 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, ModelRead /// The client options for reading and writing models. protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; if (format != "J") { throw new FormatException($"The model {nameof(MongoDBAtlasOfferDetails)} does not support writing '{format}' format."); } - writer.WritePropertyName("publisherId"u8); writer.WriteStringValue(PublisherId); writer.WritePropertyName("offerId"u8); @@ -55,15 +60,15 @@ protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWrit writer.WritePropertyName("termId"u8); writer.WriteStringValue(TermId); } - 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); } @@ -72,22 +77,27 @@ protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWrit } } - MongoDBAtlasOfferDetails IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + /// The JSON reader. + /// The client options for reading and writing models. + MongoDBAtlasOfferDetails IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) => JsonModelCreateCore(ref reader, options); + + /// The JSON reader. + /// The client options for reading and writing models. + protected virtual MongoDBAtlasOfferDetails 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(MongoDBAtlasOfferDetails)} does not support reading '{format}' format."); } - using JsonDocument document = JsonDocument.ParseValue(ref reader); return DeserializeMongoDBAtlasOfferDetails(document.RootElement, options); } - internal static MongoDBAtlasOfferDetails DeserializeMongoDBAtlasOfferDetails(JsonElement element, ModelReaderWriterOptions options = null) + /// The JSON element to deserialize. + /// The client options for reading and writing models. + internal static MongoDBAtlasOfferDetails DeserializeMongoDBAtlasOfferDetails(JsonElement element, ModelReaderWriterOptions options) { - options ??= ModelSerializationExtensions.WireOptions; - if (element.ValueKind == JsonValueKind.Null) { return null; @@ -98,46 +108,44 @@ internal static MongoDBAtlasOfferDetails DeserializeMongoDBAtlasOfferDetails(Jso string planName = default; string termUnit = default; string termId = 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("publisherId"u8)) + if (prop.NameEquals("publisherId"u8)) { - publisherId = property.Value.GetString(); + publisherId = prop.Value.GetString(); continue; } - if (property.NameEquals("offerId"u8)) + if (prop.NameEquals("offerId"u8)) { - offerId = property.Value.GetString(); + offerId = prop.Value.GetString(); continue; } - if (property.NameEquals("planId"u8)) + if (prop.NameEquals("planId"u8)) { - planId = property.Value.GetString(); + planId = prop.Value.GetString(); continue; } - if (property.NameEquals("planName"u8)) + if (prop.NameEquals("planName"u8)) { - planName = property.Value.GetString(); + planName = prop.Value.GetString(); continue; } - if (property.NameEquals("termUnit"u8)) + if (prop.NameEquals("termUnit"u8)) { - termUnit = property.Value.GetString(); + termUnit = prop.Value.GetString(); continue; } - if (property.NameEquals("termId"u8)) + if (prop.NameEquals("termId"u8)) { - termId = property.Value.GetString(); + termId = 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 MongoDBAtlasOfferDetails( publisherId, offerId, @@ -145,13 +153,16 @@ internal static MongoDBAtlasOfferDetails DeserializeMongoDBAtlasOfferDetails(Jso planName, termUnit, termId, - 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": @@ -161,15 +172,20 @@ BinaryData IPersistableModel.Write(ModelReaderWriterOp } } - MongoDBAtlasOfferDetails 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. + MongoDBAtlasOfferDetails IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) => PersistableModelCreateCore(data, options); + /// The data to parse. + /// The client options for reading and writing models. + protected virtual MongoDBAtlasOfferDetails 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)) { - using JsonDocument document = JsonDocument.Parse(data, ModelSerializationExtensions.JsonDocumentOptions); return DeserializeMongoDBAtlasOfferDetails(document.RootElement, options); } default: @@ -177,6 +193,7 @@ MongoDBAtlasOfferDetails IPersistableModel.Create(Bina } } + /// The client options for reading and writing models. string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; } } diff --git a/sdk/mongodbatlas/Azure.ResourceManager.MongoDBAtlas/src/Generated/Models/MongoDBAtlasOfferDetails.cs b/sdk/mongodbatlas/Azure.ResourceManager.MongoDBAtlas/src/Generated/Models/MongoDBAtlasOfferDetails.cs index cf0a272565aa..91017a49a608 100644 --- a/sdk/mongodbatlas/Azure.ResourceManager.MongoDBAtlas/src/Generated/Models/MongoDBAtlasOfferDetails.cs +++ b/sdk/mongodbatlas/Azure.ResourceManager.MongoDBAtlas/src/Generated/Models/MongoDBAtlasOfferDetails.cs @@ -7,43 +7,15 @@ using System; using System.Collections.Generic; +using Azure.ResourceManager.MongoDBAtlas; namespace Azure.ResourceManager.MongoDBAtlas.Models { /// Offer details for the marketplace that is selected by the user. public partial class MongoDBAtlasOfferDetails { - /// - /// 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 . /// Publisher Id for the marketplace offer. @@ -68,8 +40,8 @@ public MongoDBAtlasOfferDetails(string publisherId, string offerId, string planI /// Plan Name for the marketplace offer. /// Plan Display Name for the marketplace offer. /// Plan Display Name for the marketplace offer. - /// Keeps track of any properties unknown to the library. - internal MongoDBAtlasOfferDetails(string publisherId, string offerId, string planId, string planName, string termUnit, string termId, IDictionary serializedAdditionalRawData) + /// Keeps track of any properties unknown to the library. + internal MongoDBAtlasOfferDetails(string publisherId, string offerId, string planId, string planName, string termUnit, string termId, IDictionary additionalBinaryDataProperties) { PublisherId = publisherId; OfferId = offerId; @@ -77,24 +49,24 @@ internal MongoDBAtlasOfferDetails(string publisherId, string offerId, string pla PlanName = planName; TermUnit = termUnit; TermId = termId; - _serializedAdditionalRawData = serializedAdditionalRawData; - } - - /// Initializes a new instance of for deserialization. - internal MongoDBAtlasOfferDetails() - { + _additionalBinaryDataProperties = additionalBinaryDataProperties; } /// Publisher Id for the marketplace offer. public string PublisherId { get; set; } + /// Offer Id for the marketplace offer. public string OfferId { get; set; } + /// Plan Id for the marketplace offer. public string PlanId { get; set; } + /// Plan Name for the marketplace offer. public string PlanName { get; set; } + /// Plan Display Name for the marketplace offer. public string TermUnit { get; set; } + /// Plan Display Name for the marketplace offer. public string TermId { get; set; } } diff --git a/sdk/mongodbatlas/Azure.ResourceManager.MongoDBAtlas/src/Generated/Models/MongoDBAtlasOrganizationPatch.Serialization.cs b/sdk/mongodbatlas/Azure.ResourceManager.MongoDBAtlas/src/Generated/Models/MongoDBAtlasOrganizationPatch.Serialization.cs index ef90d884bbf2..aad39a8ae6ec 100644 --- a/sdk/mongodbatlas/Azure.ResourceManager.MongoDBAtlas/src/Generated/Models/MongoDBAtlasOrganizationPatch.Serialization.cs +++ b/sdk/mongodbatlas/Azure.ResourceManager.MongoDBAtlas/src/Generated/Models/MongoDBAtlasOrganizationPatch.Serialization.cs @@ -12,13 +12,15 @@ using System.Text.Json; using Azure.Core; using Azure.ResourceManager.Models; +using Azure.ResourceManager.MongoDBAtlas; namespace Azure.ResourceManager.MongoDBAtlas.Models { - public partial class MongoDBAtlasOrganizationPatch : IUtf8JsonSerializable, IJsonModel + /// The type used for update operations of the OrganizationResource. + public partial class MongoDBAtlasOrganizationPatch : 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(); @@ -30,16 +32,15 @@ void IJsonModel.Write(Utf8JsonWriter writer, Mode /// The client options for reading and writing models. protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; if (format != "J") { throw new FormatException($"The model {nameof(MongoDBAtlasOrganizationPatch)} does not support writing '{format}' format."); } - if (Optional.IsDefined(Identity)) { writer.WritePropertyName("identity"u8); - ((IJsonModel)Identity).Write(writer, ModelSerializationExtensions.WireV3Options); + ((IJsonModel)Identity).Write(writer, options); } if (Optional.IsCollectionDefined(Tags)) { @@ -48,6 +49,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(); @@ -57,15 +63,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); } @@ -74,78 +80,91 @@ protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWrit } } - MongoDBAtlasOrganizationPatch IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + /// The JSON reader. + /// The client options for reading and writing models. + MongoDBAtlasOrganizationPatch IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) => JsonModelCreateCore(ref reader, options); + + /// The JSON reader. + /// The client options for reading and writing models. + protected virtual MongoDBAtlasOrganizationPatch 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(MongoDBAtlasOrganizationPatch)} does not support reading '{format}' format."); } - using JsonDocument document = JsonDocument.ParseValue(ref reader); return DeserializeMongoDBAtlasOrganizationPatch(document.RootElement, options); } - internal static MongoDBAtlasOrganizationPatch DeserializeMongoDBAtlasOrganizationPatch(JsonElement element, ModelReaderWriterOptions options = null) + /// The JSON element to deserialize. + /// The client options for reading and writing models. + internal static MongoDBAtlasOrganizationPatch DeserializeMongoDBAtlasOrganizationPatch(JsonElement element, ModelReaderWriterOptions options) { - options ??= ModelSerializationExtensions.WireOptions; - if (element.ValueKind == JsonValueKind.Null) { return null; } ManagedServiceIdentity identity = default; IDictionary tags = default; - MongoDBAtlasOrganizationUpdateProperties properties = default; - IDictionary serializedAdditionalRawData = default; - Dictionary rawDataDictionary = new Dictionary(); - foreach (var property in element.EnumerateObject()) + OrganizationResourceUpdateProperties properties = default; + IDictionary additionalBinaryDataProperties = new ChangeTrackingDictionary(); + foreach (var prop in element.EnumerateObject()) { - if (property.NameEquals("identity"u8)) + if (prop.NameEquals("identity"u8)) { - if (property.Value.ValueKind == JsonValueKind.Null) + if (prop.Value.ValueKind == JsonValueKind.Null) { continue; } - identity = ModelReaderWriter.Read(new BinaryData(Encoding.UTF8.GetBytes(property.Value.GetRawText())), ModelSerializationExtensions.WireV3Options, AzureResourceManagerMongoDBAtlasContext.Default); + identity = ModelReaderWriter.Read(new BinaryData(Encoding.UTF8.GetBytes(prop.Value.GetRawText())), ModelSerializationExtensions.WireOptions, AzureResourceManagerMongoDBAtlasContext.Default); continue; } - 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 = MongoDBAtlasOrganizationUpdateProperties.DeserializeMongoDBAtlasOrganizationUpdateProperties(property.Value, options); + properties = OrganizationResourceUpdateProperties.DeserializeOrganizationResourceUpdateProperties(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 MongoDBAtlasOrganizationPatch(identity, tags ?? new ChangeTrackingDictionary(), properties, serializedAdditionalRawData); + return new MongoDBAtlasOrganizationPatch(identity, 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": @@ -155,15 +174,20 @@ BinaryData IPersistableModel.Write(ModelReaderWri } } - MongoDBAtlasOrganizationPatch 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. + MongoDBAtlasOrganizationPatch IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) => PersistableModelCreateCore(data, options); + /// The data to parse. + /// The client options for reading and writing models. + protected virtual MongoDBAtlasOrganizationPatch 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)) { - using JsonDocument document = JsonDocument.Parse(data, ModelSerializationExtensions.JsonDocumentOptions); return DeserializeMongoDBAtlasOrganizationPatch(document.RootElement, options); } default: @@ -171,6 +195,19 @@ MongoDBAtlasOrganizationPatch IPersistableModel.C } } + /// The client options for reading and writing models. string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + + /// The to serialize into . + internal static RequestContent ToRequestContent(MongoDBAtlasOrganizationPatch patch) + { + if (patch == null) + { + return null; + } + Utf8JsonRequestContent content = new Utf8JsonRequestContent(); + content.JsonWriter.WriteObjectValue(patch, ModelSerializationExtensions.WireOptions); + return content; + } } } diff --git a/sdk/mongodbatlas/Azure.ResourceManager.MongoDBAtlas/src/Generated/Models/MongoDBAtlasOrganizationPatch.cs b/sdk/mongodbatlas/Azure.ResourceManager.MongoDBAtlas/src/Generated/Models/MongoDBAtlasOrganizationPatch.cs index 2854bb3208c2..f7526a4e891d 100644 --- a/sdk/mongodbatlas/Azure.ResourceManager.MongoDBAtlas/src/Generated/Models/MongoDBAtlasOrganizationPatch.cs +++ b/sdk/mongodbatlas/Azure.ResourceManager.MongoDBAtlas/src/Generated/Models/MongoDBAtlasOrganizationPatch.cs @@ -8,43 +8,15 @@ using System; using System.Collections.Generic; using Azure.ResourceManager.Models; +using Azure.ResourceManager.MongoDBAtlas; namespace Azure.ResourceManager.MongoDBAtlas.Models { /// The type used for update operations of the OrganizationResource. public partial class MongoDBAtlasOrganizationPatch { - /// - /// 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 MongoDBAtlasOrganizationPatch() @@ -56,20 +28,22 @@ public MongoDBAtlasOrganizationPatch() /// The managed service identities assigned to this resource. /// Resource tags. /// The resource-specific properties for this resource. - /// Keeps track of any properties unknown to the library. - internal MongoDBAtlasOrganizationPatch(ManagedServiceIdentity identity, IDictionary tags, MongoDBAtlasOrganizationUpdateProperties properties, IDictionary serializedAdditionalRawData) + /// Keeps track of any properties unknown to the library. + internal MongoDBAtlasOrganizationPatch(ManagedServiceIdentity identity, IDictionary tags, OrganizationResourceUpdateProperties properties, IDictionary additionalBinaryDataProperties) { Identity = identity; Tags = tags; Properties = properties; - _serializedAdditionalRawData = serializedAdditionalRawData; + _additionalBinaryDataProperties = additionalBinaryDataProperties; } /// The managed service identities assigned to this resource. public ManagedServiceIdentity Identity { get; set; } + /// Resource tags. public IDictionary Tags { get; } + /// The resource-specific properties for this resource. - public MongoDBAtlasOrganizationUpdateProperties Properties { get; set; } + public OrganizationResourceUpdateProperties Properties { get; set; } } } diff --git a/sdk/mongodbatlas/Azure.ResourceManager.MongoDBAtlas/src/Generated/Models/MongoDBAtlasOrganizationProperties.Serialization.cs b/sdk/mongodbatlas/Azure.ResourceManager.MongoDBAtlas/src/Generated/Models/MongoDBAtlasOrganizationProperties.Serialization.cs index 9c13a067b9e3..9f388701342a 100644 --- a/sdk/mongodbatlas/Azure.ResourceManager.MongoDBAtlas/src/Generated/Models/MongoDBAtlasOrganizationProperties.Serialization.cs +++ b/sdk/mongodbatlas/Azure.ResourceManager.MongoDBAtlas/src/Generated/Models/MongoDBAtlasOrganizationProperties.Serialization.cs @@ -9,14 +9,20 @@ using System.ClientModel.Primitives; using System.Collections.Generic; using System.Text.Json; -using Azure.Core; +using Azure.ResourceManager.MongoDBAtlas; namespace Azure.ResourceManager.MongoDBAtlas.Models { - public partial class MongoDBAtlasOrganizationProperties : IUtf8JsonSerializable, IJsonModel + /// Properties specific to Organization. + public partial class MongoDBAtlasOrganizationProperties : IJsonModel { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + /// Initializes a new instance of for deserialization. + internal MongoDBAtlasOrganizationProperties() + { + } + /// The JSON writer. + /// The client options for reading and writing models. void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) { writer.WriteStartObject(); @@ -28,12 +34,11 @@ void IJsonModel.Write(Utf8JsonWriter writer, /// The client options for reading and writing models. protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; if (format != "J") { throw new FormatException($"The model {nameof(MongoDBAtlasOrganizationProperties)} does not support writing '{format}' format."); } - writer.WritePropertyName("marketplace"u8); writer.WriteObjectValue(Marketplace, options); writer.WritePropertyName("user"u8); @@ -48,15 +53,15 @@ protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWrit writer.WritePropertyName("partnerProperties"u8); writer.WriteObjectValue(PartnerProperties, 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); } @@ -65,22 +70,27 @@ protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWrit } } - MongoDBAtlasOrganizationProperties IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + /// The JSON reader. + /// The client options for reading and writing models. + MongoDBAtlasOrganizationProperties IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) => JsonModelCreateCore(ref reader, options); + + /// The JSON reader. + /// The client options for reading and writing models. + protected virtual MongoDBAtlasOrganizationProperties 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(MongoDBAtlasOrganizationProperties)} does not support reading '{format}' format."); } - using JsonDocument document = JsonDocument.ParseValue(ref reader); return DeserializeMongoDBAtlasOrganizationProperties(document.RootElement, options); } - internal static MongoDBAtlasOrganizationProperties DeserializeMongoDBAtlasOrganizationProperties(JsonElement element, ModelReaderWriterOptions options = null) + /// The JSON element to deserialize. + /// The client options for reading and writing models. + internal static MongoDBAtlasOrganizationProperties DeserializeMongoDBAtlasOrganizationProperties(JsonElement element, ModelReaderWriterOptions options) { - options ??= ModelSerializationExtensions.WireOptions; - if (element.ValueKind == JsonValueKind.Null) { return null; @@ -89,51 +99,52 @@ internal static MongoDBAtlasOrganizationProperties DeserializeMongoDBAtlasOrgani MongoDBAtlasUserDetails user = default; MongoDBAtlasResourceProvisioningState? provisioningState = default; MongoDBAtlasPartnerProperties partnerProperties = 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("marketplace"u8)) + if (prop.NameEquals("marketplace"u8)) { - marketplace = MongoDBAtlasMarketplaceDetails.DeserializeMongoDBAtlasMarketplaceDetails(property.Value, options); + marketplace = MongoDBAtlasMarketplaceDetails.DeserializeMongoDBAtlasMarketplaceDetails(prop.Value, options); continue; } - if (property.NameEquals("user"u8)) + if (prop.NameEquals("user"u8)) { - user = MongoDBAtlasUserDetails.DeserializeMongoDBAtlasUserDetails(property.Value, options); + user = MongoDBAtlasUserDetails.DeserializeMongoDBAtlasUserDetails(prop.Value, options); continue; } - if (property.NameEquals("provisioningState"u8)) + if (prop.NameEquals("provisioningState"u8)) { - if (property.Value.ValueKind == JsonValueKind.Null) + if (prop.Value.ValueKind == JsonValueKind.Null) { continue; } - provisioningState = new MongoDBAtlasResourceProvisioningState(property.Value.GetString()); + provisioningState = new MongoDBAtlasResourceProvisioningState(prop.Value.GetString()); continue; } - if (property.NameEquals("partnerProperties"u8)) + if (prop.NameEquals("partnerProperties"u8)) { - if (property.Value.ValueKind == JsonValueKind.Null) + if (prop.Value.ValueKind == JsonValueKind.Null) { continue; } - partnerProperties = MongoDBAtlasPartnerProperties.DeserializeMongoDBAtlasPartnerProperties(property.Value, options); + partnerProperties = MongoDBAtlasPartnerProperties.DeserializeMongoDBAtlasPartnerProperties(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 MongoDBAtlasOrganizationProperties(marketplace, user, provisioningState, partnerProperties, serializedAdditionalRawData); + return new MongoDBAtlasOrganizationProperties(marketplace, user, provisioningState, partnerProperties, 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": @@ -143,15 +154,20 @@ BinaryData IPersistableModel.Write(ModelRead } } - MongoDBAtlasOrganizationProperties 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. + MongoDBAtlasOrganizationProperties IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) => PersistableModelCreateCore(data, options); + /// The data to parse. + /// The client options for reading and writing models. + protected virtual MongoDBAtlasOrganizationProperties 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)) { - using JsonDocument document = JsonDocument.Parse(data, ModelSerializationExtensions.JsonDocumentOptions); return DeserializeMongoDBAtlasOrganizationProperties(document.RootElement, options); } default: @@ -159,6 +175,7 @@ MongoDBAtlasOrganizationProperties IPersistableModel The client options for reading and writing models. string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; } } diff --git a/sdk/mongodbatlas/Azure.ResourceManager.MongoDBAtlas/src/Generated/Models/MongoDBAtlasOrganizationProperties.cs b/sdk/mongodbatlas/Azure.ResourceManager.MongoDBAtlas/src/Generated/Models/MongoDBAtlasOrganizationProperties.cs index 9441aed7f605..fe4cce25b5e1 100644 --- a/sdk/mongodbatlas/Azure.ResourceManager.MongoDBAtlas/src/Generated/Models/MongoDBAtlasOrganizationProperties.cs +++ b/sdk/mongodbatlas/Azure.ResourceManager.MongoDBAtlas/src/Generated/Models/MongoDBAtlasOrganizationProperties.cs @@ -7,43 +7,15 @@ using System; using System.Collections.Generic; +using Azure.ResourceManager.MongoDBAtlas; namespace Azure.ResourceManager.MongoDBAtlas.Models { /// Properties specific to Organization. public partial class MongoDBAtlasOrganizationProperties { - /// - /// 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 . /// Marketplace details of the resource. @@ -63,27 +35,25 @@ public MongoDBAtlasOrganizationProperties(MongoDBAtlasMarketplaceDetails marketp /// Details of the user. /// Provisioning state of the resource. /// MongoDB properties. - /// Keeps track of any properties unknown to the library. - internal MongoDBAtlasOrganizationProperties(MongoDBAtlasMarketplaceDetails marketplace, MongoDBAtlasUserDetails user, MongoDBAtlasResourceProvisioningState? provisioningState, MongoDBAtlasPartnerProperties partnerProperties, IDictionary serializedAdditionalRawData) + /// Keeps track of any properties unknown to the library. + internal MongoDBAtlasOrganizationProperties(MongoDBAtlasMarketplaceDetails marketplace, MongoDBAtlasUserDetails user, MongoDBAtlasResourceProvisioningState? provisioningState, MongoDBAtlasPartnerProperties partnerProperties, IDictionary additionalBinaryDataProperties) { Marketplace = marketplace; User = user; ProvisioningState = provisioningState; PartnerProperties = partnerProperties; - _serializedAdditionalRawData = serializedAdditionalRawData; - } - - /// Initializes a new instance of for deserialization. - internal MongoDBAtlasOrganizationProperties() - { + _additionalBinaryDataProperties = additionalBinaryDataProperties; } /// Marketplace details of the resource. public MongoDBAtlasMarketplaceDetails Marketplace { get; set; } + /// Details of the user. public MongoDBAtlasUserDetails User { get; set; } + /// Provisioning state of the resource. public MongoDBAtlasResourceProvisioningState? ProvisioningState { get; } + /// MongoDB properties. public MongoDBAtlasPartnerProperties PartnerProperties { get; set; } } diff --git a/sdk/mongodbatlas/Azure.ResourceManager.MongoDBAtlas/src/Generated/Models/MongoDBAtlasOrganizationUpdateProperties.Serialization.cs b/sdk/mongodbatlas/Azure.ResourceManager.MongoDBAtlas/src/Generated/Models/MongoDBAtlasOrganizationUpdateProperties.Serialization.cs deleted file mode 100644 index 4014ab4616ee..000000000000 --- a/sdk/mongodbatlas/Azure.ResourceManager.MongoDBAtlas/src/Generated/Models/MongoDBAtlasOrganizationUpdateProperties.Serialization.cs +++ /dev/null @@ -1,148 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System; -using System.ClientModel.Primitives; -using System.Collections.Generic; -using System.Text.Json; -using Azure.Core; - -namespace Azure.ResourceManager.MongoDBAtlas.Models -{ - public partial class MongoDBAtlasOrganizationUpdateProperties : IUtf8JsonSerializable, IJsonModel - { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); - - void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) - { - writer.WriteStartObject(); - JsonModelWriteCore(writer, options); - writer.WriteEndObject(); - } - - /// The JSON writer. - /// The client options for reading and writing models. - protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) - { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; - if (format != "J") - { - throw new FormatException($"The model {nameof(MongoDBAtlasOrganizationUpdateProperties)} does not support writing '{format}' format."); - } - - if (Optional.IsDefined(User)) - { - writer.WritePropertyName("user"u8); - writer.WriteObjectValue(User, options); - } - if (Optional.IsDefined(PartnerProperties)) - { - writer.WritePropertyName("partnerProperties"u8); - writer.WriteObjectValue(PartnerProperties, options); - } - if (options.Format != "W" && _serializedAdditionalRawData != null) - { - foreach (var item in _serializedAdditionalRawData) - { - writer.WritePropertyName(item.Key); -#if NET6_0_OR_GREATER - writer.WriteRawValue(item.Value); -#else - using (JsonDocument document = JsonDocument.Parse(item.Value, ModelSerializationExtensions.JsonDocumentOptions)) - { - JsonSerializer.Serialize(writer, document.RootElement); - } -#endif - } - } - } - - MongoDBAtlasOrganizationUpdateProperties IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) - { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; - if (format != "J") - { - throw new FormatException($"The model {nameof(MongoDBAtlasOrganizationUpdateProperties)} does not support reading '{format}' format."); - } - - using JsonDocument document = JsonDocument.ParseValue(ref reader); - return DeserializeMongoDBAtlasOrganizationUpdateProperties(document.RootElement, options); - } - - internal static MongoDBAtlasOrganizationUpdateProperties DeserializeMongoDBAtlasOrganizationUpdateProperties(JsonElement element, ModelReaderWriterOptions options = null) - { - options ??= ModelSerializationExtensions.WireOptions; - - if (element.ValueKind == JsonValueKind.Null) - { - return null; - } - MongoDBAtlasUserDetails user = default; - MongoDBAtlasPartnerProperties partnerProperties = default; - IDictionary serializedAdditionalRawData = default; - Dictionary rawDataDictionary = new Dictionary(); - foreach (var property in element.EnumerateObject()) - { - if (property.NameEquals("user"u8)) - { - if (property.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - user = MongoDBAtlasUserDetails.DeserializeMongoDBAtlasUserDetails(property.Value, options); - continue; - } - if (property.NameEquals("partnerProperties"u8)) - { - if (property.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - partnerProperties = MongoDBAtlasPartnerProperties.DeserializeMongoDBAtlasPartnerProperties(property.Value, options); - continue; - } - if (options.Format != "W") - { - rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); - } - } - serializedAdditionalRawData = rawDataDictionary; - return new MongoDBAtlasOrganizationUpdateProperties(user, partnerProperties, serializedAdditionalRawData); - } - - BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) - { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; - - switch (format) - { - case "J": - return ModelReaderWriter.Write(this, options, AzureResourceManagerMongoDBAtlasContext.Default); - default: - throw new FormatException($"The model {nameof(MongoDBAtlasOrganizationUpdateProperties)} does not support writing '{options.Format}' format."); - } - } - - MongoDBAtlasOrganizationUpdateProperties IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) - { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; - - switch (format) - { - case "J": - { - using JsonDocument document = JsonDocument.Parse(data, ModelSerializationExtensions.JsonDocumentOptions); - return DeserializeMongoDBAtlasOrganizationUpdateProperties(document.RootElement, options); - } - default: - throw new FormatException($"The model {nameof(MongoDBAtlasOrganizationUpdateProperties)} does not support reading '{options.Format}' format."); - } - } - - string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; - } -} diff --git a/sdk/mongodbatlas/Azure.ResourceManager.MongoDBAtlas/src/Generated/Models/MongoDBAtlasOrganizationUpdateProperties.cs b/sdk/mongodbatlas/Azure.ResourceManager.MongoDBAtlas/src/Generated/Models/MongoDBAtlasOrganizationUpdateProperties.cs deleted file mode 100644 index 9902be693b7a..000000000000 --- a/sdk/mongodbatlas/Azure.ResourceManager.MongoDBAtlas/src/Generated/Models/MongoDBAtlasOrganizationUpdateProperties.cs +++ /dev/null @@ -1,69 +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.MongoDBAtlas.Models -{ - /// The updatable properties of the OrganizationResource. - public partial class MongoDBAtlasOrganizationUpdateProperties - { - /// - /// Keeps track of any properties unknown to the library. - /// - /// To assign an object to the value of this property use . - /// - /// - /// To assign an already formatted json string to this property use . - /// - /// - /// Examples: - /// - /// - /// BinaryData.FromObjectAsJson("foo") - /// Creates a payload of "foo". - /// - /// - /// BinaryData.FromString("\"foo\"") - /// Creates a payload of "foo". - /// - /// - /// BinaryData.FromObjectAsJson(new { key = "value" }) - /// Creates a payload of { "key": "value" }. - /// - /// - /// BinaryData.FromString("{\"key\": \"value\"}") - /// Creates a payload of { "key": "value" }. - /// - /// - /// - /// - private IDictionary _serializedAdditionalRawData; - - /// Initializes a new instance of . - public MongoDBAtlasOrganizationUpdateProperties() - { - } - - /// Initializes a new instance of . - /// Details of the user. - /// MongoDB properties. - /// Keeps track of any properties unknown to the library. - internal MongoDBAtlasOrganizationUpdateProperties(MongoDBAtlasUserDetails user, MongoDBAtlasPartnerProperties partnerProperties, IDictionary serializedAdditionalRawData) - { - User = user; - PartnerProperties = partnerProperties; - _serializedAdditionalRawData = serializedAdditionalRawData; - } - - /// Details of the user. - public MongoDBAtlasUserDetails User { get; set; } - /// MongoDB properties. - public MongoDBAtlasPartnerProperties PartnerProperties { get; set; } - } -} diff --git a/sdk/mongodbatlas/Azure.ResourceManager.MongoDBAtlas/src/Generated/Models/MongoDBAtlasPartnerProperties.Serialization.cs b/sdk/mongodbatlas/Azure.ResourceManager.MongoDBAtlas/src/Generated/Models/MongoDBAtlasPartnerProperties.Serialization.cs index 8dc62702daee..9b31661bdef6 100644 --- a/sdk/mongodbatlas/Azure.ResourceManager.MongoDBAtlas/src/Generated/Models/MongoDBAtlasPartnerProperties.Serialization.cs +++ b/sdk/mongodbatlas/Azure.ResourceManager.MongoDBAtlas/src/Generated/Models/MongoDBAtlasPartnerProperties.Serialization.cs @@ -9,14 +9,20 @@ using System.ClientModel.Primitives; using System.Collections.Generic; using System.Text.Json; -using Azure.Core; +using Azure.ResourceManager.MongoDBAtlas; namespace Azure.ResourceManager.MongoDBAtlas.Models { - public partial class MongoDBAtlasPartnerProperties : IUtf8JsonSerializable, IJsonModel + /// MongoDB specific Properties. + public partial class MongoDBAtlasPartnerProperties : IJsonModel { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + /// Initializes a new instance of for deserialization. + internal MongoDBAtlasPartnerProperties() + { + } + /// 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, Mode /// The client options for reading and writing models. protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; if (format != "J") { throw new FormatException($"The model {nameof(MongoDBAtlasPartnerProperties)} does not support writing '{format}' format."); } - if (Optional.IsDefined(OrganizationId)) { writer.WritePropertyName("organizationId"u8); @@ -46,15 +51,15 @@ protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWrit } writer.WritePropertyName("organizationName"u8); writer.WriteStringValue(OrganizationName); - 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,61 +68,67 @@ protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWrit } } - MongoDBAtlasPartnerProperties IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + /// The JSON reader. + /// The client options for reading and writing models. + MongoDBAtlasPartnerProperties IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) => JsonModelCreateCore(ref reader, options); + + /// The JSON reader. + /// The client options for reading and writing models. + protected virtual MongoDBAtlasPartnerProperties 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(MongoDBAtlasPartnerProperties)} does not support reading '{format}' format."); } - using JsonDocument document = JsonDocument.ParseValue(ref reader); return DeserializeMongoDBAtlasPartnerProperties(document.RootElement, options); } - internal static MongoDBAtlasPartnerProperties DeserializeMongoDBAtlasPartnerProperties(JsonElement element, ModelReaderWriterOptions options = null) + /// The JSON element to deserialize. + /// The client options for reading and writing models. + internal static MongoDBAtlasPartnerProperties DeserializeMongoDBAtlasPartnerProperties(JsonElement element, ModelReaderWriterOptions options) { - options ??= ModelSerializationExtensions.WireOptions; - if (element.ValueKind == JsonValueKind.Null) { return null; } string organizationId = default; - string redirectUrl = default; + string redirectUri = default; string organizationName = 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("organizationId"u8)) + if (prop.NameEquals("organizationId"u8)) { - organizationId = property.Value.GetString(); + organizationId = prop.Value.GetString(); continue; } - if (property.NameEquals("redirectUrl"u8)) + if (prop.NameEquals("redirectUrl"u8)) { - redirectUrl = property.Value.GetString(); + redirectUri = prop.Value.GetString(); continue; } - if (property.NameEquals("organizationName"u8)) + if (prop.NameEquals("organizationName"u8)) { - organizationName = property.Value.GetString(); + organizationName = 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 MongoDBAtlasPartnerProperties(organizationId, redirectUrl, organizationName, serializedAdditionalRawData); + return new MongoDBAtlasPartnerProperties(organizationId, redirectUri, organizationName, additionalBinaryDataProperties); } - BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) - { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + /// The client options for reading and writing models. + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) => PersistableModelWriteCore(options); + /// The client options for reading and writing models. + protected virtual BinaryData PersistableModelWriteCore(ModelReaderWriterOptions options) + { + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; switch (format) { case "J": @@ -127,15 +138,20 @@ BinaryData IPersistableModel.Write(ModelReaderWri } } - MongoDBAtlasPartnerProperties 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. + MongoDBAtlasPartnerProperties IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) => PersistableModelCreateCore(data, options); + /// The data to parse. + /// The client options for reading and writing models. + protected virtual MongoDBAtlasPartnerProperties 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)) { - using JsonDocument document = JsonDocument.Parse(data, ModelSerializationExtensions.JsonDocumentOptions); return DeserializeMongoDBAtlasPartnerProperties(document.RootElement, options); } default: @@ -143,6 +159,7 @@ MongoDBAtlasPartnerProperties IPersistableModel.C } } + /// The client options for reading and writing models. string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; } } diff --git a/sdk/mongodbatlas/Azure.ResourceManager.MongoDBAtlas/src/Generated/Models/MongoDBAtlasPartnerProperties.cs b/sdk/mongodbatlas/Azure.ResourceManager.MongoDBAtlas/src/Generated/Models/MongoDBAtlasPartnerProperties.cs index d530fdf06b16..f4ebdf343462 100644 --- a/sdk/mongodbatlas/Azure.ResourceManager.MongoDBAtlas/src/Generated/Models/MongoDBAtlasPartnerProperties.cs +++ b/sdk/mongodbatlas/Azure.ResourceManager.MongoDBAtlas/src/Generated/Models/MongoDBAtlasPartnerProperties.cs @@ -7,43 +7,15 @@ using System; using System.Collections.Generic; +using Azure.ResourceManager.MongoDBAtlas; namespace Azure.ResourceManager.MongoDBAtlas.Models { /// MongoDB specific Properties. public partial class MongoDBAtlasPartnerProperties { - /// - /// 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 . /// Organization name in MongoDB system. @@ -59,24 +31,21 @@ public MongoDBAtlasPartnerProperties(string organizationName) /// Organization Id in MongoDB system. /// Redirect URL for the MongoDB. /// Organization name in MongoDB system. - /// Keeps track of any properties unknown to the library. - internal MongoDBAtlasPartnerProperties(string organizationId, string redirectUri, string organizationName, IDictionary serializedAdditionalRawData) + /// Keeps track of any properties unknown to the library. + internal MongoDBAtlasPartnerProperties(string organizationId, string redirectUri, string organizationName, IDictionary additionalBinaryDataProperties) { OrganizationId = organizationId; RedirectUri = redirectUri; OrganizationName = organizationName; - _serializedAdditionalRawData = serializedAdditionalRawData; - } - - /// Initializes a new instance of for deserialization. - internal MongoDBAtlasPartnerProperties() - { + _additionalBinaryDataProperties = additionalBinaryDataProperties; } /// Organization Id in MongoDB system. public string OrganizationId { get; set; } + /// Redirect URL for the MongoDB. public string RedirectUri { get; set; } + /// Organization name in MongoDB system. public string OrganizationName { get; set; } } diff --git a/sdk/mongodbatlas/Azure.ResourceManager.MongoDBAtlas/src/Generated/Models/MongoDBAtlasResourceProvisioningState.cs b/sdk/mongodbatlas/Azure.ResourceManager.MongoDBAtlas/src/Generated/Models/MongoDBAtlasResourceProvisioningState.cs index 00fc54a3cb66..6aa4889cecc5 100644 --- a/sdk/mongodbatlas/Azure.ResourceManager.MongoDBAtlas/src/Generated/Models/MongoDBAtlasResourceProvisioningState.cs +++ b/sdk/mongodbatlas/Azure.ResourceManager.MongoDBAtlas/src/Generated/Models/MongoDBAtlasResourceProvisioningState.cs @@ -7,6 +7,7 @@ using System; using System.ComponentModel; +using Azure.ResourceManager.MongoDBAtlas; namespace Azure.ResourceManager.MongoDBAtlas.Models { @@ -14,41 +15,62 @@ namespace Azure.ResourceManager.MongoDBAtlas.Models public readonly partial struct MongoDBAtlasResourceProvisioningState : 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 MongoDBAtlasResourceProvisioningState(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 MongoDBAtlasResourceProvisioningState Succeeded { get; } = new MongoDBAtlasResourceProvisioningState(SucceededValue); + /// Resource creation failed. public static MongoDBAtlasResourceProvisioningState Failed { get; } = new MongoDBAtlasResourceProvisioningState(FailedValue); + /// Resource creation was canceled. public static MongoDBAtlasResourceProvisioningState Canceled { get; } = new MongoDBAtlasResourceProvisioningState(CanceledValue); + /// Determines if two values are the same. + /// The left value to compare. + /// The right value to compare. public static bool operator ==(MongoDBAtlasResourceProvisioningState left, MongoDBAtlasResourceProvisioningState 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 !=(MongoDBAtlasResourceProvisioningState left, MongoDBAtlasResourceProvisioningState right) => !left.Equals(right); - /// Converts a to a . + + /// Converts a string to a . + /// The value. public static implicit operator MongoDBAtlasResourceProvisioningState(string value) => new MongoDBAtlasResourceProvisioningState(value); - /// + /// Converts a string to a . + /// The value. + public static implicit operator MongoDBAtlasResourceProvisioningState?(string value) => value == null ? null : new MongoDBAtlasResourceProvisioningState(value); + + /// [EditorBrowsable(EditorBrowsableState.Never)] public override bool Equals(object obj) => obj is MongoDBAtlasResourceProvisioningState other && Equals(other); - /// + + /// public bool Equals(MongoDBAtlasResourceProvisioningState 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/mongodbatlas/Azure.ResourceManager.MongoDBAtlas/src/Generated/Models/MongoDBAtlasUserDetails.Serialization.cs b/sdk/mongodbatlas/Azure.ResourceManager.MongoDBAtlas/src/Generated/Models/MongoDBAtlasUserDetails.Serialization.cs index 3477589e3f71..b6d1b47d9571 100644 --- a/sdk/mongodbatlas/Azure.ResourceManager.MongoDBAtlas/src/Generated/Models/MongoDBAtlasUserDetails.Serialization.cs +++ b/sdk/mongodbatlas/Azure.ResourceManager.MongoDBAtlas/src/Generated/Models/MongoDBAtlasUserDetails.Serialization.cs @@ -9,14 +9,20 @@ using System.ClientModel.Primitives; using System.Collections.Generic; using System.Text.Json; -using Azure.Core; +using Azure.ResourceManager.MongoDBAtlas; namespace Azure.ResourceManager.MongoDBAtlas.Models { - public partial class MongoDBAtlasUserDetails : IUtf8JsonSerializable, IJsonModel + /// User details for an organization. + public partial class MongoDBAtlasUserDetails : IJsonModel { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + /// Initializes a new instance of for deserialization. + internal MongoDBAtlasUserDetails() + { + } + /// 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, ModelReade /// The client options for reading and writing models. protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; if (format != "J") { throw new FormatException($"The model {nameof(MongoDBAtlasUserDetails)} does not support writing '{format}' format."); } - writer.WritePropertyName("firstName"u8); writer.WriteStringValue(FirstName); writer.WritePropertyName("lastName"u8); @@ -55,15 +60,15 @@ protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWrit writer.WritePropertyName("companyName"u8); writer.WriteStringValue(CompanyName); } - 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); } @@ -72,22 +77,27 @@ protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWrit } } - MongoDBAtlasUserDetails IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + /// The JSON reader. + /// The client options for reading and writing models. + MongoDBAtlasUserDetails IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) => JsonModelCreateCore(ref reader, options); + + /// The JSON reader. + /// The client options for reading and writing models. + protected virtual MongoDBAtlasUserDetails 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(MongoDBAtlasUserDetails)} does not support reading '{format}' format."); } - using JsonDocument document = JsonDocument.ParseValue(ref reader); return DeserializeMongoDBAtlasUserDetails(document.RootElement, options); } - internal static MongoDBAtlasUserDetails DeserializeMongoDBAtlasUserDetails(JsonElement element, ModelReaderWriterOptions options = null) + /// The JSON element to deserialize. + /// The client options for reading and writing models. + internal static MongoDBAtlasUserDetails DeserializeMongoDBAtlasUserDetails(JsonElement element, ModelReaderWriterOptions options) { - options ??= ModelSerializationExtensions.WireOptions; - if (element.ValueKind == JsonValueKind.Null) { return null; @@ -98,46 +108,44 @@ internal static MongoDBAtlasUserDetails DeserializeMongoDBAtlasUserDetails(JsonE string upn = default; string phoneNumber = default; string companyName = 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("firstName"u8)) + if (prop.NameEquals("firstName"u8)) { - firstName = property.Value.GetString(); + firstName = prop.Value.GetString(); continue; } - if (property.NameEquals("lastName"u8)) + if (prop.NameEquals("lastName"u8)) { - lastName = property.Value.GetString(); + lastName = prop.Value.GetString(); continue; } - if (property.NameEquals("emailAddress"u8)) + if (prop.NameEquals("emailAddress"u8)) { - emailAddress = property.Value.GetString(); + emailAddress = prop.Value.GetString(); continue; } - if (property.NameEquals("upn"u8)) + if (prop.NameEquals("upn"u8)) { - upn = property.Value.GetString(); + upn = prop.Value.GetString(); continue; } - if (property.NameEquals("phoneNumber"u8)) + if (prop.NameEquals("phoneNumber"u8)) { - phoneNumber = property.Value.GetString(); + phoneNumber = prop.Value.GetString(); continue; } - if (property.NameEquals("companyName"u8)) + if (prop.NameEquals("companyName"u8)) { - companyName = property.Value.GetString(); + companyName = 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 MongoDBAtlasUserDetails( firstName, lastName, @@ -145,13 +153,16 @@ internal static MongoDBAtlasUserDetails DeserializeMongoDBAtlasUserDetails(JsonE upn, phoneNumber, companyName, - 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": @@ -161,15 +172,20 @@ BinaryData IPersistableModel.Write(ModelReaderWriterOpt } } - MongoDBAtlasUserDetails 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. + MongoDBAtlasUserDetails IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) => PersistableModelCreateCore(data, options); + /// The data to parse. + /// The client options for reading and writing models. + protected virtual MongoDBAtlasUserDetails 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)) { - using JsonDocument document = JsonDocument.Parse(data, ModelSerializationExtensions.JsonDocumentOptions); return DeserializeMongoDBAtlasUserDetails(document.RootElement, options); } default: @@ -177,6 +193,7 @@ MongoDBAtlasUserDetails IPersistableModel.Create(Binary } } + /// The client options for reading and writing models. string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; } } diff --git a/sdk/mongodbatlas/Azure.ResourceManager.MongoDBAtlas/src/Generated/Models/MongoDBAtlasUserDetails.cs b/sdk/mongodbatlas/Azure.ResourceManager.MongoDBAtlas/src/Generated/Models/MongoDBAtlasUserDetails.cs index 851a418f8a5c..24392571c153 100644 --- a/sdk/mongodbatlas/Azure.ResourceManager.MongoDBAtlas/src/Generated/Models/MongoDBAtlasUserDetails.cs +++ b/sdk/mongodbatlas/Azure.ResourceManager.MongoDBAtlas/src/Generated/Models/MongoDBAtlasUserDetails.cs @@ -7,43 +7,15 @@ using System; using System.Collections.Generic; +using Azure.ResourceManager.MongoDBAtlas; namespace Azure.ResourceManager.MongoDBAtlas.Models { /// User details for an organization. public partial class MongoDBAtlasUserDetails { - /// - /// 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 . /// First name of the user. @@ -68,8 +40,8 @@ public MongoDBAtlasUserDetails(string firstName, string lastName, string emailAd /// User's principal name. /// User's phone number. /// Company Name. - /// Keeps track of any properties unknown to the library. - internal MongoDBAtlasUserDetails(string firstName, string lastName, string emailAddress, string upn, string phoneNumber, string companyName, IDictionary serializedAdditionalRawData) + /// Keeps track of any properties unknown to the library. + internal MongoDBAtlasUserDetails(string firstName, string lastName, string emailAddress, string upn, string phoneNumber, string companyName, IDictionary additionalBinaryDataProperties) { FirstName = firstName; LastName = lastName; @@ -77,24 +49,24 @@ internal MongoDBAtlasUserDetails(string firstName, string lastName, string email Upn = upn; PhoneNumber = phoneNumber; CompanyName = companyName; - _serializedAdditionalRawData = serializedAdditionalRawData; - } - - /// Initializes a new instance of for deserialization. - internal MongoDBAtlasUserDetails() - { + _additionalBinaryDataProperties = additionalBinaryDataProperties; } /// First name of the user. public string FirstName { get; set; } + /// Last name of the user. public string LastName { get; set; } + /// Email address of the user. public string EmailAddress { get; set; } + /// User's principal name. public string Upn { get; set; } + /// User's phone number. public string PhoneNumber { get; set; } + /// Company Name. public string CompanyName { get; set; } } diff --git a/sdk/mongodbatlas/Azure.ResourceManager.MongoDBAtlas/src/Generated/Models/OrganizationResourceListResult.Serialization.cs b/sdk/mongodbatlas/Azure.ResourceManager.MongoDBAtlas/src/Generated/Models/OrganizationResourceListResult.Serialization.cs index a26692e40c53..19f025db4277 100644 --- a/sdk/mongodbatlas/Azure.ResourceManager.MongoDBAtlas/src/Generated/Models/OrganizationResourceListResult.Serialization.cs +++ b/sdk/mongodbatlas/Azure.ResourceManager.MongoDBAtlas/src/Generated/Models/OrganizationResourceListResult.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.MongoDBAtlas; namespace Azure.ResourceManager.MongoDBAtlas.Models { - internal partial class OrganizationResourceListResult : IUtf8JsonSerializable, IJsonModel + /// The response of a OrganizationResource list operation. + internal partial class OrganizationResourceListResult : IJsonModel { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + /// Initializes a new instance of for deserialization. + internal OrganizationResourceListResult() + { + } + /// 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, Mod /// The client options for reading and writing models. protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; if (format != "J") { throw new FormatException($"The model {nameof(OrganizationResourceListResult)} does not support writing '{format}' format."); } - writer.WritePropertyName("value"u8); writer.WriteStartArray(); - foreach (var item in Value) + foreach (MongoDBAtlasOrganizationData 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 } } - OrganizationResourceListResult IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + /// The JSON reader. + /// The client options for reading and writing models. + OrganizationResourceListResult IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) => JsonModelCreateCore(ref reader, options); + + /// The JSON reader. + /// The client options for reading and writing models. + protected virtual OrganizationResourceListResult 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(OrganizationResourceListResult)} does not support reading '{format}' format."); } - using JsonDocument document = JsonDocument.ParseValue(ref reader); return DeserializeOrganizationResourceListResult(document.RootElement, options); } - internal static OrganizationResourceListResult DeserializeOrganizationResourceListResult(JsonElement element, ModelReaderWriterOptions options = null) + /// The JSON element to deserialize. + /// The client options for reading and writing models. + internal static OrganizationResourceListResult DeserializeOrganizationResourceListResult(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(MongoDBAtlasOrganizationData.DeserializeMongoDBAtlasOrganizationData(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 OrganizationResourceListResult(value, nextLink, serializedAdditionalRawData); + return new OrganizationResourceListResult(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(ModelReaderWr } } - OrganizationResourceListResult 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. + OrganizationResourceListResult IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) => PersistableModelCreateCore(data, options); + /// The data to parse. + /// The client options for reading and writing models. + protected virtual OrganizationResourceListResult 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)) { - using JsonDocument document = JsonDocument.Parse(data, ModelSerializationExtensions.JsonDocumentOptions); return DeserializeOrganizationResourceListResult(document.RootElement, options); } default: @@ -146,6 +163,15 @@ OrganizationResourceListResult IPersistableModel } } + /// The client options for reading and writing models. string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + + /// The to deserialize the from. + internal static OrganizationResourceListResult FromResponse(Response result) + { + using Response response = result; + using JsonDocument document = JsonDocument.Parse(response.Content); + return DeserializeOrganizationResourceListResult(document.RootElement, ModelSerializationExtensions.WireOptions); + } } } diff --git a/sdk/mongodbatlas/Azure.ResourceManager.MongoDBAtlas/src/Generated/Models/OrganizationResourceListResult.cs b/sdk/mongodbatlas/Azure.ResourceManager.MongoDBAtlas/src/Generated/Models/OrganizationResourceListResult.cs index 5fb1160f67ea..069952385e52 100644 --- a/sdk/mongodbatlas/Azure.ResourceManager.MongoDBAtlas/src/Generated/Models/OrganizationResourceListResult.cs +++ b/sdk/mongodbatlas/Azure.ResourceManager.MongoDBAtlas/src/Generated/Models/OrganizationResourceListResult.cs @@ -8,72 +8,37 @@ using System; using System.Collections.Generic; using System.Linq; +using Azure.ResourceManager.MongoDBAtlas; namespace Azure.ResourceManager.MongoDBAtlas.Models { /// The response of a OrganizationResource list operation. internal partial class OrganizationResourceListResult { - /// - /// 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 OrganizationResource items on this page. - /// is null. internal OrganizationResourceListResult(IEnumerable value) { - Argument.AssertNotNull(value, nameof(value)); - Value = value.ToList(); } /// Initializes a new instance of . /// The OrganizationResource items on this page. /// The link to the next page of items. - /// Keeps track of any properties unknown to the library. - internal OrganizationResourceListResult(IReadOnlyList value, Uri nextLink, IDictionary serializedAdditionalRawData) + /// Keeps track of any properties unknown to the library. + internal OrganizationResourceListResult(IList value, Uri nextLink, IDictionary additionalBinaryDataProperties) { Value = value; NextLink = nextLink; - _serializedAdditionalRawData = serializedAdditionalRawData; - } - - /// Initializes a new instance of for deserialization. - internal OrganizationResourceListResult() - { + _additionalBinaryDataProperties = additionalBinaryDataProperties; } /// The OrganizationResource 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/mongodbatlas/Azure.ResourceManager.MongoDBAtlas/src/Generated/Models/OrganizationResourceUpdateProperties.Serialization.cs b/sdk/mongodbatlas/Azure.ResourceManager.MongoDBAtlas/src/Generated/Models/OrganizationResourceUpdateProperties.Serialization.cs new file mode 100644 index 000000000000..14958c089bd4 --- /dev/null +++ b/sdk/mongodbatlas/Azure.ResourceManager.MongoDBAtlas/src/Generated/Models/OrganizationResourceUpdateProperties.Serialization.cs @@ -0,0 +1,160 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Text.Json; +using Azure.ResourceManager.MongoDBAtlas; + +namespace Azure.ResourceManager.MongoDBAtlas.Models +{ + /// The updatable properties of the OrganizationResource. + public partial class OrganizationResourceUpdateProperties : IJsonModel + { + /// The JSON writer. + /// The client options for reading and writing models. + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + writer.WriteStartObject(); + JsonModelWriteCore(writer, options); + writer.WriteEndObject(); + } + + /// The JSON writer. + /// The client options for reading and writing models. + protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(OrganizationResourceUpdateProperties)} does not support writing '{format}' format."); + } + if (Optional.IsDefined(User)) + { + writer.WritePropertyName("user"u8); + writer.WriteObjectValue(User, options); + } + if (Optional.IsDefined(PartnerProperties)) + { + writer.WritePropertyName("partnerProperties"u8); + writer.WriteObjectValue(PartnerProperties, options); + } + if (options.Format != "W" && _additionalBinaryDataProperties != null) + { + foreach (var item in _additionalBinaryDataProperties) + { + writer.WritePropertyName(item.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(item.Value); +#else + using (JsonDocument document = JsonDocument.Parse(item.Value)) + { + JsonSerializer.Serialize(writer, document.RootElement); + } +#endif + } + } + } + + /// The JSON reader. + /// The client options for reading and writing models. + OrganizationResourceUpdateProperties IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) => JsonModelCreateCore(ref reader, options); + + /// The JSON reader. + /// The client options for reading and writing models. + protected virtual OrganizationResourceUpdateProperties JsonModelCreateCore(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(OrganizationResourceUpdateProperties)} does not support reading '{format}' format."); + } + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeOrganizationResourceUpdateProperties(document.RootElement, options); + } + + /// The JSON element to deserialize. + /// The client options for reading and writing models. + internal static OrganizationResourceUpdateProperties DeserializeOrganizationResourceUpdateProperties(JsonElement element, ModelReaderWriterOptions options) + { + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + MongoDBAtlasUserDetails user = default; + MongoDBAtlasPartnerProperties partnerProperties = default; + IDictionary additionalBinaryDataProperties = new ChangeTrackingDictionary(); + foreach (var prop in element.EnumerateObject()) + { + if (prop.NameEquals("user"u8)) + { + if (prop.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + user = MongoDBAtlasUserDetails.DeserializeMongoDBAtlasUserDetails(prop.Value, options); + continue; + } + if (prop.NameEquals("partnerProperties"u8)) + { + if (prop.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + partnerProperties = MongoDBAtlasPartnerProperties.DeserializeMongoDBAtlasPartnerProperties(prop.Value, options); + continue; + } + if (options.Format != "W") + { + additionalBinaryDataProperties.Add(prop.Name, BinaryData.FromString(prop.Value.GetRawText())); + } + } + return new OrganizationResourceUpdateProperties(user, partnerProperties, additionalBinaryDataProperties); + } + + /// The client options for reading and writing models. + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) => PersistableModelWriteCore(options); + + /// The client options for reading and writing models. + protected virtual BinaryData PersistableModelWriteCore(ModelReaderWriterOptions options) + { + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options, AzureResourceManagerMongoDBAtlasContext.Default); + default: + throw new FormatException($"The model {nameof(OrganizationResourceUpdateProperties)} does not support writing '{options.Format}' format."); + } + } + + /// The data to parse. + /// The client options for reading and writing models. + OrganizationResourceUpdateProperties IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) => PersistableModelCreateCore(data, options); + + /// The data to parse. + /// The client options for reading and writing models. + protected virtual OrganizationResourceUpdateProperties 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)) + { + return DeserializeOrganizationResourceUpdateProperties(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(OrganizationResourceUpdateProperties)} does not support reading '{options.Format}' format."); + } + } + + /// The client options for reading and writing models. + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + } +} diff --git a/sdk/mongodbatlas/Azure.ResourceManager.MongoDBAtlas/src/Generated/Models/OrganizationResourceUpdateProperties.cs b/sdk/mongodbatlas/Azure.ResourceManager.MongoDBAtlas/src/Generated/Models/OrganizationResourceUpdateProperties.cs new file mode 100644 index 000000000000..72414480a0ad --- /dev/null +++ b/sdk/mongodbatlas/Azure.ResourceManager.MongoDBAtlas/src/Generated/Models/OrganizationResourceUpdateProperties.cs @@ -0,0 +1,41 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; + +namespace Azure.ResourceManager.MongoDBAtlas.Models +{ + /// The updatable properties of the OrganizationResource. + public partial class OrganizationResourceUpdateProperties + { + /// Keeps track of any properties unknown to the library. + private protected readonly IDictionary _additionalBinaryDataProperties; + + /// Initializes a new instance of . + public OrganizationResourceUpdateProperties() + { + } + + /// Initializes a new instance of . + /// Details of the user. + /// MongoDB properties. + /// Keeps track of any properties unknown to the library. + internal OrganizationResourceUpdateProperties(MongoDBAtlasUserDetails user, MongoDBAtlasPartnerProperties partnerProperties, IDictionary additionalBinaryDataProperties) + { + User = user; + PartnerProperties = partnerProperties; + _additionalBinaryDataProperties = additionalBinaryDataProperties; + } + + /// Details of the user. + public MongoDBAtlasUserDetails User { get; set; } + + /// MongoDB properties. + public MongoDBAtlasPartnerProperties PartnerProperties { get; set; } + } +} diff --git a/sdk/mongodbatlas/Azure.ResourceManager.MongoDBAtlas/src/Generated/MongoDBAtlasOrganizationCollection.cs b/sdk/mongodbatlas/Azure.ResourceManager.MongoDBAtlas/src/Generated/MongoDBAtlasOrganizationCollection.cs index 49aa6790ea36..0d2358ee8b40 100644 --- a/sdk/mongodbatlas/Azure.ResourceManager.MongoDBAtlas/src/Generated/MongoDBAtlasOrganizationCollection.cs +++ b/sdk/mongodbatlas/Azure.ResourceManager.MongoDBAtlas/src/Generated/MongoDBAtlasOrganizationCollection.cs @@ -8,90 +8,86 @@ 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.MongoDBAtlas { /// /// A class representing a collection of and their operations. - /// Each in the collection will belong to the same instance of . - /// To get a instance call the GetMongoDBAtlasOrganizations method from an instance of . + /// Each in the collection will belong to the same instance of a parent resource (TODO: add parent resource information). + /// To get a instance call the GetMongoDBAtlasOrganizations method from an instance of the parent resource. /// public partial class MongoDBAtlasOrganizationCollection : ArmCollection, IEnumerable, IAsyncEnumerable { - private readonly ClientDiagnostics _mongoDBAtlasOrganizationOrganizationsClientDiagnostics; - private readonly OrganizationsRestOperations _mongoDBAtlasOrganizationOrganizationsRestClient; + private readonly ClientDiagnostics _organizationsClientDiagnostics; + private readonly Organizations _organizationsRestClient; - /// Initializes a new instance of the class for mocking. + /// Initializes a new instance of MongoDBAtlasOrganizationCollection for mocking. protected MongoDBAtlasOrganizationCollection() { } - /// 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 MongoDBAtlasOrganizationCollection(ArmClient client, ResourceIdentifier id) : base(client, id) { - _mongoDBAtlasOrganizationOrganizationsClientDiagnostics = new ClientDiagnostics("Azure.ResourceManager.MongoDBAtlas", MongoDBAtlasOrganizationResource.ResourceType.Namespace, Diagnostics); - TryGetApiVersion(MongoDBAtlasOrganizationResource.ResourceType, out string mongoDBAtlasOrganizationOrganizationsApiVersion); - _mongoDBAtlasOrganizationOrganizationsRestClient = new OrganizationsRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, mongoDBAtlasOrganizationOrganizationsApiVersion); -#if DEBUG - ValidateResourceId(Id); -#endif + TryGetApiVersion(MongoDBAtlasOrganizationResource.ResourceType, out string mongoDBAtlasOrganizationApiVersion); + _organizationsClientDiagnostics = new ClientDiagnostics("Azure.ResourceManager.MongoDBAtlas", MongoDBAtlasOrganizationResource.ResourceType.Namespace, Diagnostics); + _organizationsRestClient = new Organizations(_organizationsClientDiagnostics, Pipeline, Endpoint, mongoDBAtlasOrganizationApiVersion ?? "2025-06-01"); + ValidateResourceId(id); } + /// + [Conditional("DEBUG")] internal static void ValidateResourceId(ResourceIdentifier id) { if (id.ResourceType != ResourceGroupResource.ResourceType) - throw new ArgumentException(string.Format(CultureInfo.CurrentCulture, "Invalid resource type {0} expected {1}", id.ResourceType, ResourceGroupResource.ResourceType), nameof(id)); + { + throw new ArgumentException(string.Format("Invalid resource type {0} expected {1}", id.ResourceType, ResourceGroupResource.ResourceType), id); + } } - /// - /// Create a OrganizationResource - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/MongoDB.Atlas/organizations/{organizationName} - /// - /// - /// Operation Id - /// OrganizationResource_CreateOrUpdate - /// - /// - /// Default Api Version - /// 2025-06-01 - /// - /// - /// Resource - /// - /// - /// - /// + /// Create a OrganizationResource. /// 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. /// Name of the Organization 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 organizationName, MongoDBAtlasOrganizationData data, CancellationToken cancellationToken = default) { Argument.AssertNotNullOrEmpty(organizationName, nameof(organizationName)); Argument.AssertNotNull(data, nameof(data)); - using var scope = _mongoDBAtlasOrganizationOrganizationsClientDiagnostics.CreateScope("MongoDBAtlasOrganizationCollection.CreateOrUpdate"); + using DiagnosticScope scope = _organizationsClientDiagnostics.CreateScope("MongoDBAtlasOrganizationCollection.CreateOrUpdate"); scope.Start(); try { - var response = await _mongoDBAtlasOrganizationOrganizationsRestClient.CreateOrUpdateAsync(Id.SubscriptionId, Id.ResourceGroupName, organizationName, data, cancellationToken).ConfigureAwait(false); - var operation = new MongoDBAtlasArmOperation(new MongoDBAtlasOrganizationOperationSource(Client), _mongoDBAtlasOrganizationOrganizationsClientDiagnostics, Pipeline, _mongoDBAtlasOrganizationOrganizationsRestClient.CreateCreateOrUpdateRequest(Id.SubscriptionId, Id.ResourceGroupName, organizationName, data).Request, response, OperationFinalStateVia.AzureAsyncOperation); + RequestContext context = new RequestContext + { + CancellationToken = cancellationToken + }; + HttpMessage message = _organizationsRestClient.CreateCreateOrUpdateRequest(Guid.Parse(Id.SubscriptionId), Id.ResourceGroupName, organizationName, MongoDBAtlasOrganizationData.ToRequestContent(data), context); + Response response = await Pipeline.ProcessMessageAsync(message, context).ConfigureAwait(false); + MongoDBAtlasArmOperation operation = new MongoDBAtlasArmOperation( + new MongoDBAtlasOrganizationOperationSource(Client), + _organizationsClientDiagnostics, + Pipeline, + message.Request, + response, + OperationFinalStateVia.AzureAsyncOperation); if (waitUntil == WaitUntil.Completed) + { await operation.WaitForCompletionAsync(cancellationToken).ConfigureAwait(false); + } return operation; } catch (Exception e) @@ -101,46 +97,39 @@ public virtual async Task> Create } } - /// - /// Create a OrganizationResource - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/MongoDB.Atlas/organizations/{organizationName} - /// - /// - /// Operation Id - /// OrganizationResource_CreateOrUpdate - /// - /// - /// Default Api Version - /// 2025-06-01 - /// - /// - /// Resource - /// - /// - /// - /// + /// Create a OrganizationResource. /// 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. /// Name of the Organization 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 organizationName, MongoDBAtlasOrganizationData data, CancellationToken cancellationToken = default) { Argument.AssertNotNullOrEmpty(organizationName, nameof(organizationName)); Argument.AssertNotNull(data, nameof(data)); - using var scope = _mongoDBAtlasOrganizationOrganizationsClientDiagnostics.CreateScope("MongoDBAtlasOrganizationCollection.CreateOrUpdate"); + using DiagnosticScope scope = _organizationsClientDiagnostics.CreateScope("MongoDBAtlasOrganizationCollection.CreateOrUpdate"); scope.Start(); try { - var response = _mongoDBAtlasOrganizationOrganizationsRestClient.CreateOrUpdate(Id.SubscriptionId, Id.ResourceGroupName, organizationName, data, cancellationToken); - var operation = new MongoDBAtlasArmOperation(new MongoDBAtlasOrganizationOperationSource(Client), _mongoDBAtlasOrganizationOrganizationsClientDiagnostics, Pipeline, _mongoDBAtlasOrganizationOrganizationsRestClient.CreateCreateOrUpdateRequest(Id.SubscriptionId, Id.ResourceGroupName, organizationName, data).Request, response, OperationFinalStateVia.AzureAsyncOperation); + RequestContext context = new RequestContext + { + CancellationToken = cancellationToken + }; + HttpMessage message = _organizationsRestClient.CreateCreateOrUpdateRequest(Guid.Parse(Id.SubscriptionId), Id.ResourceGroupName, organizationName, MongoDBAtlasOrganizationData.ToRequestContent(data), context); + Response response = Pipeline.ProcessMessage(message, context); + MongoDBAtlasArmOperation operation = new MongoDBAtlasArmOperation( + new MongoDBAtlasOrganizationOperationSource(Client), + _organizationsClientDiagnostics, + Pipeline, + message.Request, + response, + OperationFinalStateVia.AzureAsyncOperation); if (waitUntil == WaitUntil.Completed) + { operation.WaitForCompletion(cancellationToken); + } return operation; } catch (Exception e) @@ -150,42 +139,30 @@ public virtual ArmOperation CreateOrUpdate(Wai } } - /// - /// Get a OrganizationResource - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/MongoDB.Atlas/organizations/{organizationName} - /// - /// - /// Operation Id - /// OrganizationResource_Get - /// - /// - /// Default Api Version - /// 2025-06-01 - /// - /// - /// Resource - /// - /// - /// - /// + /// Get a OrganizationResource. /// Name of the Organization 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 organizationName, CancellationToken cancellationToken = default) { Argument.AssertNotNullOrEmpty(organizationName, nameof(organizationName)); - using var scope = _mongoDBAtlasOrganizationOrganizationsClientDiagnostics.CreateScope("MongoDBAtlasOrganizationCollection.Get"); + using DiagnosticScope scope = _organizationsClientDiagnostics.CreateScope("MongoDBAtlasOrganizationCollection.Get"); scope.Start(); try { - var response = await _mongoDBAtlasOrganizationOrganizationsRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, organizationName, cancellationToken).ConfigureAwait(false); + RequestContext context = new RequestContext + { + CancellationToken = cancellationToken + }; + HttpMessage message = _organizationsRestClient.CreateGetRequest(Guid.Parse(Id.SubscriptionId), Id.ResourceGroupName, organizationName, context); + Response result = await Pipeline.ProcessMessageAsync(message, context).ConfigureAwait(false); + Response response = Response.FromValue(MongoDBAtlasOrganizationData.FromResponse(result), result); if (response.Value == null) + { throw new RequestFailedException(response.GetRawResponse()); + } return Response.FromValue(new MongoDBAtlasOrganizationResource(Client, response.Value), response.GetRawResponse()); } catch (Exception e) @@ -195,42 +172,30 @@ public virtual async Task> GetAsync(s } } - /// - /// Get a OrganizationResource - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/MongoDB.Atlas/organizations/{organizationName} - /// - /// - /// Operation Id - /// OrganizationResource_Get - /// - /// - /// Default Api Version - /// 2025-06-01 - /// - /// - /// Resource - /// - /// - /// - /// + /// Get a OrganizationResource. /// Name of the Organization 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 organizationName, CancellationToken cancellationToken = default) { Argument.AssertNotNullOrEmpty(organizationName, nameof(organizationName)); - using var scope = _mongoDBAtlasOrganizationOrganizationsClientDiagnostics.CreateScope("MongoDBAtlasOrganizationCollection.Get"); + using DiagnosticScope scope = _organizationsClientDiagnostics.CreateScope("MongoDBAtlasOrganizationCollection.Get"); scope.Start(); try { - var response = _mongoDBAtlasOrganizationOrganizationsRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, organizationName, cancellationToken); + RequestContext context = new RequestContext + { + CancellationToken = cancellationToken + }; + HttpMessage message = _organizationsRestClient.CreateGetRequest(Guid.Parse(Id.SubscriptionId), Id.ResourceGroupName, organizationName, context); + Response result = Pipeline.ProcessMessage(message, context); + Response response = Response.FromValue(MongoDBAtlasOrganizationData.FromResponse(result), result); if (response.Value == null) + { throw new RequestFailedException(response.GetRawResponse()); + } return Response.FromValue(new MongoDBAtlasOrganizationResource(Client, response.Value), response.GetRawResponse()); } catch (Exception e) @@ -240,100 +205,50 @@ public virtual Response Get(string organizatio } } - /// - /// List OrganizationResource resources by resource group - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/MongoDB.Atlas/organizations - /// - /// - /// Operation Id - /// OrganizationResource_ListByResourceGroup - /// - /// - /// Default Api Version - /// 2025-06-01 - /// - /// - /// Resource - /// - /// - /// - /// + /// List OrganizationResource resources by resource group. /// 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) => _mongoDBAtlasOrganizationOrganizationsRestClient.CreateListByResourceGroupRequest(Id.SubscriptionId, Id.ResourceGroupName); - HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _mongoDBAtlasOrganizationOrganizationsRestClient.CreateListByResourceGroupNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName); - return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new MongoDBAtlasOrganizationResource(Client, MongoDBAtlasOrganizationData.DeserializeMongoDBAtlasOrganizationData(e)), _mongoDBAtlasOrganizationOrganizationsClientDiagnostics, Pipeline, "MongoDBAtlasOrganizationCollection.GetAll", "value", "nextLink", cancellationToken); + RequestContext context = new RequestContext + { + CancellationToken = cancellationToken + }; + return new AsyncPageableWrapper(new OrganizationsGetByResourceGroupAsyncCollectionResultOfT(_organizationsRestClient, Guid.Parse(Id.SubscriptionId), Id.ResourceGroupName, context), data => new MongoDBAtlasOrganizationResource(Client, data)); } - /// - /// List OrganizationResource resources by resource group - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/MongoDB.Atlas/organizations - /// - /// - /// Operation Id - /// OrganizationResource_ListByResourceGroup - /// - /// - /// Default Api Version - /// 2025-06-01 - /// - /// - /// Resource - /// - /// - /// - /// + /// List OrganizationResource resources by resource group. /// The cancellation token to use. /// A collection of that may take multiple service requests to iterate over. public virtual Pageable GetAll(CancellationToken cancellationToken = default) { - HttpMessage FirstPageRequest(int? pageSizeHint) => _mongoDBAtlasOrganizationOrganizationsRestClient.CreateListByResourceGroupRequest(Id.SubscriptionId, Id.ResourceGroupName); - HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _mongoDBAtlasOrganizationOrganizationsRestClient.CreateListByResourceGroupNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName); - return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new MongoDBAtlasOrganizationResource(Client, MongoDBAtlasOrganizationData.DeserializeMongoDBAtlasOrganizationData(e)), _mongoDBAtlasOrganizationOrganizationsClientDiagnostics, Pipeline, "MongoDBAtlasOrganizationCollection.GetAll", "value", "nextLink", cancellationToken); + RequestContext context = new RequestContext + { + CancellationToken = cancellationToken + }; + return new PageableWrapper(new OrganizationsGetByResourceGroupCollectionResultOfT(_organizationsRestClient, Guid.Parse(Id.SubscriptionId), Id.ResourceGroupName, context), data => new MongoDBAtlasOrganizationResource(Client, data)); } - /// - /// Checks to see if the resource exists in azure. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/MongoDB.Atlas/organizations/{organizationName} - /// - /// - /// Operation Id - /// OrganizationResource_Get - /// - /// - /// Default Api Version - /// 2025-06-01 - /// - /// - /// Resource - /// - /// - /// - /// + /// Checks to see if the resource exists in azure. /// Name of the Organization 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 organizationName, CancellationToken cancellationToken = default) { Argument.AssertNotNullOrEmpty(organizationName, nameof(organizationName)); - using var scope = _mongoDBAtlasOrganizationOrganizationsClientDiagnostics.CreateScope("MongoDBAtlasOrganizationCollection.Exists"); + using DiagnosticScope scope = _organizationsClientDiagnostics.CreateScope("MongoDBAtlasOrganizationCollection.Exists"); scope.Start(); try { - var response = await _mongoDBAtlasOrganizationOrganizationsRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, organizationName, cancellationToken: cancellationToken).ConfigureAwait(false); + RequestContext context = new RequestContext + { + CancellationToken = cancellationToken + }; + HttpMessage message = _organizationsRestClient.CreateGetRequest(Guid.Parse(Id.SubscriptionId), Id.ResourceGroupName, organizationName, context); + Response result = await Pipeline.ProcessMessageAsync(message, context).ConfigureAwait(false); + Response response = Response.FromValue(MongoDBAtlasOrganizationData.FromResponse(result), result); return Response.FromValue(response.Value != null, response.GetRawResponse()); } catch (Exception e) @@ -343,40 +258,26 @@ public virtual async Task> ExistsAsync(string organizationName, C } } - /// - /// Checks to see if the resource exists in azure. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/MongoDB.Atlas/organizations/{organizationName} - /// - /// - /// Operation Id - /// OrganizationResource_Get - /// - /// - /// Default Api Version - /// 2025-06-01 - /// - /// - /// Resource - /// - /// - /// - /// + /// Checks to see if the resource exists in azure. /// Name of the Organization 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 organizationName, CancellationToken cancellationToken = default) { Argument.AssertNotNullOrEmpty(organizationName, nameof(organizationName)); - using var scope = _mongoDBAtlasOrganizationOrganizationsClientDiagnostics.CreateScope("MongoDBAtlasOrganizationCollection.Exists"); + using DiagnosticScope scope = _organizationsClientDiagnostics.CreateScope("MongoDBAtlasOrganizationCollection.Exists"); scope.Start(); try { - var response = _mongoDBAtlasOrganizationOrganizationsRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, organizationName, cancellationToken: cancellationToken); + RequestContext context = new RequestContext + { + CancellationToken = cancellationToken + }; + HttpMessage message = _organizationsRestClient.CreateGetRequest(Guid.Parse(Id.SubscriptionId), Id.ResourceGroupName, organizationName, context); + Response result = Pipeline.ProcessMessage(message, context); + Response response = Response.FromValue(MongoDBAtlasOrganizationData.FromResponse(result), result); return Response.FromValue(response.Value != null, response.GetRawResponse()); } catch (Exception e) @@ -386,42 +287,30 @@ public virtual Response Exists(string organizationName, CancellationToken } } - /// - /// Tries to get details for this resource from the service. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/MongoDB.Atlas/organizations/{organizationName} - /// - /// - /// Operation Id - /// OrganizationResource_Get - /// - /// - /// Default Api Version - /// 2025-06-01 - /// - /// - /// Resource - /// - /// - /// - /// + /// Tries to get details for this resource from the service. /// Name of the Organization 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 organizationName, CancellationToken cancellationToken = default) { Argument.AssertNotNullOrEmpty(organizationName, nameof(organizationName)); - using var scope = _mongoDBAtlasOrganizationOrganizationsClientDiagnostics.CreateScope("MongoDBAtlasOrganizationCollection.GetIfExists"); + using DiagnosticScope scope = _organizationsClientDiagnostics.CreateScope("MongoDBAtlasOrganizationCollection.GetIfExists"); scope.Start(); try { - var response = await _mongoDBAtlasOrganizationOrganizationsRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, organizationName, cancellationToken: cancellationToken).ConfigureAwait(false); + RequestContext context = new RequestContext + { + CancellationToken = cancellationToken + }; + HttpMessage message = _organizationsRestClient.CreateGetRequest(Guid.Parse(Id.SubscriptionId), Id.ResourceGroupName, organizationName, context); + Response result = await Pipeline.ProcessMessageAsync(message, context).ConfigureAwait(false); + Response response = Response.FromValue(MongoDBAtlasOrganizationData.FromResponse(result), result); if (response.Value == null) + { return new NoValueResponse(response.GetRawResponse()); + } return Response.FromValue(new MongoDBAtlasOrganizationResource(Client, response.Value), response.GetRawResponse()); } catch (Exception e) @@ -431,42 +320,30 @@ public virtual async Task> Ge } } - /// - /// Tries to get details for this resource from the service. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/MongoDB.Atlas/organizations/{organizationName} - /// - /// - /// Operation Id - /// OrganizationResource_Get - /// - /// - /// Default Api Version - /// 2025-06-01 - /// - /// - /// Resource - /// - /// - /// - /// + /// Tries to get details for this resource from the service. /// Name of the Organization 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 organizationName, CancellationToken cancellationToken = default) { Argument.AssertNotNullOrEmpty(organizationName, nameof(organizationName)); - using var scope = _mongoDBAtlasOrganizationOrganizationsClientDiagnostics.CreateScope("MongoDBAtlasOrganizationCollection.GetIfExists"); + using DiagnosticScope scope = _organizationsClientDiagnostics.CreateScope("MongoDBAtlasOrganizationCollection.GetIfExists"); scope.Start(); try { - var response = _mongoDBAtlasOrganizationOrganizationsRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, organizationName, cancellationToken: cancellationToken); + RequestContext context = new RequestContext + { + CancellationToken = cancellationToken + }; + HttpMessage message = _organizationsRestClient.CreateGetRequest(Guid.Parse(Id.SubscriptionId), Id.ResourceGroupName, organizationName, context); + Response result = Pipeline.ProcessMessage(message, context); + Response response = Response.FromValue(MongoDBAtlasOrganizationData.FromResponse(result), result); if (response.Value == null) + { return new NoValueResponse(response.GetRawResponse()); + } return Response.FromValue(new MongoDBAtlasOrganizationResource(Client, response.Value), response.GetRawResponse()); } catch (Exception e) @@ -486,9 +363,10 @@ IEnumerator IEnumerable.GetEnumerator() return GetAll().GetEnumerator(); } + /// The cancellation token to use. IAsyncEnumerator IAsyncEnumerable.GetAsyncEnumerator(CancellationToken cancellationToken) { - return GetAllAsync(cancellationToken: cancellationToken).GetAsyncEnumerator(cancellationToken); + return GetAllAsync(cancellationToken).GetAsyncEnumerator(cancellationToken); } } } diff --git a/sdk/mongodbatlas/Azure.ResourceManager.MongoDBAtlas/src/Generated/MongoDBAtlasOrganizationData.Serialization.cs b/sdk/mongodbatlas/Azure.ResourceManager.MongoDBAtlas/src/Generated/MongoDBAtlasOrganizationData.Serialization.cs index 4372365008f7..ae4d540c3cc5 100644 --- a/sdk/mongodbatlas/Azure.ResourceManager.MongoDBAtlas/src/Generated/MongoDBAtlasOrganizationData.Serialization.cs +++ b/sdk/mongodbatlas/Azure.ResourceManager.MongoDBAtlas/src/Generated/MongoDBAtlasOrganizationData.Serialization.cs @@ -10,16 +10,23 @@ using System.Collections.Generic; using System.Text; using System.Text.Json; +using Azure; using Azure.Core; using Azure.ResourceManager.Models; using Azure.ResourceManager.MongoDBAtlas.Models; namespace Azure.ResourceManager.MongoDBAtlas { - public partial class MongoDBAtlasOrganizationData : IUtf8JsonSerializable, IJsonModel + /// The resource model definition for an Azure Organization. + public partial class MongoDBAtlasOrganizationData : IJsonModel { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + /// Initializes a new instance of for deserialization. + internal MongoDBAtlasOrganizationData() + { + } + /// 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, Model /// The client options for reading and writing models. protected override void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; if (format != "J") { throw new FormatException($"The model {nameof(MongoDBAtlasOrganizationData)} does not support writing '{format}' format."); } - base.JsonModelWriteCore(writer, options); if (Optional.IsDefined(Properties)) { @@ -46,125 +52,146 @@ protected override void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWri if (Optional.IsDefined(Identity)) { writer.WritePropertyName("identity"u8); - ((IJsonModel)Identity).Write(writer, ModelSerializationExtensions.WireV3Options); + ((IJsonModel)Identity).Write(writer, options); } } - MongoDBAtlasOrganizationData IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + /// The JSON reader. + /// The client options for reading and writing models. + MongoDBAtlasOrganizationData IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) => (MongoDBAtlasOrganizationData)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(MongoDBAtlasOrganizationData)} does not support reading '{format}' format."); } - using JsonDocument document = JsonDocument.ParseValue(ref reader); return DeserializeMongoDBAtlasOrganizationData(document.RootElement, options); } - internal static MongoDBAtlasOrganizationData DeserializeMongoDBAtlasOrganizationData(JsonElement element, ModelReaderWriterOptions options = null) + /// The JSON element to deserialize. + /// The client options for reading and writing models. + internal static MongoDBAtlasOrganizationData DeserializeMongoDBAtlasOrganizationData(JsonElement element, ModelReaderWriterOptions options) { - options ??= ModelSerializationExtensions.WireOptions; - if (element.ValueKind == JsonValueKind.Null) { return null; } - MongoDBAtlasOrganizationProperties properties = default; - ManagedServiceIdentity identity = default; - IDictionary tags = default; - AzureLocation location = default; ResourceIdentifier id = default; string name = default; - ResourceType type = default; + ResourceType resourceType = default; SystemData systemData = default; - IDictionary serializedAdditionalRawData = default; - Dictionary rawDataDictionary = new Dictionary(); - foreach (var property in element.EnumerateObject()) + IDictionary additionalBinaryDataProperties = new ChangeTrackingDictionary(); + IDictionary tags = default; + string location = default; + MongoDBAtlasOrganizationProperties properties = default; + ManagedServiceIdentity identity = 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 = MongoDBAtlasOrganizationProperties.DeserializeMongoDBAtlasOrganizationProperties(property.Value, options); + id = new ResourceIdentifier(prop.Value.GetString()); continue; } - if (property.NameEquals("identity"u8)) + if (prop.NameEquals("name"u8)) { - if (property.Value.ValueKind == JsonValueKind.Null) + name = prop.Value.GetString(); + continue; + } + if (prop.NameEquals("type"u8)) + { + if (prop.Value.ValueKind == JsonValueKind.Null) { continue; } - identity = ModelReaderWriter.Read(new BinaryData(Encoding.UTF8.GetBytes(property.Value.GetRawText())), ModelSerializationExtensions.WireV3Options, AzureResourceManagerMongoDBAtlasContext.Default); + resourceType = new ResourceType(prop.Value.GetString()); continue; } - if (property.NameEquals("tags"u8)) + if (prop.NameEquals("systemData"u8)) { - if (property.Value.ValueKind == JsonValueKind.Null) + if (prop.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + systemData = ModelReaderWriter.Read(new BinaryData(Encoding.UTF8.GetBytes(prop.Value.GetRawText())), ModelSerializationExtensions.WireOptions, AzureResourceManagerMongoDBAtlasContext.Default); + continue; + } + if (prop.NameEquals("tags"u8)) + { + 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("location"u8)) + if (prop.NameEquals("location"u8)) { - location = new AzureLocation(property.Value.GetString()); + location = prop.Value.GetString(); continue; } - if (property.NameEquals("id"u8)) + if (prop.NameEquals("properties"u8)) { - id = new ResourceIdentifier(property.Value.GetString()); - continue; - } - if (property.NameEquals("name"u8)) - { - name = property.Value.GetString(); - continue; - } - if (property.NameEquals("type"u8)) - { - type = new ResourceType(property.Value.GetString()); + if (prop.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + properties = MongoDBAtlasOrganizationProperties.DeserializeMongoDBAtlasOrganizationProperties(prop.Value, options); continue; } - if (property.NameEquals("systemData"u8)) + if (prop.NameEquals("identity"u8)) { - if (property.Value.ValueKind == JsonValueKind.Null) + if (prop.Value.ValueKind == JsonValueKind.Null) { continue; } - systemData = ModelReaderWriter.Read(new BinaryData(Encoding.UTF8.GetBytes(property.Value.GetRawText())), ModelSerializationExtensions.WireOptions, AzureResourceManagerMongoDBAtlasContext.Default); + identity = ModelReaderWriter.Read(new BinaryData(Encoding.UTF8.GetBytes(prop.Value.GetRawText())), ModelSerializationExtensions.WireOptions, AzureResourceManagerMongoDBAtlasContext.Default); 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 MongoDBAtlasOrganizationData( id, name, - type, + resourceType, systemData, + additionalBinaryDataProperties, tags ?? new ChangeTrackingDictionary(), location, properties, - identity, - serializedAdditionalRawData); + identity); } - BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) - { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + /// The client options for reading and writing models. + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) => PersistableModelWriteCore(options); + /// The client options for reading and writing models. + protected virtual BinaryData PersistableModelWriteCore(ModelReaderWriterOptions options) + { + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; switch (format) { case "J": @@ -174,15 +201,20 @@ BinaryData IPersistableModel.Write(ModelReaderWrit } } - MongoDBAtlasOrganizationData 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. + MongoDBAtlasOrganizationData IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) => (MongoDBAtlasOrganizationData)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)) { - using JsonDocument document = JsonDocument.Parse(data, ModelSerializationExtensions.JsonDocumentOptions); return DeserializeMongoDBAtlasOrganizationData(document.RootElement, options); } default: @@ -190,6 +222,27 @@ MongoDBAtlasOrganizationData IPersistableModel.Cre } } + /// The client options for reading and writing models. string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + + /// The to serialize into . + internal static RequestContent ToRequestContent(MongoDBAtlasOrganizationData mongoDBAtlasOrganizationData) + { + if (mongoDBAtlasOrganizationData == null) + { + return null; + } + Utf8JsonRequestContent content = new Utf8JsonRequestContent(); + content.JsonWriter.WriteObjectValue(mongoDBAtlasOrganizationData, ModelSerializationExtensions.WireOptions); + return content; + } + + /// The to deserialize the from. + internal static MongoDBAtlasOrganizationData FromResponse(Response result) + { + using Response response = result; + using JsonDocument document = JsonDocument.Parse(response.Content); + return DeserializeMongoDBAtlasOrganizationData(document.RootElement, ModelSerializationExtensions.WireOptions); + } } } diff --git a/sdk/mongodbatlas/Azure.ResourceManager.MongoDBAtlas/src/Generated/MongoDBAtlasOrganizationData.cs b/sdk/mongodbatlas/Azure.ResourceManager.MongoDBAtlas/src/Generated/MongoDBAtlasOrganizationData.cs index 1c16d79420dc..1964e0aef7b4 100644 --- a/sdk/mongodbatlas/Azure.ResourceManager.MongoDBAtlas/src/Generated/MongoDBAtlasOrganizationData.cs +++ b/sdk/mongodbatlas/Azure.ResourceManager.MongoDBAtlas/src/Generated/MongoDBAtlasOrganizationData.cs @@ -13,74 +13,41 @@ namespace Azure.ResourceManager.MongoDBAtlas { - /// - /// A class representing the MongoDBAtlasOrganization data model. - /// The resource model definition for an Azure Organization - /// + /// The resource model definition for an Azure Organization. public partial class MongoDBAtlasOrganizationData : TrackedResourceData { - /// - /// Keeps track of any properties unknown to the library. - /// - /// To assign an object to the value of this property use . - /// - /// - /// To assign an already formatted json string to this property use . - /// - /// - /// Examples: - /// - /// - /// BinaryData.FromObjectAsJson("foo") - /// Creates a payload of "foo". - /// - /// - /// BinaryData.FromString("\"foo\"") - /// Creates a payload of "foo". - /// - /// - /// BinaryData.FromObjectAsJson(new { key = "value" }) - /// Creates a payload of { "key": "value" }. - /// - /// - /// BinaryData.FromString("{\"key\": \"value\"}") - /// Creates a payload of { "key": "value" }. - /// - /// - /// - /// - private IDictionary _serializedAdditionalRawData; + /// Keeps track of any properties unknown to the library. + private protected readonly IDictionary _additionalBinaryDataProperties; /// Initializes a new instance of . - /// The location. - public MongoDBAtlasOrganizationData(AzureLocation location) : base(location) + /// The geo-location where the resource lives. + /// is null. + public MongoDBAtlasOrganizationData(string location) : base(location) { + Argument.AssertNotNull(location, nameof(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. /// The managed service identities assigned to this resource. - /// Keeps track of any properties unknown to the library. - internal MongoDBAtlasOrganizationData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, IDictionary tags, AzureLocation location, MongoDBAtlasOrganizationProperties properties, ManagedServiceIdentity identity, IDictionary serializedAdditionalRawData) : base(id, name, resourceType, systemData, tags, location) + internal MongoDBAtlasOrganizationData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, IDictionary additionalBinaryDataProperties, IDictionary tags, string location, MongoDBAtlasOrganizationProperties properties, ManagedServiceIdentity identity) : base(id, name, resourceType, systemData, tags, location) { + _additionalBinaryDataProperties = additionalBinaryDataProperties; Properties = properties; Identity = identity; - _serializedAdditionalRawData = serializedAdditionalRawData; - } - - /// Initializes a new instance of for deserialization. - internal MongoDBAtlasOrganizationData() - { } /// The resource-specific properties for this resource. public MongoDBAtlasOrganizationProperties Properties { get; set; } + /// The managed service identities assigned to this resource. public ManagedServiceIdentity Identity { get; set; } } diff --git a/sdk/mongodbatlas/Azure.ResourceManager.MongoDBAtlas/src/Generated/MongoDBAtlasOrganizationResource.Serialization.cs b/sdk/mongodbatlas/Azure.ResourceManager.MongoDBAtlas/src/Generated/MongoDBAtlasOrganizationResource.Serialization.cs index 5e9862c11837..3c866b19e79f 100644 --- a/sdk/mongodbatlas/Azure.ResourceManager.MongoDBAtlas/src/Generated/MongoDBAtlasOrganizationResource.Serialization.cs +++ b/sdk/mongodbatlas/Azure.ResourceManager.MongoDBAtlas/src/Generated/MongoDBAtlasOrganizationResource.Serialization.cs @@ -11,19 +11,29 @@ namespace Azure.ResourceManager.MongoDBAtlas { + /// public partial class MongoDBAtlasOrganizationResource : IJsonModel { - private static MongoDBAtlasOrganizationData s_dataDeserializationInstance; - private static MongoDBAtlasOrganizationData DataDeserializationInstance => s_dataDeserializationInstance ??= new(); + private static IJsonModel s_dataDeserializationInstance; + private static IJsonModel DataDeserializationInstance => s_dataDeserializationInstance ??= new MongoDBAtlasOrganizationData(); + + /// 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); - MongoDBAtlasOrganizationData 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. + MongoDBAtlasOrganizationData 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, AzureResourceManagerMongoDBAtlasContext.Default); + /// The binary data to be processed. + /// The client options for reading and writing models. MongoDBAtlasOrganizationData IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) => ModelReaderWriter.Read(data, options, AzureResourceManagerMongoDBAtlasContext.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/mongodbatlas/Azure.ResourceManager.MongoDBAtlas/src/Generated/MongoDBAtlasOrganizationResource.cs b/sdk/mongodbatlas/Azure.ResourceManager.MongoDBAtlas/src/Generated/MongoDBAtlasOrganizationResource.cs index 8b7be2593a8a..a5662c23305e 100644 --- a/sdk/mongodbatlas/Azure.ResourceManager.MongoDBAtlas/src/Generated/MongoDBAtlasOrganizationResource.cs +++ b/sdk/mongodbatlas/Azure.ResourceManager.MongoDBAtlas/src/Generated/MongoDBAtlasOrganizationResource.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.MongoDBAtlas.Models; using Azure.ResourceManager.Resources; namespace Azure.ResourceManager.MongoDBAtlas { /// - /// A Class representing a MongoDBAtlasOrganization 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 GetMongoDBAtlasOrganizationResource method. - /// Otherwise you can get one from its parent resource using the GetMongoDBAtlasOrganization method. + /// A class representing a MongoDBAtlasOrganization 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 GetMongoDBAtlasOrganizations method. /// public partial class MongoDBAtlasOrganizationResource : ArmResource { - /// Generate the resource identifier of a instance. - /// The subscriptionId. - /// The resourceGroupName. - /// The organizationName. - public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string organizationName) - { - var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/MongoDB.Atlas/organizations/{organizationName}"; - return new ResourceIdentifier(resourceId); - } - - private readonly ClientDiagnostics _mongoDBAtlasOrganizationOrganizationsClientDiagnostics; - private readonly OrganizationsRestOperations _mongoDBAtlasOrganizationOrganizationsRestClient; + private readonly ClientDiagnostics _organizationsClientDiagnostics; + private readonly Organizations _organizationsRestClient; private readonly MongoDBAtlasOrganizationData _data; - /// Gets the resource type for the operations. public static readonly ResourceType ResourceType = "MongoDB.Atlas/organizations"; - /// Initializes a new instance of the class for mocking. + /// Initializes a new instance of MongoDBAtlasOrganizationResource for mocking. protected MongoDBAtlasOrganizationResource() { } - /// 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 MongoDBAtlasOrganizationResource(ArmClient client, MongoDBAtlasOrganizationData data) : this(client, data.Id) @@ -56,71 +46,72 @@ internal MongoDBAtlasOrganizationResource(ArmClient client, MongoDBAtlasOrganiza _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 MongoDBAtlasOrganizationResource(ArmClient client, ResourceIdentifier id) : base(client, id) { - _mongoDBAtlasOrganizationOrganizationsClientDiagnostics = new ClientDiagnostics("Azure.ResourceManager.MongoDBAtlas", ResourceType.Namespace, Diagnostics); - TryGetApiVersion(ResourceType, out string mongoDBAtlasOrganizationOrganizationsApiVersion); - _mongoDBAtlasOrganizationOrganizationsRestClient = new OrganizationsRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, mongoDBAtlasOrganizationOrganizationsApiVersion); -#if DEBUG - ValidateResourceId(Id); -#endif + TryGetApiVersion(ResourceType, out string mongoDBAtlasOrganizationApiVersion); + _organizationsClientDiagnostics = new ClientDiagnostics("Azure.ResourceManager.MongoDBAtlas", ResourceType.Namespace, Diagnostics); + _organizationsRestClient = new Organizations(_organizationsClientDiagnostics, Pipeline, Endpoint, mongoDBAtlasOrganizationApiVersion ?? "2025-06-01"); + ValidateResourceId(id); } /// Gets whether or not the current instance has data. public virtual bool HasData { get; } /// Gets the data representing this Feature. - /// Throws if there is no data loaded in the current instance. public virtual MongoDBAtlasOrganizationData 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 organizationName. + public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string organizationName) + { + string resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/MongoDB.Atlas/organizations/{organizationName}"; + return new ResourceIdentifier(resourceId); + } + + /// + [Conditional("DEBUG")] internal static void ValidateResourceId(ResourceIdentifier id) { if (id.ResourceType != ResourceType) - throw new ArgumentException(string.Format(CultureInfo.CurrentCulture, "Invalid resource type {0} expected {1}", id.ResourceType, ResourceType), nameof(id)); + { + throw new ArgumentException(string.Format("Invalid resource type {0} expected {1}", id.ResourceType, ResourceType), id); + } } - /// - /// Get a OrganizationResource - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/MongoDB.Atlas/organizations/{organizationName} - /// - /// - /// Operation Id - /// OrganizationResource_Get - /// - /// - /// Default Api Version - /// 2025-06-01 - /// - /// - /// Resource - /// - /// - /// - /// + /// Get a OrganizationResource. /// The cancellation token to use. public virtual async Task> GetAsync(CancellationToken cancellationToken = default) { - using var scope = _mongoDBAtlasOrganizationOrganizationsClientDiagnostics.CreateScope("MongoDBAtlasOrganizationResource.Get"); + using DiagnosticScope scope = _organizationsClientDiagnostics.CreateScope("MongoDBAtlasOrganizationResource.Get"); scope.Start(); try { - var response = await _mongoDBAtlasOrganizationOrganizationsRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, cancellationToken).ConfigureAwait(false); + RequestContext context = new RequestContext + { + CancellationToken = cancellationToken + }; + HttpMessage message = _organizationsRestClient.CreateGetRequest(Guid.Parse(Id.SubscriptionId), Id.ResourceGroupName, Id.Name, context); + Response result = await Pipeline.ProcessMessageAsync(message, context).ConfigureAwait(false); + Response response = Response.FromValue(MongoDBAtlasOrganizationData.FromResponse(result), result); if (response.Value == null) + { throw new RequestFailedException(response.GetRawResponse()); + } return Response.FromValue(new MongoDBAtlasOrganizationResource(Client, response.Value), response.GetRawResponse()); } catch (Exception e) @@ -130,37 +121,25 @@ public virtual async Task> GetAsync(C } } - /// - /// Get a OrganizationResource - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/MongoDB.Atlas/organizations/{organizationName} - /// - /// - /// Operation Id - /// OrganizationResource_Get - /// - /// - /// Default Api Version - /// 2025-06-01 - /// - /// - /// Resource - /// - /// - /// - /// + /// Get a OrganizationResource. /// The cancellation token to use. public virtual Response Get(CancellationToken cancellationToken = default) { - using var scope = _mongoDBAtlasOrganizationOrganizationsClientDiagnostics.CreateScope("MongoDBAtlasOrganizationResource.Get"); + using DiagnosticScope scope = _organizationsClientDiagnostics.CreateScope("MongoDBAtlasOrganizationResource.Get"); scope.Start(); try { - var response = _mongoDBAtlasOrganizationOrganizationsRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, cancellationToken); + RequestContext context = new RequestContext + { + CancellationToken = cancellationToken + }; + HttpMessage message = _organizationsRestClient.CreateGetRequest(Guid.Parse(Id.SubscriptionId), Id.ResourceGroupName, Id.Name, context); + Response result = Pipeline.ProcessMessage(message, context); + Response response = Response.FromValue(MongoDBAtlasOrganizationData.FromResponse(result), result); if (response.Value == null) + { throw new RequestFailedException(response.GetRawResponse()); + } return Response.FromValue(new MongoDBAtlasOrganizationResource(Client, response.Value), response.GetRawResponse()); } catch (Exception e) @@ -170,39 +149,36 @@ public virtual Response Get(CancellationToken } } - /// - /// Delete a OrganizationResource - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/MongoDB.Atlas/organizations/{organizationName} - /// - /// - /// Operation Id - /// OrganizationResource_Delete - /// - /// - /// Default Api Version - /// 2025-06-01 - /// - /// - /// Resource - /// - /// - /// - /// + /// Update a OrganizationResource. /// 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(WaitUntil waitUntil, MongoDBAtlasOrganizationPatch patch, CancellationToken cancellationToken = default) { - using var scope = _mongoDBAtlasOrganizationOrganizationsClientDiagnostics.CreateScope("MongoDBAtlasOrganizationResource.Delete"); + Argument.AssertNotNull(patch, nameof(patch)); + + using DiagnosticScope scope = _organizationsClientDiagnostics.CreateScope("MongoDBAtlasOrganizationResource.Update"); scope.Start(); try { - var response = await _mongoDBAtlasOrganizationOrganizationsRestClient.DeleteAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, cancellationToken).ConfigureAwait(false); - var operation = new MongoDBAtlasArmOperation(_mongoDBAtlasOrganizationOrganizationsClientDiagnostics, Pipeline, _mongoDBAtlasOrganizationOrganizationsRestClient.CreateDeleteRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name).Request, response, OperationFinalStateVia.Location); + RequestContext context = new RequestContext + { + CancellationToken = cancellationToken + }; + HttpMessage message = _organizationsRestClient.CreateUpdateRequest(Guid.Parse(Id.SubscriptionId), Id.ResourceGroupName, Id.Name, MongoDBAtlasOrganizationPatch.ToRequestContent(patch), context); + Response response = await Pipeline.ProcessMessageAsync(message, context).ConfigureAwait(false); + MongoDBAtlasArmOperation operation = new MongoDBAtlasArmOperation( + new MongoDBAtlasOrganizationOperationSource(Client), + _organizationsClientDiagnostics, + Pipeline, + message.Request, + response, + OperationFinalStateVia.Location); if (waitUntil == WaitUntil.Completed) - await operation.WaitForCompletionResponseAsync(cancellationToken).ConfigureAwait(false); + { + await operation.WaitForCompletionAsync(cancellationToken).ConfigureAwait(false); + } return operation; } catch (Exception e) @@ -212,39 +188,36 @@ public virtual async Task DeleteAsync(WaitUntil waitUntil, Cancell } } - /// - /// Delete a OrganizationResource - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/MongoDB.Atlas/organizations/{organizationName} - /// - /// - /// Operation Id - /// OrganizationResource_Delete - /// - /// - /// Default Api Version - /// 2025-06-01 - /// - /// - /// Resource - /// - /// - /// - /// + /// Update a OrganizationResource. /// 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 ArmOperation Update(WaitUntil waitUntil, MongoDBAtlasOrganizationPatch patch, CancellationToken cancellationToken = default) { - using var scope = _mongoDBAtlasOrganizationOrganizationsClientDiagnostics.CreateScope("MongoDBAtlasOrganizationResource.Delete"); + Argument.AssertNotNull(patch, nameof(patch)); + + using DiagnosticScope scope = _organizationsClientDiagnostics.CreateScope("MongoDBAtlasOrganizationResource.Update"); scope.Start(); try { - var response = _mongoDBAtlasOrganizationOrganizationsRestClient.Delete(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, cancellationToken); - var operation = new MongoDBAtlasArmOperation(_mongoDBAtlasOrganizationOrganizationsClientDiagnostics, Pipeline, _mongoDBAtlasOrganizationOrganizationsRestClient.CreateDeleteRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name).Request, response, OperationFinalStateVia.Location); + RequestContext context = new RequestContext + { + CancellationToken = cancellationToken + }; + HttpMessage message = _organizationsRestClient.CreateUpdateRequest(Guid.Parse(Id.SubscriptionId), Id.ResourceGroupName, Id.Name, MongoDBAtlasOrganizationPatch.ToRequestContent(patch), context); + Response response = Pipeline.ProcessMessage(message, context); + MongoDBAtlasArmOperation operation = new MongoDBAtlasArmOperation( + new MongoDBAtlasOrganizationOperationSource(Client), + _organizationsClientDiagnostics, + Pipeline, + message.Request, + response, + OperationFinalStateVia.Location); if (waitUntil == WaitUntil.Completed) - operation.WaitForCompletionResponse(cancellationToken); + { + operation.WaitForCompletion(cancellationToken); + } return operation; } catch (Exception e) @@ -254,43 +227,26 @@ public virtual ArmOperation Delete(WaitUntil waitUntil, CancellationToken cancel } } - /// - /// Update a OrganizationResource - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/MongoDB.Atlas/organizations/{organizationName} - /// - /// - /// Operation Id - /// OrganizationResource_Update - /// - /// - /// Default Api Version - /// 2025-06-01 - /// - /// - /// Resource - /// - /// - /// - /// + /// Delete a OrganizationResource. /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. - /// The resource properties to be updated. /// The cancellation token to use. - /// is null. - public virtual async Task> UpdateAsync(WaitUntil waitUntil, MongoDBAtlasOrganizationPatch patch, CancellationToken cancellationToken = default) + public virtual async Task DeleteAsync(WaitUntil waitUntil, CancellationToken cancellationToken = default) { - Argument.AssertNotNull(patch, nameof(patch)); - - using var scope = _mongoDBAtlasOrganizationOrganizationsClientDiagnostics.CreateScope("MongoDBAtlasOrganizationResource.Update"); + using DiagnosticScope scope = _organizationsClientDiagnostics.CreateScope("MongoDBAtlasOrganizationResource.Delete"); scope.Start(); try { - var response = await _mongoDBAtlasOrganizationOrganizationsRestClient.UpdateAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, patch, cancellationToken).ConfigureAwait(false); - var operation = new MongoDBAtlasArmOperation(new MongoDBAtlasOrganizationOperationSource(Client), _mongoDBAtlasOrganizationOrganizationsClientDiagnostics, Pipeline, _mongoDBAtlasOrganizationOrganizationsRestClient.CreateUpdateRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, patch).Request, response, OperationFinalStateVia.Location); + RequestContext context = new RequestContext + { + CancellationToken = cancellationToken + }; + HttpMessage message = _organizationsRestClient.CreateDeleteRequest(Guid.Parse(Id.SubscriptionId), Id.ResourceGroupName, Id.Name, context); + Response response = await Pipeline.ProcessMessageAsync(message, context).ConfigureAwait(false); + MongoDBAtlasArmOperation operation = new MongoDBAtlasArmOperation(_organizationsClientDiagnostics, Pipeline, message.Request, response, OperationFinalStateVia.Location); if (waitUntil == WaitUntil.Completed) - await operation.WaitForCompletionAsync(cancellationToken).ConfigureAwait(false); + { + await operation.WaitForCompletionResponseAsync(cancellationToken).ConfigureAwait(false); + } return operation; } catch (Exception e) @@ -300,43 +256,26 @@ public virtual async Task> Update } } - /// - /// Update a OrganizationResource - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/MongoDB.Atlas/organizations/{organizationName} - /// - /// - /// Operation Id - /// OrganizationResource_Update - /// - /// - /// Default Api Version - /// 2025-06-01 - /// - /// - /// Resource - /// - /// - /// - /// + /// Delete a OrganizationResource. /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. - /// The resource properties to be updated. /// The cancellation token to use. - /// is null. - public virtual ArmOperation Update(WaitUntil waitUntil, MongoDBAtlasOrganizationPatch patch, CancellationToken cancellationToken = default) + public virtual ArmOperation Delete(WaitUntil waitUntil, CancellationToken cancellationToken = default) { - Argument.AssertNotNull(patch, nameof(patch)); - - using var scope = _mongoDBAtlasOrganizationOrganizationsClientDiagnostics.CreateScope("MongoDBAtlasOrganizationResource.Update"); + using DiagnosticScope scope = _organizationsClientDiagnostics.CreateScope("MongoDBAtlasOrganizationResource.Delete"); scope.Start(); try { - var response = _mongoDBAtlasOrganizationOrganizationsRestClient.Update(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, patch, cancellationToken); - var operation = new MongoDBAtlasArmOperation(new MongoDBAtlasOrganizationOperationSource(Client), _mongoDBAtlasOrganizationOrganizationsClientDiagnostics, Pipeline, _mongoDBAtlasOrganizationOrganizationsRestClient.CreateUpdateRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, patch).Request, response, OperationFinalStateVia.Location); + RequestContext context = new RequestContext + { + CancellationToken = cancellationToken + }; + HttpMessage message = _organizationsRestClient.CreateDeleteRequest(Guid.Parse(Id.SubscriptionId), Id.ResourceGroupName, Id.Name, context); + Response response = Pipeline.ProcessMessage(message, context); + MongoDBAtlasArmOperation operation = new MongoDBAtlasArmOperation(_organizationsClientDiagnostics, Pipeline, message.Request, response, OperationFinalStateVia.Location); if (waitUntil == WaitUntil.Completed) - operation.WaitForCompletion(cancellationToken); + { + operation.WaitForCompletionResponse(cancellationToken); + } return operation; } catch (Exception e) @@ -346,27 +285,7 @@ public virtual ArmOperation Update(WaitUntil w } } - /// - /// Add a tag to the current resource. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/MongoDB.Atlas/organizations/{organizationName} - /// - /// - /// Operation Id - /// OrganizationResource_Get - /// - /// - /// Default Api Version - /// 2025-06-01 - /// - /// - /// Resource - /// - /// - /// - /// + /// Add a tag to the current resource. /// The key for the tag. /// The value for the tag. /// The cancellation token to use. @@ -376,28 +295,34 @@ public virtual async Task> AddTagAsyn Argument.AssertNotNull(key, nameof(key)); Argument.AssertNotNull(value, nameof(value)); - using var scope = _mongoDBAtlasOrganizationOrganizationsClientDiagnostics.CreateScope("MongoDBAtlasOrganizationResource.AddTag"); + using DiagnosticScope scope = _organizationsClientDiagnostics.CreateScope("MongoDBAtlasOrganizationResource.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 _mongoDBAtlasOrganizationOrganizationsRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, cancellationToken).ConfigureAwait(false); - return Response.FromValue(new MongoDBAtlasOrganizationResource(Client, originalResponse.Value), originalResponse.GetRawResponse()); + await GetTagResource().CreateOrUpdateAsync(WaitUntil.Completed, originalTags.Value.Data, cancellationToken).ConfigureAwait(false); + RequestContext context = new RequestContext + { + CancellationToken = cancellationToken + }; + HttpMessage message = _organizationsRestClient.CreateGetRequest(Guid.Parse(Id.SubscriptionId), Id.ResourceGroupName, Id.Name, context); + Response result = await Pipeline.ProcessMessageAsync(message, context).ConfigureAwait(false); + Response response = Response.FromValue(MongoDBAtlasOrganizationData.FromResponse(result), result); + return Response.FromValue(new MongoDBAtlasOrganizationResource(Client, response.Value), response.GetRawResponse()); } else { - var current = (await GetAsync(cancellationToken: cancellationToken).ConfigureAwait(false)).Value.Data; - var patch = new MongoDBAtlasOrganizationPatch(); - foreach (var tag in current.Tags) + MongoDBAtlasOrganizationData current = (await GetAsync(cancellationToken).ConfigureAwait(false)).Value.Data; + MongoDBAtlasOrganizationPatch patch = new MongoDBAtlasOrganizationPatch(); + foreach (KeyValuePair tag in current.Tags) { patch.Tags.Add(tag); } patch.Tags[key] = value; - var result = await UpdateAsync(WaitUntil.Completed, patch, cancellationToken: cancellationToken).ConfigureAwait(false); + ArmOperation result = await UpdateAsync(WaitUntil.Completed, patch, cancellationToken).ConfigureAwait(false); return Response.FromValue(result.Value, result.GetRawResponse()); } } @@ -408,27 +333,7 @@ public virtual async Task> AddTagAsyn } } - /// - /// Add a tag to the current resource. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/MongoDB.Atlas/organizations/{organizationName} - /// - /// - /// Operation Id - /// OrganizationResource_Get - /// - /// - /// Default Api Version - /// 2025-06-01 - /// - /// - /// Resource - /// - /// - /// - /// + /// Add a tag to the current resource. /// The key for the tag. /// The value for the tag. /// The cancellation token to use. @@ -438,28 +343,34 @@ public virtual Response AddTag(string key, str Argument.AssertNotNull(key, nameof(key)); Argument.AssertNotNull(value, nameof(value)); - using var scope = _mongoDBAtlasOrganizationOrganizationsClientDiagnostics.CreateScope("MongoDBAtlasOrganizationResource.AddTag"); + using DiagnosticScope scope = _organizationsClientDiagnostics.CreateScope("MongoDBAtlasOrganizationResource.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 = _mongoDBAtlasOrganizationOrganizationsRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, cancellationToken); - return Response.FromValue(new MongoDBAtlasOrganizationResource(Client, originalResponse.Value), originalResponse.GetRawResponse()); + GetTagResource().CreateOrUpdate(WaitUntil.Completed, originalTags.Value.Data, cancellationToken); + RequestContext context = new RequestContext + { + CancellationToken = cancellationToken + }; + HttpMessage message = _organizationsRestClient.CreateGetRequest(Guid.Parse(Id.SubscriptionId), Id.ResourceGroupName, Id.Name, context); + Response result = Pipeline.ProcessMessage(message, context); + Response response = Response.FromValue(MongoDBAtlasOrganizationData.FromResponse(result), result); + return Response.FromValue(new MongoDBAtlasOrganizationResource(Client, response.Value), response.GetRawResponse()); } else { - var current = Get(cancellationToken: cancellationToken).Value.Data; - var patch = new MongoDBAtlasOrganizationPatch(); - foreach (var tag in current.Tags) + MongoDBAtlasOrganizationData current = Get(cancellationToken).Value.Data; + MongoDBAtlasOrganizationPatch patch = new MongoDBAtlasOrganizationPatch(); + foreach (KeyValuePair tag in current.Tags) { patch.Tags.Add(tag); } patch.Tags[key] = value; - var result = Update(WaitUntil.Completed, patch, cancellationToken: cancellationToken); + ArmOperation result = Update(WaitUntil.Completed, patch, cancellationToken); return Response.FromValue(result.Value, result.GetRawResponse()); } } @@ -470,53 +381,39 @@ public virtual Response AddTag(string key, str } } - /// - /// Replace the tags on the resource with the given set. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/MongoDB.Atlas/organizations/{organizationName} - /// - /// - /// Operation Id - /// OrganizationResource_Get - /// - /// - /// Default Api Version - /// 2025-06-01 - /// - /// - /// Resource - /// - /// - /// - /// - /// The set of tags to use as replacement. + /// Replace the tags on the resource with the given set. + /// The tags to set on the resource. /// The cancellation token to use. /// is null. public virtual async Task> SetTagsAsync(IDictionary tags, CancellationToken cancellationToken = default) { Argument.AssertNotNull(tags, nameof(tags)); - using var scope = _mongoDBAtlasOrganizationOrganizationsClientDiagnostics.CreateScope("MongoDBAtlasOrganizationResource.SetTags"); + using DiagnosticScope scope = _organizationsClientDiagnostics.CreateScope("MongoDBAtlasOrganizationResource.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 _mongoDBAtlasOrganizationOrganizationsRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, cancellationToken).ConfigureAwait(false); - return Response.FromValue(new MongoDBAtlasOrganizationResource(Client, originalResponse.Value), originalResponse.GetRawResponse()); + await GetTagResource().CreateOrUpdateAsync(WaitUntil.Completed, originalTags.Value.Data, cancellationToken).ConfigureAwait(false); + RequestContext context = new RequestContext + { + CancellationToken = cancellationToken + }; + HttpMessage message = _organizationsRestClient.CreateGetRequest(Guid.Parse(Id.SubscriptionId), Id.ResourceGroupName, Id.Name, context); + Response result = await Pipeline.ProcessMessageAsync(message, context).ConfigureAwait(false); + Response response = Response.FromValue(MongoDBAtlasOrganizationData.FromResponse(result), result); + return Response.FromValue(new MongoDBAtlasOrganizationResource(Client, response.Value), response.GetRawResponse()); } else { - var current = (await GetAsync(cancellationToken: cancellationToken).ConfigureAwait(false)).Value.Data; - var patch = new MongoDBAtlasOrganizationPatch(); + MongoDBAtlasOrganizationData current = (await GetAsync(cancellationToken).ConfigureAwait(false)).Value.Data; + MongoDBAtlasOrganizationPatch patch = new MongoDBAtlasOrganizationPatch(); patch.Tags.ReplaceWith(tags); - var result = await UpdateAsync(WaitUntil.Completed, patch, cancellationToken: cancellationToken).ConfigureAwait(false); + ArmOperation result = await UpdateAsync(WaitUntil.Completed, patch, cancellationToken).ConfigureAwait(false); return Response.FromValue(result.Value, result.GetRawResponse()); } } @@ -527,53 +424,39 @@ public virtual async Task> SetTagsAsy } } - /// - /// Replace the tags on the resource with the given set. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/MongoDB.Atlas/organizations/{organizationName} - /// - /// - /// Operation Id - /// OrganizationResource_Get - /// - /// - /// Default Api Version - /// 2025-06-01 - /// - /// - /// Resource - /// - /// - /// - /// - /// The set of tags to use as replacement. + /// Replace the tags on the resource with the given set. + /// The tags to set on the resource. /// The cancellation token to use. /// is null. public virtual Response SetTags(IDictionary tags, CancellationToken cancellationToken = default) { Argument.AssertNotNull(tags, nameof(tags)); - using var scope = _mongoDBAtlasOrganizationOrganizationsClientDiagnostics.CreateScope("MongoDBAtlasOrganizationResource.SetTags"); + using DiagnosticScope scope = _organizationsClientDiagnostics.CreateScope("MongoDBAtlasOrganizationResource.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 = _mongoDBAtlasOrganizationOrganizationsRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, cancellationToken); - return Response.FromValue(new MongoDBAtlasOrganizationResource(Client, originalResponse.Value), originalResponse.GetRawResponse()); + GetTagResource().CreateOrUpdate(WaitUntil.Completed, originalTags.Value.Data, cancellationToken); + RequestContext context = new RequestContext + { + CancellationToken = cancellationToken + }; + HttpMessage message = _organizationsRestClient.CreateGetRequest(Guid.Parse(Id.SubscriptionId), Id.ResourceGroupName, Id.Name, context); + Response result = Pipeline.ProcessMessage(message, context); + Response response = Response.FromValue(MongoDBAtlasOrganizationData.FromResponse(result), result); + return Response.FromValue(new MongoDBAtlasOrganizationResource(Client, response.Value), response.GetRawResponse()); } else { - var current = Get(cancellationToken: cancellationToken).Value.Data; - var patch = new MongoDBAtlasOrganizationPatch(); + MongoDBAtlasOrganizationData current = Get(cancellationToken).Value.Data; + MongoDBAtlasOrganizationPatch patch = new MongoDBAtlasOrganizationPatch(); patch.Tags.ReplaceWith(tags); - var result = Update(WaitUntil.Completed, patch, cancellationToken: cancellationToken); + ArmOperation result = Update(WaitUntil.Completed, patch, cancellationToken); return Response.FromValue(result.Value, result.GetRawResponse()); } } @@ -584,27 +467,7 @@ public virtual Response SetTags(IDictionary - /// Removes a tag by key from the resource. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/MongoDB.Atlas/organizations/{organizationName} - /// - /// - /// Operation Id - /// OrganizationResource_Get - /// - /// - /// Default Api Version - /// 2025-06-01 - /// - /// - /// Resource - /// - /// - /// - /// + /// Removes a tag by key from the resource. /// The key for the tag. /// The cancellation token to use. /// is null. @@ -612,28 +475,34 @@ public virtual async Task> RemoveTagA { Argument.AssertNotNull(key, nameof(key)); - using var scope = _mongoDBAtlasOrganizationOrganizationsClientDiagnostics.CreateScope("MongoDBAtlasOrganizationResource.RemoveTag"); + using DiagnosticScope scope = _organizationsClientDiagnostics.CreateScope("MongoDBAtlasOrganizationResource.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 _mongoDBAtlasOrganizationOrganizationsRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, cancellationToken).ConfigureAwait(false); - return Response.FromValue(new MongoDBAtlasOrganizationResource(Client, originalResponse.Value), originalResponse.GetRawResponse()); + await GetTagResource().CreateOrUpdateAsync(WaitUntil.Completed, originalTags.Value.Data, cancellationToken).ConfigureAwait(false); + RequestContext context = new RequestContext + { + CancellationToken = cancellationToken + }; + HttpMessage message = _organizationsRestClient.CreateGetRequest(Guid.Parse(Id.SubscriptionId), Id.ResourceGroupName, Id.Name, context); + Response result = await Pipeline.ProcessMessageAsync(message, context).ConfigureAwait(false); + Response response = Response.FromValue(MongoDBAtlasOrganizationData.FromResponse(result), result); + return Response.FromValue(new MongoDBAtlasOrganizationResource(Client, response.Value), response.GetRawResponse()); } else { - var current = (await GetAsync(cancellationToken: cancellationToken).ConfigureAwait(false)).Value.Data; - var patch = new MongoDBAtlasOrganizationPatch(); - foreach (var tag in current.Tags) + MongoDBAtlasOrganizationData current = (await GetAsync(cancellationToken).ConfigureAwait(false)).Value.Data; + MongoDBAtlasOrganizationPatch patch = new MongoDBAtlasOrganizationPatch(); + foreach (KeyValuePair tag in current.Tags) { patch.Tags.Add(tag); } patch.Tags.Remove(key); - var result = await UpdateAsync(WaitUntil.Completed, patch, cancellationToken: cancellationToken).ConfigureAwait(false); + ArmOperation result = await UpdateAsync(WaitUntil.Completed, patch, cancellationToken).ConfigureAwait(false); return Response.FromValue(result.Value, result.GetRawResponse()); } } @@ -644,27 +513,7 @@ public virtual async Task> RemoveTagA } } - /// - /// Removes a tag by key from the resource. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/MongoDB.Atlas/organizations/{organizationName} - /// - /// - /// Operation Id - /// OrganizationResource_Get - /// - /// - /// Default Api Version - /// 2025-06-01 - /// - /// - /// Resource - /// - /// - /// - /// + /// Removes a tag by key from the resource. /// The key for the tag. /// The cancellation token to use. /// is null. @@ -672,28 +521,34 @@ public virtual Response RemoveTag(string key, { Argument.AssertNotNull(key, nameof(key)); - using var scope = _mongoDBAtlasOrganizationOrganizationsClientDiagnostics.CreateScope("MongoDBAtlasOrganizationResource.RemoveTag"); + using DiagnosticScope scope = _organizationsClientDiagnostics.CreateScope("MongoDBAtlasOrganizationResource.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 = _mongoDBAtlasOrganizationOrganizationsRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, cancellationToken); - return Response.FromValue(new MongoDBAtlasOrganizationResource(Client, originalResponse.Value), originalResponse.GetRawResponse()); + GetTagResource().CreateOrUpdate(WaitUntil.Completed, originalTags.Value.Data, cancellationToken); + RequestContext context = new RequestContext + { + CancellationToken = cancellationToken + }; + HttpMessage message = _organizationsRestClient.CreateGetRequest(Guid.Parse(Id.SubscriptionId), Id.ResourceGroupName, Id.Name, context); + Response result = Pipeline.ProcessMessage(message, context); + Response response = Response.FromValue(MongoDBAtlasOrganizationData.FromResponse(result), result); + return Response.FromValue(new MongoDBAtlasOrganizationResource(Client, response.Value), response.GetRawResponse()); } else { - var current = Get(cancellationToken: cancellationToken).Value.Data; - var patch = new MongoDBAtlasOrganizationPatch(); - foreach (var tag in current.Tags) + MongoDBAtlasOrganizationData current = Get(cancellationToken).Value.Data; + MongoDBAtlasOrganizationPatch patch = new MongoDBAtlasOrganizationPatch(); + foreach (KeyValuePair tag in current.Tags) { patch.Tags.Add(tag); } patch.Tags.Remove(key); - var result = Update(WaitUntil.Completed, patch, cancellationToken: cancellationToken); + ArmOperation result = Update(WaitUntil.Completed, patch, cancellationToken); return Response.FromValue(result.Value, result.GetRawResponse()); } } diff --git a/sdk/mongodbatlas/Azure.ResourceManager.MongoDBAtlas/src/Generated/OrganizationsGetByResourceGroupAsyncCollectionResultOfT.cs b/sdk/mongodbatlas/Azure.ResourceManager.MongoDBAtlas/src/Generated/OrganizationsGetByResourceGroupAsyncCollectionResultOfT.cs new file mode 100644 index 000000000000..92e3f6fe512c --- /dev/null +++ b/sdk/mongodbatlas/Azure.ResourceManager.MongoDBAtlas/src/Generated/OrganizationsGetByResourceGroupAsyncCollectionResultOfT.cs @@ -0,0 +1,85 @@ +// 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.MongoDBAtlas.Models; + +namespace Azure.ResourceManager.MongoDBAtlas +{ + internal partial class OrganizationsGetByResourceGroupAsyncCollectionResultOfT : AsyncPageable + { + private readonly Organizations _client; + private readonly Guid _subscriptionId; + private readonly string _resourceGroupName; + private readonly RequestContext _context; + + /// Initializes a new instance of OrganizationsGetByResourceGroupAsyncCollectionResultOfT, which is used to iterate over the pages of a collection. + /// The Organizations 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. + /// is null. + /// is an empty string, and was expected to be non-empty. + public OrganizationsGetByResourceGroupAsyncCollectionResultOfT(Organizations client, Guid subscriptionId, string resourceGroupName, RequestContext context) : base(context?.CancellationToken ?? default) + { + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + + _client = client; + _subscriptionId = subscriptionId; + _resourceGroupName = resourceGroupName; + _context = context; + } + + /// Gets the pages of OrganizationsGetByResourceGroupAsyncCollectionResultOfT as an enumerable collection. + /// A continuation token indicating where to resume paging. + /// The number of items per page. + /// The pages of OrganizationsGetByResourceGroupAsyncCollectionResultOfT 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; + } + OrganizationResourceListResult result = OrganizationResourceListResult.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("MongoDBAtlasOrganizationCollection.GetAll"); + scope.Start(); + try + { + return await _client.Pipeline.ProcessMessageAsync(message, _context).ConfigureAwait(false); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + } +} diff --git a/sdk/mongodbatlas/Azure.ResourceManager.MongoDBAtlas/src/Generated/OrganizationsGetByResourceGroupCollectionResultOfT.cs b/sdk/mongodbatlas/Azure.ResourceManager.MongoDBAtlas/src/Generated/OrganizationsGetByResourceGroupCollectionResultOfT.cs new file mode 100644 index 000000000000..fa435f4495f0 --- /dev/null +++ b/sdk/mongodbatlas/Azure.ResourceManager.MongoDBAtlas/src/Generated/OrganizationsGetByResourceGroupCollectionResultOfT.cs @@ -0,0 +1,84 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; +using Azure; +using Azure.Core; +using Azure.Core.Pipeline; +using Azure.ResourceManager.MongoDBAtlas.Models; + +namespace Azure.ResourceManager.MongoDBAtlas +{ + internal partial class OrganizationsGetByResourceGroupCollectionResultOfT : Pageable + { + private readonly Organizations _client; + private readonly Guid _subscriptionId; + private readonly string _resourceGroupName; + private readonly RequestContext _context; + + /// Initializes a new instance of OrganizationsGetByResourceGroupCollectionResultOfT, which is used to iterate over the pages of a collection. + /// The Organizations 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. + /// is null. + /// is an empty string, and was expected to be non-empty. + public OrganizationsGetByResourceGroupCollectionResultOfT(Organizations client, Guid subscriptionId, string resourceGroupName, RequestContext context) : base(context?.CancellationToken ?? default) + { + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + + _client = client; + _subscriptionId = subscriptionId; + _resourceGroupName = resourceGroupName; + _context = context; + } + + /// Gets the pages of OrganizationsGetByResourceGroupCollectionResultOfT as an enumerable collection. + /// A continuation token indicating where to resume paging. + /// The number of items per page. + /// The pages of OrganizationsGetByResourceGroupCollectionResultOfT 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; + } + OrganizationResourceListResult result = OrganizationResourceListResult.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("MongoDBAtlasOrganizationCollection.GetAll"); + scope.Start(); + try + { + return _client.Pipeline.ProcessMessage(message, _context); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + } +} diff --git a/sdk/mongodbatlas/Azure.ResourceManager.MongoDBAtlas/src/Generated/ProviderConstants.cs b/sdk/mongodbatlas/Azure.ResourceManager.MongoDBAtlas/src/Generated/ProviderConstants.cs deleted file mode 100644 index c9e87c7658ba..000000000000 --- a/sdk/mongodbatlas/Azure.ResourceManager.MongoDBAtlas/src/Generated/ProviderConstants.cs +++ /dev/null @@ -1,16 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using Azure.Core.Pipeline; - -namespace Azure.ResourceManager.MongoDBAtlas -{ - internal static class ProviderConstants - { - public static string DefaultProviderNamespace { get; } = ClientDiagnostics.GetResourceProviderNamespace(typeof(ProviderConstants).Assembly); - } -} diff --git a/sdk/mongodbatlas/Azure.ResourceManager.MongoDBAtlas/src/Generated/RestOperations/OrganizationsRestOperations.cs b/sdk/mongodbatlas/Azure.ResourceManager.MongoDBAtlas/src/Generated/RestOperations/OrganizationsRestOperations.cs index 11767e70bf04..e1bb29604494 100644 --- a/sdk/mongodbatlas/Azure.ResourceManager.MongoDBAtlas/src/Generated/RestOperations/OrganizationsRestOperations.cs +++ b/sdk/mongodbatlas/Azure.ResourceManager.MongoDBAtlas/src/Generated/RestOperations/OrganizationsRestOperations.cs @@ -6,717 +6,176 @@ #nullable disable using System; -using System.Text.Json; -using System.Threading; -using System.Threading.Tasks; +using Azure; using Azure.Core; using Azure.Core.Pipeline; -using Azure.ResourceManager.MongoDBAtlas.Models; namespace Azure.ResourceManager.MongoDBAtlas { - internal partial class OrganizationsRestOperations + internal partial class Organizations { - private readonly TelemetryDetails _userAgent; - private readonly HttpPipeline _pipeline; private readonly Uri _endpoint; private readonly string _apiVersion; - /// Initializes a new instance of OrganizationsRestOperations. - /// 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 OrganizationsRestOperations(HttpPipeline pipeline, string applicationId, Uri endpoint = null, string apiVersion = default) + /// Initializes a new instance of Organizations for mocking. + protected Organizations() { - _pipeline = pipeline ?? throw new ArgumentNullException(nameof(pipeline)); - _endpoint = endpoint ?? new Uri("https://management.azure.com"); - _apiVersion = apiVersion ?? "2025-06-01"; - _userAgent = new TelemetryDetails(GetType().Assembly, applicationId); } - internal RequestUriBuilder CreateGetRequestUri(string subscriptionId, string resourceGroupName, string organizationName) + /// Initializes a new instance of Organizations. + /// 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 Organizations(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/MongoDB.Atlas/organizations/", false); - uri.AppendPath(organizationName, true); - uri.AppendQuery("api-version", _apiVersion, true); - return uri; + ClientDiagnostics = clientDiagnostics; + _endpoint = endpoint; + Pipeline = pipeline; + _apiVersion = apiVersion; } - internal HttpMessage CreateGetRequest(string subscriptionId, string resourceGroupName, string organizationName) + /// 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 organizationName, RequestContext context) { - var message = _pipeline.CreateMessage(); - var request = message.Request; + HttpMessage message = Pipeline.CreateMessage(); + Request 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/MongoDB.Atlas/organizations/", false); uri.AppendPath(organizationName, true); uri.AppendQuery("api-version", _apiVersion, true); request.Uri = uri; - request.Headers.Add("Accept", "application/json"); - _userAgent.Apply(message); + request.Headers.SetValue("Accept", "application/json"); return message; } - /// Get a OrganizationResource. - /// 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 Organization 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 organizationName, CancellationToken cancellationToken = default) + internal HttpMessage CreateCreateOrUpdateRequest(Guid subscriptionId, string resourceGroupName, string organizationName, RequestContent content, RequestContext context) { - Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); - Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); - Argument.AssertNotNullOrEmpty(organizationName, nameof(organizationName)); - - using var message = CreateGetRequest(subscriptionId, resourceGroupName, organizationName); - await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); - switch (message.Response.Status) - { - case 200: - { - MongoDBAtlasOrganizationData value = default; - using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, ModelSerializationExtensions.JsonDocumentOptions, cancellationToken).ConfigureAwait(false); - value = MongoDBAtlasOrganizationData.DeserializeMongoDBAtlasOrganizationData(document.RootElement); - return Response.FromValue(value, message.Response); - } - case 404: - return Response.FromValue((MongoDBAtlasOrganizationData)null, message.Response); - default: - throw new RequestFailedException(message.Response); - } - } - - /// Get a OrganizationResource. - /// 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 Organization 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 organizationName, CancellationToken cancellationToken = default) - { - Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); - Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); - Argument.AssertNotNullOrEmpty(organizationName, nameof(organizationName)); - - using var message = CreateGetRequest(subscriptionId, resourceGroupName, organizationName); - _pipeline.Send(message, cancellationToken); - switch (message.Response.Status) - { - case 200: - { - MongoDBAtlasOrganizationData value = default; - using var document = JsonDocument.Parse(message.Response.ContentStream, ModelSerializationExtensions.JsonDocumentOptions); - value = MongoDBAtlasOrganizationData.DeserializeMongoDBAtlasOrganizationData(document.RootElement); - return Response.FromValue(value, message.Response); - } - case 404: - return Response.FromValue((MongoDBAtlasOrganizationData)null, message.Response); - default: - throw new RequestFailedException(message.Response); - } - } - - internal RequestUriBuilder CreateCreateOrUpdateRequestUri(string subscriptionId, string resourceGroupName, string organizationName, MongoDBAtlasOrganizationData 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/MongoDB.Atlas/organizations/", false); - uri.AppendPath(organizationName, true); - uri.AppendQuery("api-version", _apiVersion, true); - return uri; - } - - internal HttpMessage CreateCreateOrUpdateRequest(string subscriptionId, string resourceGroupName, string organizationName, MongoDBAtlasOrganizationData data) - { - var message = _pipeline.CreateMessage(); - var request = message.Request; + HttpMessage message = Pipeline.CreateMessage(); + Request request = message.Request; request.Method = RequestMethod.Put; - var uri = new RawRequestUriBuilder(); + RawRequestUriBuilder uri = new RawRequestUriBuilder(); uri.Reset(_endpoint); uri.AppendPath("/subscriptions/", false); - uri.AppendPath(subscriptionId, true); + uri.AppendPath(subscriptionId.ToString(), true); uri.AppendPath("/resourceGroups/", false); uri.AppendPath(resourceGroupName, true); uri.AppendPath("/providers/MongoDB.Atlas/organizations/", false); uri.AppendPath(organizationName, 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.Headers.SetValue("Content-Type", "application/json"); + request.Headers.SetValue("Accept", "application/json"); request.Content = content; - _userAgent.Apply(message); return message; } - /// Create a OrganizationResource. - /// 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 Organization 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 organizationName, MongoDBAtlasOrganizationData data, CancellationToken cancellationToken = default) - { - Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); - Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); - Argument.AssertNotNullOrEmpty(organizationName, nameof(organizationName)); - Argument.AssertNotNull(data, nameof(data)); - - using var message = CreateCreateOrUpdateRequest(subscriptionId, resourceGroupName, organizationName, 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 OrganizationResource. - /// 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 Organization 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 organizationName, MongoDBAtlasOrganizationData data, CancellationToken cancellationToken = default) + internal HttpMessage CreateUpdateRequest(Guid subscriptionId, string resourceGroupName, string organizationName, RequestContent content, RequestContext context) { - Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); - Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); - Argument.AssertNotNullOrEmpty(organizationName, nameof(organizationName)); - Argument.AssertNotNull(data, nameof(data)); - - using var message = CreateCreateOrUpdateRequest(subscriptionId, resourceGroupName, organizationName, 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 organizationName, MongoDBAtlasOrganizationPatch 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/MongoDB.Atlas/organizations/", false); - uri.AppendPath(organizationName, true); - uri.AppendQuery("api-version", _apiVersion, true); - return uri; - } - - internal HttpMessage CreateUpdateRequest(string subscriptionId, string resourceGroupName, string organizationName, MongoDBAtlasOrganizationPatch patch) - { - var message = _pipeline.CreateMessage(); - var request = message.Request; + HttpMessage message = Pipeline.CreateMessage(); + Request request = message.Request; request.Method = RequestMethod.Patch; - var uri = new RawRequestUriBuilder(); + RawRequestUriBuilder uri = new RawRequestUriBuilder(); uri.Reset(_endpoint); uri.AppendPath("/subscriptions/", false); - uri.AppendPath(subscriptionId, true); + uri.AppendPath(subscriptionId.ToString(), true); uri.AppendPath("/resourceGroups/", false); uri.AppendPath(resourceGroupName, true); uri.AppendPath("/providers/MongoDB.Atlas/organizations/", false); uri.AppendPath(organizationName, 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.Headers.SetValue("Content-Type", "application/json"); + request.Headers.SetValue("Accept", "application/json"); request.Content = content; - _userAgent.Apply(message); return message; } - /// Update a OrganizationResource. - /// 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 Organization 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 organizationName, MongoDBAtlasOrganizationPatch patch, CancellationToken cancellationToken = default) - { - Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); - Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); - Argument.AssertNotNullOrEmpty(organizationName, nameof(organizationName)); - Argument.AssertNotNull(patch, nameof(patch)); - - using var message = CreateUpdateRequest(subscriptionId, resourceGroupName, organizationName, patch); - await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); - switch (message.Response.Status) - { - case 200: - case 202: - return message.Response; - default: - throw new RequestFailedException(message.Response); - } - } - - /// Update a OrganizationResource. - /// 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 Organization 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 organizationName, MongoDBAtlasOrganizationPatch patch, CancellationToken cancellationToken = default) - { - Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); - Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); - Argument.AssertNotNullOrEmpty(organizationName, nameof(organizationName)); - Argument.AssertNotNull(patch, nameof(patch)); - - using var message = CreateUpdateRequest(subscriptionId, resourceGroupName, organizationName, patch); - _pipeline.Send(message, cancellationToken); - switch (message.Response.Status) - { - case 200: - case 202: - return message.Response; - default: - throw new RequestFailedException(message.Response); - } - } - - internal RequestUriBuilder CreateDeleteRequestUri(string subscriptionId, string resourceGroupName, string organizationName) + internal HttpMessage CreateDeleteRequest(Guid subscriptionId, string resourceGroupName, string organizationName, 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/MongoDB.Atlas/organizations/", false); - uri.AppendPath(organizationName, true); - uri.AppendQuery("api-version", _apiVersion, true); - return uri; - } - - internal HttpMessage CreateDeleteRequest(string subscriptionId, string resourceGroupName, string organizationName) - { - var message = _pipeline.CreateMessage(); - var request = message.Request; + HttpMessage message = Pipeline.CreateMessage(); + Request request = message.Request; request.Method = RequestMethod.Delete; - var uri = new RawRequestUriBuilder(); + RawRequestUriBuilder uri = new RawRequestUriBuilder(); uri.Reset(_endpoint); uri.AppendPath("/subscriptions/", false); - uri.AppendPath(subscriptionId, true); + uri.AppendPath(subscriptionId.ToString(), true); uri.AppendPath("/resourceGroups/", false); uri.AppendPath(resourceGroupName, true); uri.AppendPath("/providers/MongoDB.Atlas/organizations/", false); uri.AppendPath(organizationName, true); uri.AppendQuery("api-version", _apiVersion, true); request.Uri = uri; - _userAgent.Apply(message); return message; } - /// Delete a OrganizationResource. - /// 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 Organization 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 organizationName, CancellationToken cancellationToken = default) - { - Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); - Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); - Argument.AssertNotNullOrEmpty(organizationName, nameof(organizationName)); - - using var message = CreateDeleteRequest(subscriptionId, resourceGroupName, organizationName); - 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 OrganizationResource. - /// 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 Organization 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 organizationName, CancellationToken cancellationToken = default) + internal HttpMessage CreateGetByResourceGroupRequest(Guid subscriptionId, string resourceGroupName, RequestContext context) { - Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); - Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); - Argument.AssertNotNullOrEmpty(organizationName, nameof(organizationName)); - - using var message = CreateDeleteRequest(subscriptionId, resourceGroupName, organizationName); - _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/MongoDB.Atlas/organizations", false); - uri.AppendQuery("api-version", _apiVersion, true); - return uri; - } - - internal HttpMessage CreateListByResourceGroupRequest(string subscriptionId, string resourceGroupName) - { - var message = _pipeline.CreateMessage(); - var request = message.Request; + HttpMessage message = Pipeline.CreateMessage(); + Request 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/MongoDB.Atlas/organizations", false); uri.AppendQuery("api-version", _apiVersion, true); request.Uri = uri; - request.Headers.Add("Accept", "application/json"); - _userAgent.Apply(message); + request.Headers.SetValue("Accept", "application/json"); return message; } - /// List OrganizationResource 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: - { - OrganizationResourceListResult value = default; - using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, ModelSerializationExtensions.JsonDocumentOptions, cancellationToken).ConfigureAwait(false); - value = OrganizationResourceListResult.DeserializeOrganizationResourceListResult(document.RootElement); - return Response.FromValue(value, message.Response); - } - default: - throw new RequestFailedException(message.Response); - } - } - - /// List OrganizationResource 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) + internal HttpMessage CreateNextGetByResourceGroupRequest(Uri nextPage, Guid subscriptionId, string resourceGroupName, RequestContext context) { - Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); - Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); - - using var message = CreateListByResourceGroupRequest(subscriptionId, resourceGroupName); - _pipeline.Send(message, cancellationToken); - switch (message.Response.Status) - { - case 200: - { - OrganizationResourceListResult value = default; - using var document = JsonDocument.Parse(message.Response.ContentStream, ModelSerializationExtensions.JsonDocumentOptions); - value = OrganizationResourceListResult.DeserializeOrganizationResourceListResult(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/MongoDB.Atlas/organizations", false); - uri.AppendQuery("api-version", _apiVersion, true); - return uri; - } - - internal HttpMessage CreateListBySubscriptionRequest(string subscriptionId) - { - var message = _pipeline.CreateMessage(); - var request = message.Request; + HttpMessage message = Pipeline.CreateMessage(); + Request 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/MongoDB.Atlas/organizations", false); - uri.AppendQuery("api-version", _apiVersion, true); + RawRequestUriBuilder uri = new RawRequestUriBuilder(); + uri.Reset(nextPage); request.Uri = uri; - request.Headers.Add("Accept", "application/json"); - _userAgent.Apply(message); + request.Headers.SetValue("Accept", "application/json"); return message; } - /// List OrganizationResource 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: - { - OrganizationResourceListResult value = default; - using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, ModelSerializationExtensions.JsonDocumentOptions, cancellationToken).ConfigureAwait(false); - value = OrganizationResourceListResult.DeserializeOrganizationResourceListResult(document.RootElement); - return Response.FromValue(value, message.Response); - } - default: - throw new RequestFailedException(message.Response); - } - } - - /// List OrganizationResource 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) + internal HttpMessage CreateGetBySubscriptionRequest(Guid subscriptionId, RequestContext context) { - Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); - - using var message = CreateListBySubscriptionRequest(subscriptionId); - _pipeline.Send(message, cancellationToken); - switch (message.Response.Status) - { - case 200: - { - OrganizationResourceListResult value = default; - using var document = JsonDocument.Parse(message.Response.ContentStream, ModelSerializationExtensions.JsonDocumentOptions); - value = OrganizationResourceListResult.DeserializeOrganizationResourceListResult(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; + HttpMessage message = Pipeline.CreateMessage(); + Request request = message.Request; request.Method = RequestMethod.Get; - var uri = new RawRequestUriBuilder(); + RawRequestUriBuilder uri = new RawRequestUriBuilder(); uri.Reset(_endpoint); - uri.AppendRawNextLink(nextLink, false); + uri.AppendPath("/subscriptions/", false); + uri.AppendPath(subscriptionId.ToString(), true); + uri.AppendPath("/providers/MongoDB.Atlas/organizations", false); + uri.AppendQuery("api-version", _apiVersion, true); request.Uri = uri; - request.Headers.Add("Accept", "application/json"); - _userAgent.Apply(message); + request.Headers.SetValue("Accept", "application/json"); return message; } - /// List OrganizationResource 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: - { - OrganizationResourceListResult value = default; - using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, ModelSerializationExtensions.JsonDocumentOptions, cancellationToken).ConfigureAwait(false); - value = OrganizationResourceListResult.DeserializeOrganizationResourceListResult(document.RootElement); - return Response.FromValue(value, message.Response); - } - default: - throw new RequestFailedException(message.Response); - } - } - - /// List OrganizationResource 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) + internal HttpMessage CreateNextGetBySubscriptionRequest(Uri nextPage, Guid subscriptionId, RequestContext context) { - Argument.AssertNotNull(nextLink, nameof(nextLink)); - Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); - Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); - - using var message = CreateListByResourceGroupNextPageRequest(nextLink, subscriptionId, resourceGroupName); - _pipeline.Send(message, cancellationToken); - switch (message.Response.Status) - { - case 200: - { - OrganizationResourceListResult value = default; - using var document = JsonDocument.Parse(message.Response.ContentStream, ModelSerializationExtensions.JsonDocumentOptions); - value = OrganizationResourceListResult.DeserializeOrganizationResourceListResult(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; + HttpMessage message = Pipeline.CreateMessage(); + Request request = message.Request; request.Method = RequestMethod.Get; - var uri = new RawRequestUriBuilder(); - uri.Reset(_endpoint); - uri.AppendRawNextLink(nextLink, false); + RawRequestUriBuilder uri = new RawRequestUriBuilder(); + uri.Reset(nextPage); request.Uri = uri; - request.Headers.Add("Accept", "application/json"); - _userAgent.Apply(message); + request.Headers.SetValue("Accept", "application/json"); return message; } - - /// List OrganizationResource 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: - { - OrganizationResourceListResult value = default; - using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, ModelSerializationExtensions.JsonDocumentOptions, cancellationToken).ConfigureAwait(false); - value = OrganizationResourceListResult.DeserializeOrganizationResourceListResult(document.RootElement); - return Response.FromValue(value, message.Response); - } - default: - throw new RequestFailedException(message.Response); - } - } - - /// List OrganizationResource 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: - { - OrganizationResourceListResult value = default; - using var document = JsonDocument.Parse(message.Response.ContentStream, ModelSerializationExtensions.JsonDocumentOptions); - value = OrganizationResourceListResult.DeserializeOrganizationResourceListResult(document.RootElement); - return Response.FromValue(value, message.Response); - } - default: - throw new RequestFailedException(message.Response); - } - } } } diff --git a/sdk/mongodbatlas/Azure.ResourceManager.MongoDBAtlas/tsp-location.yaml b/sdk/mongodbatlas/Azure.ResourceManager.MongoDBAtlas/tsp-location.yaml index d4618b9629cb..4a762d5d0ef3 100644 --- a/sdk/mongodbatlas/Azure.ResourceManager.MongoDBAtlas/tsp-location.yaml +++ b/sdk/mongodbatlas/Azure.ResourceManager.MongoDBAtlas/tsp-location.yaml @@ -1,4 +1,4 @@ directory: specification/liftrmongodb/MongoDB.Atlas.Management -commit: cc6c702576347f68e926765ed2e14b3781eae363 +commit: d22c574864996092babaee5a77920ee08c1e9669 repo: Azure/azure-rest-api-specs -additionalDirectories: +emitterPackageJsonPath: "eng/azure-typespec-http-client-csharp-mgmt-emitter-package.json" \ No newline at end of file