From 69f2f71066fa24ed828c09831582253ec800cb6b Mon Sep 17 00:00:00 2001 From: SDKAuto Date: Mon, 12 May 2025 19:21:12 +0000 Subject: [PATCH] CodeGen from PR 34580 in Azure/azure-rest-api-specs Merge 31e96730779f83e2db3d4ebea68e9a441fe59311 into e489de297e262f087de27000a48dd69417e345a4 --- ...ure.ResourceManager.MongoCluster.net8.0.cs | 224 +++++++- ...urceManager.MongoCluster.netstandard2.0.cs | 224 +++++++- .../Samples/Sample_MongoClusterCollection.cs | 19 +- ...mple_MongoClusterFirewallRuleCollection.cs | 10 +- ...Sample_MongoClusterFirewallRuleResource.cs | 6 +- ...lusterPrivateEndpointConnectionResource.cs | 6 +- ...ateEndpointConnectionResourceCollection.cs | 10 +- .../Samples/Sample_MongoClusterResource.cs | 68 ++- .../Sample_SubscriptionResourceExtensions.cs | 6 +- .../Samples/Sample_UserCollection.cs | 204 +++++++ .../Generated/Samples/Sample_UserResource.cs | 117 ++++ .../Generated/ArmMongoClusterModelFactory.cs | 45 +- .../MockableMongoClusterArmClient.cs | 12 + ...ckableMongoClusterResourceGroupResource.cs | 4 +- ...ockableMongoClusterSubscriptionResource.cs | 8 +- .../Extensions/MongoClusterExtensions.cs | 31 +- .../UserOperationSource.cs | 36 ++ .../AuthConfigProperties.Serialization.cs | 143 +++++ .../Generated/Models/AuthConfigProperties.cs | 66 +++ .../Generated/Models/AuthenticationMode.cs | 51 ++ .../src/Generated/Models/DataApiMode.cs | 51 ++ .../Models/DataApiProperties.Serialization.cs | 133 +++++ .../src/Generated/Models/DataApiProperties.cs | 65 +++ .../Models/DatabaseRole.Serialization.cs | 134 +++++ .../src/Generated/Models/DatabaseRole.cs | 81 +++ .../EntraIdentityProvider.Serialization.cs | 118 ++++ .../Generated/Models/EntraIdentityProvider.cs | 54 ++ ...dentityProviderProperties.Serialization.cs | 126 +++++ .../Models/EntraIdentityProviderProperties.cs | 72 +++ .../Generated/Models/EntraPrincipalType.cs | 51 ++ .../Models/IdentityProvider.Serialization.cs | 117 ++++ .../src/Generated/Models/IdentityProvider.cs | 69 +++ .../Generated/Models/IdentityProviderType.cs | 48 ++ .../MongoClusterProperties.Serialization.cs | 32 ++ .../Models/MongoClusterProperties.cs | 46 +- ...goClusterUpdateProperties.Serialization.cs | 32 ++ .../Models/MongoClusterUpdateProperties.cs | 46 +- .../Models/StorageProperties.Serialization.cs | 49 +- .../src/Generated/Models/StorageProperties.cs | 16 +- .../src/Generated/Models/StorageType.cs | 51 ++ .../UnknownIdentityProvider.Serialization.cs | 110 ++++ .../Models/UnknownIdentityProvider.cs | 29 + .../Models/UserListResult.Serialization.cs | 151 ++++++ .../src/Generated/Models/UserListResult.cs | 80 +++ .../Models/UserProperties.Serialization.cs | 173 ++++++ .../src/Generated/Models/UserProperties.cs | 82 +++ .../src/Generated/Models/UserRole.cs | 48 ++ .../src/Generated/MongoClusterCollection.cs | 20 +- .../MongoClusterFirewallRuleCollection.cs | 20 +- .../MongoClusterFirewallRuleResource.cs | 12 +- ...lusterPrivateEndpointConnectionResource.cs | 12 +- ...ateEndpointConnectionResourceCollection.cs | 20 +- .../src/Generated/MongoClusterResource.cs | 117 +++- .../FirewallRulesRestOperations.cs | 2 +- .../MongoClustersRestOperations.cs | 2 +- ...rivateEndpointConnectionsRestOperations.cs | 2 +- .../PrivateLinksRestOperations.cs | 2 +- .../RestOperations/ReplicasRestOperations.cs | 2 +- .../RestOperations/UsersRestOperations.cs | 513 ++++++++++++++++++ .../src/Generated/UserCollection.cs | 493 +++++++++++++++++ .../src/Generated/UserData.Serialization.cs | 155 ++++++ .../src/Generated/UserData.cs | 75 +++ .../Generated/UserResource.Serialization.cs | 26 + .../src/Generated/UserResource.cs | 347 ++++++++++++ .../tsp-location.yaml | 7 +- sdk/storage/ci.yml | 2 + 66 files changed, 5017 insertions(+), 166 deletions(-) create mode 100644 sdk/mongocluster/Azure.ResourceManager.MongoCluster/samples/Generated/Samples/Sample_UserCollection.cs create mode 100644 sdk/mongocluster/Azure.ResourceManager.MongoCluster/samples/Generated/Samples/Sample_UserResource.cs create mode 100644 sdk/mongocluster/Azure.ResourceManager.MongoCluster/src/Generated/LongRunningOperation/UserOperationSource.cs create mode 100644 sdk/mongocluster/Azure.ResourceManager.MongoCluster/src/Generated/Models/AuthConfigProperties.Serialization.cs create mode 100644 sdk/mongocluster/Azure.ResourceManager.MongoCluster/src/Generated/Models/AuthConfigProperties.cs create mode 100644 sdk/mongocluster/Azure.ResourceManager.MongoCluster/src/Generated/Models/AuthenticationMode.cs create mode 100644 sdk/mongocluster/Azure.ResourceManager.MongoCluster/src/Generated/Models/DataApiMode.cs create mode 100644 sdk/mongocluster/Azure.ResourceManager.MongoCluster/src/Generated/Models/DataApiProperties.Serialization.cs create mode 100644 sdk/mongocluster/Azure.ResourceManager.MongoCluster/src/Generated/Models/DataApiProperties.cs create mode 100644 sdk/mongocluster/Azure.ResourceManager.MongoCluster/src/Generated/Models/DatabaseRole.Serialization.cs create mode 100644 sdk/mongocluster/Azure.ResourceManager.MongoCluster/src/Generated/Models/DatabaseRole.cs create mode 100644 sdk/mongocluster/Azure.ResourceManager.MongoCluster/src/Generated/Models/EntraIdentityProvider.Serialization.cs create mode 100644 sdk/mongocluster/Azure.ResourceManager.MongoCluster/src/Generated/Models/EntraIdentityProvider.cs create mode 100644 sdk/mongocluster/Azure.ResourceManager.MongoCluster/src/Generated/Models/EntraIdentityProviderProperties.Serialization.cs create mode 100644 sdk/mongocluster/Azure.ResourceManager.MongoCluster/src/Generated/Models/EntraIdentityProviderProperties.cs create mode 100644 sdk/mongocluster/Azure.ResourceManager.MongoCluster/src/Generated/Models/EntraPrincipalType.cs create mode 100644 sdk/mongocluster/Azure.ResourceManager.MongoCluster/src/Generated/Models/IdentityProvider.Serialization.cs create mode 100644 sdk/mongocluster/Azure.ResourceManager.MongoCluster/src/Generated/Models/IdentityProvider.cs create mode 100644 sdk/mongocluster/Azure.ResourceManager.MongoCluster/src/Generated/Models/IdentityProviderType.cs create mode 100644 sdk/mongocluster/Azure.ResourceManager.MongoCluster/src/Generated/Models/StorageType.cs create mode 100644 sdk/mongocluster/Azure.ResourceManager.MongoCluster/src/Generated/Models/UnknownIdentityProvider.Serialization.cs create mode 100644 sdk/mongocluster/Azure.ResourceManager.MongoCluster/src/Generated/Models/UnknownIdentityProvider.cs create mode 100644 sdk/mongocluster/Azure.ResourceManager.MongoCluster/src/Generated/Models/UserListResult.Serialization.cs create mode 100644 sdk/mongocluster/Azure.ResourceManager.MongoCluster/src/Generated/Models/UserListResult.cs create mode 100644 sdk/mongocluster/Azure.ResourceManager.MongoCluster/src/Generated/Models/UserProperties.Serialization.cs create mode 100644 sdk/mongocluster/Azure.ResourceManager.MongoCluster/src/Generated/Models/UserProperties.cs create mode 100644 sdk/mongocluster/Azure.ResourceManager.MongoCluster/src/Generated/Models/UserRole.cs create mode 100644 sdk/mongocluster/Azure.ResourceManager.MongoCluster/src/Generated/RestOperations/UsersRestOperations.cs create mode 100644 sdk/mongocluster/Azure.ResourceManager.MongoCluster/src/Generated/UserCollection.cs create mode 100644 sdk/mongocluster/Azure.ResourceManager.MongoCluster/src/Generated/UserData.Serialization.cs create mode 100644 sdk/mongocluster/Azure.ResourceManager.MongoCluster/src/Generated/UserData.cs create mode 100644 sdk/mongocluster/Azure.ResourceManager.MongoCluster/src/Generated/UserResource.Serialization.cs create mode 100644 sdk/mongocluster/Azure.ResourceManager.MongoCluster/src/Generated/UserResource.cs diff --git a/sdk/mongocluster/Azure.ResourceManager.MongoCluster/api/Azure.ResourceManager.MongoCluster.net8.0.cs b/sdk/mongocluster/Azure.ResourceManager.MongoCluster/api/Azure.ResourceManager.MongoCluster.net8.0.cs index 92741a64fc87..02e639506649 100644 --- a/sdk/mongocluster/Azure.ResourceManager.MongoCluster/api/Azure.ResourceManager.MongoCluster.net8.0.cs +++ b/sdk/mongocluster/Azure.ResourceManager.MongoCluster/api/Azure.ResourceManager.MongoCluster.net8.0.cs @@ -46,6 +46,7 @@ public static partial class MongoClusterExtensions public static Azure.ResourceManager.MongoCluster.MongoClusterCollection GetMongoClusters(this Azure.ResourceManager.Resources.ResourceGroupResource resourceGroupResource) { throw null; } public static Azure.Pageable GetMongoClusters(this Azure.ResourceManager.Resources.SubscriptionResource subscriptionResource, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } public static Azure.AsyncPageable GetMongoClustersAsync(this Azure.ResourceManager.Resources.SubscriptionResource subscriptionResource, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public static Azure.ResourceManager.MongoCluster.UserResource GetUserResource(this Azure.ResourceManager.ArmClient client, Azure.Core.ResourceIdentifier id) { throw null; } } public partial class MongoClusterFirewallRuleCollection : Azure.ResourceManager.ArmCollection, System.Collections.Generic.IAsyncEnumerable, System.Collections.Generic.IEnumerable, System.Collections.IEnumerable { @@ -166,6 +167,9 @@ protected MongoClusterResource() { } public virtual Azure.AsyncPageable GetPrivateLinksAsync(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } public virtual Azure.Pageable GetReplicasByParent(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } public virtual Azure.AsyncPageable GetReplicasByParentAsync(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Response GetUser(string userName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> GetUserAsync(string userName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.ResourceManager.MongoCluster.UserCollection GetUsers() { throw null; } public virtual Azure.ResourceManager.ArmOperation Promote(Azure.WaitUntil waitUntil, Azure.ResourceManager.MongoCluster.Models.PromoteReplicaContent content, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } public virtual System.Threading.Tasks.Task PromoteAsync(Azure.WaitUntil waitUntil, Azure.ResourceManager.MongoCluster.Models.PromoteReplicaContent content, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } public virtual Azure.Response RemoveTag(string key, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } @@ -180,6 +184,53 @@ protected MongoClusterResource() { } public virtual Azure.ResourceManager.ArmOperation Update(Azure.WaitUntil waitUntil, Azure.ResourceManager.MongoCluster.Models.MongoClusterPatch patch, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } public virtual System.Threading.Tasks.Task> UpdateAsync(Azure.WaitUntil waitUntil, Azure.ResourceManager.MongoCluster.Models.MongoClusterPatch patch, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } } + public partial class UserCollection : Azure.ResourceManager.ArmCollection, System.Collections.Generic.IAsyncEnumerable, System.Collections.Generic.IEnumerable, System.Collections.IEnumerable + { + protected UserCollection() { } + public virtual Azure.ResourceManager.ArmOperation CreateOrUpdate(Azure.WaitUntil waitUntil, string userName, Azure.ResourceManager.MongoCluster.UserData data, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> CreateOrUpdateAsync(Azure.WaitUntil waitUntil, string userName, Azure.ResourceManager.MongoCluster.UserData data, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Response Exists(string userName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> ExistsAsync(string userName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Response Get(string userName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Pageable GetAll(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.AsyncPageable GetAllAsync(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> GetAsync(string userName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.NullableResponse GetIfExists(string userName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> GetIfExistsAsync(string userName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + System.Collections.Generic.IAsyncEnumerator System.Collections.Generic.IAsyncEnumerable.GetAsyncEnumerator(System.Threading.CancellationToken cancellationToken) { throw null; } + System.Collections.Generic.IEnumerator System.Collections.Generic.IEnumerable.GetEnumerator() { throw null; } + System.Collections.IEnumerator System.Collections.IEnumerable.GetEnumerator() { throw null; } + } + public partial class UserData : Azure.ResourceManager.Models.ResourceData, System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel + { + public UserData() { } + public Azure.ResourceManager.MongoCluster.Models.UserProperties Properties { get { throw null; } set { } } + protected override void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.ResourceManager.MongoCluster.UserData System.ClientModel.Primitives.IJsonModel.Create(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + void System.ClientModel.Primitives.IJsonModel.Write(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.ResourceManager.MongoCluster.UserData 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 UserResource : Azure.ResourceManager.ArmResource, System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel + { + public static readonly Azure.Core.ResourceType ResourceType; + protected UserResource() { } + public virtual Azure.ResourceManager.MongoCluster.UserData Data { get { throw null; } } + public virtual bool HasData { get { throw null; } } + public static Azure.Core.ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string mongoClusterName, string userName) { throw null; } + public virtual Azure.ResourceManager.ArmOperation Delete(Azure.WaitUntil waitUntil, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task DeleteAsync(Azure.WaitUntil waitUntil, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Response Get(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> GetAsync(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + Azure.ResourceManager.MongoCluster.UserData System.ClientModel.Primitives.IJsonModel.Create(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + void System.ClientModel.Primitives.IJsonModel.Write(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.ResourceManager.MongoCluster.UserData System.ClientModel.Primitives.IPersistableModel.Create(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + string System.ClientModel.Primitives.IPersistableModel.GetFormatFromOptions(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + System.BinaryData System.ClientModel.Primitives.IPersistableModel.Write(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + public virtual Azure.ResourceManager.ArmOperation Update(Azure.WaitUntil waitUntil, Azure.ResourceManager.MongoCluster.UserData data, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> UpdateAsync(Azure.WaitUntil waitUntil, Azure.ResourceManager.MongoCluster.UserData data, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + } } namespace Azure.ResourceManager.MongoCluster.Mocking { @@ -189,6 +240,7 @@ protected MockableMongoClusterArmClient() { } public virtual Azure.ResourceManager.MongoCluster.MongoClusterFirewallRuleResource GetMongoClusterFirewallRuleResource(Azure.Core.ResourceIdentifier id) { throw null; } public virtual Azure.ResourceManager.MongoCluster.MongoClusterPrivateEndpointConnectionResource GetMongoClusterPrivateEndpointConnectionResource(Azure.Core.ResourceIdentifier id) { throw null; } public virtual Azure.ResourceManager.MongoCluster.MongoClusterResource GetMongoClusterResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.MongoCluster.UserResource GetUserResource(Azure.Core.ResourceIdentifier id) { throw null; } } public partial class MockableMongoClusterResourceGroupResource : Azure.ResourceManager.ArmResource { @@ -221,10 +273,100 @@ public static partial class ArmMongoClusterModelFactory public static Azure.ResourceManager.MongoCluster.MongoClusterPrivateEndpointConnectionResourceData MongoClusterPrivateEndpointConnectionResourceData(Azure.Core.ResourceIdentifier id = null, string name = null, Azure.Core.ResourceType resourceType = default(Azure.Core.ResourceType), Azure.ResourceManager.Models.SystemData systemData = null, Azure.ResourceManager.MongoCluster.Models.MongoClusterPrivateEndpointConnectionProperties properties = null) { throw null; } public static Azure.ResourceManager.MongoCluster.Models.MongoClusterPrivateLinkResourceData MongoClusterPrivateLinkResourceData(Azure.Core.ResourceIdentifier id = null, string name = null, Azure.Core.ResourceType resourceType = default(Azure.Core.ResourceType), Azure.ResourceManager.Models.SystemData systemData = null, Azure.ResourceManager.MongoCluster.Models.MongoClusterPrivateLinkResourceProperties properties = null) { throw null; } public static Azure.ResourceManager.MongoCluster.Models.MongoClusterPrivateLinkResourceProperties MongoClusterPrivateLinkResourceProperties(string groupId = null, System.Collections.Generic.IEnumerable requiredMembers = null, System.Collections.Generic.IEnumerable requiredZoneNames = null) { throw null; } - public static Azure.ResourceManager.MongoCluster.Models.MongoClusterProperties MongoClusterProperties(Azure.ResourceManager.MongoCluster.Models.MongoClusterCreateMode? createMode = default(Azure.ResourceManager.MongoCluster.Models.MongoClusterCreateMode?), Azure.ResourceManager.MongoCluster.Models.MongoClusterRestoreContent restoreParameters = null, Azure.ResourceManager.MongoCluster.Models.MongoClusterReplicaContent replicaParameters = null, Azure.ResourceManager.MongoCluster.Models.MongoClusterAdministratorProperties administrator = null, string serverVersion = null, string connectionString = null, Azure.ResourceManager.MongoCluster.Models.MongoClusterProvisioningState? provisioningState = default(Azure.ResourceManager.MongoCluster.Models.MongoClusterProvisioningState?), Azure.ResourceManager.MongoCluster.Models.MongoClusterStatus? clusterStatus = default(Azure.ResourceManager.MongoCluster.Models.MongoClusterStatus?), Azure.ResourceManager.MongoCluster.Models.MongoClusterPublicNetworkAccess? publicNetworkAccess = default(Azure.ResourceManager.MongoCluster.Models.MongoClusterPublicNetworkAccess?), Azure.ResourceManager.MongoCluster.Models.HighAvailabilityMode? highAvailabilityTargetMode = default(Azure.ResourceManager.MongoCluster.Models.HighAvailabilityMode?), long? storageSizeGb = default(long?), int? shardingShardCount = default(int?), string computeTier = null, string backupEarliestRestoreTime = null, System.Collections.Generic.IEnumerable privateEndpointConnections = null, System.Collections.Generic.IEnumerable previewFeatures = null, Azure.ResourceManager.MongoCluster.Models.MongoClusterReplicationProperties replica = null, string infrastructureVersion = null) { throw null; } + public static Azure.ResourceManager.MongoCluster.Models.MongoClusterProperties MongoClusterProperties(Azure.ResourceManager.MongoCluster.Models.MongoClusterCreateMode? createMode = default(Azure.ResourceManager.MongoCluster.Models.MongoClusterCreateMode?), Azure.ResourceManager.MongoCluster.Models.MongoClusterRestoreContent restoreParameters = null, Azure.ResourceManager.MongoCluster.Models.MongoClusterReplicaContent replicaParameters = null, Azure.ResourceManager.MongoCluster.Models.MongoClusterAdministratorProperties administrator = null, string serverVersion = null, string connectionString = null, Azure.ResourceManager.MongoCluster.Models.MongoClusterProvisioningState? provisioningState = default(Azure.ResourceManager.MongoCluster.Models.MongoClusterProvisioningState?), Azure.ResourceManager.MongoCluster.Models.MongoClusterStatus? clusterStatus = default(Azure.ResourceManager.MongoCluster.Models.MongoClusterStatus?), Azure.ResourceManager.MongoCluster.Models.MongoClusterPublicNetworkAccess? publicNetworkAccess = default(Azure.ResourceManager.MongoCluster.Models.MongoClusterPublicNetworkAccess?), Azure.ResourceManager.MongoCluster.Models.HighAvailabilityMode? highAvailabilityTargetMode = default(Azure.ResourceManager.MongoCluster.Models.HighAvailabilityMode?), Azure.ResourceManager.MongoCluster.Models.StorageProperties storage = null, int? shardingShardCount = default(int?), string computeTier = null, string backupEarliestRestoreTime = null, Azure.ResourceManager.MongoCluster.Models.DataApiMode? dataApiMode = default(Azure.ResourceManager.MongoCluster.Models.DataApiMode?), System.Collections.Generic.IEnumerable privateEndpointConnections = null, System.Collections.Generic.IEnumerable previewFeatures = null, Azure.ResourceManager.MongoCluster.Models.MongoClusterReplicationProperties replica = null, string infrastructureVersion = null, System.Collections.Generic.IEnumerable authConfigAllowedModes = null) { throw null; } public static Azure.ResourceManager.MongoCluster.Models.MongoClusterReplica MongoClusterReplica(Azure.Core.ResourceIdentifier id = null, string name = null, Azure.Core.ResourceType resourceType = default(Azure.Core.ResourceType), Azure.ResourceManager.Models.SystemData systemData = null, Azure.ResourceManager.MongoCluster.Models.MongoClusterProperties properties = null) { throw null; } public static Azure.ResourceManager.MongoCluster.Models.MongoClusterReplicationProperties MongoClusterReplicationProperties(Azure.Core.ResourceIdentifier sourceResourceId = null, Azure.ResourceManager.MongoCluster.Models.MongoClusterReplicationRole? role = default(Azure.ResourceManager.MongoCluster.Models.MongoClusterReplicationRole?), Azure.ResourceManager.MongoCluster.Models.MongoClusterReplicationState? replicationState = default(Azure.ResourceManager.MongoCluster.Models.MongoClusterReplicationState?)) { throw null; } public static Azure.ResourceManager.MongoCluster.Models.PromoteReplicaContent PromoteReplicaContent(Azure.ResourceManager.MongoCluster.Models.MongoClusterPromoteOption promoteOption = default(Azure.ResourceManager.MongoCluster.Models.MongoClusterPromoteOption), Azure.ResourceManager.MongoCluster.Models.MongoClusterPromoteMode? mode = default(Azure.ResourceManager.MongoCluster.Models.MongoClusterPromoteMode?)) { throw null; } + public static Azure.ResourceManager.MongoCluster.UserData UserData(Azure.Core.ResourceIdentifier id = null, string name = null, Azure.Core.ResourceType resourceType = default(Azure.Core.ResourceType), Azure.ResourceManager.Models.SystemData systemData = null, Azure.ResourceManager.MongoCluster.Models.UserProperties properties = null) { throw null; } + public static Azure.ResourceManager.MongoCluster.Models.UserProperties UserProperties(Azure.ResourceManager.MongoCluster.Models.MongoClusterProvisioningState? provisioningState = default(Azure.ResourceManager.MongoCluster.Models.MongoClusterProvisioningState?), Azure.ResourceManager.MongoCluster.Models.IdentityProvider identityProvider = null, System.Collections.Generic.IEnumerable roles = null) { throw null; } + } + [System.Runtime.InteropServices.StructLayoutAttribute(System.Runtime.InteropServices.LayoutKind.Sequential)] + public readonly partial struct AuthenticationMode : System.IEquatable + { + private readonly object _dummy; + private readonly int _dummyPrimitive; + public AuthenticationMode(string value) { throw null; } + public static Azure.ResourceManager.MongoCluster.Models.AuthenticationMode MicrosoftEntraId { get { throw null; } } + public static Azure.ResourceManager.MongoCluster.Models.AuthenticationMode NativeAuth { get { throw null; } } + public bool Equals(Azure.ResourceManager.MongoCluster.Models.AuthenticationMode other) { throw null; } + [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] + public override bool Equals(object obj) { throw null; } + [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] + public override int GetHashCode() { throw null; } + public static bool operator ==(Azure.ResourceManager.MongoCluster.Models.AuthenticationMode left, Azure.ResourceManager.MongoCluster.Models.AuthenticationMode right) { throw null; } + public static implicit operator Azure.ResourceManager.MongoCluster.Models.AuthenticationMode (string value) { throw null; } + public static bool operator !=(Azure.ResourceManager.MongoCluster.Models.AuthenticationMode left, Azure.ResourceManager.MongoCluster.Models.AuthenticationMode right) { throw null; } + public override string ToString() { throw null; } + } + [System.Runtime.InteropServices.StructLayoutAttribute(System.Runtime.InteropServices.LayoutKind.Sequential)] + public readonly partial struct DataApiMode : System.IEquatable + { + private readonly object _dummy; + private readonly int _dummyPrimitive; + public DataApiMode(string value) { throw null; } + public static Azure.ResourceManager.MongoCluster.Models.DataApiMode Disabled { get { throw null; } } + public static Azure.ResourceManager.MongoCluster.Models.DataApiMode Enabled { get { throw null; } } + public bool Equals(Azure.ResourceManager.MongoCluster.Models.DataApiMode other) { throw null; } + [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] + public override bool Equals(object obj) { throw null; } + [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] + public override int GetHashCode() { throw null; } + public static bool operator ==(Azure.ResourceManager.MongoCluster.Models.DataApiMode left, Azure.ResourceManager.MongoCluster.Models.DataApiMode right) { throw null; } + public static implicit operator Azure.ResourceManager.MongoCluster.Models.DataApiMode (string value) { throw null; } + public static bool operator !=(Azure.ResourceManager.MongoCluster.Models.DataApiMode left, Azure.ResourceManager.MongoCluster.Models.DataApiMode right) { throw null; } + public override string ToString() { throw null; } + } + public partial class DatabaseRole : System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel + { + public DatabaseRole(string db, Azure.ResourceManager.MongoCluster.Models.UserRole role) { } + public string Db { get { throw null; } set { } } + public Azure.ResourceManager.MongoCluster.Models.UserRole Role { get { throw null; } set { } } + protected virtual void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.ResourceManager.MongoCluster.Models.DatabaseRole System.ClientModel.Primitives.IJsonModel.Create(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + void System.ClientModel.Primitives.IJsonModel.Write(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.ResourceManager.MongoCluster.Models.DatabaseRole 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 EntraIdentityProvider : Azure.ResourceManager.MongoCluster.Models.IdentityProvider, System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel + { + public EntraIdentityProvider(Azure.ResourceManager.MongoCluster.Models.EntraIdentityProviderProperties properties) { } + public Azure.ResourceManager.MongoCluster.Models.EntraPrincipalType? EntraIdentityProviderPrincipalType { get { throw null; } set { } } + protected override void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.ResourceManager.MongoCluster.Models.EntraIdentityProvider System.ClientModel.Primitives.IJsonModel.Create(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + void System.ClientModel.Primitives.IJsonModel.Write(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.ResourceManager.MongoCluster.Models.EntraIdentityProvider 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 EntraIdentityProviderProperties : System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel + { + public EntraIdentityProviderProperties(Azure.ResourceManager.MongoCluster.Models.EntraPrincipalType principalType) { } + public Azure.ResourceManager.MongoCluster.Models.EntraPrincipalType PrincipalType { get { throw null; } set { } } + protected virtual void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.ResourceManager.MongoCluster.Models.EntraIdentityProviderProperties System.ClientModel.Primitives.IJsonModel.Create(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + void System.ClientModel.Primitives.IJsonModel.Write(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.ResourceManager.MongoCluster.Models.EntraIdentityProviderProperties System.ClientModel.Primitives.IPersistableModel.Create(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + string System.ClientModel.Primitives.IPersistableModel.GetFormatFromOptions(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + System.BinaryData System.ClientModel.Primitives.IPersistableModel.Write(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + } + [System.Runtime.InteropServices.StructLayoutAttribute(System.Runtime.InteropServices.LayoutKind.Sequential)] + public readonly partial struct EntraPrincipalType : System.IEquatable + { + private readonly object _dummy; + private readonly int _dummyPrimitive; + public EntraPrincipalType(string value) { throw null; } + public static Azure.ResourceManager.MongoCluster.Models.EntraPrincipalType ServiePrincipal { get { throw null; } } + public static Azure.ResourceManager.MongoCluster.Models.EntraPrincipalType User { get { throw null; } } + public bool Equals(Azure.ResourceManager.MongoCluster.Models.EntraPrincipalType other) { throw null; } + [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] + public override bool Equals(object obj) { throw null; } + [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] + public override int GetHashCode() { throw null; } + public static bool operator ==(Azure.ResourceManager.MongoCluster.Models.EntraPrincipalType left, Azure.ResourceManager.MongoCluster.Models.EntraPrincipalType right) { throw null; } + public static implicit operator Azure.ResourceManager.MongoCluster.Models.EntraPrincipalType (string value) { throw null; } + public static bool operator !=(Azure.ResourceManager.MongoCluster.Models.EntraPrincipalType left, Azure.ResourceManager.MongoCluster.Models.EntraPrincipalType right) { throw null; } + public override string ToString() { throw null; } } [System.Runtime.InteropServices.StructLayoutAttribute(System.Runtime.InteropServices.LayoutKind.Sequential)] public readonly partial struct HighAvailabilityMode : System.IEquatable @@ -245,6 +387,16 @@ public static partial class ArmMongoClusterModelFactory public static bool operator !=(Azure.ResourceManager.MongoCluster.Models.HighAvailabilityMode left, Azure.ResourceManager.MongoCluster.Models.HighAvailabilityMode right) { throw null; } public override string ToString() { throw null; } } + public abstract partial class IdentityProvider : System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel + { + protected IdentityProvider() { } + protected virtual void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.ResourceManager.MongoCluster.Models.IdentityProvider System.ClientModel.Primitives.IJsonModel.Create(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + void System.ClientModel.Primitives.IJsonModel.Write(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.ResourceManager.MongoCluster.Models.IdentityProvider 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 MongoClusterAdministratorProperties : System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel { public MongoClusterAdministratorProperties() { } @@ -525,11 +677,13 @@ public partial class MongoClusterProperties : System.ClientModel.Primitives.IJso { public MongoClusterProperties() { } public Azure.ResourceManager.MongoCluster.Models.MongoClusterAdministratorProperties Administrator { get { throw null; } set { } } + public System.Collections.Generic.IList AuthConfigAllowedModes { get { throw null; } } public string BackupEarliestRestoreTime { get { throw null; } } public Azure.ResourceManager.MongoCluster.Models.MongoClusterStatus? ClusterStatus { get { throw null; } } public string ComputeTier { get { throw null; } set { } } public string ConnectionString { get { throw null; } } public Azure.ResourceManager.MongoCluster.Models.MongoClusterCreateMode? CreateMode { get { throw null; } set { } } + public Azure.ResourceManager.MongoCluster.Models.DataApiMode? DataApiMode { get { throw null; } set { } } public Azure.ResourceManager.MongoCluster.Models.HighAvailabilityMode? HighAvailabilityTargetMode { get { throw null; } set { } } public string InfrastructureVersion { get { throw null; } } public System.Collections.Generic.IList PreviewFeatures { get { throw null; } } @@ -541,7 +695,7 @@ public MongoClusterProperties() { } public Azure.ResourceManager.MongoCluster.Models.MongoClusterRestoreContent RestoreParameters { get { throw null; } set { } } public string ServerVersion { get { throw null; } set { } } public int? ShardingShardCount { get { throw null; } set { } } - public long? StorageSizeGb { get { throw null; } set { } } + public Azure.ResourceManager.MongoCluster.Models.StorageProperties Storage { get { throw null; } set { } } protected virtual void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } Azure.ResourceManager.MongoCluster.Models.MongoClusterProperties System.ClientModel.Primitives.IJsonModel.Create(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } void System.ClientModel.Primitives.IJsonModel.Write(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } @@ -705,14 +859,16 @@ public partial class MongoClusterUpdateProperties : System.ClientModel.Primitive { public MongoClusterUpdateProperties() { } public Azure.ResourceManager.MongoCluster.Models.MongoClusterAdministratorProperties Administrator { get { throw null; } set { } } + public System.Collections.Generic.IList AuthConfigAllowedModes { get { throw null; } } public string BackupEarliestRestoreTime { get { throw null; } } public string ComputeTier { get { throw null; } set { } } + public Azure.ResourceManager.MongoCluster.Models.DataApiMode? DataApiMode { get { throw null; } set { } } public Azure.ResourceManager.MongoCluster.Models.HighAvailabilityMode? HighAvailabilityTargetMode { get { throw null; } set { } } public System.Collections.Generic.IList PreviewFeatures { get { throw null; } } public Azure.ResourceManager.MongoCluster.Models.MongoClusterPublicNetworkAccess? PublicNetworkAccess { get { throw null; } set { } } public string ServerVersion { get { throw null; } set { } } public int? ShardingShardCount { get { throw null; } set { } } - public long? StorageSizeGb { get { throw null; } set { } } + public Azure.ResourceManager.MongoCluster.Models.StorageProperties Storage { get { throw null; } set { } } protected virtual void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } Azure.ResourceManager.MongoCluster.Models.MongoClusterUpdateProperties System.ClientModel.Primitives.IJsonModel.Create(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } void System.ClientModel.Primitives.IJsonModel.Write(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } @@ -732,4 +888,66 @@ protected virtual void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer 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 StorageProperties : System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel + { + public StorageProperties() { } + public long? Iops { get { throw null; } set { } } + public long? SizeGb { get { throw null; } set { } } + public long? Throughput { get { throw null; } set { } } + public Azure.ResourceManager.MongoCluster.Models.StorageType? Type { get { throw null; } set { } } + protected virtual void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.ResourceManager.MongoCluster.Models.StorageProperties System.ClientModel.Primitives.IJsonModel.Create(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + void System.ClientModel.Primitives.IJsonModel.Write(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.ResourceManager.MongoCluster.Models.StorageProperties System.ClientModel.Primitives.IPersistableModel.Create(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + string System.ClientModel.Primitives.IPersistableModel.GetFormatFromOptions(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + System.BinaryData System.ClientModel.Primitives.IPersistableModel.Write(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + } + [System.Runtime.InteropServices.StructLayoutAttribute(System.Runtime.InteropServices.LayoutKind.Sequential)] + public readonly partial struct StorageType : System.IEquatable + { + private readonly object _dummy; + private readonly int _dummyPrimitive; + public StorageType(string value) { throw null; } + public static Azure.ResourceManager.MongoCluster.Models.StorageType PremiumSSD { get { throw null; } } + public static Azure.ResourceManager.MongoCluster.Models.StorageType PremiumSSDv2 { get { throw null; } } + public bool Equals(Azure.ResourceManager.MongoCluster.Models.StorageType other) { throw null; } + [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] + public override bool Equals(object obj) { throw null; } + [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] + public override int GetHashCode() { throw null; } + public static bool operator ==(Azure.ResourceManager.MongoCluster.Models.StorageType left, Azure.ResourceManager.MongoCluster.Models.StorageType right) { throw null; } + public static implicit operator Azure.ResourceManager.MongoCluster.Models.StorageType (string value) { throw null; } + public static bool operator !=(Azure.ResourceManager.MongoCluster.Models.StorageType left, Azure.ResourceManager.MongoCluster.Models.StorageType right) { throw null; } + public override string ToString() { throw null; } + } + public partial class UserProperties : System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel + { + public UserProperties() { } + public Azure.ResourceManager.MongoCluster.Models.IdentityProvider IdentityProvider { get { throw null; } set { } } + public Azure.ResourceManager.MongoCluster.Models.MongoClusterProvisioningState? ProvisioningState { get { throw null; } } + public System.Collections.Generic.IList Roles { get { throw null; } } + protected virtual void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.ResourceManager.MongoCluster.Models.UserProperties System.ClientModel.Primitives.IJsonModel.Create(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + void System.ClientModel.Primitives.IJsonModel.Write(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.ResourceManager.MongoCluster.Models.UserProperties System.ClientModel.Primitives.IPersistableModel.Create(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + string System.ClientModel.Primitives.IPersistableModel.GetFormatFromOptions(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + System.BinaryData System.ClientModel.Primitives.IPersistableModel.Write(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + } + [System.Runtime.InteropServices.StructLayoutAttribute(System.Runtime.InteropServices.LayoutKind.Sequential)] + public readonly partial struct UserRole : System.IEquatable + { + private readonly object _dummy; + private readonly int _dummyPrimitive; + public UserRole(string value) { throw null; } + public static Azure.ResourceManager.MongoCluster.Models.UserRole DatabaseOwner { get { throw null; } } + public bool Equals(Azure.ResourceManager.MongoCluster.Models.UserRole other) { throw null; } + [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] + public override bool Equals(object obj) { throw null; } + [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] + public override int GetHashCode() { throw null; } + public static bool operator ==(Azure.ResourceManager.MongoCluster.Models.UserRole left, Azure.ResourceManager.MongoCluster.Models.UserRole right) { throw null; } + public static implicit operator Azure.ResourceManager.MongoCluster.Models.UserRole (string value) { throw null; } + public static bool operator !=(Azure.ResourceManager.MongoCluster.Models.UserRole left, Azure.ResourceManager.MongoCluster.Models.UserRole right) { throw null; } + public override string ToString() { throw null; } + } } diff --git a/sdk/mongocluster/Azure.ResourceManager.MongoCluster/api/Azure.ResourceManager.MongoCluster.netstandard2.0.cs b/sdk/mongocluster/Azure.ResourceManager.MongoCluster/api/Azure.ResourceManager.MongoCluster.netstandard2.0.cs index 92741a64fc87..02e639506649 100644 --- a/sdk/mongocluster/Azure.ResourceManager.MongoCluster/api/Azure.ResourceManager.MongoCluster.netstandard2.0.cs +++ b/sdk/mongocluster/Azure.ResourceManager.MongoCluster/api/Azure.ResourceManager.MongoCluster.netstandard2.0.cs @@ -46,6 +46,7 @@ public static partial class MongoClusterExtensions public static Azure.ResourceManager.MongoCluster.MongoClusterCollection GetMongoClusters(this Azure.ResourceManager.Resources.ResourceGroupResource resourceGroupResource) { throw null; } public static Azure.Pageable GetMongoClusters(this Azure.ResourceManager.Resources.SubscriptionResource subscriptionResource, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } public static Azure.AsyncPageable GetMongoClustersAsync(this Azure.ResourceManager.Resources.SubscriptionResource subscriptionResource, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public static Azure.ResourceManager.MongoCluster.UserResource GetUserResource(this Azure.ResourceManager.ArmClient client, Azure.Core.ResourceIdentifier id) { throw null; } } public partial class MongoClusterFirewallRuleCollection : Azure.ResourceManager.ArmCollection, System.Collections.Generic.IAsyncEnumerable, System.Collections.Generic.IEnumerable, System.Collections.IEnumerable { @@ -166,6 +167,9 @@ protected MongoClusterResource() { } public virtual Azure.AsyncPageable GetPrivateLinksAsync(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } public virtual Azure.Pageable GetReplicasByParent(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } public virtual Azure.AsyncPageable GetReplicasByParentAsync(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Response GetUser(string userName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> GetUserAsync(string userName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.ResourceManager.MongoCluster.UserCollection GetUsers() { throw null; } public virtual Azure.ResourceManager.ArmOperation Promote(Azure.WaitUntil waitUntil, Azure.ResourceManager.MongoCluster.Models.PromoteReplicaContent content, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } public virtual System.Threading.Tasks.Task PromoteAsync(Azure.WaitUntil waitUntil, Azure.ResourceManager.MongoCluster.Models.PromoteReplicaContent content, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } public virtual Azure.Response RemoveTag(string key, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } @@ -180,6 +184,53 @@ protected MongoClusterResource() { } public virtual Azure.ResourceManager.ArmOperation Update(Azure.WaitUntil waitUntil, Azure.ResourceManager.MongoCluster.Models.MongoClusterPatch patch, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } public virtual System.Threading.Tasks.Task> UpdateAsync(Azure.WaitUntil waitUntil, Azure.ResourceManager.MongoCluster.Models.MongoClusterPatch patch, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } } + public partial class UserCollection : Azure.ResourceManager.ArmCollection, System.Collections.Generic.IAsyncEnumerable, System.Collections.Generic.IEnumerable, System.Collections.IEnumerable + { + protected UserCollection() { } + public virtual Azure.ResourceManager.ArmOperation CreateOrUpdate(Azure.WaitUntil waitUntil, string userName, Azure.ResourceManager.MongoCluster.UserData data, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> CreateOrUpdateAsync(Azure.WaitUntil waitUntil, string userName, Azure.ResourceManager.MongoCluster.UserData data, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Response Exists(string userName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> ExistsAsync(string userName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Response Get(string userName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Pageable GetAll(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.AsyncPageable GetAllAsync(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> GetAsync(string userName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.NullableResponse GetIfExists(string userName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> GetIfExistsAsync(string userName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + System.Collections.Generic.IAsyncEnumerator System.Collections.Generic.IAsyncEnumerable.GetAsyncEnumerator(System.Threading.CancellationToken cancellationToken) { throw null; } + System.Collections.Generic.IEnumerator System.Collections.Generic.IEnumerable.GetEnumerator() { throw null; } + System.Collections.IEnumerator System.Collections.IEnumerable.GetEnumerator() { throw null; } + } + public partial class UserData : Azure.ResourceManager.Models.ResourceData, System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel + { + public UserData() { } + public Azure.ResourceManager.MongoCluster.Models.UserProperties Properties { get { throw null; } set { } } + protected override void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.ResourceManager.MongoCluster.UserData System.ClientModel.Primitives.IJsonModel.Create(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + void System.ClientModel.Primitives.IJsonModel.Write(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.ResourceManager.MongoCluster.UserData 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 UserResource : Azure.ResourceManager.ArmResource, System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel + { + public static readonly Azure.Core.ResourceType ResourceType; + protected UserResource() { } + public virtual Azure.ResourceManager.MongoCluster.UserData Data { get { throw null; } } + public virtual bool HasData { get { throw null; } } + public static Azure.Core.ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string mongoClusterName, string userName) { throw null; } + public virtual Azure.ResourceManager.ArmOperation Delete(Azure.WaitUntil waitUntil, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task DeleteAsync(Azure.WaitUntil waitUntil, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Response Get(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> GetAsync(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + Azure.ResourceManager.MongoCluster.UserData System.ClientModel.Primitives.IJsonModel.Create(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + void System.ClientModel.Primitives.IJsonModel.Write(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.ResourceManager.MongoCluster.UserData System.ClientModel.Primitives.IPersistableModel.Create(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + string System.ClientModel.Primitives.IPersistableModel.GetFormatFromOptions(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + System.BinaryData System.ClientModel.Primitives.IPersistableModel.Write(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + public virtual Azure.ResourceManager.ArmOperation Update(Azure.WaitUntil waitUntil, Azure.ResourceManager.MongoCluster.UserData data, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> UpdateAsync(Azure.WaitUntil waitUntil, Azure.ResourceManager.MongoCluster.UserData data, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + } } namespace Azure.ResourceManager.MongoCluster.Mocking { @@ -189,6 +240,7 @@ protected MockableMongoClusterArmClient() { } public virtual Azure.ResourceManager.MongoCluster.MongoClusterFirewallRuleResource GetMongoClusterFirewallRuleResource(Azure.Core.ResourceIdentifier id) { throw null; } public virtual Azure.ResourceManager.MongoCluster.MongoClusterPrivateEndpointConnectionResource GetMongoClusterPrivateEndpointConnectionResource(Azure.Core.ResourceIdentifier id) { throw null; } public virtual Azure.ResourceManager.MongoCluster.MongoClusterResource GetMongoClusterResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.MongoCluster.UserResource GetUserResource(Azure.Core.ResourceIdentifier id) { throw null; } } public partial class MockableMongoClusterResourceGroupResource : Azure.ResourceManager.ArmResource { @@ -221,10 +273,100 @@ public static partial class ArmMongoClusterModelFactory public static Azure.ResourceManager.MongoCluster.MongoClusterPrivateEndpointConnectionResourceData MongoClusterPrivateEndpointConnectionResourceData(Azure.Core.ResourceIdentifier id = null, string name = null, Azure.Core.ResourceType resourceType = default(Azure.Core.ResourceType), Azure.ResourceManager.Models.SystemData systemData = null, Azure.ResourceManager.MongoCluster.Models.MongoClusterPrivateEndpointConnectionProperties properties = null) { throw null; } public static Azure.ResourceManager.MongoCluster.Models.MongoClusterPrivateLinkResourceData MongoClusterPrivateLinkResourceData(Azure.Core.ResourceIdentifier id = null, string name = null, Azure.Core.ResourceType resourceType = default(Azure.Core.ResourceType), Azure.ResourceManager.Models.SystemData systemData = null, Azure.ResourceManager.MongoCluster.Models.MongoClusterPrivateLinkResourceProperties properties = null) { throw null; } public static Azure.ResourceManager.MongoCluster.Models.MongoClusterPrivateLinkResourceProperties MongoClusterPrivateLinkResourceProperties(string groupId = null, System.Collections.Generic.IEnumerable requiredMembers = null, System.Collections.Generic.IEnumerable requiredZoneNames = null) { throw null; } - public static Azure.ResourceManager.MongoCluster.Models.MongoClusterProperties MongoClusterProperties(Azure.ResourceManager.MongoCluster.Models.MongoClusterCreateMode? createMode = default(Azure.ResourceManager.MongoCluster.Models.MongoClusterCreateMode?), Azure.ResourceManager.MongoCluster.Models.MongoClusterRestoreContent restoreParameters = null, Azure.ResourceManager.MongoCluster.Models.MongoClusterReplicaContent replicaParameters = null, Azure.ResourceManager.MongoCluster.Models.MongoClusterAdministratorProperties administrator = null, string serverVersion = null, string connectionString = null, Azure.ResourceManager.MongoCluster.Models.MongoClusterProvisioningState? provisioningState = default(Azure.ResourceManager.MongoCluster.Models.MongoClusterProvisioningState?), Azure.ResourceManager.MongoCluster.Models.MongoClusterStatus? clusterStatus = default(Azure.ResourceManager.MongoCluster.Models.MongoClusterStatus?), Azure.ResourceManager.MongoCluster.Models.MongoClusterPublicNetworkAccess? publicNetworkAccess = default(Azure.ResourceManager.MongoCluster.Models.MongoClusterPublicNetworkAccess?), Azure.ResourceManager.MongoCluster.Models.HighAvailabilityMode? highAvailabilityTargetMode = default(Azure.ResourceManager.MongoCluster.Models.HighAvailabilityMode?), long? storageSizeGb = default(long?), int? shardingShardCount = default(int?), string computeTier = null, string backupEarliestRestoreTime = null, System.Collections.Generic.IEnumerable privateEndpointConnections = null, System.Collections.Generic.IEnumerable previewFeatures = null, Azure.ResourceManager.MongoCluster.Models.MongoClusterReplicationProperties replica = null, string infrastructureVersion = null) { throw null; } + public static Azure.ResourceManager.MongoCluster.Models.MongoClusterProperties MongoClusterProperties(Azure.ResourceManager.MongoCluster.Models.MongoClusterCreateMode? createMode = default(Azure.ResourceManager.MongoCluster.Models.MongoClusterCreateMode?), Azure.ResourceManager.MongoCluster.Models.MongoClusterRestoreContent restoreParameters = null, Azure.ResourceManager.MongoCluster.Models.MongoClusterReplicaContent replicaParameters = null, Azure.ResourceManager.MongoCluster.Models.MongoClusterAdministratorProperties administrator = null, string serverVersion = null, string connectionString = null, Azure.ResourceManager.MongoCluster.Models.MongoClusterProvisioningState? provisioningState = default(Azure.ResourceManager.MongoCluster.Models.MongoClusterProvisioningState?), Azure.ResourceManager.MongoCluster.Models.MongoClusterStatus? clusterStatus = default(Azure.ResourceManager.MongoCluster.Models.MongoClusterStatus?), Azure.ResourceManager.MongoCluster.Models.MongoClusterPublicNetworkAccess? publicNetworkAccess = default(Azure.ResourceManager.MongoCluster.Models.MongoClusterPublicNetworkAccess?), Azure.ResourceManager.MongoCluster.Models.HighAvailabilityMode? highAvailabilityTargetMode = default(Azure.ResourceManager.MongoCluster.Models.HighAvailabilityMode?), Azure.ResourceManager.MongoCluster.Models.StorageProperties storage = null, int? shardingShardCount = default(int?), string computeTier = null, string backupEarliestRestoreTime = null, Azure.ResourceManager.MongoCluster.Models.DataApiMode? dataApiMode = default(Azure.ResourceManager.MongoCluster.Models.DataApiMode?), System.Collections.Generic.IEnumerable privateEndpointConnections = null, System.Collections.Generic.IEnumerable previewFeatures = null, Azure.ResourceManager.MongoCluster.Models.MongoClusterReplicationProperties replica = null, string infrastructureVersion = null, System.Collections.Generic.IEnumerable authConfigAllowedModes = null) { throw null; } public static Azure.ResourceManager.MongoCluster.Models.MongoClusterReplica MongoClusterReplica(Azure.Core.ResourceIdentifier id = null, string name = null, Azure.Core.ResourceType resourceType = default(Azure.Core.ResourceType), Azure.ResourceManager.Models.SystemData systemData = null, Azure.ResourceManager.MongoCluster.Models.MongoClusterProperties properties = null) { throw null; } public static Azure.ResourceManager.MongoCluster.Models.MongoClusterReplicationProperties MongoClusterReplicationProperties(Azure.Core.ResourceIdentifier sourceResourceId = null, Azure.ResourceManager.MongoCluster.Models.MongoClusterReplicationRole? role = default(Azure.ResourceManager.MongoCluster.Models.MongoClusterReplicationRole?), Azure.ResourceManager.MongoCluster.Models.MongoClusterReplicationState? replicationState = default(Azure.ResourceManager.MongoCluster.Models.MongoClusterReplicationState?)) { throw null; } public static Azure.ResourceManager.MongoCluster.Models.PromoteReplicaContent PromoteReplicaContent(Azure.ResourceManager.MongoCluster.Models.MongoClusterPromoteOption promoteOption = default(Azure.ResourceManager.MongoCluster.Models.MongoClusterPromoteOption), Azure.ResourceManager.MongoCluster.Models.MongoClusterPromoteMode? mode = default(Azure.ResourceManager.MongoCluster.Models.MongoClusterPromoteMode?)) { throw null; } + public static Azure.ResourceManager.MongoCluster.UserData UserData(Azure.Core.ResourceIdentifier id = null, string name = null, Azure.Core.ResourceType resourceType = default(Azure.Core.ResourceType), Azure.ResourceManager.Models.SystemData systemData = null, Azure.ResourceManager.MongoCluster.Models.UserProperties properties = null) { throw null; } + public static Azure.ResourceManager.MongoCluster.Models.UserProperties UserProperties(Azure.ResourceManager.MongoCluster.Models.MongoClusterProvisioningState? provisioningState = default(Azure.ResourceManager.MongoCluster.Models.MongoClusterProvisioningState?), Azure.ResourceManager.MongoCluster.Models.IdentityProvider identityProvider = null, System.Collections.Generic.IEnumerable roles = null) { throw null; } + } + [System.Runtime.InteropServices.StructLayoutAttribute(System.Runtime.InteropServices.LayoutKind.Sequential)] + public readonly partial struct AuthenticationMode : System.IEquatable + { + private readonly object _dummy; + private readonly int _dummyPrimitive; + public AuthenticationMode(string value) { throw null; } + public static Azure.ResourceManager.MongoCluster.Models.AuthenticationMode MicrosoftEntraId { get { throw null; } } + public static Azure.ResourceManager.MongoCluster.Models.AuthenticationMode NativeAuth { get { throw null; } } + public bool Equals(Azure.ResourceManager.MongoCluster.Models.AuthenticationMode other) { throw null; } + [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] + public override bool Equals(object obj) { throw null; } + [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] + public override int GetHashCode() { throw null; } + public static bool operator ==(Azure.ResourceManager.MongoCluster.Models.AuthenticationMode left, Azure.ResourceManager.MongoCluster.Models.AuthenticationMode right) { throw null; } + public static implicit operator Azure.ResourceManager.MongoCluster.Models.AuthenticationMode (string value) { throw null; } + public static bool operator !=(Azure.ResourceManager.MongoCluster.Models.AuthenticationMode left, Azure.ResourceManager.MongoCluster.Models.AuthenticationMode right) { throw null; } + public override string ToString() { throw null; } + } + [System.Runtime.InteropServices.StructLayoutAttribute(System.Runtime.InteropServices.LayoutKind.Sequential)] + public readonly partial struct DataApiMode : System.IEquatable + { + private readonly object _dummy; + private readonly int _dummyPrimitive; + public DataApiMode(string value) { throw null; } + public static Azure.ResourceManager.MongoCluster.Models.DataApiMode Disabled { get { throw null; } } + public static Azure.ResourceManager.MongoCluster.Models.DataApiMode Enabled { get { throw null; } } + public bool Equals(Azure.ResourceManager.MongoCluster.Models.DataApiMode other) { throw null; } + [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] + public override bool Equals(object obj) { throw null; } + [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] + public override int GetHashCode() { throw null; } + public static bool operator ==(Azure.ResourceManager.MongoCluster.Models.DataApiMode left, Azure.ResourceManager.MongoCluster.Models.DataApiMode right) { throw null; } + public static implicit operator Azure.ResourceManager.MongoCluster.Models.DataApiMode (string value) { throw null; } + public static bool operator !=(Azure.ResourceManager.MongoCluster.Models.DataApiMode left, Azure.ResourceManager.MongoCluster.Models.DataApiMode right) { throw null; } + public override string ToString() { throw null; } + } + public partial class DatabaseRole : System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel + { + public DatabaseRole(string db, Azure.ResourceManager.MongoCluster.Models.UserRole role) { } + public string Db { get { throw null; } set { } } + public Azure.ResourceManager.MongoCluster.Models.UserRole Role { get { throw null; } set { } } + protected virtual void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.ResourceManager.MongoCluster.Models.DatabaseRole System.ClientModel.Primitives.IJsonModel.Create(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + void System.ClientModel.Primitives.IJsonModel.Write(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.ResourceManager.MongoCluster.Models.DatabaseRole 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 EntraIdentityProvider : Azure.ResourceManager.MongoCluster.Models.IdentityProvider, System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel + { + public EntraIdentityProvider(Azure.ResourceManager.MongoCluster.Models.EntraIdentityProviderProperties properties) { } + public Azure.ResourceManager.MongoCluster.Models.EntraPrincipalType? EntraIdentityProviderPrincipalType { get { throw null; } set { } } + protected override void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.ResourceManager.MongoCluster.Models.EntraIdentityProvider System.ClientModel.Primitives.IJsonModel.Create(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + void System.ClientModel.Primitives.IJsonModel.Write(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.ResourceManager.MongoCluster.Models.EntraIdentityProvider 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 EntraIdentityProviderProperties : System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel + { + public EntraIdentityProviderProperties(Azure.ResourceManager.MongoCluster.Models.EntraPrincipalType principalType) { } + public Azure.ResourceManager.MongoCluster.Models.EntraPrincipalType PrincipalType { get { throw null; } set { } } + protected virtual void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.ResourceManager.MongoCluster.Models.EntraIdentityProviderProperties System.ClientModel.Primitives.IJsonModel.Create(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + void System.ClientModel.Primitives.IJsonModel.Write(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.ResourceManager.MongoCluster.Models.EntraIdentityProviderProperties System.ClientModel.Primitives.IPersistableModel.Create(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + string System.ClientModel.Primitives.IPersistableModel.GetFormatFromOptions(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + System.BinaryData System.ClientModel.Primitives.IPersistableModel.Write(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + } + [System.Runtime.InteropServices.StructLayoutAttribute(System.Runtime.InteropServices.LayoutKind.Sequential)] + public readonly partial struct EntraPrincipalType : System.IEquatable + { + private readonly object _dummy; + private readonly int _dummyPrimitive; + public EntraPrincipalType(string value) { throw null; } + public static Azure.ResourceManager.MongoCluster.Models.EntraPrincipalType ServiePrincipal { get { throw null; } } + public static Azure.ResourceManager.MongoCluster.Models.EntraPrincipalType User { get { throw null; } } + public bool Equals(Azure.ResourceManager.MongoCluster.Models.EntraPrincipalType other) { throw null; } + [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] + public override bool Equals(object obj) { throw null; } + [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] + public override int GetHashCode() { throw null; } + public static bool operator ==(Azure.ResourceManager.MongoCluster.Models.EntraPrincipalType left, Azure.ResourceManager.MongoCluster.Models.EntraPrincipalType right) { throw null; } + public static implicit operator Azure.ResourceManager.MongoCluster.Models.EntraPrincipalType (string value) { throw null; } + public static bool operator !=(Azure.ResourceManager.MongoCluster.Models.EntraPrincipalType left, Azure.ResourceManager.MongoCluster.Models.EntraPrincipalType right) { throw null; } + public override string ToString() { throw null; } } [System.Runtime.InteropServices.StructLayoutAttribute(System.Runtime.InteropServices.LayoutKind.Sequential)] public readonly partial struct HighAvailabilityMode : System.IEquatable @@ -245,6 +387,16 @@ public static partial class ArmMongoClusterModelFactory public static bool operator !=(Azure.ResourceManager.MongoCluster.Models.HighAvailabilityMode left, Azure.ResourceManager.MongoCluster.Models.HighAvailabilityMode right) { throw null; } public override string ToString() { throw null; } } + public abstract partial class IdentityProvider : System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel + { + protected IdentityProvider() { } + protected virtual void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.ResourceManager.MongoCluster.Models.IdentityProvider System.ClientModel.Primitives.IJsonModel.Create(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + void System.ClientModel.Primitives.IJsonModel.Write(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.ResourceManager.MongoCluster.Models.IdentityProvider 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 MongoClusterAdministratorProperties : System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel { public MongoClusterAdministratorProperties() { } @@ -525,11 +677,13 @@ public partial class MongoClusterProperties : System.ClientModel.Primitives.IJso { public MongoClusterProperties() { } public Azure.ResourceManager.MongoCluster.Models.MongoClusterAdministratorProperties Administrator { get { throw null; } set { } } + public System.Collections.Generic.IList AuthConfigAllowedModes { get { throw null; } } public string BackupEarliestRestoreTime { get { throw null; } } public Azure.ResourceManager.MongoCluster.Models.MongoClusterStatus? ClusterStatus { get { throw null; } } public string ComputeTier { get { throw null; } set { } } public string ConnectionString { get { throw null; } } public Azure.ResourceManager.MongoCluster.Models.MongoClusterCreateMode? CreateMode { get { throw null; } set { } } + public Azure.ResourceManager.MongoCluster.Models.DataApiMode? DataApiMode { get { throw null; } set { } } public Azure.ResourceManager.MongoCluster.Models.HighAvailabilityMode? HighAvailabilityTargetMode { get { throw null; } set { } } public string InfrastructureVersion { get { throw null; } } public System.Collections.Generic.IList PreviewFeatures { get { throw null; } } @@ -541,7 +695,7 @@ public MongoClusterProperties() { } public Azure.ResourceManager.MongoCluster.Models.MongoClusterRestoreContent RestoreParameters { get { throw null; } set { } } public string ServerVersion { get { throw null; } set { } } public int? ShardingShardCount { get { throw null; } set { } } - public long? StorageSizeGb { get { throw null; } set { } } + public Azure.ResourceManager.MongoCluster.Models.StorageProperties Storage { get { throw null; } set { } } protected virtual void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } Azure.ResourceManager.MongoCluster.Models.MongoClusterProperties System.ClientModel.Primitives.IJsonModel.Create(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } void System.ClientModel.Primitives.IJsonModel.Write(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } @@ -705,14 +859,16 @@ public partial class MongoClusterUpdateProperties : System.ClientModel.Primitive { public MongoClusterUpdateProperties() { } public Azure.ResourceManager.MongoCluster.Models.MongoClusterAdministratorProperties Administrator { get { throw null; } set { } } + public System.Collections.Generic.IList AuthConfigAllowedModes { get { throw null; } } public string BackupEarliestRestoreTime { get { throw null; } } public string ComputeTier { get { throw null; } set { } } + public Azure.ResourceManager.MongoCluster.Models.DataApiMode? DataApiMode { get { throw null; } set { } } public Azure.ResourceManager.MongoCluster.Models.HighAvailabilityMode? HighAvailabilityTargetMode { get { throw null; } set { } } public System.Collections.Generic.IList PreviewFeatures { get { throw null; } } public Azure.ResourceManager.MongoCluster.Models.MongoClusterPublicNetworkAccess? PublicNetworkAccess { get { throw null; } set { } } public string ServerVersion { get { throw null; } set { } } public int? ShardingShardCount { get { throw null; } set { } } - public long? StorageSizeGb { get { throw null; } set { } } + public Azure.ResourceManager.MongoCluster.Models.StorageProperties Storage { get { throw null; } set { } } protected virtual void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } Azure.ResourceManager.MongoCluster.Models.MongoClusterUpdateProperties System.ClientModel.Primitives.IJsonModel.Create(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } void System.ClientModel.Primitives.IJsonModel.Write(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } @@ -732,4 +888,66 @@ protected virtual void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer 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 StorageProperties : System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel + { + public StorageProperties() { } + public long? Iops { get { throw null; } set { } } + public long? SizeGb { get { throw null; } set { } } + public long? Throughput { get { throw null; } set { } } + public Azure.ResourceManager.MongoCluster.Models.StorageType? Type { get { throw null; } set { } } + protected virtual void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.ResourceManager.MongoCluster.Models.StorageProperties System.ClientModel.Primitives.IJsonModel.Create(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + void System.ClientModel.Primitives.IJsonModel.Write(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.ResourceManager.MongoCluster.Models.StorageProperties System.ClientModel.Primitives.IPersistableModel.Create(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + string System.ClientModel.Primitives.IPersistableModel.GetFormatFromOptions(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + System.BinaryData System.ClientModel.Primitives.IPersistableModel.Write(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + } + [System.Runtime.InteropServices.StructLayoutAttribute(System.Runtime.InteropServices.LayoutKind.Sequential)] + public readonly partial struct StorageType : System.IEquatable + { + private readonly object _dummy; + private readonly int _dummyPrimitive; + public StorageType(string value) { throw null; } + public static Azure.ResourceManager.MongoCluster.Models.StorageType PremiumSSD { get { throw null; } } + public static Azure.ResourceManager.MongoCluster.Models.StorageType PremiumSSDv2 { get { throw null; } } + public bool Equals(Azure.ResourceManager.MongoCluster.Models.StorageType other) { throw null; } + [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] + public override bool Equals(object obj) { throw null; } + [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] + public override int GetHashCode() { throw null; } + public static bool operator ==(Azure.ResourceManager.MongoCluster.Models.StorageType left, Azure.ResourceManager.MongoCluster.Models.StorageType right) { throw null; } + public static implicit operator Azure.ResourceManager.MongoCluster.Models.StorageType (string value) { throw null; } + public static bool operator !=(Azure.ResourceManager.MongoCluster.Models.StorageType left, Azure.ResourceManager.MongoCluster.Models.StorageType right) { throw null; } + public override string ToString() { throw null; } + } + public partial class UserProperties : System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel + { + public UserProperties() { } + public Azure.ResourceManager.MongoCluster.Models.IdentityProvider IdentityProvider { get { throw null; } set { } } + public Azure.ResourceManager.MongoCluster.Models.MongoClusterProvisioningState? ProvisioningState { get { throw null; } } + public System.Collections.Generic.IList Roles { get { throw null; } } + protected virtual void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.ResourceManager.MongoCluster.Models.UserProperties System.ClientModel.Primitives.IJsonModel.Create(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + void System.ClientModel.Primitives.IJsonModel.Write(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.ResourceManager.MongoCluster.Models.UserProperties System.ClientModel.Primitives.IPersistableModel.Create(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + string System.ClientModel.Primitives.IPersistableModel.GetFormatFromOptions(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + System.BinaryData System.ClientModel.Primitives.IPersistableModel.Write(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + } + [System.Runtime.InteropServices.StructLayoutAttribute(System.Runtime.InteropServices.LayoutKind.Sequential)] + public readonly partial struct UserRole : System.IEquatable + { + private readonly object _dummy; + private readonly int _dummyPrimitive; + public UserRole(string value) { throw null; } + public static Azure.ResourceManager.MongoCluster.Models.UserRole DatabaseOwner { get { throw null; } } + public bool Equals(Azure.ResourceManager.MongoCluster.Models.UserRole other) { throw null; } + [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] + public override bool Equals(object obj) { throw null; } + [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] + public override int GetHashCode() { throw null; } + public static bool operator ==(Azure.ResourceManager.MongoCluster.Models.UserRole left, Azure.ResourceManager.MongoCluster.Models.UserRole right) { throw null; } + public static implicit operator Azure.ResourceManager.MongoCluster.Models.UserRole (string value) { throw null; } + public static bool operator !=(Azure.ResourceManager.MongoCluster.Models.UserRole left, Azure.ResourceManager.MongoCluster.Models.UserRole right) { throw null; } + public override string ToString() { throw null; } + } } diff --git a/sdk/mongocluster/Azure.ResourceManager.MongoCluster/samples/Generated/Samples/Sample_MongoClusterCollection.cs b/sdk/mongocluster/Azure.ResourceManager.MongoCluster/samples/Generated/Samples/Sample_MongoClusterCollection.cs index 3a1dea587e91..ad3dcf9f02a5 100644 --- a/sdk/mongocluster/Azure.ResourceManager.MongoCluster/samples/Generated/Samples/Sample_MongoClusterCollection.cs +++ b/sdk/mongocluster/Azure.ResourceManager.MongoCluster/samples/Generated/Samples/Sample_MongoClusterCollection.cs @@ -21,7 +21,7 @@ public partial class Sample_MongoClusterCollection [Ignore("Only validating compilation of examples")] public async Task CreateOrUpdate_CreatesANewMongoClusterResource() { - // Generated from example definition: 2024-07-01/MongoClusters_Create.json + // Generated from example definition: 2025-04-01-preview/MongoClusters_Create.json // this example is just showing the usage of "MongoCluster_CreateOrUpdate" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line @@ -52,7 +52,10 @@ public async Task CreateOrUpdate_CreatesANewMongoClusterResource() }, ServerVersion = "5.0", HighAvailabilityTargetMode = HighAvailabilityMode.SameZone, - StorageSizeGb = 128L, + Storage = new StorageProperties + { + SizeGb = 128L, + }, ShardingShardCount = 1, ComputeTier = "M30", }, @@ -71,7 +74,7 @@ public async Task CreateOrUpdate_CreatesANewMongoClusterResource() [Ignore("Only validating compilation of examples")] public async Task CreateOrUpdate_CreatesAReplicaMongoClusterResourceFromASourceResource() { - // Generated from example definition: 2024-07-01/MongoClusters_CreateGeoReplica.json + // Generated from example definition: 2025-04-01-preview/MongoClusters_CreateGeoReplica.json // this example is just showing the usage of "MongoCluster_CreateOrUpdate" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line @@ -113,7 +116,7 @@ public async Task CreateOrUpdate_CreatesAReplicaMongoClusterResourceFromASourceR [Ignore("Only validating compilation of examples")] public async Task CreateOrUpdate_CreatesAMongoClusterResourceFromAPointInTimeRestore() { - // Generated from example definition: 2024-07-01/MongoClusters_CreatePITR.json + // Generated from example definition: 2025-04-01-preview/MongoClusters_CreatePITR.json // this example is just showing the usage of "MongoCluster_CreateOrUpdate" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line @@ -159,7 +162,7 @@ public async Task CreateOrUpdate_CreatesAMongoClusterResourceFromAPointInTimeRes [Ignore("Only validating compilation of examples")] public async Task Get_GetsAMongoClusterResource() { - // Generated from example definition: 2024-07-01/MongoClusters_Get.json + // Generated from example definition: 2025-04-01-preview/MongoClusters_Get.json // this example is just showing the usage of "MongoCluster_Get" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line @@ -192,7 +195,7 @@ public async Task Get_GetsAMongoClusterResource() [Ignore("Only validating compilation of examples")] public async Task GetAll_ListsTheMongoClusterResourcesInAResourceGroup() { - // Generated from example definition: 2024-07-01/MongoClusters_ListByResourceGroup.json + // Generated from example definition: 2025-04-01-preview/MongoClusters_ListByResourceGroup.json // this example is just showing the usage of "MongoCluster_ListByResourceGroup" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line @@ -227,7 +230,7 @@ public async Task GetAll_ListsTheMongoClusterResourcesInAResourceGroup() [Ignore("Only validating compilation of examples")] public async Task Exists_GetsAMongoClusterResource() { - // Generated from example definition: 2024-07-01/MongoClusters_Get.json + // Generated from example definition: 2025-04-01-preview/MongoClusters_Get.json // this example is just showing the usage of "MongoCluster_Get" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line @@ -256,7 +259,7 @@ public async Task Exists_GetsAMongoClusterResource() [Ignore("Only validating compilation of examples")] public async Task GetIfExists_GetsAMongoClusterResource() { - // Generated from example definition: 2024-07-01/MongoClusters_Get.json + // Generated from example definition: 2025-04-01-preview/MongoClusters_Get.json // this example is just showing the usage of "MongoCluster_Get" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line diff --git a/sdk/mongocluster/Azure.ResourceManager.MongoCluster/samples/Generated/Samples/Sample_MongoClusterFirewallRuleCollection.cs b/sdk/mongocluster/Azure.ResourceManager.MongoCluster/samples/Generated/Samples/Sample_MongoClusterFirewallRuleCollection.cs index f95bd4dccd14..76894107886f 100644 --- a/sdk/mongocluster/Azure.ResourceManager.MongoCluster/samples/Generated/Samples/Sample_MongoClusterFirewallRuleCollection.cs +++ b/sdk/mongocluster/Azure.ResourceManager.MongoCluster/samples/Generated/Samples/Sample_MongoClusterFirewallRuleCollection.cs @@ -20,7 +20,7 @@ public partial class Sample_MongoClusterFirewallRuleCollection [Ignore("Only validating compilation of examples")] public async Task CreateOrUpdate_CreatesAFirewallRuleOnAMongoClusterResource() { - // Generated from example definition: 2024-07-01/MongoClusters_FirewallRuleCreate.json + // Generated from example definition: 2025-04-01-preview/MongoClusters_FirewallRuleCreate.json // this example is just showing the usage of "FirewallRule_CreateOrUpdate" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line @@ -59,7 +59,7 @@ public async Task CreateOrUpdate_CreatesAFirewallRuleOnAMongoClusterResource() [Ignore("Only validating compilation of examples")] public async Task Get_GetsAFirewallRuleOnAMongoClusterResource() { - // Generated from example definition: 2024-07-01/MongoClusters_FirewallRuleGet.json + // Generated from example definition: 2025-04-01-preview/MongoClusters_FirewallRuleGet.json // this example is just showing the usage of "FirewallRule_Get" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line @@ -93,7 +93,7 @@ public async Task Get_GetsAFirewallRuleOnAMongoClusterResource() [Ignore("Only validating compilation of examples")] public async Task GetAll_ListTheFirewallRulesOnAMongoClusterResource() { - // Generated from example definition: 2024-07-01/MongoClusters_FirewallRuleList.json + // Generated from example definition: 2025-04-01-preview/MongoClusters_FirewallRuleList.json // this example is just showing the usage of "FirewallRule_ListByMongoCluster" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line @@ -129,7 +129,7 @@ public async Task GetAll_ListTheFirewallRulesOnAMongoClusterResource() [Ignore("Only validating compilation of examples")] public async Task Exists_GetsAFirewallRuleOnAMongoClusterResource() { - // Generated from example definition: 2024-07-01/MongoClusters_FirewallRuleGet.json + // Generated from example definition: 2025-04-01-preview/MongoClusters_FirewallRuleGet.json // this example is just showing the usage of "FirewallRule_Get" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line @@ -159,7 +159,7 @@ public async Task Exists_GetsAFirewallRuleOnAMongoClusterResource() [Ignore("Only validating compilation of examples")] public async Task GetIfExists_GetsAFirewallRuleOnAMongoClusterResource() { - // Generated from example definition: 2024-07-01/MongoClusters_FirewallRuleGet.json + // Generated from example definition: 2025-04-01-preview/MongoClusters_FirewallRuleGet.json // this example is just showing the usage of "FirewallRule_Get" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line diff --git a/sdk/mongocluster/Azure.ResourceManager.MongoCluster/samples/Generated/Samples/Sample_MongoClusterFirewallRuleResource.cs b/sdk/mongocluster/Azure.ResourceManager.MongoCluster/samples/Generated/Samples/Sample_MongoClusterFirewallRuleResource.cs index d4aa354b7aaf..2c207cd816ff 100644 --- a/sdk/mongocluster/Azure.ResourceManager.MongoCluster/samples/Generated/Samples/Sample_MongoClusterFirewallRuleResource.cs +++ b/sdk/mongocluster/Azure.ResourceManager.MongoCluster/samples/Generated/Samples/Sample_MongoClusterFirewallRuleResource.cs @@ -20,7 +20,7 @@ public partial class Sample_MongoClusterFirewallRuleResource [Ignore("Only validating compilation of examples")] public async Task Get_GetsAFirewallRuleOnAMongoClusterResource() { - // Generated from example definition: 2024-07-01/MongoClusters_FirewallRuleGet.json + // Generated from example definition: 2025-04-01-preview/MongoClusters_FirewallRuleGet.json // this example is just showing the usage of "FirewallRule_Get" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line @@ -51,7 +51,7 @@ public async Task Get_GetsAFirewallRuleOnAMongoClusterResource() [Ignore("Only validating compilation of examples")] public async Task Delete_DeletesAFirewallRuleOnAMongoClusterResource() { - // Generated from example definition: 2024-07-01/MongoClusters_FirewallRuleDelete.json + // Generated from example definition: 2025-04-01-preview/MongoClusters_FirewallRuleDelete.json // this example is just showing the usage of "FirewallRule_Delete" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line @@ -78,7 +78,7 @@ public async Task Delete_DeletesAFirewallRuleOnAMongoClusterResource() [Ignore("Only validating compilation of examples")] public async Task Update_CreatesAFirewallRuleOnAMongoClusterResource() { - // Generated from example definition: 2024-07-01/MongoClusters_FirewallRuleCreate.json + // Generated from example definition: 2025-04-01-preview/MongoClusters_FirewallRuleCreate.json // this example is just showing the usage of "FirewallRule_CreateOrUpdate" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line diff --git a/sdk/mongocluster/Azure.ResourceManager.MongoCluster/samples/Generated/Samples/Sample_MongoClusterPrivateEndpointConnectionResource.cs b/sdk/mongocluster/Azure.ResourceManager.MongoCluster/samples/Generated/Samples/Sample_MongoClusterPrivateEndpointConnectionResource.cs index b613f615940e..78fe178e15ff 100644 --- a/sdk/mongocluster/Azure.ResourceManager.MongoCluster/samples/Generated/Samples/Sample_MongoClusterPrivateEndpointConnectionResource.cs +++ b/sdk/mongocluster/Azure.ResourceManager.MongoCluster/samples/Generated/Samples/Sample_MongoClusterPrivateEndpointConnectionResource.cs @@ -20,7 +20,7 @@ public partial class Sample_MongoClusterPrivateEndpointConnectionResource [Ignore("Only validating compilation of examples")] public async Task Get_GetAPrivateEndpointConnectionOnAMongoClusterResource() { - // Generated from example definition: 2024-07-01/MongoClusters_PrivateEndpointConnectionGet.json + // Generated from example definition: 2025-04-01-preview/MongoClusters_PrivateEndpointConnectionGet.json // this example is just showing the usage of "PrivateEndpointConnectionResource_Get" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line @@ -51,7 +51,7 @@ public async Task Get_GetAPrivateEndpointConnectionOnAMongoClusterResource() [Ignore("Only validating compilation of examples")] public async Task Delete_DeleteAPrivateEndpointConnectionOnAMongoClusterResource() { - // Generated from example definition: 2024-07-01/MongoClusters_PrivateEndpointConnectionDelete.json + // Generated from example definition: 2025-04-01-preview/MongoClusters_PrivateEndpointConnectionDelete.json // this example is just showing the usage of "PrivateEndpointConnectionResource_Delete" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line @@ -78,7 +78,7 @@ public async Task Delete_DeleteAPrivateEndpointConnectionOnAMongoClusterResource [Ignore("Only validating compilation of examples")] public async Task Update_ApprovesAPrivateEndpointConnectionOnAMongoClusterResource() { - // Generated from example definition: 2024-07-01/MongoClusters_PrivateEndpointConnectionPut.json + // Generated from example definition: 2025-04-01-preview/MongoClusters_PrivateEndpointConnectionPut.json // this example is just showing the usage of "PrivateEndpointConnectionResource_Create" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line diff --git a/sdk/mongocluster/Azure.ResourceManager.MongoCluster/samples/Generated/Samples/Sample_MongoClusterPrivateEndpointConnectionResourceCollection.cs b/sdk/mongocluster/Azure.ResourceManager.MongoCluster/samples/Generated/Samples/Sample_MongoClusterPrivateEndpointConnectionResourceCollection.cs index f0480e5f2648..98d13b3a5158 100644 --- a/sdk/mongocluster/Azure.ResourceManager.MongoCluster/samples/Generated/Samples/Sample_MongoClusterPrivateEndpointConnectionResourceCollection.cs +++ b/sdk/mongocluster/Azure.ResourceManager.MongoCluster/samples/Generated/Samples/Sample_MongoClusterPrivateEndpointConnectionResourceCollection.cs @@ -20,7 +20,7 @@ public partial class Sample_MongoClusterPrivateEndpointConnectionResourceCollect [Ignore("Only validating compilation of examples")] public async Task CreateOrUpdate_ApprovesAPrivateEndpointConnectionOnAMongoClusterResource() { - // Generated from example definition: 2024-07-01/MongoClusters_PrivateEndpointConnectionPut.json + // Generated from example definition: 2025-04-01-preview/MongoClusters_PrivateEndpointConnectionPut.json // this example is just showing the usage of "PrivateEndpointConnectionResource_Create" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line @@ -63,7 +63,7 @@ public async Task CreateOrUpdate_ApprovesAPrivateEndpointConnectionOnAMongoClust [Ignore("Only validating compilation of examples")] public async Task Get_GetAPrivateEndpointConnectionOnAMongoClusterResource() { - // Generated from example definition: 2024-07-01/MongoClusters_PrivateEndpointConnectionGet.json + // Generated from example definition: 2025-04-01-preview/MongoClusters_PrivateEndpointConnectionGet.json // this example is just showing the usage of "PrivateEndpointConnectionResource_Get" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line @@ -97,7 +97,7 @@ public async Task Get_GetAPrivateEndpointConnectionOnAMongoClusterResource() [Ignore("Only validating compilation of examples")] public async Task GetAll_ListsThePrivateEndpointConnectionResourcesOnAMongoClusterResource() { - // Generated from example definition: 2024-07-01/MongoClusters_PrivateEndpointConnectionList.json + // Generated from example definition: 2025-04-01-preview/MongoClusters_PrivateEndpointConnectionList.json // this example is just showing the usage of "PrivateEndpointConnectionResource_ListByMongoCluster" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line @@ -133,7 +133,7 @@ public async Task GetAll_ListsThePrivateEndpointConnectionResourcesOnAMongoClust [Ignore("Only validating compilation of examples")] public async Task Exists_GetAPrivateEndpointConnectionOnAMongoClusterResource() { - // Generated from example definition: 2024-07-01/MongoClusters_PrivateEndpointConnectionGet.json + // Generated from example definition: 2025-04-01-preview/MongoClusters_PrivateEndpointConnectionGet.json // this example is just showing the usage of "PrivateEndpointConnectionResource_Get" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line @@ -163,7 +163,7 @@ public async Task Exists_GetAPrivateEndpointConnectionOnAMongoClusterResource() [Ignore("Only validating compilation of examples")] public async Task GetIfExists_GetAPrivateEndpointConnectionOnAMongoClusterResource() { - // Generated from example definition: 2024-07-01/MongoClusters_PrivateEndpointConnectionGet.json + // Generated from example definition: 2025-04-01-preview/MongoClusters_PrivateEndpointConnectionGet.json // this example is just showing the usage of "PrivateEndpointConnectionResource_Get" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line diff --git a/sdk/mongocluster/Azure.ResourceManager.MongoCluster/samples/Generated/Samples/Sample_MongoClusterResource.cs b/sdk/mongocluster/Azure.ResourceManager.MongoCluster/samples/Generated/Samples/Sample_MongoClusterResource.cs index 89dc0e9ea8fe..061b83c53cbe 100644 --- a/sdk/mongocluster/Azure.ResourceManager.MongoCluster/samples/Generated/Samples/Sample_MongoClusterResource.cs +++ b/sdk/mongocluster/Azure.ResourceManager.MongoCluster/samples/Generated/Samples/Sample_MongoClusterResource.cs @@ -20,7 +20,7 @@ public partial class Sample_MongoClusterResource [Ignore("Only validating compilation of examples")] public async Task Get_GetsAMongoClusterResource() { - // Generated from example definition: 2024-07-01/MongoClusters_Get.json + // Generated from example definition: 2025-04-01-preview/MongoClusters_Get.json // this example is just showing the usage of "MongoCluster_Get" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line @@ -50,7 +50,7 @@ public async Task Get_GetsAMongoClusterResource() [Ignore("Only validating compilation of examples")] public async Task Delete_DeletesAMongoClusterResource() { - // Generated from example definition: 2024-07-01/MongoClusters_Delete.json + // Generated from example definition: 2025-04-01-preview/MongoClusters_Delete.json // this example is just showing the usage of "MongoCluster_Delete" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line @@ -72,11 +72,49 @@ public async Task Delete_DeletesAMongoClusterResource() Console.WriteLine("Succeeded"); } + [Test] + [Ignore("Only validating compilation of examples")] + public async Task Update_EnablesDataAPIOnAMongoClusterResource() + { + // Generated from example definition: 2025-04-01-preview/MongoClusters_PatchDataApi.json + // this example is just showing the usage of "MongoCluster_Update" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this MongoClusterResource created on azure + // for more information of creating MongoClusterResource, please refer to the document of MongoClusterResource + string subscriptionId = "ffffffff-ffff-ffff-ffff-ffffffffffff"; + string resourceGroupName = "TestResourceGroup"; + string mongoClusterName = "myMongoCluster"; + ResourceIdentifier mongoClusterResourceId = MongoClusterResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, mongoClusterName); + MongoClusterResource mongoCluster = client.GetMongoClusterResource(mongoClusterResourceId); + + // invoke the operation + MongoClusterPatch patch = new MongoClusterPatch + { + Properties = new MongoClusterUpdateProperties + { + DataApiMode = DataApiMode.Enabled, + }, + }; + ArmOperation lro = await mongoCluster.UpdateAsync(WaitUntil.Completed, patch); + MongoClusterResource result = lro.Value; + + // the variable result is a resource, you could call other operations on this instance as well + // but just for demo, we get its data from this resource instance + MongoClusterData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + [Test] [Ignore("Only validating compilation of examples")] public async Task Update_UpdatesTheDiskSizeOnAMongoClusterResource() { - // Generated from example definition: 2024-07-01/MongoClusters_PatchDiskSize.json + // Generated from example definition: 2025-04-01-preview/MongoClusters_PatchDiskSize.json // this example is just showing the usage of "MongoCluster_Update" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line @@ -97,7 +135,10 @@ public async Task Update_UpdatesTheDiskSizeOnAMongoClusterResource() { Properties = new MongoClusterUpdateProperties { - StorageSizeGb = 256L, + Storage = new StorageProperties + { + SizeGb = 256L, + }, }, }; ArmOperation lro = await mongoCluster.UpdateAsync(WaitUntil.Completed, patch); @@ -114,7 +155,7 @@ public async Task Update_UpdatesTheDiskSizeOnAMongoClusterResource() [Ignore("Only validating compilation of examples")] public async Task Update_DisablesPublicNetworkAccessOnAMongoClusterResourceWithAPrivateEndpointConnection() { - // Generated from example definition: 2024-07-01/MongoClusters_PatchPrivateNetworkAccess.json + // Generated from example definition: 2025-04-01-preview/MongoClusters_PatchPrivateNetworkAccess.json // this example is just showing the usage of "MongoCluster_Update" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line @@ -152,7 +193,7 @@ public async Task Update_DisablesPublicNetworkAccessOnAMongoClusterResourceWithA [Ignore("Only validating compilation of examples")] public async Task Update_ResetsTheAdministratorLoginPassword() { - // Generated from example definition: 2024-07-01/MongoClusters_ResetPassword.json + // Generated from example definition: 2025-04-01-preview/MongoClusters_ResetPassword.json // this example is just showing the usage of "MongoCluster_Update" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line @@ -194,7 +235,7 @@ public async Task Update_ResetsTheAdministratorLoginPassword() [Ignore("Only validating compilation of examples")] public async Task Update_UpdatesAMongoClusterResource() { - // Generated from example definition: 2024-07-01/MongoClusters_Update.json + // Generated from example definition: 2025-04-01-preview/MongoClusters_Update.json // this example is just showing the usage of "MongoCluster_Update" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line @@ -222,7 +263,10 @@ public async Task Update_UpdatesAMongoClusterResource() ServerVersion = "5.0", PublicNetworkAccess = MongoClusterPublicNetworkAccess.Enabled, HighAvailabilityTargetMode = HighAvailabilityMode.SameZone, - StorageSizeGb = 256L, + Storage = new StorageProperties + { + SizeGb = 256L, + }, ShardingShardCount = 4, ComputeTier = "M50", PreviewFeatures = { }, @@ -242,7 +286,7 @@ public async Task Update_UpdatesAMongoClusterResource() [Ignore("Only validating compilation of examples")] public async Task GetConnectionStrings_ListTheAvailableConnectionStringsForTheMongoClusterResource() { - // Generated from example definition: 2024-07-01/MongoClusters_ListConnectionStrings.json + // Generated from example definition: 2025-04-01-preview/MongoClusters_ListConnectionStrings.json // this example is just showing the usage of "MongoClusters_ListConnectionStrings" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line @@ -268,7 +312,7 @@ public async Task GetConnectionStrings_ListTheAvailableConnectionStringsForTheMo [Ignore("Only validating compilation of examples")] public async Task Promote_PromotesAReplicaMongoClusterResourceToAPrimaryRole() { - // Generated from example definition: 2024-07-01/MongoClusters_ForcePromoteReplica.json + // Generated from example definition: 2025-04-01-preview/MongoClusters_ForcePromoteReplica.json // this example is just showing the usage of "MongoClusters_Promote" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line @@ -298,7 +342,7 @@ public async Task Promote_PromotesAReplicaMongoClusterResourceToAPrimaryRole() [Ignore("Only validating compilation of examples")] public async Task GetPrivateLinks_ListsThePrivateLinkResourcesAvailableOnAMongoClusterResource() { - // Generated from example definition: 2024-07-01/MongoClusters_PrivateLinkResourceList.json + // Generated from example definition: 2025-04-01-preview/MongoClusters_PrivateLinkResourceList.json // this example is just showing the usage of "PrivateLinkResource_ListByMongoCluster" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line @@ -327,7 +371,7 @@ public async Task GetPrivateLinks_ListsThePrivateLinkResourcesAvailableOnAMongoC [Ignore("Only validating compilation of examples")] public async Task GetReplicasByParent_ListTheReplicasLinkedToAMongoClusterResource() { - // Generated from example definition: 2024-07-01/MongoClusters_ReplicaList.json + // Generated from example definition: 2025-04-01-preview/MongoClusters_ReplicaList.json // this example is just showing the usage of "Replica_ListByParent" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line diff --git a/sdk/mongocluster/Azure.ResourceManager.MongoCluster/samples/Generated/Samples/Sample_SubscriptionResourceExtensions.cs b/sdk/mongocluster/Azure.ResourceManager.MongoCluster/samples/Generated/Samples/Sample_SubscriptionResourceExtensions.cs index 30d2c455dea6..2e08ee699af5 100644 --- a/sdk/mongocluster/Azure.ResourceManager.MongoCluster/samples/Generated/Samples/Sample_SubscriptionResourceExtensions.cs +++ b/sdk/mongocluster/Azure.ResourceManager.MongoCluster/samples/Generated/Samples/Sample_SubscriptionResourceExtensions.cs @@ -21,7 +21,7 @@ public partial class Sample_SubscriptionResourceExtensions [Ignore("Only validating compilation of examples")] public async Task GetMongoClusters_ListsTheMongoClusterResourcesInASubscription() { - // Generated from example definition: 2024-07-01/MongoClusters_List.json + // Generated from example definition: 2025-04-01-preview/MongoClusters_List.json // this example is just showing the usage of "MongoCluster_List" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line @@ -52,7 +52,7 @@ public async Task GetMongoClusters_ListsTheMongoClusterResourcesInASubscription( [Ignore("Only validating compilation of examples")] public async Task CheckMongoClusterNameAvailability_ChecksAndConfirmsTheMongoClusterNameIsAvailabilityForUse() { - // Generated from example definition: 2024-07-01/MongoClusters_NameAvailability.json + // Generated from example definition: 2025-04-01-preview/MongoClusters_NameAvailability.json // this example is just showing the usage of "MongoClusters_CheckMongoClusterNameAvailability" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line @@ -82,7 +82,7 @@ public async Task CheckMongoClusterNameAvailability_ChecksAndConfirmsTheMongoClu [Ignore("Only validating compilation of examples")] public async Task CheckMongoClusterNameAvailability_ChecksAndReturnsThatTheMongoClusterNameIsAlreadyInUse() { - // Generated from example definition: 2024-07-01/MongoClusters_NameAvailability_AlreadyExists.json + // Generated from example definition: 2025-04-01-preview/MongoClusters_NameAvailability_AlreadyExists.json // this example is just showing the usage of "MongoClusters_CheckMongoClusterNameAvailability" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line diff --git a/sdk/mongocluster/Azure.ResourceManager.MongoCluster/samples/Generated/Samples/Sample_UserCollection.cs b/sdk/mongocluster/Azure.ResourceManager.MongoCluster/samples/Generated/Samples/Sample_UserCollection.cs new file mode 100644 index 000000000000..602bdf523247 --- /dev/null +++ b/sdk/mongocluster/Azure.ResourceManager.MongoCluster/samples/Generated/Samples/Sample_UserCollection.cs @@ -0,0 +1,204 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Threading.Tasks; +using Azure.Core; +using Azure.Identity; +using Azure.ResourceManager.MongoCluster.Models; +using NUnit.Framework; + +namespace Azure.ResourceManager.MongoCluster.Samples +{ + public partial class Sample_UserCollection + { + [Test] + [Ignore("Only validating compilation of examples")] + public async Task CreateOrUpdate_CreatesAUserOnAMongoClusterResource() + { + // Generated from example definition: 2025-04-01-preview/MongoClusters_UserCreateOrUpdate.json + // this example is just showing the usage of "User_CreateOrUpdate" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this MongoClusterResource created on azure + // for more information of creating MongoClusterResource, please refer to the document of MongoClusterResource + string subscriptionId = "ffffffff-ffff-ffff-ffff-ffffffffffff"; + string resourceGroupName = "TestGroup"; + string mongoClusterName = "myMongoCluster"; + ResourceIdentifier mongoClusterResourceId = MongoClusterResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, mongoClusterName); + MongoClusterResource mongoCluster = client.GetMongoClusterResource(mongoClusterResourceId); + + // get the collection of this UserResource + UserCollection collection = mongoCluster.GetUsers(); + + // invoke the operation + string userName = "uuuuuuuu-uuuu-uuuu-uuuu-uuuuuuuuuuuu"; + UserData data = new UserData + { + Properties = new UserProperties + { + IdentityProvider = new EntraIdentityProvider(new EntraIdentityProviderProperties(EntraPrincipalType.User)), + Roles = { new DatabaseRole("admin", UserRole.DatabaseOwner) }, + }, + }; + ArmOperation lro = await collection.CreateOrUpdateAsync(WaitUntil.Completed, userName, data); + UserResource result = lro.Value; + + // the variable result is a resource, you could call other operations on this instance as well + // but just for demo, we get its data from this resource instance + UserData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async Task Get_GetsAUserOnAMongoClusterResource() + { + // Generated from example definition: 2025-04-01-preview/MongoClusters_UserGet.json + // this example is just showing the usage of "User_Get" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this MongoClusterResource created on azure + // for more information of creating MongoClusterResource, please refer to the document of MongoClusterResource + string subscriptionId = "ffffffff-ffff-ffff-ffff-ffffffffffff"; + string resourceGroupName = "TestGroup"; + string mongoClusterName = "myMongoCluster"; + ResourceIdentifier mongoClusterResourceId = MongoClusterResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, mongoClusterName); + MongoClusterResource mongoCluster = client.GetMongoClusterResource(mongoClusterResourceId); + + // get the collection of this UserResource + UserCollection collection = mongoCluster.GetUsers(); + + // invoke the operation + string userName = "uuuuuuuu-uuuu-uuuu-uuuu-uuuuuuuuuuuu"; + UserResource result = await collection.GetAsync(userName); + + // the variable result is a resource, you could call other operations on this instance as well + // but just for demo, we get its data from this resource instance + UserData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async Task GetAll_ListTheUsersOnAMongoClusterResource() + { + // Generated from example definition: 2025-04-01-preview/MongoClusters_UserList.json + // this example is just showing the usage of "User_ListByMongoCluster" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this MongoClusterResource created on azure + // for more information of creating MongoClusterResource, please refer to the document of MongoClusterResource + string subscriptionId = "ffffffff-ffff-ffff-ffff-ffffffffffff"; + string resourceGroupName = "TestGroup"; + string mongoClusterName = "myMongoCluster"; + ResourceIdentifier mongoClusterResourceId = MongoClusterResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, mongoClusterName); + MongoClusterResource mongoCluster = client.GetMongoClusterResource(mongoClusterResourceId); + + // get the collection of this UserResource + UserCollection collection = mongoCluster.GetUsers(); + + // invoke the operation and iterate over the result + await foreach (UserResource item in collection.GetAllAsync()) + { + // the variable item is a resource, you could call other operations on this instance as well + // but just for demo, we get its data from this resource instance + UserData resourceData = item.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + + Console.WriteLine("Succeeded"); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async Task Exists_GetsAUserOnAMongoClusterResource() + { + // Generated from example definition: 2025-04-01-preview/MongoClusters_UserGet.json + // this example is just showing the usage of "User_Get" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this MongoClusterResource created on azure + // for more information of creating MongoClusterResource, please refer to the document of MongoClusterResource + string subscriptionId = "ffffffff-ffff-ffff-ffff-ffffffffffff"; + string resourceGroupName = "TestGroup"; + string mongoClusterName = "myMongoCluster"; + ResourceIdentifier mongoClusterResourceId = MongoClusterResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, mongoClusterName); + MongoClusterResource mongoCluster = client.GetMongoClusterResource(mongoClusterResourceId); + + // get the collection of this UserResource + UserCollection collection = mongoCluster.GetUsers(); + + // invoke the operation + string userName = "uuuuuuuu-uuuu-uuuu-uuuu-uuuuuuuuuuuu"; + bool result = await collection.ExistsAsync(userName); + + Console.WriteLine($"Succeeded: {result}"); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async Task GetIfExists_GetsAUserOnAMongoClusterResource() + { + // Generated from example definition: 2025-04-01-preview/MongoClusters_UserGet.json + // this example is just showing the usage of "User_Get" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this MongoClusterResource created on azure + // for more information of creating MongoClusterResource, please refer to the document of MongoClusterResource + string subscriptionId = "ffffffff-ffff-ffff-ffff-ffffffffffff"; + string resourceGroupName = "TestGroup"; + string mongoClusterName = "myMongoCluster"; + ResourceIdentifier mongoClusterResourceId = MongoClusterResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, mongoClusterName); + MongoClusterResource mongoCluster = client.GetMongoClusterResource(mongoClusterResourceId); + + // get the collection of this UserResource + UserCollection collection = mongoCluster.GetUsers(); + + // invoke the operation + string userName = "uuuuuuuu-uuuu-uuuu-uuuu-uuuuuuuuuuuu"; + NullableResponse response = await collection.GetIfExistsAsync(userName); + UserResource result = response.HasValue ? response.Value : null; + + if (result == null) + { + Console.WriteLine("Succeeded with null as result"); + } + else + { + // the variable result is a resource, you could call other operations on this instance as well + // but just for demo, we get its data from this resource instance + UserData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } + } +} diff --git a/sdk/mongocluster/Azure.ResourceManager.MongoCluster/samples/Generated/Samples/Sample_UserResource.cs b/sdk/mongocluster/Azure.ResourceManager.MongoCluster/samples/Generated/Samples/Sample_UserResource.cs new file mode 100644 index 000000000000..0f05df080337 --- /dev/null +++ b/sdk/mongocluster/Azure.ResourceManager.MongoCluster/samples/Generated/Samples/Sample_UserResource.cs @@ -0,0 +1,117 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Threading.Tasks; +using Azure.Core; +using Azure.Identity; +using Azure.ResourceManager.MongoCluster.Models; +using NUnit.Framework; + +namespace Azure.ResourceManager.MongoCluster.Samples +{ + public partial class Sample_UserResource + { + [Test] + [Ignore("Only validating compilation of examples")] + public async Task Get_GetsAUserOnAMongoClusterResource() + { + // Generated from example definition: 2025-04-01-preview/MongoClusters_UserGet.json + // this example is just showing the usage of "User_Get" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this UserResource created on azure + // for more information of creating UserResource, please refer to the document of UserResource + string subscriptionId = "ffffffff-ffff-ffff-ffff-ffffffffffff"; + string resourceGroupName = "TestGroup"; + string mongoClusterName = "myMongoCluster"; + string userName = "uuuuuuuu-uuuu-uuuu-uuuu-uuuuuuuuuuuu"; + ResourceIdentifier userResourceId = UserResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, mongoClusterName, userName); + UserResource user = client.GetUserResource(userResourceId); + + // invoke the operation + UserResource result = await user.GetAsync(); + + // the variable result is a resource, you could call other operations on this instance as well + // but just for demo, we get its data from this resource instance + UserData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async Task Delete_DeletesAUserOnAMongoClusterResource() + { + // Generated from example definition: 2025-04-01-preview/MongoClusters_UserDelete.json + // this example is just showing the usage of "User_Delete" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this UserResource created on azure + // for more information of creating UserResource, please refer to the document of UserResource + string subscriptionId = "ffffffff-ffff-ffff-ffff-ffffffffffff"; + string resourceGroupName = "TestGroup"; + string mongoClusterName = "myMongoCluster"; + string userName = "uuuuuuuu-uuuu-uuuu-uuuu-uuuuuuuuuuuu"; + ResourceIdentifier userResourceId = UserResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, mongoClusterName, userName); + UserResource user = client.GetUserResource(userResourceId); + + // invoke the operation + await user.DeleteAsync(WaitUntil.Completed); + + Console.WriteLine("Succeeded"); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async Task Update_CreatesAUserOnAMongoClusterResource() + { + // Generated from example definition: 2025-04-01-preview/MongoClusters_UserCreateOrUpdate.json + // this example is just showing the usage of "User_CreateOrUpdate" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this UserResource created on azure + // for more information of creating UserResource, please refer to the document of UserResource + string subscriptionId = "ffffffff-ffff-ffff-ffff-ffffffffffff"; + string resourceGroupName = "TestGroup"; + string mongoClusterName = "myMongoCluster"; + string userName = "uuuuuuuu-uuuu-uuuu-uuuu-uuuuuuuuuuuu"; + ResourceIdentifier userResourceId = UserResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, mongoClusterName, userName); + UserResource user = client.GetUserResource(userResourceId); + + // invoke the operation + UserData data = new UserData + { + Properties = new UserProperties + { + IdentityProvider = new EntraIdentityProvider(new EntraIdentityProviderProperties(EntraPrincipalType.User)), + Roles = { new DatabaseRole("admin", UserRole.DatabaseOwner) }, + }, + }; + ArmOperation lro = await user.UpdateAsync(WaitUntil.Completed, data); + UserResource result = lro.Value; + + // the variable result is a resource, you could call other operations on this instance as well + // but just for demo, we get its data from this resource instance + UserData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } +} diff --git a/sdk/mongocluster/Azure.ResourceManager.MongoCluster/src/Generated/ArmMongoClusterModelFactory.cs b/sdk/mongocluster/Azure.ResourceManager.MongoCluster/src/Generated/ArmMongoClusterModelFactory.cs index b9099c97c334..4eadc7a01b20 100644 --- a/sdk/mongocluster/Azure.ResourceManager.MongoCluster/src/Generated/ArmMongoClusterModelFactory.cs +++ b/sdk/mongocluster/Azure.ResourceManager.MongoCluster/src/Generated/ArmMongoClusterModelFactory.cs @@ -51,19 +51,22 @@ public static MongoClusterData MongoClusterData(ResourceIdentifier id = null, st /// The status of the mongo cluster. /// Whether or not public endpoint access is allowed for this mongo cluster. /// The high availability properties of the mongo cluster. - /// The storage properties of the mongo cluster. + /// The storage properties of the mongo cluster. /// The sharding properties of the mongo cluster. /// The compute properties of the mongo cluster. /// The backup properties of the mongo cluster. + /// The Data API properties of the mongo cluster. /// List of private endpoint connections. /// List of private endpoint connections. /// The replication properties for the mongo cluster. /// The infrastructure version the cluster is provisioned on. + /// The authentication configuration for the cluster. /// A new instance for mocking. - public static MongoClusterProperties MongoClusterProperties(MongoClusterCreateMode? createMode = null, MongoClusterRestoreContent restoreParameters = null, MongoClusterReplicaContent replicaParameters = null, MongoClusterAdministratorProperties administrator = null, string serverVersion = null, string connectionString = null, MongoClusterProvisioningState? provisioningState = null, MongoClusterStatus? clusterStatus = null, MongoClusterPublicNetworkAccess? publicNetworkAccess = null, HighAvailabilityMode? highAvailabilityTargetMode = null, long? storageSizeGb = null, int? shardingShardCount = null, string computeTier = null, string backupEarliestRestoreTime = null, IEnumerable privateEndpointConnections = null, IEnumerable previewFeatures = null, MongoClusterReplicationProperties replica = null, string infrastructureVersion = null) + public static MongoClusterProperties MongoClusterProperties(MongoClusterCreateMode? createMode = null, MongoClusterRestoreContent restoreParameters = null, MongoClusterReplicaContent replicaParameters = null, MongoClusterAdministratorProperties administrator = null, string serverVersion = null, string connectionString = null, MongoClusterProvisioningState? provisioningState = null, MongoClusterStatus? clusterStatus = null, MongoClusterPublicNetworkAccess? publicNetworkAccess = null, HighAvailabilityMode? highAvailabilityTargetMode = null, StorageProperties storage = null, int? shardingShardCount = null, string computeTier = null, string backupEarliestRestoreTime = null, DataApiMode? dataApiMode = null, IEnumerable privateEndpointConnections = null, IEnumerable previewFeatures = null, MongoClusterReplicationProperties replica = null, string infrastructureVersion = null, IEnumerable authConfigAllowedModes = null) { privateEndpointConnections ??= new List(); previewFeatures ??= new List(); + authConfigAllowedModes ??= new List(); return new MongoClusterProperties( createMode, @@ -76,14 +79,16 @@ public static MongoClusterProperties MongoClusterProperties(MongoClusterCreateMo clusterStatus, publicNetworkAccess, highAvailabilityTargetMode != null ? new HighAvailabilityProperties(highAvailabilityTargetMode, serializedAdditionalRawData: null) : null, - storageSizeGb != null ? new StorageProperties(storageSizeGb, serializedAdditionalRawData: null) : null, + storage, shardingShardCount != null ? new ShardingProperties(shardingShardCount, serializedAdditionalRawData: null) : null, computeTier != null ? new ComputeProperties(computeTier, serializedAdditionalRawData: null) : null, backupEarliestRestoreTime != null ? new BackupProperties(backupEarliestRestoreTime, serializedAdditionalRawData: null) : null, + dataApiMode != null ? new DataApiProperties(dataApiMode, serializedAdditionalRawData: null) : null, privateEndpointConnections?.ToList(), previewFeatures?.ToList(), replica, infrastructureVersion, + authConfigAllowedModes != null ? new AuthConfigProperties(authConfigAllowedModes?.ToList(), serializedAdditionalRawData: null) : null, serializedAdditionalRawData: null); } @@ -261,5 +266,39 @@ public static MongoClusterReplica MongoClusterReplica(ResourceIdentifier id = nu properties, serializedAdditionalRawData: null); } + + /// Initializes a new instance of . + /// The id. + /// The name. + /// The resourceType. + /// The systemData. + /// The resource-specific properties for this resource. + /// A new instance for mocking. + public static UserData UserData(ResourceIdentifier id = null, string name = null, ResourceType resourceType = default, SystemData systemData = null, UserProperties properties = null) + { + return new UserData( + id, + name, + resourceType, + systemData, + properties, + serializedAdditionalRawData: null); + } + + /// Initializes a new instance of . + /// The provisioning state of the user. + /// + /// The user's identity provider definition. + /// Please note is the base class. According to the scenario, a derived class of the base class might need to be assigned here, or this property needs to be casted to one of the possible derived classes. + /// The available derived classes include . + /// + /// Database roles that are assigned to the user. + /// A new instance for mocking. + public static UserProperties UserProperties(MongoClusterProvisioningState? provisioningState = null, IdentityProvider identityProvider = null, IEnumerable roles = null) + { + roles ??= new List(); + + return new UserProperties(provisioningState, identityProvider, roles?.ToList(), serializedAdditionalRawData: null); + } } } diff --git a/sdk/mongocluster/Azure.ResourceManager.MongoCluster/src/Generated/Extensions/MockableMongoClusterArmClient.cs b/sdk/mongocluster/Azure.ResourceManager.MongoCluster/src/Generated/Extensions/MockableMongoClusterArmClient.cs index 003eb2338558..d7d4f55dd489 100644 --- a/sdk/mongocluster/Azure.ResourceManager.MongoCluster/src/Generated/Extensions/MockableMongoClusterArmClient.cs +++ b/sdk/mongocluster/Azure.ResourceManager.MongoCluster/src/Generated/Extensions/MockableMongoClusterArmClient.cs @@ -69,5 +69,17 @@ public virtual MongoClusterPrivateEndpointConnectionResource GetMongoClusterPriv MongoClusterPrivateEndpointConnectionResource.ValidateResourceId(id); return new MongoClusterPrivateEndpointConnectionResource(Client, id); } + + /// + /// Gets an object representing an along with the instance operations that can be performed on it but with no data. + /// You can use to create an from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual UserResource GetUserResource(ResourceIdentifier id) + { + UserResource.ValidateResourceId(id); + return new UserResource(Client, id); + } } } diff --git a/sdk/mongocluster/Azure.ResourceManager.MongoCluster/src/Generated/Extensions/MockableMongoClusterResourceGroupResource.cs b/sdk/mongocluster/Azure.ResourceManager.MongoCluster/src/Generated/Extensions/MockableMongoClusterResourceGroupResource.cs index 87e8ad903dcb..7e05786fdb6c 100644 --- a/sdk/mongocluster/Azure.ResourceManager.MongoCluster/src/Generated/Extensions/MockableMongoClusterResourceGroupResource.cs +++ b/sdk/mongocluster/Azure.ResourceManager.MongoCluster/src/Generated/Extensions/MockableMongoClusterResourceGroupResource.cs @@ -53,7 +53,7 @@ public virtual MongoClusterCollection GetMongoClusters() /// /// /// Default Api Version - /// 2024-07-01 + /// 2025-04-01-preview /// /// /// Resource @@ -84,7 +84,7 @@ public virtual async Task> GetMongoClusterAsync(s /// /// /// Default Api Version - /// 2024-07-01 + /// 2025-04-01-preview /// /// /// Resource diff --git a/sdk/mongocluster/Azure.ResourceManager.MongoCluster/src/Generated/Extensions/MockableMongoClusterSubscriptionResource.cs b/sdk/mongocluster/Azure.ResourceManager.MongoCluster/src/Generated/Extensions/MockableMongoClusterSubscriptionResource.cs index bcba1d0d3f84..6731cbbb4d90 100644 --- a/sdk/mongocluster/Azure.ResourceManager.MongoCluster/src/Generated/Extensions/MockableMongoClusterSubscriptionResource.cs +++ b/sdk/mongocluster/Azure.ResourceManager.MongoCluster/src/Generated/Extensions/MockableMongoClusterSubscriptionResource.cs @@ -55,7 +55,7 @@ private string GetApiVersionOrNull(ResourceType resourceType) /// /// /// Default Api Version - /// 2024-07-01 + /// 2025-04-01-preview /// /// /// Resource @@ -85,7 +85,7 @@ public virtual AsyncPageable GetMongoClustersAsync(Cancell /// /// /// Default Api Version - /// 2024-07-01 + /// 2025-04-01-preview /// /// /// Resource @@ -115,7 +115,7 @@ public virtual Pageable GetMongoClusters(CancellationToken /// /// /// Default Api Version - /// 2024-07-01 + /// 2025-04-01-preview /// /// /// Resource @@ -158,7 +158,7 @@ public virtual async Task> CheckMon /// /// /// Default Api Version - /// 2024-07-01 + /// 2025-04-01-preview /// /// /// Resource diff --git a/sdk/mongocluster/Azure.ResourceManager.MongoCluster/src/Generated/Extensions/MongoClusterExtensions.cs b/sdk/mongocluster/Azure.ResourceManager.MongoCluster/src/Generated/Extensions/MongoClusterExtensions.cs index ee4d0e4ffd35..e21358caa35a 100644 --- a/sdk/mongocluster/Azure.ResourceManager.MongoCluster/src/Generated/Extensions/MongoClusterExtensions.cs +++ b/sdk/mongocluster/Azure.ResourceManager.MongoCluster/src/Generated/Extensions/MongoClusterExtensions.cs @@ -90,6 +90,25 @@ public static MongoClusterPrivateEndpointConnectionResource GetMongoClusterPriva return GetMockableMongoClusterArmClient(client).GetMongoClusterPrivateEndpointConnectionResource(id); } + /// + /// Gets an object representing an along with the instance operations that can be performed on it but with no data. + /// You can use to create an from its components. + /// + /// Mocking + /// To mock this method, please mock instead. + /// + /// + /// The instance the method will execute against. + /// The resource ID of the resource to get. + /// is null. + /// Returns a object. + public static UserResource GetUserResource(this ArmClient client, ResourceIdentifier id) + { + Argument.AssertNotNull(client, nameof(client)); + + return GetMockableMongoClusterArmClient(client).GetUserResource(id); + } + /// /// Gets a collection of MongoClusterResources in the ResourceGroupResource. /// @@ -120,7 +139,7 @@ public static MongoClusterCollection GetMongoClusters(this ResourceGroupResource /// /// /// Default Api Version - /// 2024-07-01 + /// 2025-04-01-preview /// /// /// Resource @@ -158,7 +177,7 @@ public static async Task> GetMongoClusterAsync(th /// /// /// Default Api Version - /// 2024-07-01 + /// 2025-04-01-preview /// /// /// Resource @@ -196,7 +215,7 @@ public static Response GetMongoCluster(this ResourceGroupR /// /// /// Default Api Version - /// 2024-07-01 + /// 2025-04-01-preview /// /// /// Resource @@ -232,7 +251,7 @@ public static AsyncPageable GetMongoClustersAsync(this Sub /// /// /// Default Api Version - /// 2024-07-01 + /// 2025-04-01-preview /// /// /// Resource @@ -268,7 +287,7 @@ public static Pageable GetMongoClusters(this SubscriptionR /// /// /// Default Api Version - /// 2024-07-01 + /// 2025-04-01-preview /// /// /// Resource @@ -305,7 +324,7 @@ public static async Task> CheckMong /// /// /// Default Api Version - /// 2024-07-01 + /// 2025-04-01-preview /// /// /// Resource diff --git a/sdk/mongocluster/Azure.ResourceManager.MongoCluster/src/Generated/LongRunningOperation/UserOperationSource.cs b/sdk/mongocluster/Azure.ResourceManager.MongoCluster/src/Generated/LongRunningOperation/UserOperationSource.cs new file mode 100644 index 000000000000..39587f89970e --- /dev/null +++ b/sdk/mongocluster/Azure.ResourceManager.MongoCluster/src/Generated/LongRunningOperation/UserOperationSource.cs @@ -0,0 +1,36 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.ClientModel.Primitives; +using System.Threading; +using System.Threading.Tasks; +using Azure.Core; + +namespace Azure.ResourceManager.MongoCluster +{ + internal class UserOperationSource : IOperationSource + { + private readonly ArmClient _client; + + internal UserOperationSource(ArmClient client) + { + _client = client; + } + + UserResource IOperationSource.CreateResult(Response response, CancellationToken cancellationToken) + { + var data = ModelReaderWriter.Read(response.Content, ModelReaderWriterOptions.Json, AzureResourceManagerMongoClusterContext.Default); + return new UserResource(_client, data); + } + + async ValueTask IOperationSource.CreateResultAsync(Response response, CancellationToken cancellationToken) + { + var data = ModelReaderWriter.Read(response.Content, ModelReaderWriterOptions.Json, AzureResourceManagerMongoClusterContext.Default); + return await Task.FromResult(new UserResource(_client, data)).ConfigureAwait(false); + } + } +} diff --git a/sdk/mongocluster/Azure.ResourceManager.MongoCluster/src/Generated/Models/AuthConfigProperties.Serialization.cs b/sdk/mongocluster/Azure.ResourceManager.MongoCluster/src/Generated/Models/AuthConfigProperties.Serialization.cs new file mode 100644 index 000000000000..868e3d5ed99f --- /dev/null +++ b/sdk/mongocluster/Azure.ResourceManager.MongoCluster/src/Generated/Models/AuthConfigProperties.Serialization.cs @@ -0,0 +1,143 @@ +// 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.MongoCluster.Models +{ + internal partial class AuthConfigProperties : 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(AuthConfigProperties)} does not support writing '{format}' format."); + } + + if (Optional.IsCollectionDefined(AllowedModes)) + { + writer.WritePropertyName("allowedModes"u8); + writer.WriteStartArray(); + foreach (var item in AllowedModes) + { + writer.WriteStringValue(item.ToString()); + } + writer.WriteEndArray(); + } + if (options.Format != "W" && _serializedAdditionalRawData != null) + { + foreach (var item in _serializedAdditionalRawData) + { + writer.WritePropertyName(item.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(item.Value); +#else + using (JsonDocument document = JsonDocument.Parse(item.Value, ModelSerializationExtensions.JsonDocumentOptions)) + { + JsonSerializer.Serialize(writer, document.RootElement); + } +#endif + } + } + } + + AuthConfigProperties 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(AuthConfigProperties)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeAuthConfigProperties(document.RootElement, options); + } + + internal static AuthConfigProperties DeserializeAuthConfigProperties(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + IList allowedModes = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("allowedModes"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + array.Add(new AuthenticationMode(item.GetString())); + } + allowedModes = array; + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new AuthConfigProperties(allowedModes ?? new ChangeTrackingList(), serializedAdditionalRawData); + } + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options, AzureResourceManagerMongoClusterContext.Default); + default: + throw new FormatException($"The model {nameof(AuthConfigProperties)} does not support writing '{options.Format}' format."); + } + } + + AuthConfigProperties 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 DeserializeAuthConfigProperties(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(AuthConfigProperties)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + } +} diff --git a/sdk/mongocluster/Azure.ResourceManager.MongoCluster/src/Generated/Models/AuthConfigProperties.cs b/sdk/mongocluster/Azure.ResourceManager.MongoCluster/src/Generated/Models/AuthConfigProperties.cs new file mode 100644 index 000000000000..1548e8beb9c1 --- /dev/null +++ b/sdk/mongocluster/Azure.ResourceManager.MongoCluster/src/Generated/Models/AuthConfigProperties.cs @@ -0,0 +1,66 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; + +namespace Azure.ResourceManager.MongoCluster.Models +{ + /// The authentication configuration for the Mongo cluster. + internal partial class AuthConfigProperties + { + /// + /// 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 AuthConfigProperties() + { + AllowedModes = new ChangeTrackingList(); + } + + /// Initializes a new instance of . + /// Allowed authentication modes for data access on the cluster. + /// Keeps track of any properties unknown to the library. + internal AuthConfigProperties(IList allowedModes, IDictionary serializedAdditionalRawData) + { + AllowedModes = allowedModes; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Allowed authentication modes for data access on the cluster. + public IList AllowedModes { get; } + } +} diff --git a/sdk/mongocluster/Azure.ResourceManager.MongoCluster/src/Generated/Models/AuthenticationMode.cs b/sdk/mongocluster/Azure.ResourceManager.MongoCluster/src/Generated/Models/AuthenticationMode.cs new file mode 100644 index 000000000000..6b6ad58260bc --- /dev/null +++ b/sdk/mongocluster/Azure.ResourceManager.MongoCluster/src/Generated/Models/AuthenticationMode.cs @@ -0,0 +1,51 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ComponentModel; + +namespace Azure.ResourceManager.MongoCluster.Models +{ + /// The authentication modes supporting on the Mongo cluster. + public readonly partial struct AuthenticationMode : IEquatable + { + private readonly string _value; + + /// Initializes a new instance of . + /// is null. + public AuthenticationMode(string value) + { + _value = value ?? throw new ArgumentNullException(nameof(value)); + } + + private const string NativeAuthValue = "NativeAuth"; + private const string MicrosoftEntraIdValue = "MicrosoftEntraID"; + + /// Native mongo authentication mode using username and password with auth mechanism 'SCRAM-SHA-256'. + public static AuthenticationMode NativeAuth { get; } = new AuthenticationMode(NativeAuthValue); + /// Microsot Entra ID authentication mode using Entra users assigned to the cluster and auth mechanism 'MONGODB-OIDC'. + public static AuthenticationMode MicrosoftEntraId { get; } = new AuthenticationMode(MicrosoftEntraIdValue); + /// Determines if two values are the same. + public static bool operator ==(AuthenticationMode left, AuthenticationMode right) => left.Equals(right); + /// Determines if two values are not the same. + public static bool operator !=(AuthenticationMode left, AuthenticationMode right) => !left.Equals(right); + /// Converts a to a . + public static implicit operator AuthenticationMode(string value) => new AuthenticationMode(value); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override bool Equals(object obj) => obj is AuthenticationMode other && Equals(other); + /// + public bool Equals(AuthenticationMode 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/mongocluster/Azure.ResourceManager.MongoCluster/src/Generated/Models/DataApiMode.cs b/sdk/mongocluster/Azure.ResourceManager.MongoCluster/src/Generated/Models/DataApiMode.cs new file mode 100644 index 000000000000..72ce8ed51f95 --- /dev/null +++ b/sdk/mongocluster/Azure.ResourceManager.MongoCluster/src/Generated/Models/DataApiMode.cs @@ -0,0 +1,51 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ComponentModel; + +namespace Azure.ResourceManager.MongoCluster.Models +{ + /// The mode to apply to the Mongo Data API. + public readonly partial struct DataApiMode : IEquatable + { + private readonly string _value; + + /// Initializes a new instance of . + /// is null. + public DataApiMode(string value) + { + _value = value ?? throw new ArgumentNullException(nameof(value)); + } + + private const string EnabledValue = "Enabled"; + private const string DisabledValue = "Disabled"; + + /// Mongo Data API is enabled for the cluster. + public static DataApiMode Enabled { get; } = new DataApiMode(EnabledValue); + /// Mongo Data API is disabled for the cluster. + public static DataApiMode Disabled { get; } = new DataApiMode(DisabledValue); + /// Determines if two values are the same. + public static bool operator ==(DataApiMode left, DataApiMode right) => left.Equals(right); + /// Determines if two values are not the same. + public static bool operator !=(DataApiMode left, DataApiMode right) => !left.Equals(right); + /// Converts a to a . + public static implicit operator DataApiMode(string value) => new DataApiMode(value); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override bool Equals(object obj) => obj is DataApiMode other && Equals(other); + /// + public bool Equals(DataApiMode 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/mongocluster/Azure.ResourceManager.MongoCluster/src/Generated/Models/DataApiProperties.Serialization.cs b/sdk/mongocluster/Azure.ResourceManager.MongoCluster/src/Generated/Models/DataApiProperties.Serialization.cs new file mode 100644 index 000000000000..361ce0411a5c --- /dev/null +++ b/sdk/mongocluster/Azure.ResourceManager.MongoCluster/src/Generated/Models/DataApiProperties.Serialization.cs @@ -0,0 +1,133 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Text.Json; +using Azure.Core; + +namespace Azure.ResourceManager.MongoCluster.Models +{ + internal partial class DataApiProperties : 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(DataApiProperties)} does not support writing '{format}' format."); + } + + if (Optional.IsDefined(Mode)) + { + writer.WritePropertyName("mode"u8); + writer.WriteStringValue(Mode.Value.ToString()); + } + if (options.Format != "W" && _serializedAdditionalRawData != null) + { + foreach (var item in _serializedAdditionalRawData) + { + writer.WritePropertyName(item.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(item.Value); +#else + using (JsonDocument document = JsonDocument.Parse(item.Value, ModelSerializationExtensions.JsonDocumentOptions)) + { + JsonSerializer.Serialize(writer, document.RootElement); + } +#endif + } + } + } + + DataApiProperties 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(DataApiProperties)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeDataApiProperties(document.RootElement, options); + } + + internal static DataApiProperties DeserializeDataApiProperties(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + DataApiMode? mode = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("mode"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + mode = new DataApiMode(property.Value.GetString()); + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new DataApiProperties(mode, 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, AzureResourceManagerMongoClusterContext.Default); + default: + throw new FormatException($"The model {nameof(DataApiProperties)} does not support writing '{options.Format}' format."); + } + } + + DataApiProperties 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 DeserializeDataApiProperties(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(DataApiProperties)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + } +} diff --git a/sdk/mongocluster/Azure.ResourceManager.MongoCluster/src/Generated/Models/DataApiProperties.cs b/sdk/mongocluster/Azure.ResourceManager.MongoCluster/src/Generated/Models/DataApiProperties.cs new file mode 100644 index 000000000000..5eccac330a35 --- /dev/null +++ b/sdk/mongocluster/Azure.ResourceManager.MongoCluster/src/Generated/Models/DataApiProperties.cs @@ -0,0 +1,65 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; + +namespace Azure.ResourceManager.MongoCluster.Models +{ + /// Data API properties. + internal partial class DataApiProperties + { + /// + /// 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 DataApiProperties() + { + } + + /// Initializes a new instance of . + /// The mode to indicate whether the Mongo Data API is enabled for a cluster. + /// Keeps track of any properties unknown to the library. + internal DataApiProperties(DataApiMode? mode, IDictionary serializedAdditionalRawData) + { + Mode = mode; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// The mode to indicate whether the Mongo Data API is enabled for a cluster. + public DataApiMode? Mode { get; set; } + } +} diff --git a/sdk/mongocluster/Azure.ResourceManager.MongoCluster/src/Generated/Models/DatabaseRole.Serialization.cs b/sdk/mongocluster/Azure.ResourceManager.MongoCluster/src/Generated/Models/DatabaseRole.Serialization.cs new file mode 100644 index 000000000000..160ba14bf9f6 --- /dev/null +++ b/sdk/mongocluster/Azure.ResourceManager.MongoCluster/src/Generated/Models/DatabaseRole.Serialization.cs @@ -0,0 +1,134 @@ +// 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.MongoCluster.Models +{ + public partial class DatabaseRole : 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(DatabaseRole)} does not support writing '{format}' format."); + } + + writer.WritePropertyName("db"u8); + writer.WriteStringValue(Db); + writer.WritePropertyName("role"u8); + writer.WriteStringValue(Role.ToString()); + if (options.Format != "W" && _serializedAdditionalRawData != null) + { + foreach (var item in _serializedAdditionalRawData) + { + writer.WritePropertyName(item.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(item.Value); +#else + using (JsonDocument document = JsonDocument.Parse(item.Value, ModelSerializationExtensions.JsonDocumentOptions)) + { + JsonSerializer.Serialize(writer, document.RootElement); + } +#endif + } + } + } + + DatabaseRole 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(DatabaseRole)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeDatabaseRole(document.RootElement, options); + } + + internal static DatabaseRole DeserializeDatabaseRole(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + string db = default; + UserRole role = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("db"u8)) + { + db = property.Value.GetString(); + continue; + } + if (property.NameEquals("role"u8)) + { + role = new UserRole(property.Value.GetString()); + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new DatabaseRole(db, role, 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, AzureResourceManagerMongoClusterContext.Default); + default: + throw new FormatException($"The model {nameof(DatabaseRole)} does not support writing '{options.Format}' format."); + } + } + + DatabaseRole 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 DeserializeDatabaseRole(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(DatabaseRole)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + } +} diff --git a/sdk/mongocluster/Azure.ResourceManager.MongoCluster/src/Generated/Models/DatabaseRole.cs b/sdk/mongocluster/Azure.ResourceManager.MongoCluster/src/Generated/Models/DatabaseRole.cs new file mode 100644 index 000000000000..1cc3019c250d --- /dev/null +++ b/sdk/mongocluster/Azure.ResourceManager.MongoCluster/src/Generated/Models/DatabaseRole.cs @@ -0,0 +1,81 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; + +namespace Azure.ResourceManager.MongoCluster.Models +{ + /// Database role definition that is assigned to a user. + public partial class DatabaseRole + { + /// + /// 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 . + /// Database scope that the role is assigned to. + /// The role that is assigned to the user on the database scope. + /// is null. + public DatabaseRole(string db, UserRole role) + { + Argument.AssertNotNull(db, nameof(db)); + + Db = db; + Role = role; + } + + /// Initializes a new instance of . + /// Database scope that the role is assigned to. + /// The role that is assigned to the user on the database scope. + /// Keeps track of any properties unknown to the library. + internal DatabaseRole(string db, UserRole role, IDictionary serializedAdditionalRawData) + { + Db = db; + Role = role; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal DatabaseRole() + { + } + + /// Database scope that the role is assigned to. + public string Db { get; set; } + /// The role that is assigned to the user on the database scope. + public UserRole Role { get; set; } + } +} diff --git a/sdk/mongocluster/Azure.ResourceManager.MongoCluster/src/Generated/Models/EntraIdentityProvider.Serialization.cs b/sdk/mongocluster/Azure.ResourceManager.MongoCluster/src/Generated/Models/EntraIdentityProvider.Serialization.cs new file mode 100644 index 000000000000..298e2136bc3d --- /dev/null +++ b/sdk/mongocluster/Azure.ResourceManager.MongoCluster/src/Generated/Models/EntraIdentityProvider.Serialization.cs @@ -0,0 +1,118 @@ +// 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.MongoCluster.Models +{ + public partial class EntraIdentityProvider : IUtf8JsonSerializable, IJsonModel + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + writer.WriteStartObject(); + JsonModelWriteCore(writer, options); + writer.WriteEndObject(); + } + + /// The JSON writer. + /// The client options for reading and writing models. + protected override void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(EntraIdentityProvider)} does not support writing '{format}' format."); + } + + base.JsonModelWriteCore(writer, options); + writer.WritePropertyName("properties"u8); + writer.WriteObjectValue(Properties, options); + } + + EntraIdentityProvider 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(EntraIdentityProvider)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeEntraIdentityProvider(document.RootElement, options); + } + + internal static EntraIdentityProvider DeserializeEntraIdentityProvider(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + EntraIdentityProviderProperties properties = default; + IdentityProviderType type = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("properties"u8)) + { + properties = EntraIdentityProviderProperties.DeserializeEntraIdentityProviderProperties(property.Value, options); + continue; + } + if (property.NameEquals("type"u8)) + { + type = new IdentityProviderType(property.Value.GetString()); + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new EntraIdentityProvider(type, serializedAdditionalRawData, properties); + } + + 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, AzureResourceManagerMongoClusterContext.Default); + default: + throw new FormatException($"The model {nameof(EntraIdentityProvider)} does not support writing '{options.Format}' format."); + } + } + + EntraIdentityProvider 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 DeserializeEntraIdentityProvider(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(EntraIdentityProvider)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + } +} diff --git a/sdk/mongocluster/Azure.ResourceManager.MongoCluster/src/Generated/Models/EntraIdentityProvider.cs b/sdk/mongocluster/Azure.ResourceManager.MongoCluster/src/Generated/Models/EntraIdentityProvider.cs new file mode 100644 index 000000000000..0464402bd6e2 --- /dev/null +++ b/sdk/mongocluster/Azure.ResourceManager.MongoCluster/src/Generated/Models/EntraIdentityProvider.cs @@ -0,0 +1,54 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; + +namespace Azure.ResourceManager.MongoCluster.Models +{ + /// Defines a Microsot Entra ID Mongo user. + public partial class EntraIdentityProvider : IdentityProvider + { + /// Initializes a new instance of . + /// The Entra identity properties for the user. + /// is null. + public EntraIdentityProvider(EntraIdentityProviderProperties properties) + { + Argument.AssertNotNull(properties, nameof(properties)); + + Properties = properties; + Type = IdentityProviderType.MicrosoftEntraId; + } + + /// Initializes a new instance of . + /// The type of identity provider that the user belongs to. + /// Keeps track of any properties unknown to the library. + /// The Entra identity properties for the user. + internal EntraIdentityProvider(IdentityProviderType type, IDictionary serializedAdditionalRawData, EntraIdentityProviderProperties properties) : base(type, serializedAdditionalRawData) + { + Properties = properties; + Type = type; + } + + /// Initializes a new instance of for deserialization. + internal EntraIdentityProvider() + { + } + + /// The Entra identity properties for the user. + internal EntraIdentityProviderProperties Properties { get; set; } + /// The principal type of the user. + public EntraPrincipalType? EntraIdentityProviderPrincipalType + { + get => Properties is null ? default(EntraPrincipalType?) : Properties.PrincipalType; + set + { + Properties = value.HasValue ? new EntraIdentityProviderProperties(value.Value) : null; + } + } + } +} diff --git a/sdk/mongocluster/Azure.ResourceManager.MongoCluster/src/Generated/Models/EntraIdentityProviderProperties.Serialization.cs b/sdk/mongocluster/Azure.ResourceManager.MongoCluster/src/Generated/Models/EntraIdentityProviderProperties.Serialization.cs new file mode 100644 index 000000000000..a46f30af78c2 --- /dev/null +++ b/sdk/mongocluster/Azure.ResourceManager.MongoCluster/src/Generated/Models/EntraIdentityProviderProperties.Serialization.cs @@ -0,0 +1,126 @@ +// 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.MongoCluster.Models +{ + public partial class EntraIdentityProviderProperties : 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(EntraIdentityProviderProperties)} does not support writing '{format}' format."); + } + + writer.WritePropertyName("principalType"u8); + writer.WriteStringValue(PrincipalType.ToString()); + if (options.Format != "W" && _serializedAdditionalRawData != null) + { + foreach (var item in _serializedAdditionalRawData) + { + writer.WritePropertyName(item.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(item.Value); +#else + using (JsonDocument document = JsonDocument.Parse(item.Value, ModelSerializationExtensions.JsonDocumentOptions)) + { + JsonSerializer.Serialize(writer, document.RootElement); + } +#endif + } + } + } + + EntraIdentityProviderProperties 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(EntraIdentityProviderProperties)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeEntraIdentityProviderProperties(document.RootElement, options); + } + + internal static EntraIdentityProviderProperties DeserializeEntraIdentityProviderProperties(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + EntraPrincipalType principalType = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("principalType"u8)) + { + principalType = new EntraPrincipalType(property.Value.GetString()); + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new EntraIdentityProviderProperties(principalType, 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, AzureResourceManagerMongoClusterContext.Default); + default: + throw new FormatException($"The model {nameof(EntraIdentityProviderProperties)} does not support writing '{options.Format}' format."); + } + } + + EntraIdentityProviderProperties 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 DeserializeEntraIdentityProviderProperties(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(EntraIdentityProviderProperties)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + } +} diff --git a/sdk/mongocluster/Azure.ResourceManager.MongoCluster/src/Generated/Models/EntraIdentityProviderProperties.cs b/sdk/mongocluster/Azure.ResourceManager.MongoCluster/src/Generated/Models/EntraIdentityProviderProperties.cs new file mode 100644 index 000000000000..595ecee643a9 --- /dev/null +++ b/sdk/mongocluster/Azure.ResourceManager.MongoCluster/src/Generated/Models/EntraIdentityProviderProperties.cs @@ -0,0 +1,72 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; + +namespace Azure.ResourceManager.MongoCluster.Models +{ + /// Microsoft Entra ID provider properties. + public partial class EntraIdentityProviderProperties + { + /// + /// Keeps track of any properties unknown to the library. + /// + /// To assign an object to the value of this property use . + /// + /// + /// To assign an already formatted json string to this property use . + /// + /// + /// Examples: + /// + /// + /// BinaryData.FromObjectAsJson("foo") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromString("\"foo\"") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromObjectAsJson(new { key = "value" }) + /// Creates a payload of { "key": "value" }. + /// + /// + /// BinaryData.FromString("{\"key\": \"value\"}") + /// Creates a payload of { "key": "value" }. + /// + /// + /// + /// + private IDictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . + /// The principal type of the user. + public EntraIdentityProviderProperties(EntraPrincipalType principalType) + { + PrincipalType = principalType; + } + + /// Initializes a new instance of . + /// The principal type of the user. + /// Keeps track of any properties unknown to the library. + internal EntraIdentityProviderProperties(EntraPrincipalType principalType, IDictionary serializedAdditionalRawData) + { + PrincipalType = principalType; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal EntraIdentityProviderProperties() + { + } + + /// The principal type of the user. + public EntraPrincipalType PrincipalType { get; set; } + } +} diff --git a/sdk/mongocluster/Azure.ResourceManager.MongoCluster/src/Generated/Models/EntraPrincipalType.cs b/sdk/mongocluster/Azure.ResourceManager.MongoCluster/src/Generated/Models/EntraPrincipalType.cs new file mode 100644 index 000000000000..5d8339cea23b --- /dev/null +++ b/sdk/mongocluster/Azure.ResourceManager.MongoCluster/src/Generated/Models/EntraPrincipalType.cs @@ -0,0 +1,51 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ComponentModel; + +namespace Azure.ResourceManager.MongoCluster.Models +{ + /// Microsoft Entra ID principal types available for a Mongo user. + public readonly partial struct EntraPrincipalType : IEquatable + { + private readonly string _value; + + /// Initializes a new instance of . + /// is null. + public EntraPrincipalType(string value) + { + _value = value ?? throw new ArgumentNullException(nameof(value)); + } + + private const string UserValue = "User"; + private const string ServiePrincipalValue = "ServicePrincipal"; + + /// Entra user type. + public static EntraPrincipalType User { get; } = new EntraPrincipalType(UserValue); + /// Entra service principal type. + public static EntraPrincipalType ServiePrincipal { get; } = new EntraPrincipalType(ServiePrincipalValue); + /// Determines if two values are the same. + public static bool operator ==(EntraPrincipalType left, EntraPrincipalType right) => left.Equals(right); + /// Determines if two values are not the same. + public static bool operator !=(EntraPrincipalType left, EntraPrincipalType right) => !left.Equals(right); + /// Converts a to a . + public static implicit operator EntraPrincipalType(string value) => new EntraPrincipalType(value); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override bool Equals(object obj) => obj is EntraPrincipalType other && Equals(other); + /// + public bool Equals(EntraPrincipalType 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/mongocluster/Azure.ResourceManager.MongoCluster/src/Generated/Models/IdentityProvider.Serialization.cs b/sdk/mongocluster/Azure.ResourceManager.MongoCluster/src/Generated/Models/IdentityProvider.Serialization.cs new file mode 100644 index 000000000000..6376e707fac0 --- /dev/null +++ b/sdk/mongocluster/Azure.ResourceManager.MongoCluster/src/Generated/Models/IdentityProvider.Serialization.cs @@ -0,0 +1,117 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Text.Json; +using Azure.Core; + +namespace Azure.ResourceManager.MongoCluster.Models +{ + [PersistableModelProxy(typeof(UnknownIdentityProvider))] + public partial class IdentityProvider : 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(IdentityProvider)} does not support writing '{format}' format."); + } + + writer.WritePropertyName("type"u8); + writer.WriteStringValue(Type.ToString()); + if (options.Format != "W" && _serializedAdditionalRawData != null) + { + foreach (var item in _serializedAdditionalRawData) + { + writer.WritePropertyName(item.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(item.Value); +#else + using (JsonDocument document = JsonDocument.Parse(item.Value, ModelSerializationExtensions.JsonDocumentOptions)) + { + JsonSerializer.Serialize(writer, document.RootElement); + } +#endif + } + } + } + + IdentityProvider 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(IdentityProvider)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeIdentityProvider(document.RootElement, options); + } + + internal static IdentityProvider DeserializeIdentityProvider(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + if (element.TryGetProperty("type", out JsonElement discriminator)) + { + switch (discriminator.GetString()) + { + case "MicrosoftEntraID": return EntraIdentityProvider.DeserializeEntraIdentityProvider(element, options); + } + } + return UnknownIdentityProvider.DeserializeUnknownIdentityProvider(element, options); + } + + 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, AzureResourceManagerMongoClusterContext.Default); + default: + throw new FormatException($"The model {nameof(IdentityProvider)} does not support writing '{options.Format}' format."); + } + } + + IdentityProvider 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 DeserializeIdentityProvider(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(IdentityProvider)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + } +} diff --git a/sdk/mongocluster/Azure.ResourceManager.MongoCluster/src/Generated/Models/IdentityProvider.cs b/sdk/mongocluster/Azure.ResourceManager.MongoCluster/src/Generated/Models/IdentityProvider.cs new file mode 100644 index 000000000000..d968ff1d9c03 --- /dev/null +++ b/sdk/mongocluster/Azure.ResourceManager.MongoCluster/src/Generated/Models/IdentityProvider.cs @@ -0,0 +1,69 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; + +namespace Azure.ResourceManager.MongoCluster.Models +{ + /// + /// Defines a user's identity provider definition. + /// Please note is the base class. According to the scenario, a derived class of the base class might need to be assigned here, or this property needs to be casted to one of the possible derived classes. + /// The available derived classes include . + /// + public abstract partial class IdentityProvider + { + /// + /// Keeps track of any properties unknown to the library. + /// + /// To assign an object to the value of this property use . + /// + /// + /// To assign an already formatted json string to this property use . + /// + /// + /// Examples: + /// + /// + /// BinaryData.FromObjectAsJson("foo") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromString("\"foo\"") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromObjectAsJson(new { key = "value" }) + /// Creates a payload of { "key": "value" }. + /// + /// + /// BinaryData.FromString("{\"key\": \"value\"}") + /// Creates a payload of { "key": "value" }. + /// + /// + /// + /// + private protected IDictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . + protected IdentityProvider() + { + } + + /// Initializes a new instance of . + /// The type of identity provider that the user belongs to. + /// Keeps track of any properties unknown to the library. + internal IdentityProvider(IdentityProviderType type, IDictionary serializedAdditionalRawData) + { + Type = type; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// The type of identity provider that the user belongs to. + internal IdentityProviderType Type { get; set; } + } +} diff --git a/sdk/mongocluster/Azure.ResourceManager.MongoCluster/src/Generated/Models/IdentityProviderType.cs b/sdk/mongocluster/Azure.ResourceManager.MongoCluster/src/Generated/Models/IdentityProviderType.cs new file mode 100644 index 000000000000..5f56e6ea2b3c --- /dev/null +++ b/sdk/mongocluster/Azure.ResourceManager.MongoCluster/src/Generated/Models/IdentityProviderType.cs @@ -0,0 +1,48 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ComponentModel; + +namespace Azure.ResourceManager.MongoCluster.Models +{ + /// Identity provider types that a a user identity can belong to. + internal readonly partial struct IdentityProviderType : IEquatable + { + private readonly string _value; + + /// Initializes a new instance of . + /// is null. + public IdentityProviderType(string value) + { + _value = value ?? throw new ArgumentNullException(nameof(value)); + } + + private const string MicrosoftEntraIdValue = "MicrosoftEntraID"; + + /// Microsoft Entra ID provider. + public static IdentityProviderType MicrosoftEntraId { get; } = new IdentityProviderType(MicrosoftEntraIdValue); + /// Determines if two values are the same. + public static bool operator ==(IdentityProviderType left, IdentityProviderType right) => left.Equals(right); + /// Determines if two values are not the same. + public static bool operator !=(IdentityProviderType left, IdentityProviderType right) => !left.Equals(right); + /// Converts a to a . + public static implicit operator IdentityProviderType(string value) => new IdentityProviderType(value); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override bool Equals(object obj) => obj is IdentityProviderType other && Equals(other); + /// + public bool Equals(IdentityProviderType 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/mongocluster/Azure.ResourceManager.MongoCluster/src/Generated/Models/MongoClusterProperties.Serialization.cs b/sdk/mongocluster/Azure.ResourceManager.MongoCluster/src/Generated/Models/MongoClusterProperties.Serialization.cs index 9054ba5fb44d..2c0658deab1c 100644 --- a/sdk/mongocluster/Azure.ResourceManager.MongoCluster/src/Generated/Models/MongoClusterProperties.Serialization.cs +++ b/sdk/mongocluster/Azure.ResourceManager.MongoCluster/src/Generated/Models/MongoClusterProperties.Serialization.cs @@ -104,6 +104,11 @@ protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWrit writer.WritePropertyName("backup"u8); writer.WriteObjectValue(Backup, options); } + if (Optional.IsDefined(DataApi)) + { + writer.WritePropertyName("dataApi"u8); + writer.WriteObjectValue(DataApi, options); + } if (options.Format != "W" && Optional.IsCollectionDefined(PrivateEndpointConnections)) { writer.WritePropertyName("privateEndpointConnections"u8); @@ -134,6 +139,11 @@ protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWrit writer.WritePropertyName("infrastructureVersion"u8); writer.WriteStringValue(InfrastructureVersion); } + if (Optional.IsDefined(AuthConfig)) + { + writer.WritePropertyName("authConfig"u8); + writer.WriteObjectValue(AuthConfig, options); + } if (options.Format != "W" && _serializedAdditionalRawData != null) { foreach (var item in _serializedAdditionalRawData) @@ -185,10 +195,12 @@ internal static MongoClusterProperties DeserializeMongoClusterProperties(JsonEle ShardingProperties sharding = default; ComputeProperties compute = default; BackupProperties backup = default; + DataApiProperties dataApi = default; IReadOnlyList privateEndpointConnections = default; IList previewFeatures = default; MongoClusterReplicationProperties replica = default; string infrastructureVersion = default; + AuthConfigProperties authConfig = default; IDictionary serializedAdditionalRawData = default; Dictionary rawDataDictionary = new Dictionary(); foreach (var property in element.EnumerateObject()) @@ -311,6 +323,15 @@ internal static MongoClusterProperties DeserializeMongoClusterProperties(JsonEle backup = BackupProperties.DeserializeBackupProperties(property.Value, options); continue; } + if (property.NameEquals("dataApi"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + dataApi = DataApiProperties.DeserializeDataApiProperties(property.Value, options); + continue; + } if (property.NameEquals("privateEndpointConnections"u8)) { if (property.Value.ValueKind == JsonValueKind.Null) @@ -353,6 +374,15 @@ internal static MongoClusterProperties DeserializeMongoClusterProperties(JsonEle infrastructureVersion = property.Value.GetString(); continue; } + if (property.NameEquals("authConfig"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + authConfig = AuthConfigProperties.DeserializeAuthConfigProperties(property.Value, options); + continue; + } if (options.Format != "W") { rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); @@ -374,10 +404,12 @@ internal static MongoClusterProperties DeserializeMongoClusterProperties(JsonEle sharding, compute, backup, + dataApi, privateEndpointConnections ?? new ChangeTrackingList(), previewFeatures ?? new ChangeTrackingList(), replica, infrastructureVersion, + authConfig, serializedAdditionalRawData); } diff --git a/sdk/mongocluster/Azure.ResourceManager.MongoCluster/src/Generated/Models/MongoClusterProperties.cs b/sdk/mongocluster/Azure.ResourceManager.MongoCluster/src/Generated/Models/MongoClusterProperties.cs index 34981443c068..dbfcace6ca2d 100644 --- a/sdk/mongocluster/Azure.ResourceManager.MongoCluster/src/Generated/Models/MongoClusterProperties.cs +++ b/sdk/mongocluster/Azure.ResourceManager.MongoCluster/src/Generated/Models/MongoClusterProperties.cs @@ -67,12 +67,14 @@ public MongoClusterProperties() /// The sharding properties of the mongo cluster. /// The compute properties of the mongo cluster. /// The backup properties of the mongo cluster. + /// The Data API properties of the mongo cluster. /// List of private endpoint connections. /// List of private endpoint connections. /// The replication properties for the mongo cluster. /// The infrastructure version the cluster is provisioned on. + /// The authentication configuration for the cluster. /// Keeps track of any properties unknown to the library. - internal MongoClusterProperties(MongoClusterCreateMode? createMode, MongoClusterRestoreContent restoreParameters, MongoClusterReplicaContent replicaParameters, MongoClusterAdministratorProperties administrator, string serverVersion, string connectionString, MongoClusterProvisioningState? provisioningState, MongoClusterStatus? clusterStatus, MongoClusterPublicNetworkAccess? publicNetworkAccess, HighAvailabilityProperties highAvailability, StorageProperties storage, ShardingProperties sharding, ComputeProperties compute, BackupProperties backup, IReadOnlyList privateEndpointConnections, IList previewFeatures, MongoClusterReplicationProperties replica, string infrastructureVersion, IDictionary serializedAdditionalRawData) + internal MongoClusterProperties(MongoClusterCreateMode? createMode, MongoClusterRestoreContent restoreParameters, MongoClusterReplicaContent replicaParameters, MongoClusterAdministratorProperties administrator, string serverVersion, string connectionString, MongoClusterProvisioningState? provisioningState, MongoClusterStatus? clusterStatus, MongoClusterPublicNetworkAccess? publicNetworkAccess, HighAvailabilityProperties highAvailability, StorageProperties storage, ShardingProperties sharding, ComputeProperties compute, BackupProperties backup, DataApiProperties dataApi, IReadOnlyList privateEndpointConnections, IList previewFeatures, MongoClusterReplicationProperties replica, string infrastructureVersion, AuthConfigProperties authConfig, IDictionary serializedAdditionalRawData) { CreateMode = createMode; RestoreParameters = restoreParameters; @@ -88,10 +90,12 @@ internal MongoClusterProperties(MongoClusterCreateMode? createMode, MongoCluster Sharding = sharding; Compute = compute; Backup = backup; + DataApi = dataApi; PrivateEndpointConnections = privateEndpointConnections; PreviewFeatures = previewFeatures; Replica = replica; InfrastructureVersion = infrastructureVersion; + AuthConfig = authConfig; _serializedAdditionalRawData = serializedAdditionalRawData; } @@ -128,19 +132,7 @@ public HighAvailabilityMode? HighAvailabilityTargetMode } /// The storage properties of the mongo cluster. - internal StorageProperties Storage { get; set; } - /// The size of the data disk assigned to each server. - public long? StorageSizeGb - { - get => Storage is null ? default : Storage.SizeGb; - set - { - if (Storage is null) - Storage = new StorageProperties(); - Storage.SizeGb = value; - } - } - + public StorageProperties Storage { get; set; } /// The sharding properties of the mongo cluster. internal ShardingProperties Sharding { get; set; } /// Number of shards to provision on the cluster. @@ -177,6 +169,20 @@ public string BackupEarliestRestoreTime get => Backup is null ? default : Backup.EarliestRestoreTime; } + /// The Data API properties of the mongo cluster. + internal DataApiProperties DataApi { get; set; } + /// The mode to indicate whether the Mongo Data API is enabled for a cluster. + public DataApiMode? DataApiMode + { + get => DataApi is null ? default : DataApi.Mode; + set + { + if (DataApi is null) + DataApi = new DataApiProperties(); + DataApi.Mode = value; + } + } + /// List of private endpoint connections. public IReadOnlyList PrivateEndpointConnections { get; } /// List of private endpoint connections. @@ -185,5 +191,17 @@ public string BackupEarliestRestoreTime public MongoClusterReplicationProperties Replica { get; } /// The infrastructure version the cluster is provisioned on. public string InfrastructureVersion { get; } + /// The authentication configuration for the cluster. + internal AuthConfigProperties AuthConfig { get; set; } + /// Allowed authentication modes for data access on the cluster. + public IList AuthConfigAllowedModes + { + get + { + if (AuthConfig is null) + AuthConfig = new AuthConfigProperties(); + return AuthConfig.AllowedModes; + } + } } } diff --git a/sdk/mongocluster/Azure.ResourceManager.MongoCluster/src/Generated/Models/MongoClusterUpdateProperties.Serialization.cs b/sdk/mongocluster/Azure.ResourceManager.MongoCluster/src/Generated/Models/MongoClusterUpdateProperties.Serialization.cs index 45edbef1df2d..8c705abd922c 100644 --- a/sdk/mongocluster/Azure.ResourceManager.MongoCluster/src/Generated/Models/MongoClusterUpdateProperties.Serialization.cs +++ b/sdk/mongocluster/Azure.ResourceManager.MongoCluster/src/Generated/Models/MongoClusterUpdateProperties.Serialization.cs @@ -74,6 +74,11 @@ protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWrit writer.WritePropertyName("backup"u8); writer.WriteObjectValue(Backup, options); } + if (Optional.IsDefined(DataApi)) + { + writer.WritePropertyName("dataApi"u8); + writer.WriteObjectValue(DataApi, options); + } if (Optional.IsCollectionDefined(PreviewFeatures)) { writer.WritePropertyName("previewFeatures"u8); @@ -84,6 +89,11 @@ protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWrit } writer.WriteEndArray(); } + if (Optional.IsDefined(AuthConfig)) + { + writer.WritePropertyName("authConfig"u8); + writer.WriteObjectValue(AuthConfig, options); + } if (options.Format != "W" && _serializedAdditionalRawData != null) { foreach (var item in _serializedAdditionalRawData) @@ -129,7 +139,9 @@ internal static MongoClusterUpdateProperties DeserializeMongoClusterUpdateProper ShardingProperties sharding = default; ComputeProperties compute = default; BackupProperties backup = default; + DataApiProperties dataApi = default; IList previewFeatures = default; + AuthConfigProperties authConfig = default; IDictionary serializedAdditionalRawData = default; Dictionary rawDataDictionary = new Dictionary(); foreach (var property in element.EnumerateObject()) @@ -202,6 +214,15 @@ internal static MongoClusterUpdateProperties DeserializeMongoClusterUpdateProper backup = BackupProperties.DeserializeBackupProperties(property.Value, options); continue; } + if (property.NameEquals("dataApi"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + dataApi = DataApiProperties.DeserializeDataApiProperties(property.Value, options); + continue; + } if (property.NameEquals("previewFeatures"u8)) { if (property.Value.ValueKind == JsonValueKind.Null) @@ -216,6 +237,15 @@ internal static MongoClusterUpdateProperties DeserializeMongoClusterUpdateProper previewFeatures = array; continue; } + if (property.NameEquals("authConfig"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + authConfig = AuthConfigProperties.DeserializeAuthConfigProperties(property.Value, options); + continue; + } if (options.Format != "W") { rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); @@ -231,7 +261,9 @@ internal static MongoClusterUpdateProperties DeserializeMongoClusterUpdateProper sharding, compute, backup, + dataApi, previewFeatures ?? new ChangeTrackingList(), + authConfig, serializedAdditionalRawData); } diff --git a/sdk/mongocluster/Azure.ResourceManager.MongoCluster/src/Generated/Models/MongoClusterUpdateProperties.cs b/sdk/mongocluster/Azure.ResourceManager.MongoCluster/src/Generated/Models/MongoClusterUpdateProperties.cs index 182cdb763b42..fd4f49562aaa 100644 --- a/sdk/mongocluster/Azure.ResourceManager.MongoCluster/src/Generated/Models/MongoClusterUpdateProperties.cs +++ b/sdk/mongocluster/Azure.ResourceManager.MongoCluster/src/Generated/Models/MongoClusterUpdateProperties.cs @@ -60,9 +60,11 @@ public MongoClusterUpdateProperties() /// The sharding properties of the mongo cluster. /// The compute properties of the mongo cluster. /// The backup properties of the mongo cluster. + /// The Data API properties of the mongo cluster. /// List of private endpoint connections. + /// The authentication configuration for the cluster. /// Keeps track of any properties unknown to the library. - internal MongoClusterUpdateProperties(MongoClusterAdministratorProperties administrator, string serverVersion, MongoClusterPublicNetworkAccess? publicNetworkAccess, HighAvailabilityProperties highAvailability, StorageProperties storage, ShardingProperties sharding, ComputeProperties compute, BackupProperties backup, IList previewFeatures, IDictionary serializedAdditionalRawData) + internal MongoClusterUpdateProperties(MongoClusterAdministratorProperties administrator, string serverVersion, MongoClusterPublicNetworkAccess? publicNetworkAccess, HighAvailabilityProperties highAvailability, StorageProperties storage, ShardingProperties sharding, ComputeProperties compute, BackupProperties backup, DataApiProperties dataApi, IList previewFeatures, AuthConfigProperties authConfig, IDictionary serializedAdditionalRawData) { Administrator = administrator; ServerVersion = serverVersion; @@ -72,7 +74,9 @@ internal MongoClusterUpdateProperties(MongoClusterAdministratorProperties admini Sharding = sharding; Compute = compute; Backup = backup; + DataApi = dataApi; PreviewFeatures = previewFeatures; + AuthConfig = authConfig; _serializedAdditionalRawData = serializedAdditionalRawData; } @@ -97,19 +101,7 @@ public HighAvailabilityMode? HighAvailabilityTargetMode } /// The storage properties of the mongo cluster. - internal StorageProperties Storage { get; set; } - /// The size of the data disk assigned to each server. - public long? StorageSizeGb - { - get => Storage is null ? default : Storage.SizeGb; - set - { - if (Storage is null) - Storage = new StorageProperties(); - Storage.SizeGb = value; - } - } - + public StorageProperties Storage { get; set; } /// The sharding properties of the mongo cluster. internal ShardingProperties Sharding { get; set; } /// Number of shards to provision on the cluster. @@ -146,7 +138,33 @@ public string BackupEarliestRestoreTime get => Backup is null ? default : Backup.EarliestRestoreTime; } + /// The Data API properties of the mongo cluster. + internal DataApiProperties DataApi { get; set; } + /// The mode to indicate whether the Mongo Data API is enabled for a cluster. + public DataApiMode? DataApiMode + { + get => DataApi is null ? default : DataApi.Mode; + set + { + if (DataApi is null) + DataApi = new DataApiProperties(); + DataApi.Mode = value; + } + } + /// List of private endpoint connections. public IList PreviewFeatures { get; } + /// The authentication configuration for the cluster. + internal AuthConfigProperties AuthConfig { get; set; } + /// Allowed authentication modes for data access on the cluster. + public IList AuthConfigAllowedModes + { + get + { + if (AuthConfig is null) + AuthConfig = new AuthConfigProperties(); + return AuthConfig.AllowedModes; + } + } } } diff --git a/sdk/mongocluster/Azure.ResourceManager.MongoCluster/src/Generated/Models/StorageProperties.Serialization.cs b/sdk/mongocluster/Azure.ResourceManager.MongoCluster/src/Generated/Models/StorageProperties.Serialization.cs index 07212c45464e..e5bd4b06b087 100644 --- a/sdk/mongocluster/Azure.ResourceManager.MongoCluster/src/Generated/Models/StorageProperties.Serialization.cs +++ b/sdk/mongocluster/Azure.ResourceManager.MongoCluster/src/Generated/Models/StorageProperties.Serialization.cs @@ -13,7 +13,7 @@ namespace Azure.ResourceManager.MongoCluster.Models { - internal partial class StorageProperties : IUtf8JsonSerializable, IJsonModel + public partial class StorageProperties : IUtf8JsonSerializable, IJsonModel { void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); @@ -39,6 +39,21 @@ protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWrit writer.WritePropertyName("sizeGb"u8); writer.WriteNumberValue(SizeGb.Value); } + if (Optional.IsDefined(Type)) + { + writer.WritePropertyName("type"u8); + writer.WriteStringValue(Type.Value.ToString()); + } + if (Optional.IsDefined(Iops)) + { + writer.WritePropertyName("iops"u8); + writer.WriteNumberValue(Iops.Value); + } + if (Optional.IsDefined(Throughput)) + { + writer.WritePropertyName("throughput"u8); + writer.WriteNumberValue(Throughput.Value); + } if (options.Format != "W" && _serializedAdditionalRawData != null) { foreach (var item in _serializedAdditionalRawData) @@ -77,6 +92,9 @@ internal static StorageProperties DeserializeStorageProperties(JsonElement eleme return null; } long? sizeGb = default; + StorageType? type = default; + long? iops = default; + long? throughput = default; IDictionary serializedAdditionalRawData = default; Dictionary rawDataDictionary = new Dictionary(); foreach (var property in element.EnumerateObject()) @@ -90,13 +108,40 @@ internal static StorageProperties DeserializeStorageProperties(JsonElement eleme sizeGb = property.Value.GetInt64(); continue; } + if (property.NameEquals("type"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + type = new StorageType(property.Value.GetString()); + continue; + } + if (property.NameEquals("iops"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + iops = property.Value.GetInt64(); + continue; + } + if (property.NameEquals("throughput"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + throughput = property.Value.GetInt64(); + continue; + } if (options.Format != "W") { rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); } } serializedAdditionalRawData = rawDataDictionary; - return new StorageProperties(sizeGb, serializedAdditionalRawData); + return new StorageProperties(sizeGb, type, iops, throughput, serializedAdditionalRawData); } BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) diff --git a/sdk/mongocluster/Azure.ResourceManager.MongoCluster/src/Generated/Models/StorageProperties.cs b/sdk/mongocluster/Azure.ResourceManager.MongoCluster/src/Generated/Models/StorageProperties.cs index fb650b8b8a99..712fb4ed611b 100644 --- a/sdk/mongocluster/Azure.ResourceManager.MongoCluster/src/Generated/Models/StorageProperties.cs +++ b/sdk/mongocluster/Azure.ResourceManager.MongoCluster/src/Generated/Models/StorageProperties.cs @@ -11,7 +11,7 @@ namespace Azure.ResourceManager.MongoCluster.Models { /// The storage properties of the cluster. This includes the data storage size and scaling applied to servers in the cluster. - internal partial class StorageProperties + public partial class StorageProperties { /// /// Keeps track of any properties unknown to the library. @@ -52,14 +52,26 @@ public StorageProperties() /// Initializes a new instance of . /// The size of the data disk assigned to each server. + /// The type of storage to provision the cluster servers with. + /// The IOPs of the storage assigned to each server. Only applicable if the type is 'PremiumSSDv2'. + /// The throughput of the storage assigned to each server. Only applicable if the type is 'PremiumSSDv2'. /// Keeps track of any properties unknown to the library. - internal StorageProperties(long? sizeGb, IDictionary serializedAdditionalRawData) + internal StorageProperties(long? sizeGb, StorageType? type, long? iops, long? throughput, IDictionary serializedAdditionalRawData) { SizeGb = sizeGb; + Type = type; + Iops = iops; + Throughput = throughput; _serializedAdditionalRawData = serializedAdditionalRawData; } /// The size of the data disk assigned to each server. public long? SizeGb { get; set; } + /// The type of storage to provision the cluster servers with. + public StorageType? Type { get; set; } + /// The IOPs of the storage assigned to each server. Only applicable if the type is 'PremiumSSDv2'. + public long? Iops { get; set; } + /// The throughput of the storage assigned to each server. Only applicable if the type is 'PremiumSSDv2'. + public long? Throughput { get; set; } } } diff --git a/sdk/mongocluster/Azure.ResourceManager.MongoCluster/src/Generated/Models/StorageType.cs b/sdk/mongocluster/Azure.ResourceManager.MongoCluster/src/Generated/Models/StorageType.cs new file mode 100644 index 000000000000..bb0e85c796b3 --- /dev/null +++ b/sdk/mongocluster/Azure.ResourceManager.MongoCluster/src/Generated/Models/StorageType.cs @@ -0,0 +1,51 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ComponentModel; + +namespace Azure.ResourceManager.MongoCluster.Models +{ + /// The type of storage that a mongo cluster can be provisioned with. + public readonly partial struct StorageType : IEquatable + { + private readonly string _value; + + /// Initializes a new instance of . + /// is null. + public StorageType(string value) + { + _value = value ?? throw new ArgumentNullException(nameof(value)); + } + + private const string PremiumSSDValue = "PremiumSSD"; + private const string PremiumSSDv2Value = "PremiumSSDv2"; + + /// Premium SSD for high performance workloads. + public static StorageType PremiumSSD { get; } = new StorageType(PremiumSSDValue); + /// Premium SSD v2 for very IO-intensive workloads. This is a preview option and has additional limitations. + public static StorageType PremiumSSDv2 { get; } = new StorageType(PremiumSSDv2Value); + /// Determines if two values are the same. + public static bool operator ==(StorageType left, StorageType right) => left.Equals(right); + /// Determines if two values are not the same. + public static bool operator !=(StorageType left, StorageType right) => !left.Equals(right); + /// Converts a to a . + public static implicit operator StorageType(string value) => new StorageType(value); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override bool Equals(object obj) => obj is StorageType other && Equals(other); + /// + public bool Equals(StorageType 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/mongocluster/Azure.ResourceManager.MongoCluster/src/Generated/Models/UnknownIdentityProvider.Serialization.cs b/sdk/mongocluster/Azure.ResourceManager.MongoCluster/src/Generated/Models/UnknownIdentityProvider.Serialization.cs new file mode 100644 index 000000000000..58f172d9b775 --- /dev/null +++ b/sdk/mongocluster/Azure.ResourceManager.MongoCluster/src/Generated/Models/UnknownIdentityProvider.Serialization.cs @@ -0,0 +1,110 @@ +// 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.MongoCluster.Models +{ + internal partial class UnknownIdentityProvider : IUtf8JsonSerializable, IJsonModel + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + writer.WriteStartObject(); + JsonModelWriteCore(writer, options); + writer.WriteEndObject(); + } + + /// The JSON writer. + /// The client options for reading and writing models. + protected override void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(IdentityProvider)} does not support writing '{format}' format."); + } + + base.JsonModelWriteCore(writer, options); + } + + IdentityProvider 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(IdentityProvider)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeIdentityProvider(document.RootElement, options); + } + + internal static UnknownIdentityProvider DeserializeUnknownIdentityProvider(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + IdentityProviderType type = "Unknown"; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("type"u8)) + { + type = new IdentityProviderType(property.Value.GetString()); + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new UnknownIdentityProvider(type, serializedAdditionalRawData); + } + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options, AzureResourceManagerMongoClusterContext.Default); + default: + throw new FormatException($"The model {nameof(IdentityProvider)} does not support writing '{options.Format}' format."); + } + } + + IdentityProvider 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 DeserializeIdentityProvider(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(IdentityProvider)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + } +} diff --git a/sdk/mongocluster/Azure.ResourceManager.MongoCluster/src/Generated/Models/UnknownIdentityProvider.cs b/sdk/mongocluster/Azure.ResourceManager.MongoCluster/src/Generated/Models/UnknownIdentityProvider.cs new file mode 100644 index 000000000000..15fc720c67c4 --- /dev/null +++ b/sdk/mongocluster/Azure.ResourceManager.MongoCluster/src/Generated/Models/UnknownIdentityProvider.cs @@ -0,0 +1,29 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; + +namespace Azure.ResourceManager.MongoCluster.Models +{ + /// Unknown version of IdentityProvider. + internal partial class UnknownIdentityProvider : IdentityProvider + { + /// Initializes a new instance of . + /// The type of identity provider that the user belongs to. + /// Keeps track of any properties unknown to the library. + internal UnknownIdentityProvider(IdentityProviderType type, IDictionary serializedAdditionalRawData) : base(type, serializedAdditionalRawData) + { + Type = type; + } + + /// Initializes a new instance of for deserialization. + internal UnknownIdentityProvider() + { + } + } +} diff --git a/sdk/mongocluster/Azure.ResourceManager.MongoCluster/src/Generated/Models/UserListResult.Serialization.cs b/sdk/mongocluster/Azure.ResourceManager.MongoCluster/src/Generated/Models/UserListResult.Serialization.cs new file mode 100644 index 000000000000..186c1cc614fe --- /dev/null +++ b/sdk/mongocluster/Azure.ResourceManager.MongoCluster/src/Generated/Models/UserListResult.Serialization.cs @@ -0,0 +1,151 @@ +// 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.MongoCluster.Models +{ + internal partial class UserListResult : 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(UserListResult)} does not support writing '{format}' format."); + } + + writer.WritePropertyName("value"u8); + writer.WriteStartArray(); + foreach (var item in Value) + { + writer.WriteObjectValue(item, options); + } + writer.WriteEndArray(); + if (Optional.IsDefined(NextLink)) + { + writer.WritePropertyName("nextLink"u8); + writer.WriteStringValue(NextLink.AbsoluteUri); + } + if (options.Format != "W" && _serializedAdditionalRawData != null) + { + foreach (var item in _serializedAdditionalRawData) + { + writer.WritePropertyName(item.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(item.Value); +#else + using (JsonDocument document = JsonDocument.Parse(item.Value, ModelSerializationExtensions.JsonDocumentOptions)) + { + JsonSerializer.Serialize(writer, document.RootElement); + } +#endif + } + } + } + + UserListResult 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(UserListResult)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeUserListResult(document.RootElement, options); + } + + internal static UserListResult DeserializeUserListResult(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + IReadOnlyList value = default; + Uri nextLink = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("value"u8)) + { + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + array.Add(UserData.DeserializeUserData(item, options)); + } + value = array; + continue; + } + if (property.NameEquals("nextLink"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + nextLink = new Uri(property.Value.GetString()); + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new UserListResult(value, nextLink, serializedAdditionalRawData); + } + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options, AzureResourceManagerMongoClusterContext.Default); + default: + throw new FormatException($"The model {nameof(UserListResult)} does not support writing '{options.Format}' format."); + } + } + + UserListResult 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 DeserializeUserListResult(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(UserListResult)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + } +} diff --git a/sdk/mongocluster/Azure.ResourceManager.MongoCluster/src/Generated/Models/UserListResult.cs b/sdk/mongocluster/Azure.ResourceManager.MongoCluster/src/Generated/Models/UserListResult.cs new file mode 100644 index 000000000000..bc2a79d55c0a --- /dev/null +++ b/sdk/mongocluster/Azure.ResourceManager.MongoCluster/src/Generated/Models/UserListResult.cs @@ -0,0 +1,80 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; +using System.Linq; + +namespace Azure.ResourceManager.MongoCluster.Models +{ + /// The response of a User list operation. + internal partial class UserListResult + { + /// + /// Keeps track of any properties unknown to the library. + /// + /// To assign an object to the value of this property use . + /// + /// + /// To assign an already formatted json string to this property use . + /// + /// + /// Examples: + /// + /// + /// BinaryData.FromObjectAsJson("foo") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromString("\"foo\"") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromObjectAsJson(new { key = "value" }) + /// Creates a payload of { "key": "value" }. + /// + /// + /// BinaryData.FromString("{\"key\": \"value\"}") + /// Creates a payload of { "key": "value" }. + /// + /// + /// + /// + private IDictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . + /// The User items on this page. + /// is null. + internal UserListResult(IEnumerable value) + { + Argument.AssertNotNull(value, nameof(value)); + + Value = value.ToList(); + } + + /// Initializes a new instance of . + /// The User items on this page. + /// The link to the next page of items. + /// Keeps track of any properties unknown to the library. + internal UserListResult(IReadOnlyList value, Uri nextLink, IDictionary serializedAdditionalRawData) + { + Value = value; + NextLink = nextLink; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal UserListResult() + { + } + + /// The User items on this page. + public IReadOnlyList Value { get; } + /// The link to the next page of items. + public Uri NextLink { get; } + } +} diff --git a/sdk/mongocluster/Azure.ResourceManager.MongoCluster/src/Generated/Models/UserProperties.Serialization.cs b/sdk/mongocluster/Azure.ResourceManager.MongoCluster/src/Generated/Models/UserProperties.Serialization.cs new file mode 100644 index 000000000000..f56e6da00e07 --- /dev/null +++ b/sdk/mongocluster/Azure.ResourceManager.MongoCluster/src/Generated/Models/UserProperties.Serialization.cs @@ -0,0 +1,173 @@ +// 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.MongoCluster.Models +{ + public partial class UserProperties : 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(UserProperties)} does not support writing '{format}' format."); + } + + if (options.Format != "W" && Optional.IsDefined(ProvisioningState)) + { + writer.WritePropertyName("provisioningState"u8); + writer.WriteStringValue(ProvisioningState.Value.ToString()); + } + if (Optional.IsDefined(IdentityProvider)) + { + writer.WritePropertyName("identityProvider"u8); + writer.WriteObjectValue(IdentityProvider, options); + } + if (Optional.IsCollectionDefined(Roles)) + { + writer.WritePropertyName("roles"u8); + writer.WriteStartArray(); + foreach (var item in Roles) + { + writer.WriteObjectValue(item, options); + } + writer.WriteEndArray(); + } + if (options.Format != "W" && _serializedAdditionalRawData != null) + { + foreach (var item in _serializedAdditionalRawData) + { + writer.WritePropertyName(item.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(item.Value); +#else + using (JsonDocument document = JsonDocument.Parse(item.Value, ModelSerializationExtensions.JsonDocumentOptions)) + { + JsonSerializer.Serialize(writer, document.RootElement); + } +#endif + } + } + } + + UserProperties 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(UserProperties)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeUserProperties(document.RootElement, options); + } + + internal static UserProperties DeserializeUserProperties(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + MongoClusterProvisioningState? provisioningState = default; + IdentityProvider identityProvider = default; + IList roles = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("provisioningState"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + provisioningState = new MongoClusterProvisioningState(property.Value.GetString()); + continue; + } + if (property.NameEquals("identityProvider"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + identityProvider = IdentityProvider.DeserializeIdentityProvider(property.Value, options); + continue; + } + if (property.NameEquals("roles"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + array.Add(DatabaseRole.DeserializeDatabaseRole(item, options)); + } + roles = array; + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new UserProperties(provisioningState, identityProvider, roles ?? new ChangeTrackingList(), serializedAdditionalRawData); + } + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options, AzureResourceManagerMongoClusterContext.Default); + default: + throw new FormatException($"The model {nameof(UserProperties)} does not support writing '{options.Format}' format."); + } + } + + UserProperties 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 DeserializeUserProperties(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(UserProperties)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + } +} diff --git a/sdk/mongocluster/Azure.ResourceManager.MongoCluster/src/Generated/Models/UserProperties.cs b/sdk/mongocluster/Azure.ResourceManager.MongoCluster/src/Generated/Models/UserProperties.cs new file mode 100644 index 000000000000..6730f6024974 --- /dev/null +++ b/sdk/mongocluster/Azure.ResourceManager.MongoCluster/src/Generated/Models/UserProperties.cs @@ -0,0 +1,82 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; + +namespace Azure.ResourceManager.MongoCluster.Models +{ + /// Definition of Mongo user resource on a cluster. + public partial class UserProperties + { + /// + /// 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 UserProperties() + { + Roles = new ChangeTrackingList(); + } + + /// Initializes a new instance of . + /// The provisioning state of the user. + /// + /// The user's identity provider definition. + /// Please note is the base class. According to the scenario, a derived class of the base class might need to be assigned here, or this property needs to be casted to one of the possible derived classes. + /// The available derived classes include . + /// + /// Database roles that are assigned to the user. + /// Keeps track of any properties unknown to the library. + internal UserProperties(MongoClusterProvisioningState? provisioningState, IdentityProvider identityProvider, IList roles, IDictionary serializedAdditionalRawData) + { + ProvisioningState = provisioningState; + IdentityProvider = identityProvider; + Roles = roles; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// The provisioning state of the user. + public MongoClusterProvisioningState? ProvisioningState { get; } + /// + /// The user's identity provider definition. + /// Please note is the base class. According to the scenario, a derived class of the base class might need to be assigned here, or this property needs to be casted to one of the possible derived classes. + /// The available derived classes include . + /// + public IdentityProvider IdentityProvider { get; set; } + /// Database roles that are assigned to the user. + public IList Roles { get; } + } +} diff --git a/sdk/mongocluster/Azure.ResourceManager.MongoCluster/src/Generated/Models/UserRole.cs b/sdk/mongocluster/Azure.ResourceManager.MongoCluster/src/Generated/Models/UserRole.cs new file mode 100644 index 000000000000..6f139c3316d3 --- /dev/null +++ b/sdk/mongocluster/Azure.ResourceManager.MongoCluster/src/Generated/Models/UserRole.cs @@ -0,0 +1,48 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ComponentModel; + +namespace Azure.ResourceManager.MongoCluster.Models +{ + /// Built-in database role that can be assigned to a user. + public readonly partial struct UserRole : IEquatable + { + private readonly string _value; + + /// Initializes a new instance of . + /// is null. + public UserRole(string value) + { + _value = value ?? throw new ArgumentNullException(nameof(value)); + } + + private const string DatabaseOwnerValue = "dbOwner"; + + /// Datbase owner role permissions on the target scope. + public static UserRole DatabaseOwner { get; } = new UserRole(DatabaseOwnerValue); + /// Determines if two values are the same. + public static bool operator ==(UserRole left, UserRole right) => left.Equals(right); + /// Determines if two values are not the same. + public static bool operator !=(UserRole left, UserRole right) => !left.Equals(right); + /// Converts a to a . + public static implicit operator UserRole(string value) => new UserRole(value); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override bool Equals(object obj) => obj is UserRole other && Equals(other); + /// + public bool Equals(UserRole 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/mongocluster/Azure.ResourceManager.MongoCluster/src/Generated/MongoClusterCollection.cs b/sdk/mongocluster/Azure.ResourceManager.MongoCluster/src/Generated/MongoClusterCollection.cs index c8d9efdce71d..b8199242498b 100644 --- a/sdk/mongocluster/Azure.ResourceManager.MongoCluster/src/Generated/MongoClusterCollection.cs +++ b/sdk/mongocluster/Azure.ResourceManager.MongoCluster/src/Generated/MongoClusterCollection.cs @@ -65,7 +65,7 @@ internal static void ValidateResourceId(ResourceIdentifier id) /// /// /// Default Api Version - /// 2024-07-01 + /// 2025-04-01-preview /// /// /// Resource @@ -114,7 +114,7 @@ public virtual async Task> CreateOrUpdateAsyn /// /// /// Default Api Version - /// 2024-07-01 + /// 2025-04-01-preview /// /// /// Resource @@ -163,7 +163,7 @@ public virtual ArmOperation CreateOrUpdate(WaitUntil waitU /// /// /// Default Api Version - /// 2024-07-01 + /// 2025-04-01-preview /// /// /// Resource @@ -208,7 +208,7 @@ public virtual async Task> GetAsync(string mongoC /// /// /// Default Api Version - /// 2024-07-01 + /// 2025-04-01-preview /// /// /// Resource @@ -253,7 +253,7 @@ public virtual Response Get(string mongoClusterName, Cance /// /// /// Default Api Version - /// 2024-07-01 + /// 2025-04-01-preview /// /// /// Resource @@ -283,7 +283,7 @@ public virtual AsyncPageable GetAllAsync(CancellationToken /// /// /// Default Api Version - /// 2024-07-01 + /// 2025-04-01-preview /// /// /// Resource @@ -313,7 +313,7 @@ public virtual Pageable GetAll(CancellationToken cancellat /// /// /// Default Api Version - /// 2024-07-01 + /// 2025-04-01-preview /// /// /// Resource @@ -356,7 +356,7 @@ public virtual async Task> ExistsAsync(string mongoClusterName, C /// /// /// Default Api Version - /// 2024-07-01 + /// 2025-04-01-preview /// /// /// Resource @@ -399,7 +399,7 @@ public virtual Response Exists(string mongoClusterName, CancellationToken /// /// /// Default Api Version - /// 2024-07-01 + /// 2025-04-01-preview /// /// /// Resource @@ -444,7 +444,7 @@ public virtual async Task> GetIfExistsAsy /// /// /// Default Api Version - /// 2024-07-01 + /// 2025-04-01-preview /// /// /// Resource diff --git a/sdk/mongocluster/Azure.ResourceManager.MongoCluster/src/Generated/MongoClusterFirewallRuleCollection.cs b/sdk/mongocluster/Azure.ResourceManager.MongoCluster/src/Generated/MongoClusterFirewallRuleCollection.cs index 941f285a6a0f..47b51a380b82 100644 --- a/sdk/mongocluster/Azure.ResourceManager.MongoCluster/src/Generated/MongoClusterFirewallRuleCollection.cs +++ b/sdk/mongocluster/Azure.ResourceManager.MongoCluster/src/Generated/MongoClusterFirewallRuleCollection.cs @@ -64,7 +64,7 @@ internal static void ValidateResourceId(ResourceIdentifier id) /// /// /// Default Api Version - /// 2024-07-01 + /// 2025-04-01-preview /// /// /// Resource @@ -113,7 +113,7 @@ public virtual async Task> Create /// /// /// Default Api Version - /// 2024-07-01 + /// 2025-04-01-preview /// /// /// Resource @@ -162,7 +162,7 @@ public virtual ArmOperation CreateOrUpdate(Wai /// /// /// Default Api Version - /// 2024-07-01 + /// 2025-04-01-preview /// /// /// Resource @@ -207,7 +207,7 @@ public virtual async Task> GetAsync(s /// /// /// Default Api Version - /// 2024-07-01 + /// 2025-04-01-preview /// /// /// Resource @@ -252,7 +252,7 @@ public virtual Response Get(string firewallRul /// /// /// Default Api Version - /// 2024-07-01 + /// 2025-04-01-preview /// /// /// Resource @@ -282,7 +282,7 @@ public virtual AsyncPageable GetAllAsync(Cance /// /// /// Default Api Version - /// 2024-07-01 + /// 2025-04-01-preview /// /// /// Resource @@ -312,7 +312,7 @@ public virtual Pageable GetAll(CancellationTok /// /// /// Default Api Version - /// 2024-07-01 + /// 2025-04-01-preview /// /// /// Resource @@ -355,7 +355,7 @@ public virtual async Task> ExistsAsync(string firewallRuleName, C /// /// /// Default Api Version - /// 2024-07-01 + /// 2025-04-01-preview /// /// /// Resource @@ -398,7 +398,7 @@ public virtual Response Exists(string firewallRuleName, CancellationToken /// /// /// Default Api Version - /// 2024-07-01 + /// 2025-04-01-preview /// /// /// Resource @@ -443,7 +443,7 @@ public virtual async Task> Ge /// /// /// Default Api Version - /// 2024-07-01 + /// 2025-04-01-preview /// /// /// Resource diff --git a/sdk/mongocluster/Azure.ResourceManager.MongoCluster/src/Generated/MongoClusterFirewallRuleResource.cs b/sdk/mongocluster/Azure.ResourceManager.MongoCluster/src/Generated/MongoClusterFirewallRuleResource.cs index fd29a6f95f8d..6781f29ea30a 100644 --- a/sdk/mongocluster/Azure.ResourceManager.MongoCluster/src/Generated/MongoClusterFirewallRuleResource.cs +++ b/sdk/mongocluster/Azure.ResourceManager.MongoCluster/src/Generated/MongoClusterFirewallRuleResource.cs @@ -101,7 +101,7 @@ internal static void ValidateResourceId(ResourceIdentifier id) /// /// /// Default Api Version - /// 2024-07-01 + /// 2025-04-01-preview /// /// /// Resource @@ -141,7 +141,7 @@ public virtual async Task> GetAsync(C /// /// /// Default Api Version - /// 2024-07-01 + /// 2025-04-01-preview /// /// /// Resource @@ -181,7 +181,7 @@ public virtual Response Get(CancellationToken /// /// /// Default Api Version - /// 2024-07-01 + /// 2025-04-01-preview /// /// /// Resource @@ -223,7 +223,7 @@ public virtual async Task DeleteAsync(WaitUntil waitUntil, Cancell /// /// /// Default Api Version - /// 2024-07-01 + /// 2025-04-01-preview /// /// /// Resource @@ -265,7 +265,7 @@ public virtual ArmOperation Delete(WaitUntil waitUntil, CancellationToken cancel /// /// /// Default Api Version - /// 2024-07-01 + /// 2025-04-01-preview /// /// /// Resource @@ -311,7 +311,7 @@ public virtual async Task> Update /// /// /// Default Api Version - /// 2024-07-01 + /// 2025-04-01-preview /// /// /// Resource diff --git a/sdk/mongocluster/Azure.ResourceManager.MongoCluster/src/Generated/MongoClusterPrivateEndpointConnectionResource.cs b/sdk/mongocluster/Azure.ResourceManager.MongoCluster/src/Generated/MongoClusterPrivateEndpointConnectionResource.cs index 07c1a1c07d42..c6ee877ecf06 100644 --- a/sdk/mongocluster/Azure.ResourceManager.MongoCluster/src/Generated/MongoClusterPrivateEndpointConnectionResource.cs +++ b/sdk/mongocluster/Azure.ResourceManager.MongoCluster/src/Generated/MongoClusterPrivateEndpointConnectionResource.cs @@ -101,7 +101,7 @@ internal static void ValidateResourceId(ResourceIdentifier id) /// /// /// Default Api Version - /// 2024-07-01 + /// 2025-04-01-preview /// /// /// Resource @@ -141,7 +141,7 @@ public virtual async Task /// /// Default Api Version - /// 2024-07-01 + /// 2025-04-01-preview /// /// /// Resource @@ -181,7 +181,7 @@ public virtual Response Get(Cance /// /// /// Default Api Version - /// 2024-07-01 + /// 2025-04-01-preview /// /// /// Resource @@ -223,7 +223,7 @@ public virtual async Task DeleteAsync(WaitUntil waitUntil, Cancell /// /// /// Default Api Version - /// 2024-07-01 + /// 2025-04-01-preview /// /// /// Resource @@ -265,7 +265,7 @@ public virtual ArmOperation Delete(WaitUntil waitUntil, CancellationToken cancel /// /// /// Default Api Version - /// 2024-07-01 + /// 2025-04-01-preview /// /// /// Resource @@ -311,7 +311,7 @@ public virtual async Task /// /// Default Api Version - /// 2024-07-01 + /// 2025-04-01-preview /// /// /// Resource diff --git a/sdk/mongocluster/Azure.ResourceManager.MongoCluster/src/Generated/MongoClusterPrivateEndpointConnectionResourceCollection.cs b/sdk/mongocluster/Azure.ResourceManager.MongoCluster/src/Generated/MongoClusterPrivateEndpointConnectionResourceCollection.cs index 8136ff74d1d0..d4d232cdd88e 100644 --- a/sdk/mongocluster/Azure.ResourceManager.MongoCluster/src/Generated/MongoClusterPrivateEndpointConnectionResourceCollection.cs +++ b/sdk/mongocluster/Azure.ResourceManager.MongoCluster/src/Generated/MongoClusterPrivateEndpointConnectionResourceCollection.cs @@ -64,7 +64,7 @@ internal static void ValidateResourceId(ResourceIdentifier id) /// /// /// Default Api Version - /// 2024-07-01 + /// 2025-04-01-preview /// /// /// Resource @@ -113,7 +113,7 @@ public virtual async Task /// /// Default Api Version - /// 2024-07-01 + /// 2025-04-01-preview /// /// /// Resource @@ -162,7 +162,7 @@ public virtual ArmOperation Creat /// /// /// Default Api Version - /// 2024-07-01 + /// 2025-04-01-preview /// /// /// Resource @@ -207,7 +207,7 @@ public virtual async Task /// /// Default Api Version - /// 2024-07-01 + /// 2025-04-01-preview /// /// /// Resource @@ -252,7 +252,7 @@ public virtual Response Get(strin /// /// /// Default Api Version - /// 2024-07-01 + /// 2025-04-01-preview /// /// /// Resource @@ -282,7 +282,7 @@ public virtual AsyncPageable GetA /// /// /// Default Api Version - /// 2024-07-01 + /// 2025-04-01-preview /// /// /// Resource @@ -312,7 +312,7 @@ public virtual Pageable GetAll(Ca /// /// /// Default Api Version - /// 2024-07-01 + /// 2025-04-01-preview /// /// /// Resource @@ -355,7 +355,7 @@ public virtual async Task> ExistsAsync(string privateEndpointConn /// /// /// Default Api Version - /// 2024-07-01 + /// 2025-04-01-preview /// /// /// Resource @@ -398,7 +398,7 @@ public virtual Response Exists(string privateEndpointConnectionName, Cance /// /// /// Default Api Version - /// 2024-07-01 + /// 2025-04-01-preview /// /// /// Resource @@ -443,7 +443,7 @@ public virtual async Task /// /// Default Api Version - /// 2024-07-01 + /// 2025-04-01-preview /// /// /// Resource diff --git a/sdk/mongocluster/Azure.ResourceManager.MongoCluster/src/Generated/MongoClusterResource.cs b/sdk/mongocluster/Azure.ResourceManager.MongoCluster/src/Generated/MongoClusterResource.cs index 6804c462bb87..f7bedd62846f 100644 --- a/sdk/mongocluster/Azure.ResourceManager.MongoCluster/src/Generated/MongoClusterResource.cs +++ b/sdk/mongocluster/Azure.ResourceManager.MongoCluster/src/Generated/MongoClusterResource.cs @@ -119,7 +119,7 @@ public virtual MongoClusterFirewallRuleCollection GetMongoClusterFirewallRules() /// /// /// Default Api Version - /// 2024-07-01 + /// 2025-04-01-preview /// /// /// Resource @@ -150,7 +150,7 @@ public virtual async Task> GetMongoCl /// /// /// Default Api Version - /// 2024-07-01 + /// 2025-04-01-preview /// /// /// Resource @@ -188,7 +188,7 @@ public virtual MongoClusterPrivateEndpointConnectionResourceCollection GetMongoC /// /// /// Default Api Version - /// 2024-07-01 + /// 2025-04-01-preview /// /// /// Resource @@ -219,7 +219,7 @@ public virtual async Task /// /// Default Api Version - /// 2024-07-01 + /// 2025-04-01-preview /// /// /// Resource @@ -237,6 +237,75 @@ public virtual Response GetMongoC return GetMongoClusterPrivateEndpointConnectionResources().Get(privateEndpointConnectionName, cancellationToken); } + /// Gets a collection of UserResources in the MongoCluster. + /// An object representing collection of UserResources and their operations over a UserResource. + public virtual UserCollection GetUsers() + { + return GetCachedClient(client => new UserCollection(client, Id)); + } + + /// + /// Gets the defintion of a Mongo cluster user. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/mongoClusters/{mongoClusterName}/users/{userName} + /// + /// + /// Operation Id + /// User_Get + /// + /// + /// Default Api Version + /// 2025-04-01-preview + /// + /// + /// Resource + /// + /// + /// + /// + /// The name of the mongo cluster user. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public virtual async Task> GetUserAsync(string userName, CancellationToken cancellationToken = default) + { + return await GetUsers().GetAsync(userName, cancellationToken).ConfigureAwait(false); + } + + /// + /// Gets the defintion of a Mongo cluster user. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/mongoClusters/{mongoClusterName}/users/{userName} + /// + /// + /// Operation Id + /// User_Get + /// + /// + /// Default Api Version + /// 2025-04-01-preview + /// + /// + /// Resource + /// + /// + /// + /// + /// The name of the mongo cluster user. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public virtual Response GetUser(string userName, CancellationToken cancellationToken = default) + { + return GetUsers().Get(userName, cancellationToken); + } + /// /// Gets information about a mongo cluster. /// @@ -250,7 +319,7 @@ public virtual Response GetMongoC /// /// /// Default Api Version - /// 2024-07-01 + /// 2025-04-01-preview /// /// /// Resource @@ -290,7 +359,7 @@ public virtual async Task> GetAsync(CancellationT /// /// /// Default Api Version - /// 2024-07-01 + /// 2025-04-01-preview /// /// /// Resource @@ -330,7 +399,7 @@ public virtual Response Get(CancellationToken cancellation /// /// /// Default Api Version - /// 2024-07-01 + /// 2025-04-01-preview /// /// /// Resource @@ -372,7 +441,7 @@ public virtual async Task DeleteAsync(WaitUntil waitUntil, Cancell /// /// /// Default Api Version - /// 2024-07-01 + /// 2025-04-01-preview /// /// /// Resource @@ -414,7 +483,7 @@ public virtual ArmOperation Delete(WaitUntil waitUntil, CancellationToken cancel /// /// /// Default Api Version - /// 2024-07-01 + /// 2025-04-01-preview /// /// /// Resource @@ -460,7 +529,7 @@ public virtual async Task> UpdateAsync(WaitUn /// /// /// Default Api Version - /// 2024-07-01 + /// 2025-04-01-preview /// /// /// Resource @@ -506,7 +575,7 @@ public virtual ArmOperation Update(WaitUntil waitUntil, Mo /// /// /// Default Api Version - /// 2024-07-01 + /// 2025-04-01-preview /// /// /// Resource @@ -544,7 +613,7 @@ public virtual async Task> GetConn /// /// /// Default Api Version - /// 2024-07-01 + /// 2025-04-01-preview /// /// /// Resource @@ -582,7 +651,7 @@ public virtual Response GetConnectionString /// /// /// Default Api Version - /// 2024-07-01 + /// 2025-04-01-preview /// /// /// Resource @@ -628,7 +697,7 @@ public virtual async Task PromoteAsync(WaitUntil waitUntil, Promot /// /// /// Default Api Version - /// 2024-07-01 + /// 2025-04-01-preview /// /// /// Resource @@ -674,7 +743,7 @@ public virtual ArmOperation Promote(WaitUntil waitUntil, PromoteReplicaContent c /// /// /// Default Api Version - /// 2024-07-01 + /// 2025-04-01-preview /// /// /// @@ -700,7 +769,7 @@ public virtual AsyncPageable GetPrivateLink /// /// /// Default Api Version - /// 2024-07-01 + /// 2025-04-01-preview /// /// /// @@ -726,7 +795,7 @@ public virtual Pageable GetPrivateLinks(Can /// /// /// Default Api Version - /// 2024-07-01 + /// 2025-04-01-preview /// /// /// @@ -752,7 +821,7 @@ public virtual AsyncPageable GetReplicasByParentAsync(Cance /// /// /// Default Api Version - /// 2024-07-01 + /// 2025-04-01-preview /// /// /// @@ -778,7 +847,7 @@ public virtual Pageable GetReplicasByParent(CancellationTok /// /// /// Default Api Version - /// 2024-07-01 + /// 2025-04-01-preview /// /// /// Resource @@ -840,7 +909,7 @@ public virtual async Task> AddTagAsync(string key /// /// /// Default Api Version - /// 2024-07-01 + /// 2025-04-01-preview /// /// /// Resource @@ -902,7 +971,7 @@ public virtual Response AddTag(string key, string value, C /// /// /// Default Api Version - /// 2024-07-01 + /// 2025-04-01-preview /// /// /// Resource @@ -959,7 +1028,7 @@ public virtual async Task> SetTagsAsync(IDictiona /// /// /// Default Api Version - /// 2024-07-01 + /// 2025-04-01-preview /// /// /// Resource @@ -1016,7 +1085,7 @@ public virtual Response SetTags(IDictionary /// /// Default Api Version - /// 2024-07-01 + /// 2025-04-01-preview /// /// /// Resource @@ -1076,7 +1145,7 @@ public virtual async Task> RemoveTagAsync(string /// /// /// Default Api Version - /// 2024-07-01 + /// 2025-04-01-preview /// /// /// Resource diff --git a/sdk/mongocluster/Azure.ResourceManager.MongoCluster/src/Generated/RestOperations/FirewallRulesRestOperations.cs b/sdk/mongocluster/Azure.ResourceManager.MongoCluster/src/Generated/RestOperations/FirewallRulesRestOperations.cs index 4d0d6ac3ecd6..ef3a09d42892 100644 --- a/sdk/mongocluster/Azure.ResourceManager.MongoCluster/src/Generated/RestOperations/FirewallRulesRestOperations.cs +++ b/sdk/mongocluster/Azure.ResourceManager.MongoCluster/src/Generated/RestOperations/FirewallRulesRestOperations.cs @@ -32,7 +32,7 @@ public FirewallRulesRestOperations(HttpPipeline pipeline, string applicationId, { _pipeline = pipeline ?? throw new ArgumentNullException(nameof(pipeline)); _endpoint = endpoint ?? new Uri("https://management.azure.com"); - _apiVersion = apiVersion ?? "2024-07-01"; + _apiVersion = apiVersion ?? "2025-04-01-preview"; _userAgent = new TelemetryDetails(GetType().Assembly, applicationId); } diff --git a/sdk/mongocluster/Azure.ResourceManager.MongoCluster/src/Generated/RestOperations/MongoClustersRestOperations.cs b/sdk/mongocluster/Azure.ResourceManager.MongoCluster/src/Generated/RestOperations/MongoClustersRestOperations.cs index 159287b991d5..2645787aabd8 100644 --- a/sdk/mongocluster/Azure.ResourceManager.MongoCluster/src/Generated/RestOperations/MongoClustersRestOperations.cs +++ b/sdk/mongocluster/Azure.ResourceManager.MongoCluster/src/Generated/RestOperations/MongoClustersRestOperations.cs @@ -32,7 +32,7 @@ public MongoClustersRestOperations(HttpPipeline pipeline, string applicationId, { _pipeline = pipeline ?? throw new ArgumentNullException(nameof(pipeline)); _endpoint = endpoint ?? new Uri("https://management.azure.com"); - _apiVersion = apiVersion ?? "2024-07-01"; + _apiVersion = apiVersion ?? "2025-04-01-preview"; _userAgent = new TelemetryDetails(GetType().Assembly, applicationId); } diff --git a/sdk/mongocluster/Azure.ResourceManager.MongoCluster/src/Generated/RestOperations/PrivateEndpointConnectionsRestOperations.cs b/sdk/mongocluster/Azure.ResourceManager.MongoCluster/src/Generated/RestOperations/PrivateEndpointConnectionsRestOperations.cs index a25fc00275c0..b506eb42919e 100644 --- a/sdk/mongocluster/Azure.ResourceManager.MongoCluster/src/Generated/RestOperations/PrivateEndpointConnectionsRestOperations.cs +++ b/sdk/mongocluster/Azure.ResourceManager.MongoCluster/src/Generated/RestOperations/PrivateEndpointConnectionsRestOperations.cs @@ -32,7 +32,7 @@ public PrivateEndpointConnectionsRestOperations(HttpPipeline pipeline, string ap { _pipeline = pipeline ?? throw new ArgumentNullException(nameof(pipeline)); _endpoint = endpoint ?? new Uri("https://management.azure.com"); - _apiVersion = apiVersion ?? "2024-07-01"; + _apiVersion = apiVersion ?? "2025-04-01-preview"; _userAgent = new TelemetryDetails(GetType().Assembly, applicationId); } diff --git a/sdk/mongocluster/Azure.ResourceManager.MongoCluster/src/Generated/RestOperations/PrivateLinksRestOperations.cs b/sdk/mongocluster/Azure.ResourceManager.MongoCluster/src/Generated/RestOperations/PrivateLinksRestOperations.cs index 04d9d0daf17a..8340e369a86b 100644 --- a/sdk/mongocluster/Azure.ResourceManager.MongoCluster/src/Generated/RestOperations/PrivateLinksRestOperations.cs +++ b/sdk/mongocluster/Azure.ResourceManager.MongoCluster/src/Generated/RestOperations/PrivateLinksRestOperations.cs @@ -32,7 +32,7 @@ public PrivateLinksRestOperations(HttpPipeline pipeline, string applicationId, U { _pipeline = pipeline ?? throw new ArgumentNullException(nameof(pipeline)); _endpoint = endpoint ?? new Uri("https://management.azure.com"); - _apiVersion = apiVersion ?? "2024-07-01"; + _apiVersion = apiVersion ?? "2025-04-01-preview"; _userAgent = new TelemetryDetails(GetType().Assembly, applicationId); } diff --git a/sdk/mongocluster/Azure.ResourceManager.MongoCluster/src/Generated/RestOperations/ReplicasRestOperations.cs b/sdk/mongocluster/Azure.ResourceManager.MongoCluster/src/Generated/RestOperations/ReplicasRestOperations.cs index c99a3c0e0d27..1ef0e22e71ee 100644 --- a/sdk/mongocluster/Azure.ResourceManager.MongoCluster/src/Generated/RestOperations/ReplicasRestOperations.cs +++ b/sdk/mongocluster/Azure.ResourceManager.MongoCluster/src/Generated/RestOperations/ReplicasRestOperations.cs @@ -32,7 +32,7 @@ public ReplicasRestOperations(HttpPipeline pipeline, string applicationId, Uri e { _pipeline = pipeline ?? throw new ArgumentNullException(nameof(pipeline)); _endpoint = endpoint ?? new Uri("https://management.azure.com"); - _apiVersion = apiVersion ?? "2024-07-01"; + _apiVersion = apiVersion ?? "2025-04-01-preview"; _userAgent = new TelemetryDetails(GetType().Assembly, applicationId); } diff --git a/sdk/mongocluster/Azure.ResourceManager.MongoCluster/src/Generated/RestOperations/UsersRestOperations.cs b/sdk/mongocluster/Azure.ResourceManager.MongoCluster/src/Generated/RestOperations/UsersRestOperations.cs new file mode 100644 index 000000000000..2f40dd02af0f --- /dev/null +++ b/sdk/mongocluster/Azure.ResourceManager.MongoCluster/src/Generated/RestOperations/UsersRestOperations.cs @@ -0,0 +1,513 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Text.Json; +using System.Threading; +using System.Threading.Tasks; +using Azure.Core; +using Azure.Core.Pipeline; +using Azure.ResourceManager.MongoCluster.Models; + +namespace Azure.ResourceManager.MongoCluster +{ + internal partial class UsersRestOperations + { + private readonly TelemetryDetails _userAgent; + private readonly HttpPipeline _pipeline; + private readonly Uri _endpoint; + private readonly string _apiVersion; + + /// Initializes a new instance of UsersRestOperations. + /// The HTTP pipeline for sending and receiving REST requests and responses. + /// The application id to use for user agent. + /// Service host. + /// The API version to use for this operation. + /// or is null. + public UsersRestOperations(HttpPipeline pipeline, string applicationId, Uri endpoint = null, string apiVersion = default) + { + _pipeline = pipeline ?? throw new ArgumentNullException(nameof(pipeline)); + _endpoint = endpoint ?? new Uri("https://management.azure.com"); + _apiVersion = apiVersion ?? "2025-04-01-preview"; + _userAgent = new TelemetryDetails(GetType().Assembly, applicationId); + } + + internal RequestUriBuilder CreateGetRequestUri(string subscriptionId, string resourceGroupName, string mongoClusterName, string userName) + { + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/subscriptions/", false); + uri.AppendPath(subscriptionId, true); + uri.AppendPath("/resourceGroups/", false); + uri.AppendPath(resourceGroupName, true); + uri.AppendPath("/providers/Microsoft.DocumentDB/mongoClusters/", false); + uri.AppendPath(mongoClusterName, true); + uri.AppendPath("/users/", false); + uri.AppendPath(userName, true); + uri.AppendQuery("api-version", _apiVersion, true); + return uri; + } + + internal HttpMessage CreateGetRequest(string subscriptionId, string resourceGroupName, string mongoClusterName, string userName) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Get; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/subscriptions/", false); + uri.AppendPath(subscriptionId, true); + uri.AppendPath("/resourceGroups/", false); + uri.AppendPath(resourceGroupName, true); + uri.AppendPath("/providers/Microsoft.DocumentDB/mongoClusters/", false); + uri.AppendPath(mongoClusterName, true); + uri.AppendPath("/users/", false); + uri.AppendPath(userName, true); + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + _userAgent.Apply(message); + return message; + } + + /// Gets the defintion of a Mongo cluster user. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. + /// The name of the mongo cluster. + /// The name of the mongo cluster user. + /// 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 mongoClusterName, string userName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(mongoClusterName, nameof(mongoClusterName)); + Argument.AssertNotNullOrEmpty(userName, nameof(userName)); + + using var message = CreateGetRequest(subscriptionId, resourceGroupName, mongoClusterName, userName); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + { + UserData value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, ModelSerializationExtensions.JsonDocumentOptions, cancellationToken).ConfigureAwait(false); + value = UserData.DeserializeUserData(document.RootElement); + return Response.FromValue(value, message.Response); + } + case 404: + return Response.FromValue((UserData)null, message.Response); + default: + throw new RequestFailedException(message.Response); + } + } + + /// Gets the defintion of a Mongo cluster user. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. + /// The name of the mongo cluster. + /// The name of the mongo cluster user. + /// 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 mongoClusterName, string userName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(mongoClusterName, nameof(mongoClusterName)); + Argument.AssertNotNullOrEmpty(userName, nameof(userName)); + + using var message = CreateGetRequest(subscriptionId, resourceGroupName, mongoClusterName, userName); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + { + UserData value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream, ModelSerializationExtensions.JsonDocumentOptions); + value = UserData.DeserializeUserData(document.RootElement); + return Response.FromValue(value, message.Response); + } + case 404: + return Response.FromValue((UserData)null, message.Response); + default: + throw new RequestFailedException(message.Response); + } + } + + internal RequestUriBuilder CreateCreateOrUpdateRequestUri(string subscriptionId, string resourceGroupName, string mongoClusterName, string userName, UserData data) + { + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/subscriptions/", false); + uri.AppendPath(subscriptionId, true); + uri.AppendPath("/resourceGroups/", false); + uri.AppendPath(resourceGroupName, true); + uri.AppendPath("/providers/Microsoft.DocumentDB/mongoClusters/", false); + uri.AppendPath(mongoClusterName, true); + uri.AppendPath("/users/", false); + uri.AppendPath(userName, true); + uri.AppendQuery("api-version", _apiVersion, true); + return uri; + } + + internal HttpMessage CreateCreateOrUpdateRequest(string subscriptionId, string resourceGroupName, string mongoClusterName, string userName, UserData data) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Put; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/subscriptions/", false); + uri.AppendPath(subscriptionId, true); + uri.AppendPath("/resourceGroups/", false); + uri.AppendPath(resourceGroupName, true); + uri.AppendPath("/providers/Microsoft.DocumentDB/mongoClusters/", false); + uri.AppendPath(mongoClusterName, true); + uri.AppendPath("/users/", false); + uri.AppendPath(userName, true); + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + request.Headers.Add("Content-Type", "application/json"); + var content = new Utf8JsonRequestContent(); + content.JsonWriter.WriteObjectValue(data, ModelSerializationExtensions.WireOptions); + request.Content = content; + _userAgent.Apply(message); + return message; + } + + /// Creates a new user or updates an existing user on a mongo cluster. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. + /// The name of the mongo cluster. + /// The name of the mongo cluster user. + /// 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 mongoClusterName, string userName, UserData data, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(mongoClusterName, nameof(mongoClusterName)); + Argument.AssertNotNullOrEmpty(userName, nameof(userName)); + Argument.AssertNotNull(data, nameof(data)); + + using var message = CreateCreateOrUpdateRequest(subscriptionId, resourceGroupName, mongoClusterName, userName, 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); + } + } + + /// Creates a new user or updates an existing user on a mongo cluster. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. + /// The name of the mongo cluster. + /// The name of the mongo cluster user. + /// 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 mongoClusterName, string userName, UserData data, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(mongoClusterName, nameof(mongoClusterName)); + Argument.AssertNotNullOrEmpty(userName, nameof(userName)); + Argument.AssertNotNull(data, nameof(data)); + + using var message = CreateCreateOrUpdateRequest(subscriptionId, resourceGroupName, mongoClusterName, userName, data); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + case 201: + return message.Response; + default: + throw new RequestFailedException(message.Response); + } + } + + internal RequestUriBuilder CreateDeleteRequestUri(string subscriptionId, string resourceGroupName, string mongoClusterName, string userName) + { + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/subscriptions/", false); + uri.AppendPath(subscriptionId, true); + uri.AppendPath("/resourceGroups/", false); + uri.AppendPath(resourceGroupName, true); + uri.AppendPath("/providers/Microsoft.DocumentDB/mongoClusters/", false); + uri.AppendPath(mongoClusterName, true); + uri.AppendPath("/users/", false); + uri.AppendPath(userName, true); + uri.AppendQuery("api-version", _apiVersion, true); + return uri; + } + + internal HttpMessage CreateDeleteRequest(string subscriptionId, string resourceGroupName, string mongoClusterName, string userName) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Delete; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/subscriptions/", false); + uri.AppendPath(subscriptionId, true); + uri.AppendPath("/resourceGroups/", false); + uri.AppendPath(resourceGroupName, true); + uri.AppendPath("/providers/Microsoft.DocumentDB/mongoClusters/", false); + uri.AppendPath(mongoClusterName, true); + uri.AppendPath("/users/", false); + uri.AppendPath(userName, true); + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + _userAgent.Apply(message); + return message; + } + + /// Deletes a mongo cluster user. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. + /// The name of the mongo cluster. + /// The name of the mongo cluster user. + /// 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 mongoClusterName, string userName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(mongoClusterName, nameof(mongoClusterName)); + Argument.AssertNotNullOrEmpty(userName, nameof(userName)); + + using var message = CreateDeleteRequest(subscriptionId, resourceGroupName, mongoClusterName, userName); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 202: + case 204: + return message.Response; + default: + throw new RequestFailedException(message.Response); + } + } + + /// Deletes a mongo cluster user. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. + /// The name of the mongo cluster. + /// The name of the mongo cluster user. + /// 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 mongoClusterName, string userName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(mongoClusterName, nameof(mongoClusterName)); + Argument.AssertNotNullOrEmpty(userName, nameof(userName)); + + using var message = CreateDeleteRequest(subscriptionId, resourceGroupName, mongoClusterName, userName); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 202: + case 204: + return message.Response; + default: + throw new RequestFailedException(message.Response); + } + } + + internal RequestUriBuilder CreateListByMongoClusterRequestUri(string subscriptionId, string resourceGroupName, string mongoClusterName) + { + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/subscriptions/", false); + uri.AppendPath(subscriptionId, true); + uri.AppendPath("/resourceGroups/", false); + uri.AppendPath(resourceGroupName, true); + uri.AppendPath("/providers/Microsoft.DocumentDB/mongoClusters/", false); + uri.AppendPath(mongoClusterName, true); + uri.AppendPath("/users", false); + uri.AppendQuery("api-version", _apiVersion, true); + return uri; + } + + internal HttpMessage CreateListByMongoClusterRequest(string subscriptionId, string resourceGroupName, string mongoClusterName) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Get; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/subscriptions/", false); + uri.AppendPath(subscriptionId, true); + uri.AppendPath("/resourceGroups/", false); + uri.AppendPath(resourceGroupName, true); + uri.AppendPath("/providers/Microsoft.DocumentDB/mongoClusters/", false); + uri.AppendPath(mongoClusterName, true); + uri.AppendPath("/users", false); + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + _userAgent.Apply(message); + return message; + } + + /// List all the users on a mongo cluster. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. + /// The name of the mongo cluster. + /// The cancellation token to use. + /// , or is null. + /// , or is an empty string, and was expected to be non-empty. + public async Task> ListByMongoClusterAsync(string subscriptionId, string resourceGroupName, string mongoClusterName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(mongoClusterName, nameof(mongoClusterName)); + + using var message = CreateListByMongoClusterRequest(subscriptionId, resourceGroupName, mongoClusterName); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + { + UserListResult value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, ModelSerializationExtensions.JsonDocumentOptions, cancellationToken).ConfigureAwait(false); + value = UserListResult.DeserializeUserListResult(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + /// List all the users on a mongo cluster. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. + /// The name of the mongo cluster. + /// The cancellation token to use. + /// , or is null. + /// , or is an empty string, and was expected to be non-empty. + public Response ListByMongoCluster(string subscriptionId, string resourceGroupName, string mongoClusterName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(mongoClusterName, nameof(mongoClusterName)); + + using var message = CreateListByMongoClusterRequest(subscriptionId, resourceGroupName, mongoClusterName); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + { + UserListResult value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream, ModelSerializationExtensions.JsonDocumentOptions); + value = UserListResult.DeserializeUserListResult(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + internal RequestUriBuilder CreateListByMongoClusterNextPageRequestUri(string nextLink, string subscriptionId, string resourceGroupName, string mongoClusterName) + { + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendRawNextLink(nextLink, false); + return uri; + } + + internal HttpMessage CreateListByMongoClusterNextPageRequest(string nextLink, string subscriptionId, string resourceGroupName, string mongoClusterName) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Get; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendRawNextLink(nextLink, false); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + _userAgent.Apply(message); + return message; + } + + /// List all the users on a mongo cluster. + /// The URL to the next page of results. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. + /// The name of the mongo cluster. + /// The cancellation token to use. + /// , , or is null. + /// , or is an empty string, and was expected to be non-empty. + public async Task> ListByMongoClusterNextPageAsync(string nextLink, string subscriptionId, string resourceGroupName, string mongoClusterName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(nextLink, nameof(nextLink)); + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(mongoClusterName, nameof(mongoClusterName)); + + using var message = CreateListByMongoClusterNextPageRequest(nextLink, subscriptionId, resourceGroupName, mongoClusterName); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + { + UserListResult value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, ModelSerializationExtensions.JsonDocumentOptions, cancellationToken).ConfigureAwait(false); + value = UserListResult.DeserializeUserListResult(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + /// List all the users on a mongo cluster. + /// The URL to the next page of results. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. + /// The name of the mongo cluster. + /// The cancellation token to use. + /// , , or is null. + /// , or is an empty string, and was expected to be non-empty. + public Response ListByMongoClusterNextPage(string nextLink, string subscriptionId, string resourceGroupName, string mongoClusterName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(nextLink, nameof(nextLink)); + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(mongoClusterName, nameof(mongoClusterName)); + + using var message = CreateListByMongoClusterNextPageRequest(nextLink, subscriptionId, resourceGroupName, mongoClusterName); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + { + UserListResult value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream, ModelSerializationExtensions.JsonDocumentOptions); + value = UserListResult.DeserializeUserListResult(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + } +} diff --git a/sdk/mongocluster/Azure.ResourceManager.MongoCluster/src/Generated/UserCollection.cs b/sdk/mongocluster/Azure.ResourceManager.MongoCluster/src/Generated/UserCollection.cs new file mode 100644 index 000000000000..57ba693844ac --- /dev/null +++ b/sdk/mongocluster/Azure.ResourceManager.MongoCluster/src/Generated/UserCollection.cs @@ -0,0 +1,493 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections; +using System.Collections.Generic; +using System.Globalization; +using System.Threading; +using System.Threading.Tasks; +using Autorest.CSharp.Core; +using Azure.Core; +using Azure.Core.Pipeline; + +namespace Azure.ResourceManager.MongoCluster +{ + /// + /// A class representing a collection of and their operations. + /// Each in the collection will belong to the same instance of . + /// To get an instance call the GetUsers method from an instance of . + /// + public partial class UserCollection : ArmCollection, IEnumerable, IAsyncEnumerable + { + private readonly ClientDiagnostics _userClientDiagnostics; + private readonly UsersRestOperations _userRestClient; + + /// Initializes a new instance of the class for mocking. + protected UserCollection() + { + } + + /// Initializes a new instance of the class. + /// The client parameters to use in these operations. + /// The identifier of the parent resource that is the target of operations. + internal UserCollection(ArmClient client, ResourceIdentifier id) : base(client, id) + { + _userClientDiagnostics = new ClientDiagnostics("Azure.ResourceManager.MongoCluster", UserResource.ResourceType.Namespace, Diagnostics); + TryGetApiVersion(UserResource.ResourceType, out string userApiVersion); + _userRestClient = new UsersRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, userApiVersion); +#if DEBUG + ValidateResourceId(Id); +#endif + } + + internal static void ValidateResourceId(ResourceIdentifier id) + { + if (id.ResourceType != MongoClusterResource.ResourceType) + throw new ArgumentException(string.Format(CultureInfo.CurrentCulture, "Invalid resource type {0} expected {1}", id.ResourceType, MongoClusterResource.ResourceType), nameof(id)); + } + + /// + /// Creates a new user or updates an existing user on a mongo cluster. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/mongoClusters/{mongoClusterName}/users/{userName} + /// + /// + /// Operation Id + /// User_CreateOrUpdate + /// + /// + /// Default Api Version + /// 2025-04-01-preview + /// + /// + /// Resource + /// + /// + /// + /// + /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. + /// The name of the mongo cluster user. + /// Resource create parameters. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// or is null. + public virtual async Task> CreateOrUpdateAsync(WaitUntil waitUntil, string userName, UserData data, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(userName, nameof(userName)); + Argument.AssertNotNull(data, nameof(data)); + + using var scope = _userClientDiagnostics.CreateScope("UserCollection.CreateOrUpdate"); + scope.Start(); + try + { + var response = await _userRestClient.CreateOrUpdateAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, userName, data, cancellationToken).ConfigureAwait(false); + var operation = new MongoClusterArmOperation(new UserOperationSource(Client), _userClientDiagnostics, Pipeline, _userRestClient.CreateCreateOrUpdateRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, userName, data).Request, response, OperationFinalStateVia.AzureAsyncOperation); + if (waitUntil == WaitUntil.Completed) + await operation.WaitForCompletionAsync(cancellationToken).ConfigureAwait(false); + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Creates a new user or updates an existing user on a mongo cluster. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/mongoClusters/{mongoClusterName}/users/{userName} + /// + /// + /// Operation Id + /// User_CreateOrUpdate + /// + /// + /// Default Api Version + /// 2025-04-01-preview + /// + /// + /// Resource + /// + /// + /// + /// + /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. + /// The name of the mongo cluster user. + /// Resource create parameters. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// or is null. + public virtual ArmOperation CreateOrUpdate(WaitUntil waitUntil, string userName, UserData data, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(userName, nameof(userName)); + Argument.AssertNotNull(data, nameof(data)); + + using var scope = _userClientDiagnostics.CreateScope("UserCollection.CreateOrUpdate"); + scope.Start(); + try + { + var response = _userRestClient.CreateOrUpdate(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, userName, data, cancellationToken); + var operation = new MongoClusterArmOperation(new UserOperationSource(Client), _userClientDiagnostics, Pipeline, _userRestClient.CreateCreateOrUpdateRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, userName, data).Request, response, OperationFinalStateVia.AzureAsyncOperation); + if (waitUntil == WaitUntil.Completed) + operation.WaitForCompletion(cancellationToken); + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Gets the defintion of a Mongo cluster user. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/mongoClusters/{mongoClusterName}/users/{userName} + /// + /// + /// Operation Id + /// User_Get + /// + /// + /// Default Api Version + /// 2025-04-01-preview + /// + /// + /// Resource + /// + /// + /// + /// + /// The name of the mongo cluster user. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetAsync(string userName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(userName, nameof(userName)); + + using var scope = _userClientDiagnostics.CreateScope("UserCollection.Get"); + scope.Start(); + try + { + var response = await _userRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, userName, cancellationToken).ConfigureAwait(false); + if (response.Value == null) + throw new RequestFailedException(response.GetRawResponse()); + return Response.FromValue(new UserResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Gets the defintion of a Mongo cluster user. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/mongoClusters/{mongoClusterName}/users/{userName} + /// + /// + /// Operation Id + /// User_Get + /// + /// + /// Default Api Version + /// 2025-04-01-preview + /// + /// + /// Resource + /// + /// + /// + /// + /// The name of the mongo cluster user. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual Response Get(string userName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(userName, nameof(userName)); + + using var scope = _userClientDiagnostics.CreateScope("UserCollection.Get"); + scope.Start(); + try + { + var response = _userRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, userName, cancellationToken); + if (response.Value == null) + throw new RequestFailedException(response.GetRawResponse()); + return Response.FromValue(new UserResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// List all the users on a mongo cluster. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/mongoClusters/{mongoClusterName}/users + /// + /// + /// Operation Id + /// User_ListByMongoCluster + /// + /// + /// Default Api Version + /// 2025-04-01-preview + /// + /// + /// Resource + /// + /// + /// + /// + /// The cancellation token to use. + /// An async collection of that may take multiple service requests to iterate over. + public virtual AsyncPageable GetAllAsync(CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => _userRestClient.CreateListByMongoClusterRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _userRestClient.CreateListByMongoClusterNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName, Id.Name); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new UserResource(Client, UserData.DeserializeUserData(e)), _userClientDiagnostics, Pipeline, "UserCollection.GetAll", "value", "nextLink", cancellationToken); + } + + /// + /// List all the users on a mongo cluster. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/mongoClusters/{mongoClusterName}/users + /// + /// + /// Operation Id + /// User_ListByMongoCluster + /// + /// + /// Default Api Version + /// 2025-04-01-preview + /// + /// + /// Resource + /// + /// + /// + /// + /// 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) => _userRestClient.CreateListByMongoClusterRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _userRestClient.CreateListByMongoClusterNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName, Id.Name); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new UserResource(Client, UserData.DeserializeUserData(e)), _userClientDiagnostics, Pipeline, "UserCollection.GetAll", "value", "nextLink", cancellationToken); + } + + /// + /// Checks to see if the resource exists in azure. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/mongoClusters/{mongoClusterName}/users/{userName} + /// + /// + /// Operation Id + /// User_Get + /// + /// + /// Default Api Version + /// 2025-04-01-preview + /// + /// + /// Resource + /// + /// + /// + /// + /// The name of the mongo cluster user. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> ExistsAsync(string userName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(userName, nameof(userName)); + + using var scope = _userClientDiagnostics.CreateScope("UserCollection.Exists"); + scope.Start(); + try + { + var response = await _userRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, userName, cancellationToken: cancellationToken).ConfigureAwait(false); + return Response.FromValue(response.Value != null, response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Checks to see if the resource exists in azure. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/mongoClusters/{mongoClusterName}/users/{userName} + /// + /// + /// Operation Id + /// User_Get + /// + /// + /// Default Api Version + /// 2025-04-01-preview + /// + /// + /// Resource + /// + /// + /// + /// + /// The name of the mongo cluster user. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual Response Exists(string userName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(userName, nameof(userName)); + + using var scope = _userClientDiagnostics.CreateScope("UserCollection.Exists"); + scope.Start(); + try + { + var response = _userRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, userName, cancellationToken: cancellationToken); + return Response.FromValue(response.Value != null, response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/mongoClusters/{mongoClusterName}/users/{userName} + /// + /// + /// Operation Id + /// User_Get + /// + /// + /// Default Api Version + /// 2025-04-01-preview + /// + /// + /// Resource + /// + /// + /// + /// + /// The name of the mongo cluster user. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetIfExistsAsync(string userName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(userName, nameof(userName)); + + using var scope = _userClientDiagnostics.CreateScope("UserCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _userRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, userName, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new UserResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/mongoClusters/{mongoClusterName}/users/{userName} + /// + /// + /// Operation Id + /// User_Get + /// + /// + /// Default Api Version + /// 2025-04-01-preview + /// + /// + /// Resource + /// + /// + /// + /// + /// The name of the mongo cluster user. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual NullableResponse GetIfExists(string userName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(userName, nameof(userName)); + + using var scope = _userClientDiagnostics.CreateScope("UserCollection.GetIfExists"); + scope.Start(); + try + { + var response = _userRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, userName, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new UserResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + IEnumerator IEnumerable.GetEnumerator() + { + return GetAll().GetEnumerator(); + } + + IEnumerator IEnumerable.GetEnumerator() + { + return GetAll().GetEnumerator(); + } + + IAsyncEnumerator IAsyncEnumerable.GetAsyncEnumerator(CancellationToken cancellationToken) + { + return GetAllAsync(cancellationToken: cancellationToken).GetAsyncEnumerator(cancellationToken); + } + } +} diff --git a/sdk/mongocluster/Azure.ResourceManager.MongoCluster/src/Generated/UserData.Serialization.cs b/sdk/mongocluster/Azure.ResourceManager.MongoCluster/src/Generated/UserData.Serialization.cs new file mode 100644 index 000000000000..abb580d9795c --- /dev/null +++ b/sdk/mongocluster/Azure.ResourceManager.MongoCluster/src/Generated/UserData.Serialization.cs @@ -0,0 +1,155 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Text.Json; +using Azure.Core; +using Azure.ResourceManager.Models; +using Azure.ResourceManager.MongoCluster.Models; + +namespace Azure.ResourceManager.MongoCluster +{ + public partial class UserData : IUtf8JsonSerializable, IJsonModel + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + writer.WriteStartObject(); + JsonModelWriteCore(writer, options); + writer.WriteEndObject(); + } + + /// The JSON writer. + /// The client options for reading and writing models. + protected override void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(UserData)} does not support writing '{format}' format."); + } + + base.JsonModelWriteCore(writer, options); + if (Optional.IsDefined(Properties)) + { + writer.WritePropertyName("properties"u8); + writer.WriteObjectValue(Properties, options); + } + } + + UserData 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(UserData)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeUserData(document.RootElement, options); + } + + internal static UserData DeserializeUserData(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + UserProperties properties = default; + ResourceIdentifier id = default; + string name = default; + ResourceType type = default; + SystemData systemData = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("properties"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + properties = UserProperties.DeserializeUserProperties(property.Value, options); + continue; + } + if (property.NameEquals("id"u8)) + { + id = new ResourceIdentifier(property.Value.GetString()); + continue; + } + if (property.NameEquals("name"u8)) + { + name = property.Value.GetString(); + continue; + } + if (property.NameEquals("type"u8)) + { + type = new ResourceType(property.Value.GetString()); + continue; + } + if (property.NameEquals("systemData"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + systemData = JsonSerializer.Deserialize(property.Value.GetRawText()); + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new UserData( + id, + name, + type, + systemData, + properties, + serializedAdditionalRawData); + } + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options, AzureResourceManagerMongoClusterContext.Default); + default: + throw new FormatException($"The model {nameof(UserData)} does not support writing '{options.Format}' format."); + } + } + + UserData 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 DeserializeUserData(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(UserData)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + } +} diff --git a/sdk/mongocluster/Azure.ResourceManager.MongoCluster/src/Generated/UserData.cs b/sdk/mongocluster/Azure.ResourceManager.MongoCluster/src/Generated/UserData.cs new file mode 100644 index 000000000000..181befb637d8 --- /dev/null +++ b/sdk/mongocluster/Azure.ResourceManager.MongoCluster/src/Generated/UserData.cs @@ -0,0 +1,75 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; +using Azure.Core; +using Azure.ResourceManager.Models; +using Azure.ResourceManager.MongoCluster.Models; + +namespace Azure.ResourceManager.MongoCluster +{ + /// + /// A class representing the User data model. + /// Represents a Mongo cluster user. + /// + public partial class UserData : ResourceData + { + /// + /// Keeps track of any properties unknown to the library. + /// + /// To assign an object to the value of this property use . + /// + /// + /// To assign an already formatted json string to this property use . + /// + /// + /// Examples: + /// + /// + /// BinaryData.FromObjectAsJson("foo") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromString("\"foo\"") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromObjectAsJson(new { key = "value" }) + /// Creates a payload of { "key": "value" }. + /// + /// + /// BinaryData.FromString("{\"key\": \"value\"}") + /// Creates a payload of { "key": "value" }. + /// + /// + /// + /// + private IDictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . + public UserData() + { + } + + /// Initializes a new instance of . + /// The id. + /// The name. + /// The resourceType. + /// The systemData. + /// The resource-specific properties for this resource. + /// Keeps track of any properties unknown to the library. + internal UserData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, UserProperties properties, IDictionary serializedAdditionalRawData) : base(id, name, resourceType, systemData) + { + Properties = properties; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// The resource-specific properties for this resource. + public UserProperties Properties { get; set; } + } +} diff --git a/sdk/mongocluster/Azure.ResourceManager.MongoCluster/src/Generated/UserResource.Serialization.cs b/sdk/mongocluster/Azure.ResourceManager.MongoCluster/src/Generated/UserResource.Serialization.cs new file mode 100644 index 000000000000..2c4ca7740370 --- /dev/null +++ b/sdk/mongocluster/Azure.ResourceManager.MongoCluster/src/Generated/UserResource.Serialization.cs @@ -0,0 +1,26 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Text.Json; + +namespace Azure.ResourceManager.MongoCluster +{ + public partial class UserResource : IJsonModel + { + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) => ((IJsonModel)Data).Write(writer, options); + + UserData IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) => ((IJsonModel)Data).Create(ref reader, options); + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) => ModelReaderWriter.Write(Data, options, AzureResourceManagerMongoClusterContext.Default); + + UserData IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) => ModelReaderWriter.Read(data, options, AzureResourceManagerMongoClusterContext.Default); + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => ((IPersistableModel)Data).GetFormatFromOptions(options); + } +} diff --git a/sdk/mongocluster/Azure.ResourceManager.MongoCluster/src/Generated/UserResource.cs b/sdk/mongocluster/Azure.ResourceManager.MongoCluster/src/Generated/UserResource.cs new file mode 100644 index 000000000000..fcbee81bdfe5 --- /dev/null +++ b/sdk/mongocluster/Azure.ResourceManager.MongoCluster/src/Generated/UserResource.cs @@ -0,0 +1,347 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Globalization; +using System.Threading; +using System.Threading.Tasks; +using Azure.Core; +using Azure.Core.Pipeline; + +namespace Azure.ResourceManager.MongoCluster +{ + /// + /// A Class representing an User along with the instance operations that can be performed on it. + /// If you have a you can construct an + /// from an instance of using the GetUserResource method. + /// Otherwise you can get one from its parent resource using the GetUser method. + /// + public partial class UserResource : ArmResource + { + /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The mongoClusterName. + /// The userName. + public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string mongoClusterName, string userName) + { + var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/mongoClusters/{mongoClusterName}/users/{userName}"; + return new ResourceIdentifier(resourceId); + } + + private readonly ClientDiagnostics _userClientDiagnostics; + private readonly UsersRestOperations _userRestClient; + private readonly UserData _data; + + /// Gets the resource type for the operations. + public static readonly ResourceType ResourceType = "Microsoft.DocumentDB/mongoClusters/users"; + + /// Initializes a new instance of the class for mocking. + protected UserResource() + { + } + + /// Initializes a new instance of the class. + /// The client parameters to use in these operations. + /// The resource that is the target of operations. + internal UserResource(ArmClient client, UserData data) : this(client, data.Id) + { + HasData = true; + _data = data; + } + + /// Initializes a new instance of the class. + /// The client parameters to use in these operations. + /// The identifier of the resource that is the target of operations. + internal UserResource(ArmClient client, ResourceIdentifier id) : base(client, id) + { + _userClientDiagnostics = new ClientDiagnostics("Azure.ResourceManager.MongoCluster", ResourceType.Namespace, Diagnostics); + TryGetApiVersion(ResourceType, out string userApiVersion); + _userRestClient = new UsersRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, userApiVersion); +#if DEBUG + ValidateResourceId(Id); +#endif + } + + /// Gets whether or not the current instance has data. + public virtual bool HasData { get; } + + /// Gets the data representing this Feature. + /// Throws if there is no data loaded in the current instance. + public virtual UserData Data + { + get + { + if (!HasData) + throw new InvalidOperationException("The current instance does not have data, you must call Get first."); + return _data; + } + } + + internal static void ValidateResourceId(ResourceIdentifier id) + { + if (id.ResourceType != ResourceType) + throw new ArgumentException(string.Format(CultureInfo.CurrentCulture, "Invalid resource type {0} expected {1}", id.ResourceType, ResourceType), nameof(id)); + } + + /// + /// Gets the defintion of a Mongo cluster user. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/mongoClusters/{mongoClusterName}/users/{userName} + /// + /// + /// Operation Id + /// User_Get + /// + /// + /// Default Api Version + /// 2025-04-01-preview + /// + /// + /// Resource + /// + /// + /// + /// + /// The cancellation token to use. + public virtual async Task> GetAsync(CancellationToken cancellationToken = default) + { + using var scope = _userClientDiagnostics.CreateScope("UserResource.Get"); + scope.Start(); + try + { + var response = await _userRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, cancellationToken).ConfigureAwait(false); + if (response.Value == null) + throw new RequestFailedException(response.GetRawResponse()); + return Response.FromValue(new UserResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Gets the defintion of a Mongo cluster user. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/mongoClusters/{mongoClusterName}/users/{userName} + /// + /// + /// Operation Id + /// User_Get + /// + /// + /// Default Api Version + /// 2025-04-01-preview + /// + /// + /// Resource + /// + /// + /// + /// + /// The cancellation token to use. + public virtual Response Get(CancellationToken cancellationToken = default) + { + using var scope = _userClientDiagnostics.CreateScope("UserResource.Get"); + scope.Start(); + try + { + var response = _userRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, cancellationToken); + if (response.Value == null) + throw new RequestFailedException(response.GetRawResponse()); + return Response.FromValue(new UserResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Deletes a mongo cluster user. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/mongoClusters/{mongoClusterName}/users/{userName} + /// + /// + /// Operation Id + /// User_Delete + /// + /// + /// Default Api Version + /// 2025-04-01-preview + /// + /// + /// Resource + /// + /// + /// + /// + /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. + /// The cancellation token to use. + public virtual async Task DeleteAsync(WaitUntil waitUntil, CancellationToken cancellationToken = default) + { + using var scope = _userClientDiagnostics.CreateScope("UserResource.Delete"); + scope.Start(); + try + { + var response = await _userRestClient.DeleteAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, cancellationToken).ConfigureAwait(false); + var operation = new MongoClusterArmOperation(_userClientDiagnostics, Pipeline, _userRestClient.CreateDeleteRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name).Request, response, OperationFinalStateVia.Location); + if (waitUntil == WaitUntil.Completed) + await operation.WaitForCompletionResponseAsync(cancellationToken).ConfigureAwait(false); + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Deletes a mongo cluster user. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/mongoClusters/{mongoClusterName}/users/{userName} + /// + /// + /// Operation Id + /// User_Delete + /// + /// + /// Default Api Version + /// 2025-04-01-preview + /// + /// + /// Resource + /// + /// + /// + /// + /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. + /// The cancellation token to use. + public virtual ArmOperation Delete(WaitUntil waitUntil, CancellationToken cancellationToken = default) + { + using var scope = _userClientDiagnostics.CreateScope("UserResource.Delete"); + scope.Start(); + try + { + var response = _userRestClient.Delete(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, cancellationToken); + var operation = new MongoClusterArmOperation(_userClientDiagnostics, Pipeline, _userRestClient.CreateDeleteRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name).Request, response, OperationFinalStateVia.Location); + if (waitUntil == WaitUntil.Completed) + operation.WaitForCompletionResponse(cancellationToken); + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Creates a new user or updates an existing user on a mongo cluster. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/mongoClusters/{mongoClusterName}/users/{userName} + /// + /// + /// Operation Id + /// User_CreateOrUpdate + /// + /// + /// Default Api Version + /// 2025-04-01-preview + /// + /// + /// Resource + /// + /// + /// + /// + /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. + /// Resource create parameters. + /// The cancellation token to use. + /// is null. + public virtual async Task> UpdateAsync(WaitUntil waitUntil, UserData data, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(data, nameof(data)); + + using var scope = _userClientDiagnostics.CreateScope("UserResource.Update"); + scope.Start(); + try + { + var response = await _userRestClient.CreateOrUpdateAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, data, cancellationToken).ConfigureAwait(false); + var operation = new MongoClusterArmOperation(new UserOperationSource(Client), _userClientDiagnostics, Pipeline, _userRestClient.CreateCreateOrUpdateRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, data).Request, response, OperationFinalStateVia.AzureAsyncOperation); + if (waitUntil == WaitUntil.Completed) + await operation.WaitForCompletionAsync(cancellationToken).ConfigureAwait(false); + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Creates a new user or updates an existing user on a mongo cluster. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/mongoClusters/{mongoClusterName}/users/{userName} + /// + /// + /// Operation Id + /// User_CreateOrUpdate + /// + /// + /// Default Api Version + /// 2025-04-01-preview + /// + /// + /// Resource + /// + /// + /// + /// + /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. + /// Resource create parameters. + /// The cancellation token to use. + /// is null. + public virtual ArmOperation Update(WaitUntil waitUntil, UserData data, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(data, nameof(data)); + + using var scope = _userClientDiagnostics.CreateScope("UserResource.Update"); + scope.Start(); + try + { + var response = _userRestClient.CreateOrUpdate(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, data, cancellationToken); + var operation = new MongoClusterArmOperation(new UserOperationSource(Client), _userClientDiagnostics, Pipeline, _userRestClient.CreateCreateOrUpdateRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, data).Request, response, OperationFinalStateVia.AzureAsyncOperation); + if (waitUntil == WaitUntil.Completed) + operation.WaitForCompletion(cancellationToken); + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + } +} diff --git a/sdk/mongocluster/Azure.ResourceManager.MongoCluster/tsp-location.yaml b/sdk/mongocluster/Azure.ResourceManager.MongoCluster/tsp-location.yaml index 1d7ced7e41b4..1e924bd2bbb4 100644 --- a/sdk/mongocluster/Azure.ResourceManager.MongoCluster/tsp-location.yaml +++ b/sdk/mongocluster/Azure.ResourceManager.MongoCluster/tsp-location.yaml @@ -1,3 +1,4 @@ -directory: specification\mongocluster\DocumentDB.MongoCluster.Management -commit: a105688c303677e1bd3b0968b977b924f2cbbcb8 -repo: Azure/azure-rest-api-specs \ No newline at end of file +directory: specification/mongocluster/DocumentDB.MongoCluster.Management +commit: 713682507acfafd4e56645790022ae6fd18312f2 +repo: Azure/azure-rest-api-specs +additionalDirectories: diff --git a/sdk/storage/ci.yml b/sdk/storage/ci.yml index 2ca0501b60bd..4e749e6b85b1 100644 --- a/sdk/storage/ci.yml +++ b/sdk/storage/ci.yml @@ -12,6 +12,8 @@ trigger: - sdk/storage/Azure.Storage.DataMovement/ - sdk/storage/Azure.Storage.DataMovement.Blobs/ - sdk/storage/Azure.Storage.DataMovement.Files/ + exclude: + - sdk/storage/Azure.ResourceManager.Storage/ - sdk/storage/Azure.Storage.DataMovement.Blobs.Files.Shares/ exclude: - sdk/storage/Azure.ResourceManager.Storage/