diff --git a/sdk/postgresql/Azure.ResourceManager.PostgreSql/samples/Generated/Samples/Sample_PostgreSqlFlexibleServerCollection.cs b/sdk/postgresql/Azure.ResourceManager.PostgreSql/samples/Generated/Samples/Sample_PostgreSqlFlexibleServerCollection.cs index 49f00432c084..15ac087aa3ce 100644 --- a/sdk/postgresql/Azure.ResourceManager.PostgreSql/samples/Generated/Samples/Sample_PostgreSqlFlexibleServerCollection.cs +++ b/sdk/postgresql/Azure.ResourceManager.PostgreSql/samples/Generated/Samples/Sample_PostgreSqlFlexibleServerCollection.cs @@ -44,12 +44,12 @@ public async Task CreateOrUpdate_CreateADatabaseAsAGeoRestoreInGeoPairedLocation string serverName = "pgtestsvc5geo"; PostgreSqlFlexibleServerData data = new PostgreSqlFlexibleServerData(new AzureLocation("eastus")) { - Identity = new PostgreSqlFlexibleServerUserAssignedIdentity(PostgreSqlFlexibleServerIdentityType.UserAssigned) + Identity = new ManagedServiceIdentity("UserAssigned") { UserAssignedIdentities = { -["/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourceGroups/testresourcegroup/providers/Microsoft.ManagedIdentity/userAssignedIdentities/test-geo-usermanagedidentity"] = new UserAssignedIdentity(), -["/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourceGroups/testresourcegroup/providers/Microsoft.ManagedIdentity/userAssignedIdentities/test-usermanagedidentity"] = new UserAssignedIdentity() +[new ResourceIdentifier("/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourceGroups/testresourcegroup/providers/Microsoft.ManagedIdentity/userAssignedIdentities/test-geo-usermanagedidentity")] = new UserAssignedIdentity(), +[new ResourceIdentifier("/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourceGroups/testresourcegroup/providers/Microsoft.ManagedIdentity/userAssignedIdentities/test-usermanagedidentity")] = new UserAssignedIdentity() }, }, DataEncryption = new PostgreSqlFlexibleServerDataEncryption @@ -284,11 +284,11 @@ public async Task CreateOrUpdate_ServerCreateReplica() string serverName = "pgtestsvc5rep"; PostgreSqlFlexibleServerData data = new PostgreSqlFlexibleServerData(new AzureLocation("westus")) { - Identity = new PostgreSqlFlexibleServerUserAssignedIdentity(PostgreSqlFlexibleServerIdentityType.UserAssigned) + Identity = new ManagedServiceIdentity("UserAssigned") { UserAssignedIdentities = { -["/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourceGroups/testresourcegroup/providers/Microsoft.ManagedIdentity/userAssignedIdentities/test-usermanagedidentity"] = new UserAssignedIdentity() +[new ResourceIdentifier("/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourceGroups/testresourcegroup/providers/Microsoft.ManagedIdentity/userAssignedIdentities/test-usermanagedidentity")] = new UserAssignedIdentity() }, }, DataEncryption = new PostgreSqlFlexibleServerDataEncryption @@ -380,11 +380,11 @@ public async Task CreateOrUpdate_ServerCreateWithDataEncryptionEnabled() PostgreSqlFlexibleServerData data = new PostgreSqlFlexibleServerData(new AzureLocation("westus")) { Sku = new PostgreSqlFlexibleServerSku("Standard_D4s_v3", PostgreSqlFlexibleServerSkuTier.GeneralPurpose), - Identity = new PostgreSqlFlexibleServerUserAssignedIdentity(PostgreSqlFlexibleServerIdentityType.UserAssigned) + Identity = new ManagedServiceIdentity("UserAssigned") { UserAssignedIdentities = { -["/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourceGroups/testresourcegroup/providers/Microsoft.ManagedIdentity/userAssignedIdentities/test-usermanagedidentity"] = new UserAssignedIdentity() +[new ResourceIdentifier("/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourceGroups/testresourcegroup/providers/Microsoft.ManagedIdentity/userAssignedIdentities/test-usermanagedidentity")] = new UserAssignedIdentity() }, }, AdministratorLogin = "cloudsa", diff --git a/sdk/postgresql/Azure.ResourceManager.PostgreSql/samples/Generated/Samples/Sample_PostgreSqlFlexibleServerResource.cs b/sdk/postgresql/Azure.ResourceManager.PostgreSql/samples/Generated/Samples/Sample_PostgreSqlFlexibleServerResource.cs index e61133464075..0bf5827c7e24 100644 --- a/sdk/postgresql/Azure.ResourceManager.PostgreSql/samples/Generated/Samples/Sample_PostgreSqlFlexibleServerResource.cs +++ b/sdk/postgresql/Azure.ResourceManager.PostgreSql/samples/Generated/Samples/Sample_PostgreSqlFlexibleServerResource.cs @@ -377,12 +377,12 @@ public async Task Update_ServerUpdateWithDataEncryptionEnabled() PostgreSqlFlexibleServerPatch patch = new PostgreSqlFlexibleServerPatch { Sku = new PostgreSqlFlexibleServerSku("Standard_D8s_v3", PostgreSqlFlexibleServerSkuTier.GeneralPurpose), - Identity = new PostgreSqlFlexibleServerUserAssignedIdentity(PostgreSqlFlexibleServerIdentityType.UserAssigned) + Identity = new ManagedServiceIdentity("UserAssigned") { UserAssignedIdentities = { -["/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourceGroups/testresourcegroup/providers/Microsoft.ManagedIdentity/userAssignedIdentities/test-geo-usermanagedidentity"] = new UserAssignedIdentity(), -["/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourceGroups/testresourcegroup/providers/Microsoft.ManagedIdentity/userAssignedIdentities/test-usermanagedidentity"] = new UserAssignedIdentity() +[new ResourceIdentifier("/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourceGroups/testresourcegroup/providers/Microsoft.ManagedIdentity/userAssignedIdentities/test-geo-usermanagedidentity")] = new UserAssignedIdentity(), +[new ResourceIdentifier("/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourceGroups/testresourcegroup/providers/Microsoft.ManagedIdentity/userAssignedIdentities/test-usermanagedidentity")] = new UserAssignedIdentity() }, }, AdministratorLoginPassword = "newpassword", diff --git a/sdk/postgresql/Azure.ResourceManager.PostgreSql/src/PostgreSqlFlexibleServers/Generated/ArmPostgreSqlFlexibleServersModelFactory.cs b/sdk/postgresql/Azure.ResourceManager.PostgreSql/src/PostgreSqlFlexibleServers/Generated/ArmPostgreSqlFlexibleServersModelFactory.cs index 89d0aa1df2b5..6ac615d119d9 100644 --- a/sdk/postgresql/Azure.ResourceManager.PostgreSql/src/PostgreSqlFlexibleServers/Generated/ArmPostgreSqlFlexibleServersModelFactory.cs +++ b/sdk/postgresql/Azure.ResourceManager.PostgreSql/src/PostgreSqlFlexibleServers/Generated/ArmPostgreSqlFlexibleServersModelFactory.cs @@ -379,7 +379,7 @@ public static PostgreSqlFlexibleServerFirewallRuleData PostgreSqlFlexibleServerF /// The tags. /// The location. /// The SKU (pricing tier) of the server. - /// Describes the identity of the application. + /// Describes the identity of the application. Current supported identity types: None, UserAssigned, SystemAssigned. /// The administrator's login name of a server. Can only be specified when the server is being created (and is required for creation). /// The administrator login password (required for server creation). /// PostgreSQL Server version. @@ -402,7 +402,7 @@ public static PostgreSqlFlexibleServerFirewallRuleData PostgreSqlFlexibleServerF /// The mode to create a new PostgreSQL server. /// List of private endpoint connections associated with the specified resource. /// A new instance for mocking. - public static PostgreSqlFlexibleServerData PostgreSqlFlexibleServerData(ResourceIdentifier id = null, string name = null, ResourceType resourceType = default, SystemData systemData = null, IDictionary tags = null, AzureLocation location = default, PostgreSqlFlexibleServerSku sku = null, PostgreSqlFlexibleServerUserAssignedIdentity identity = null, string administratorLogin = null, string administratorLoginPassword = null, PostgreSqlFlexibleServerVersion? version = null, string minorVersion = null, PostgreSqlFlexibleServerState? state = null, string fullyQualifiedDomainName = null, PostgreSqlFlexibleServerStorage storage = null, PostgreSqlFlexibleServerAuthConfig authConfig = null, PostgreSqlFlexibleServerDataEncryption dataEncryption = null, PostgreSqlFlexibleServerBackupProperties backup = null, PostgreSqlFlexibleServerNetwork network = null, PostgreSqlFlexibleServerHighAvailability highAvailability = null, PostgreSqlFlexibleServerMaintenanceWindow maintenanceWindow = null, ResourceIdentifier sourceServerResourceId = null, DateTimeOffset? pointInTimeUtc = null, string availabilityZone = null, PostgreSqlFlexibleServerReplicationRole? replicationRole = null, int? replicaCapacity = null, PostgreSqlFlexibleServersReplica replica = null, PostgreSqlFlexibleServerCreateMode? createMode = null, IEnumerable privateEndpointConnections = null) + public static PostgreSqlFlexibleServerData PostgreSqlFlexibleServerData(ResourceIdentifier id = null, string name = null, ResourceType resourceType = default, SystemData systemData = null, IDictionary tags = null, AzureLocation location = default, PostgreSqlFlexibleServerSku sku = null, ManagedServiceIdentity identity = null, string administratorLogin = null, string administratorLoginPassword = null, PostgreSqlFlexibleServerVersion? version = null, string minorVersion = null, PostgreSqlFlexibleServerState? state = null, string fullyQualifiedDomainName = null, PostgreSqlFlexibleServerStorage storage = null, PostgreSqlFlexibleServerAuthConfig authConfig = null, PostgreSqlFlexibleServerDataEncryption dataEncryption = null, PostgreSqlFlexibleServerBackupProperties backup = null, PostgreSqlFlexibleServerNetwork network = null, PostgreSqlFlexibleServerHighAvailability highAvailability = null, PostgreSqlFlexibleServerMaintenanceWindow maintenanceWindow = null, ResourceIdentifier sourceServerResourceId = null, DateTimeOffset? pointInTimeUtc = null, string availabilityZone = null, PostgreSqlFlexibleServerReplicationRole? replicationRole = null, int? replicaCapacity = null, PostgreSqlFlexibleServersReplica replica = null, PostgreSqlFlexibleServerCreateMode? createMode = null, IEnumerable privateEndpointConnections = null) { tags ??= new Dictionary(); privateEndpointConnections ??= new List(); @@ -440,18 +440,6 @@ public static PostgreSqlFlexibleServerData PostgreSqlFlexibleServerData(Resource serializedAdditionalRawData: null); } - /// Initializes a new instance of . - /// represents user assigned identities map. - /// the types of identities associated with this resource; currently restricted to 'None and UserAssigned'. - /// Tenant id of the server. - /// A new instance for mocking. - public static PostgreSqlFlexibleServerUserAssignedIdentity PostgreSqlFlexibleServerUserAssignedIdentity(IDictionary userAssignedIdentities = null, PostgreSqlFlexibleServerIdentityType identityType = default, Guid? tenantId = null) - { - userAssignedIdentities ??= new Dictionary(); - - return new PostgreSqlFlexibleServerUserAssignedIdentity(userAssignedIdentities, identityType, tenantId, serializedAdditionalRawData: null); - } - /// Initializes a new instance of . /// Backup retention days for the server. /// A value indicating whether Geo-Redundant backup is enabled on the server. diff --git a/sdk/postgresql/Azure.ResourceManager.PostgreSql/src/PostgreSqlFlexibleServers/Generated/Models/PostgreSqlFlexibleServerPatch.Serialization.cs b/sdk/postgresql/Azure.ResourceManager.PostgreSql/src/PostgreSqlFlexibleServers/Generated/Models/PostgreSqlFlexibleServerPatch.Serialization.cs index f1cec80d57e2..efa1b5079ab9 100644 --- a/sdk/postgresql/Azure.ResourceManager.PostgreSql/src/PostgreSqlFlexibleServers/Generated/Models/PostgreSqlFlexibleServerPatch.Serialization.cs +++ b/sdk/postgresql/Azure.ResourceManager.PostgreSql/src/PostgreSqlFlexibleServers/Generated/Models/PostgreSqlFlexibleServerPatch.Serialization.cs @@ -10,6 +10,7 @@ using System.Collections.Generic; using System.Text.Json; using Azure.Core; +using Azure.ResourceManager.Models; namespace Azure.ResourceManager.PostgreSql.FlexibleServers.Models { @@ -42,7 +43,7 @@ protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWrit if (Optional.IsDefined(Identity)) { writer.WritePropertyName("identity"u8); - writer.WriteObjectValue(Identity, options); + JsonSerializer.Serialize(writer, Identity); } if (Optional.IsCollectionDefined(Tags)) { @@ -166,7 +167,7 @@ internal static PostgreSqlFlexibleServerPatch DeserializePostgreSqlFlexibleServe return null; } PostgreSqlFlexibleServerSku sku = default; - PostgreSqlFlexibleServerUserAssignedIdentity identity = default; + ManagedServiceIdentity identity = default; IDictionary tags = default; AzureLocation? location = default; string administratorLogin = default; @@ -201,7 +202,7 @@ internal static PostgreSqlFlexibleServerPatch DeserializePostgreSqlFlexibleServe { continue; } - identity = PostgreSqlFlexibleServerUserAssignedIdentity.DeserializePostgreSqlFlexibleServerUserAssignedIdentity(property.Value, options); + identity = JsonSerializer.Deserialize(property.Value.GetRawText()); continue; } if (property.NameEquals("tags"u8)) diff --git a/sdk/postgresql/Azure.ResourceManager.PostgreSql/src/PostgreSqlFlexibleServers/Generated/Models/PostgreSqlFlexibleServerPatch.cs b/sdk/postgresql/Azure.ResourceManager.PostgreSql/src/PostgreSqlFlexibleServers/Generated/Models/PostgreSqlFlexibleServerPatch.cs index 320afc87de22..a5f838dfd925 100644 --- a/sdk/postgresql/Azure.ResourceManager.PostgreSql/src/PostgreSqlFlexibleServers/Generated/Models/PostgreSqlFlexibleServerPatch.cs +++ b/sdk/postgresql/Azure.ResourceManager.PostgreSql/src/PostgreSqlFlexibleServers/Generated/Models/PostgreSqlFlexibleServerPatch.cs @@ -8,6 +8,7 @@ using System; using System.Collections.Generic; using Azure.Core; +using Azure.ResourceManager.Models; namespace Azure.ResourceManager.PostgreSql.FlexibleServers.Models { @@ -54,7 +55,7 @@ public PostgreSqlFlexibleServerPatch() /// Initializes a new instance of . /// The SKU (pricing tier) of the server. - /// Describes the identity of the application. + /// Describes the identity of the application. Current supported identity types: None, UserAssigned, SystemAssigned. /// Application-specific metadata in the form of key-value pairs. /// The location the resource resides in. /// The administrator's login name of a server. Can only be specified when the server is trying to switch to password authentication and does not have default administrator login. @@ -71,7 +72,7 @@ public PostgreSqlFlexibleServerPatch() /// Replica properties of a server. These Replica properties are required to be passed only in case you want to Promote a server. /// Network properties of a server. These are required to be passed only in case if server is a private access server. /// Keeps track of any properties unknown to the library. - internal PostgreSqlFlexibleServerPatch(PostgreSqlFlexibleServerSku sku, PostgreSqlFlexibleServerUserAssignedIdentity identity, IDictionary tags, AzureLocation? location, string administratorLogin, string administratorLoginPassword, PostgreSqlFlexibleServerVersion? version, PostgreSqlFlexibleServerStorage storage, PostgreSqlFlexibleServerBackupProperties backup, PostgreSqlFlexibleServerHighAvailability highAvailability, PostgreSqlFlexibleServerMaintenanceWindow maintenanceWindow, PostgreSqlFlexibleServerAuthConfig authConfig, PostgreSqlFlexibleServerDataEncryption dataEncryption, PostgreSqlFlexibleServerCreateModeForUpdate? createMode, PostgreSqlFlexibleServerReplicationRole? replicationRole, PostgreSqlFlexibleServersReplica replica, PostgreSqlFlexibleServerNetwork network, IDictionary serializedAdditionalRawData) + internal PostgreSqlFlexibleServerPatch(PostgreSqlFlexibleServerSku sku, ManagedServiceIdentity identity, IDictionary tags, AzureLocation? location, string administratorLogin, string administratorLoginPassword, PostgreSqlFlexibleServerVersion? version, PostgreSqlFlexibleServerStorage storage, PostgreSqlFlexibleServerBackupProperties backup, PostgreSqlFlexibleServerHighAvailability highAvailability, PostgreSqlFlexibleServerMaintenanceWindow maintenanceWindow, PostgreSqlFlexibleServerAuthConfig authConfig, PostgreSqlFlexibleServerDataEncryption dataEncryption, PostgreSqlFlexibleServerCreateModeForUpdate? createMode, PostgreSqlFlexibleServerReplicationRole? replicationRole, PostgreSqlFlexibleServersReplica replica, PostgreSqlFlexibleServerNetwork network, IDictionary serializedAdditionalRawData) { Sku = sku; Identity = identity; @@ -96,9 +97,9 @@ internal PostgreSqlFlexibleServerPatch(PostgreSqlFlexibleServerSku sku, PostgreS /// The SKU (pricing tier) of the server. [WirePath("sku")] public PostgreSqlFlexibleServerSku Sku { get; set; } - /// Describes the identity of the application. + /// Describes the identity of the application. Current supported identity types: None, UserAssigned, SystemAssigned. [WirePath("identity")] - public PostgreSqlFlexibleServerUserAssignedIdentity Identity { get; set; } + public ManagedServiceIdentity Identity { get; set; } /// Application-specific metadata in the form of key-value pairs. [WirePath("tags")] public IDictionary Tags { get; } diff --git a/sdk/postgresql/Azure.ResourceManager.PostgreSql/src/PostgreSqlFlexibleServers/Generated/Models/PostgreSqlFlexibleServerUserAssignedIdentity.Serialization.cs b/sdk/postgresql/Azure.ResourceManager.PostgreSql/src/PostgreSqlFlexibleServers/Generated/Models/PostgreSqlFlexibleServerUserAssignedIdentity.Serialization.cs deleted file mode 100644 index bdf1077358bd..000000000000 --- a/sdk/postgresql/Azure.ResourceManager.PostgreSql/src/PostgreSqlFlexibleServers/Generated/Models/PostgreSqlFlexibleServerUserAssignedIdentity.Serialization.cs +++ /dev/null @@ -1,238 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System; -using System.ClientModel.Primitives; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Text.Json; -using Azure.Core; -using Azure.ResourceManager.Models; - -namespace Azure.ResourceManager.PostgreSql.FlexibleServers.Models -{ - public partial class PostgreSqlFlexibleServerUserAssignedIdentity : 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(PostgreSqlFlexibleServerUserAssignedIdentity)} does not support writing '{format}' format."); - } - - if (Optional.IsCollectionDefined(UserAssignedIdentities)) - { - writer.WritePropertyName("userAssignedIdentities"u8); - writer.WriteStartObject(); - foreach (var item in UserAssignedIdentities) - { - writer.WritePropertyName(item.Key); - JsonSerializer.Serialize(writer, item.Value); - } - writer.WriteEndObject(); - } - writer.WritePropertyName("type"u8); - writer.WriteStringValue(IdentityType.ToString()); - if (options.Format != "W" && Optional.IsDefined(TenantId)) - { - writer.WritePropertyName("tenantId"u8); - writer.WriteStringValue(TenantId.Value); - } - if (options.Format != "W" && _serializedAdditionalRawData != null) - { - foreach (var item in _serializedAdditionalRawData) - { - writer.WritePropertyName(item.Key); -#if NET6_0_OR_GREATER - writer.WriteRawValue(item.Value); -#else - using (JsonDocument document = JsonDocument.Parse(item.Value)) - { - JsonSerializer.Serialize(writer, document.RootElement); - } -#endif - } - } - } - - PostgreSqlFlexibleServerUserAssignedIdentity 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(PostgreSqlFlexibleServerUserAssignedIdentity)} does not support reading '{format}' format."); - } - - using JsonDocument document = JsonDocument.ParseValue(ref reader); - return DeserializePostgreSqlFlexibleServerUserAssignedIdentity(document.RootElement, options); - } - - internal static PostgreSqlFlexibleServerUserAssignedIdentity DeserializePostgreSqlFlexibleServerUserAssignedIdentity(JsonElement element, ModelReaderWriterOptions options = null) - { - options ??= ModelSerializationExtensions.WireOptions; - - if (element.ValueKind == JsonValueKind.Null) - { - return null; - } - IDictionary userAssignedIdentities = default; - PostgreSqlFlexibleServerIdentityType type = default; - Guid? tenantId = default; - IDictionary serializedAdditionalRawData = default; - Dictionary rawDataDictionary = new Dictionary(); - foreach (var property in element.EnumerateObject()) - { - if (property.NameEquals("userAssignedIdentities"u8)) - { - if (property.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - Dictionary dictionary = new Dictionary(); - foreach (var property0 in property.Value.EnumerateObject()) - { - dictionary.Add(property0.Name, JsonSerializer.Deserialize(property0.Value.GetRawText())); - } - userAssignedIdentities = dictionary; - continue; - } - if (property.NameEquals("type"u8)) - { - type = new PostgreSqlFlexibleServerIdentityType(property.Value.GetString()); - continue; - } - if (property.NameEquals("tenantId"u8)) - { - if (property.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - tenantId = property.Value.GetGuid(); - continue; - } - if (options.Format != "W") - { - rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); - } - } - serializedAdditionalRawData = rawDataDictionary; - return new PostgreSqlFlexibleServerUserAssignedIdentity(userAssignedIdentities ?? new ChangeTrackingDictionary(), type, tenantId, serializedAdditionalRawData); - } - - private BinaryData SerializeBicep(ModelReaderWriterOptions options) - { - StringBuilder builder = new StringBuilder(); - BicepModelReaderWriterOptions bicepOptions = options as BicepModelReaderWriterOptions; - IDictionary propertyOverrides = null; - bool hasObjectOverride = bicepOptions != null && bicepOptions.PropertyOverrides.TryGetValue(this, out propertyOverrides); - bool hasPropertyOverride = false; - string propertyOverride = null; - - builder.AppendLine("{"); - - hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(UserAssignedIdentities), out propertyOverride); - if (hasPropertyOverride) - { - builder.Append(" userAssignedIdentities: "); - builder.AppendLine(propertyOverride); - } - else - { - if (Optional.IsCollectionDefined(UserAssignedIdentities)) - { - if (UserAssignedIdentities.Any()) - { - builder.Append(" userAssignedIdentities: "); - builder.AppendLine("{"); - foreach (var item in UserAssignedIdentities) - { - builder.Append($" '{item.Key}': "); - BicepSerializationHelpers.AppendChildObject(builder, item.Value, options, 4, false, " userAssignedIdentities: "); - } - builder.AppendLine(" }"); - } - } - } - - hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(IdentityType), out propertyOverride); - if (hasPropertyOverride) - { - builder.Append(" type: "); - builder.AppendLine(propertyOverride); - } - else - { - builder.Append(" type: "); - builder.AppendLine($"'{IdentityType.ToString()}'"); - } - - hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(TenantId), out propertyOverride); - if (hasPropertyOverride) - { - builder.Append(" tenantId: "); - builder.AppendLine(propertyOverride); - } - else - { - if (Optional.IsDefined(TenantId)) - { - builder.Append(" tenantId: "); - builder.AppendLine($"'{TenantId.Value.ToString()}'"); - } - } - - builder.AppendLine("}"); - return BinaryData.FromString(builder.ToString()); - } - - 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); - case "bicep": - return SerializeBicep(options); - default: - throw new FormatException($"The model {nameof(PostgreSqlFlexibleServerUserAssignedIdentity)} does not support writing '{options.Format}' format."); - } - } - - PostgreSqlFlexibleServerUserAssignedIdentity IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) - { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; - - switch (format) - { - case "J": - { - using JsonDocument document = JsonDocument.Parse(data); - return DeserializePostgreSqlFlexibleServerUserAssignedIdentity(document.RootElement, options); - } - default: - throw new FormatException($"The model {nameof(PostgreSqlFlexibleServerUserAssignedIdentity)} does not support reading '{options.Format}' format."); - } - } - - string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; - } -} diff --git a/sdk/postgresql/Azure.ResourceManager.PostgreSql/src/PostgreSqlFlexibleServers/Generated/Models/PostgreSqlFlexibleServerUserAssignedIdentity.cs b/sdk/postgresql/Azure.ResourceManager.PostgreSql/src/PostgreSqlFlexibleServers/Generated/Models/PostgreSqlFlexibleServerUserAssignedIdentity.cs deleted file mode 100644 index 84a7d8ac2a2f..000000000000 --- a/sdk/postgresql/Azure.ResourceManager.PostgreSql/src/PostgreSqlFlexibleServers/Generated/Models/PostgreSqlFlexibleServerUserAssignedIdentity.cs +++ /dev/null @@ -1,85 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System; -using System.Collections.Generic; -using Azure.ResourceManager.Models; - -namespace Azure.ResourceManager.PostgreSql.FlexibleServers.Models -{ - /// Information describing the identities associated with this application. - public partial class PostgreSqlFlexibleServerUserAssignedIdentity - { - /// - /// 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 types of identities associated with this resource; currently restricted to 'None and UserAssigned'. - public PostgreSqlFlexibleServerUserAssignedIdentity(PostgreSqlFlexibleServerIdentityType identityType) - { - UserAssignedIdentities = new ChangeTrackingDictionary(); - IdentityType = identityType; - } - - /// Initializes a new instance of . - /// represents user assigned identities map. - /// the types of identities associated with this resource; currently restricted to 'None and UserAssigned'. - /// Tenant id of the server. - /// Keeps track of any properties unknown to the library. - internal PostgreSqlFlexibleServerUserAssignedIdentity(IDictionary userAssignedIdentities, PostgreSqlFlexibleServerIdentityType identityType, Guid? tenantId, IDictionary serializedAdditionalRawData) - { - UserAssignedIdentities = userAssignedIdentities; - IdentityType = identityType; - TenantId = tenantId; - _serializedAdditionalRawData = serializedAdditionalRawData; - } - - /// Initializes a new instance of for deserialization. - internal PostgreSqlFlexibleServerUserAssignedIdentity() - { - } - - /// represents user assigned identities map. - [WirePath("userAssignedIdentities")] - public IDictionary UserAssignedIdentities { get; } - /// the types of identities associated with this resource; currently restricted to 'None and UserAssigned'. - [WirePath("type")] - public PostgreSqlFlexibleServerIdentityType IdentityType { get; set; } - /// Tenant id of the server. - [WirePath("tenantId")] - public Guid? TenantId { get; } - } -} diff --git a/sdk/postgresql/Azure.ResourceManager.PostgreSql/src/PostgreSqlFlexibleServers/Generated/PostgreSqlFlexibleServerData.Serialization.cs b/sdk/postgresql/Azure.ResourceManager.PostgreSql/src/PostgreSqlFlexibleServers/Generated/PostgreSqlFlexibleServerData.Serialization.cs index 3aef7edc3dbb..9b19f9bb3526 100644 --- a/sdk/postgresql/Azure.ResourceManager.PostgreSql/src/PostgreSqlFlexibleServers/Generated/PostgreSqlFlexibleServerData.Serialization.cs +++ b/sdk/postgresql/Azure.ResourceManager.PostgreSql/src/PostgreSqlFlexibleServers/Generated/PostgreSqlFlexibleServerData.Serialization.cs @@ -47,7 +47,7 @@ protected override void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWri if (Optional.IsDefined(Identity)) { writer.WritePropertyName("identity"u8); - writer.WriteObjectValue(Identity, options); + JsonSerializer.Serialize(writer, Identity); } writer.WritePropertyName("properties"u8); writer.WriteStartObject(); @@ -185,7 +185,7 @@ internal static PostgreSqlFlexibleServerData DeserializePostgreSqlFlexibleServer return null; } PostgreSqlFlexibleServerSku sku = default; - PostgreSqlFlexibleServerUserAssignedIdentity identity = default; + ManagedServiceIdentity identity = default; IDictionary tags = default; AzureLocation location = default; ResourceIdentifier id = default; @@ -232,7 +232,7 @@ internal static PostgreSqlFlexibleServerData DeserializePostgreSqlFlexibleServer { continue; } - identity = PostgreSqlFlexibleServerUserAssignedIdentity.DeserializePostgreSqlFlexibleServerUserAssignedIdentity(property.Value, options); + identity = JsonSerializer.Deserialize(property.Value.GetRawText()); continue; } if (property.NameEquals("tags"u8)) diff --git a/sdk/postgresql/Azure.ResourceManager.PostgreSql/src/PostgreSqlFlexibleServers/Generated/PostgreSqlFlexibleServerData.cs b/sdk/postgresql/Azure.ResourceManager.PostgreSql/src/PostgreSqlFlexibleServers/Generated/PostgreSqlFlexibleServerData.cs index e2f54e0dc905..69717dea0275 100644 --- a/sdk/postgresql/Azure.ResourceManager.PostgreSql/src/PostgreSqlFlexibleServers/Generated/PostgreSqlFlexibleServerData.cs +++ b/sdk/postgresql/Azure.ResourceManager.PostgreSql/src/PostgreSqlFlexibleServers/Generated/PostgreSqlFlexibleServerData.cs @@ -66,7 +66,7 @@ public PostgreSqlFlexibleServerData(AzureLocation location) : base(location) /// The tags. /// The location. /// The SKU (pricing tier) of the server. - /// Describes the identity of the application. + /// Describes the identity of the application. Current supported identity types: None, UserAssigned, SystemAssigned. /// The administrator's login name of a server. Can only be specified when the server is being created (and is required for creation). /// The administrator login password (required for server creation). /// PostgreSQL Server version. @@ -89,7 +89,7 @@ public PostgreSqlFlexibleServerData(AzureLocation location) : base(location) /// The mode to create a new PostgreSQL server. /// List of private endpoint connections associated with the specified resource. /// Keeps track of any properties unknown to the library. - internal PostgreSqlFlexibleServerData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, IDictionary tags, AzureLocation location, PostgreSqlFlexibleServerSku sku, PostgreSqlFlexibleServerUserAssignedIdentity identity, string administratorLogin, string administratorLoginPassword, PostgreSqlFlexibleServerVersion? version, string minorVersion, PostgreSqlFlexibleServerState? state, string fullyQualifiedDomainName, PostgreSqlFlexibleServerStorage storage, PostgreSqlFlexibleServerAuthConfig authConfig, PostgreSqlFlexibleServerDataEncryption dataEncryption, PostgreSqlFlexibleServerBackupProperties backup, PostgreSqlFlexibleServerNetwork network, PostgreSqlFlexibleServerHighAvailability highAvailability, PostgreSqlFlexibleServerMaintenanceWindow maintenanceWindow, ResourceIdentifier sourceServerResourceId, DateTimeOffset? pointInTimeUtc, string availabilityZone, PostgreSqlFlexibleServerReplicationRole? replicationRole, int? replicaCapacity, PostgreSqlFlexibleServersReplica replica, PostgreSqlFlexibleServerCreateMode? createMode, IReadOnlyList privateEndpointConnections, IDictionary serializedAdditionalRawData) : base(id, name, resourceType, systemData, tags, location) + internal PostgreSqlFlexibleServerData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, IDictionary tags, AzureLocation location, PostgreSqlFlexibleServerSku sku, ManagedServiceIdentity identity, string administratorLogin, string administratorLoginPassword, PostgreSqlFlexibleServerVersion? version, string minorVersion, PostgreSqlFlexibleServerState? state, string fullyQualifiedDomainName, PostgreSqlFlexibleServerStorage storage, PostgreSqlFlexibleServerAuthConfig authConfig, PostgreSqlFlexibleServerDataEncryption dataEncryption, PostgreSqlFlexibleServerBackupProperties backup, PostgreSqlFlexibleServerNetwork network, PostgreSqlFlexibleServerHighAvailability highAvailability, PostgreSqlFlexibleServerMaintenanceWindow maintenanceWindow, ResourceIdentifier sourceServerResourceId, DateTimeOffset? pointInTimeUtc, string availabilityZone, PostgreSqlFlexibleServerReplicationRole? replicationRole, int? replicaCapacity, PostgreSqlFlexibleServersReplica replica, PostgreSqlFlexibleServerCreateMode? createMode, IReadOnlyList privateEndpointConnections, IDictionary serializedAdditionalRawData) : base(id, name, resourceType, systemData, tags, location) { Sku = sku; Identity = identity; @@ -125,9 +125,9 @@ internal PostgreSqlFlexibleServerData() /// The SKU (pricing tier) of the server. [WirePath("sku")] public PostgreSqlFlexibleServerSku Sku { get; set; } - /// Describes the identity of the application. + /// Describes the identity of the application. Current supported identity types: None, UserAssigned, SystemAssigned. [WirePath("identity")] - public PostgreSqlFlexibleServerUserAssignedIdentity Identity { get; set; } + public ManagedServiceIdentity Identity { get; set; } /// The administrator's login name of a server. Can only be specified when the server is being created (and is required for creation). [WirePath("properties.administratorLogin")] public string AdministratorLogin { get; set; } diff --git a/sdk/postgresql/Azure.ResourceManager.PostgreSql/src/autorest.md b/sdk/postgresql/Azure.ResourceManager.PostgreSql/src/autorest.md index 605552d9fac5..7c4f46c57fc8 100644 --- a/sdk/postgresql/Azure.ResourceManager.PostgreSql/src/autorest.md +++ b/sdk/postgresql/Azure.ResourceManager.PostgreSql/src/autorest.md @@ -22,7 +22,7 @@ enable-bicep-serialization: true ``` yaml $(tag) == 'package-2020-01-01' namespace: Azure.ResourceManager.PostgreSql -require: https://github.com/Azure/azure-rest-api-specs/blob/eca38ee0caf445cb1e79c8e7bbaf9e1dca36479a/specification/postgresql/resource-manager/readme.md +require: /mnt/vss/_work/1/s/azure-rest-api-specs/specification/postgresql/resource-manager/readme.md output-folder: $(this-folder)/PostgreSql/Generated sample-gen: output-folder: $(this-folder)/../samples/Generated @@ -159,7 +159,7 @@ directive: ``` yaml $(tag) == 'package-flexibleserver-2024-08-01' namespace: Azure.ResourceManager.PostgreSql.FlexibleServers -require: https://github.com/Azure/azure-rest-api-specs/blob/7e2cb423d45186cd1bff123f35e7d43bc4c0f268/specification/postgresql/resource-manager/readme.md +require: /mnt/vss/_work/1/s/azure-rest-api-specs/specification/postgresql/resource-manager/readme.md output-folder: $(this-folder)/PostgreSqlFlexibleServers/Generated sample-gen: output-folder: $(this-folder)/../samples/Generated diff --git a/sdk/resourcemanager/ci.mgmt.yml b/sdk/resourcemanager/ci.mgmt.yml index d8bf790b5988..f28c28a5d39c 100644 --- a/sdk/resourcemanager/ci.mgmt.yml +++ b/sdk/resourcemanager/ci.mgmt.yml @@ -79,7 +79,6 @@ trigger: - sdk/dnsresolver/Azure.ResourceManager.DnsResolver - sdk/dynatrace/Azure.ResourceManager.Dynatrace - sdk/edgeorder/Azure.ResourceManager.EdgeOrder - - sdk/iotoperations/Azure.ResourceManager.IotOperations - sdk/edgezones/Azure.ResourceManager.EdgeZones - sdk/elastic/Azure.ResourceManager.Elastic - sdk/elasticsan/Azure.ResourceManager.ElasticSan @@ -108,6 +107,7 @@ trigger: - sdk/iot/Azure.ResourceManager.IotFirmwareDefense - sdk/iotcentral/Azure.ResourceManager.IotCentral - sdk/iothub/Azure.ResourceManager.IotHub + - sdk/iotoperations/Azure.ResourceManager.IotOperations - sdk/keyvault/Azure.ResourceManager.KeyVault - sdk/kubernetesconfiguration/Azure.ResourceManager.KubernetesConfiguration - sdk/kusto/Azure.ResourceManager.Kusto @@ -285,7 +285,6 @@ pr: - sdk/dnsresolver/Azure.ResourceManager.DnsResolver - sdk/dynatrace/Azure.ResourceManager.Dynatrace - sdk/edgeorder/Azure.ResourceManager.EdgeOrder - - sdk/iotoperations/Azure.ResourceManager.IotOperations - sdk/edgezones/Azure.ResourceManager.EdgeZones - sdk/elastic/Azure.ResourceManager.Elastic - sdk/elasticsan/Azure.ResourceManager.ElasticSan @@ -314,6 +313,7 @@ pr: - sdk/iot/Azure.ResourceManager.IotFirmwareDefense - sdk/iotcentral/Azure.ResourceManager.IotCentral - sdk/iothub/Azure.ResourceManager.IotHub + - sdk/iotoperations/Azure.ResourceManager.IotOperations - sdk/keyvault/Azure.ResourceManager.KeyVault - sdk/kubernetesconfiguration/Azure.ResourceManager.KubernetesConfiguration - sdk/kusto/Azure.ResourceManager.Kusto