From 92577ebf5f188bdb880cf6e6b5319c94b5d1ec36 Mon Sep 17 00:00:00 2001 From: Xiaogang Ding Date: Wed, 18 Dec 2024 17:07:42 +0800 Subject: [PATCH] Tsp - fixed a vis related issue --- .../src/utils/modelUtils.ts | 2 +- .../api/Models/AdditionalUnattendContent.cs | 2 +- .../Models/AdditionalUnattendContent.json.cs | 6 +++-- .../Models/VirtualMachineScaleSetExtension.cs | 2 +- ...rtualMachineScaleSetExtensionProperties.cs | 2 +- ...MachineScaleSetExtensionProperties.json.cs | 6 +++-- .../Models/VirtualMachineScaleSetOSProfile.cs | 4 ++-- .../VirtualMachineScaleSetOSProfile.json.cs | 12 ++++++---- .../api/Models/AdministratorProperties.cs | 2 +- .../Models/AdministratorProperties.json.cs | 6 +++-- .../generated/api/Models/MongoCluster.cs | 22 +++++++++---------- .../api/Models/MongoClusterProperties.cs | 22 +++++++++---------- .../api/Models/MongoClusterProperties.json.cs | 18 ++++++++++----- .../api/Models/MongoClusterUpdate.cs | 2 +- .../Models/MongoClusterUpdateProperties.cs | 2 +- .../target/generated/api/Models/Replica.cs | 22 +++++++++---------- 16 files changed, 74 insertions(+), 58 deletions(-) diff --git a/packages/typespec-powershell/src/utils/modelUtils.ts b/packages/typespec-powershell/src/utils/modelUtils.ts index de7c220bf9..2bbd4db742 100644 --- a/packages/typespec-powershell/src/utils/modelUtils.ts +++ b/packages/typespec-powershell/src/utils/modelUtils.ts @@ -883,7 +883,7 @@ function getSchemaForModel( property.required = true; } const vis = getVisibility(program, prop); - if (vis && vis.includes("read")) { + if (vis) { if (vis.includes("read")) { if (vis.length === 1) { property.readOnly = true; diff --git a/tests-upgrade/tests-emitter/AzureFleet.Management/target/generated/api/Models/AdditionalUnattendContent.cs b/tests-upgrade/tests-emitter/AzureFleet.Management/target/generated/api/Models/AdditionalUnattendContent.cs index d8d3d31bf1..65ef741cb3 100644 --- a/tests-upgrade/tests-emitter/AzureFleet.Management/target/generated/api/Models/AdditionalUnattendContent.cs +++ b/tests-upgrade/tests-emitter/AzureFleet.Management/target/generated/api/Models/AdditionalUnattendContent.cs @@ -88,7 +88,7 @@ public partial interface IAdditionalUnattendContent : [Microsoft.Azure.PowerShell.Cmdlets.ComputeFleet.Runtime.Info( Required = false, ReadOnly = false, - Read = true, + Read = false, Create = true, Update = true, Description = @"Specifies the XML formatted content that is added to the unattend.xml file for diff --git a/tests-upgrade/tests-emitter/AzureFleet.Management/target/generated/api/Models/AdditionalUnattendContent.json.cs b/tests-upgrade/tests-emitter/AzureFleet.Management/target/generated/api/Models/AdditionalUnattendContent.json.cs index 85a52560e2..15a77089d9 100644 --- a/tests-upgrade/tests-emitter/AzureFleet.Management/target/generated/api/Models/AdditionalUnattendContent.json.cs +++ b/tests-upgrade/tests-emitter/AzureFleet.Management/target/generated/api/Models/AdditionalUnattendContent.json.cs @@ -70,7 +70,6 @@ internal AdditionalUnattendContent(Microsoft.Azure.PowerShell.Cmdlets.ComputeFle {_passName = If( json?.PropertyT("passName"), out var __jsonPassName) ? (string)__jsonPassName : (string)_passName;} {_componentName = If( json?.PropertyT("componentName"), out var __jsonComponentName) ? (string)__jsonComponentName : (string)_componentName;} {_settingName = If( json?.PropertyT("settingName"), out var __jsonSettingName) ? (string)__jsonSettingName : (string)_settingName;} - {_content = If( json?.PropertyT("content"), out var __jsonContent) ? new System.Net.NetworkCredential("",(string)__jsonContent).SecurePassword : _content;} AfterFromJson(json); } @@ -108,7 +107,10 @@ public Microsoft.Azure.PowerShell.Cmdlets.ComputeFleet.Runtime.Json.JsonNode ToJ AddIf( null != (((object)this._passName)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.ComputeFleet.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.ComputeFleet.Runtime.Json.JsonString(this._passName.ToString()) : null, "passName" ,container.Add ); AddIf( null != (((object)this._componentName)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.ComputeFleet.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.ComputeFleet.Runtime.Json.JsonString(this._componentName.ToString()) : null, "componentName" ,container.Add ); AddIf( null != (((object)this._settingName)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.ComputeFleet.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.ComputeFleet.Runtime.Json.JsonString(this._settingName.ToString()) : null, "settingName" ,container.Add ); - AddIf( null != (((object)this._content)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.ComputeFleet.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.ComputeFleet.Runtime.Json.JsonString(System.Runtime.InteropServices.Marshal.PtrToStringBSTR(System.Runtime.InteropServices.Marshal.SecureStringToBSTR(this._content))) : null, "content" ,container.Add ); + if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.ComputeFleet.Runtime.SerializationMode.IncludeUpdate)||serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.ComputeFleet.Runtime.SerializationMode.IncludeCreate)) + { + AddIf( null != (((object)this._content)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.ComputeFleet.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.ComputeFleet.Runtime.Json.JsonString(System.Runtime.InteropServices.Marshal.PtrToStringBSTR(System.Runtime.InteropServices.Marshal.SecureStringToBSTR(this._content))) : null, "content" ,container.Add ); + } AfterToJson(ref container); return container; } diff --git a/tests-upgrade/tests-emitter/AzureFleet.Management/target/generated/api/Models/VirtualMachineScaleSetExtension.cs b/tests-upgrade/tests-emitter/AzureFleet.Management/target/generated/api/Models/VirtualMachineScaleSetExtension.cs index fd9dbdaafe..847c8aa1ff 100644 --- a/tests-upgrade/tests-emitter/AzureFleet.Management/target/generated/api/Models/VirtualMachineScaleSetExtension.cs +++ b/tests-upgrade/tests-emitter/AzureFleet.Management/target/generated/api/Models/VirtualMachineScaleSetExtension.cs @@ -229,7 +229,7 @@ public partial interface IVirtualMachineScaleSetExtension : [Microsoft.Azure.PowerShell.Cmdlets.ComputeFleet.Runtime.Info( Required = false, ReadOnly = false, - Read = true, + Read = false, Create = true, Update = true, Description = @"The extension can contain either protectedSettings or diff --git a/tests-upgrade/tests-emitter/AzureFleet.Management/target/generated/api/Models/VirtualMachineScaleSetExtensionProperties.cs b/tests-upgrade/tests-emitter/AzureFleet.Management/target/generated/api/Models/VirtualMachineScaleSetExtensionProperties.cs index 31ff384ce5..8559ad1e79 100644 --- a/tests-upgrade/tests-emitter/AzureFleet.Management/target/generated/api/Models/VirtualMachineScaleSetExtensionProperties.cs +++ b/tests-upgrade/tests-emitter/AzureFleet.Management/target/generated/api/Models/VirtualMachineScaleSetExtensionProperties.cs @@ -204,7 +204,7 @@ public partial interface IVirtualMachineScaleSetExtensionProperties : [Microsoft.Azure.PowerShell.Cmdlets.ComputeFleet.Runtime.Info( Required = false, ReadOnly = false, - Read = true, + Read = false, Create = true, Update = true, Description = @"The extension can contain either protectedSettings or diff --git a/tests-upgrade/tests-emitter/AzureFleet.Management/target/generated/api/Models/VirtualMachineScaleSetExtensionProperties.json.cs b/tests-upgrade/tests-emitter/AzureFleet.Management/target/generated/api/Models/VirtualMachineScaleSetExtensionProperties.json.cs index c1318c198e..52454958e9 100644 --- a/tests-upgrade/tests-emitter/AzureFleet.Management/target/generated/api/Models/VirtualMachineScaleSetExtensionProperties.json.cs +++ b/tests-upgrade/tests-emitter/AzureFleet.Management/target/generated/api/Models/VirtualMachineScaleSetExtensionProperties.json.cs @@ -92,7 +92,10 @@ public Microsoft.Azure.PowerShell.Cmdlets.ComputeFleet.Runtime.Json.JsonNode ToJ AddIf( null != this._autoUpgradeMinorVersion ? (Microsoft.Azure.PowerShell.Cmdlets.ComputeFleet.Runtime.Json.JsonNode)new Microsoft.Azure.PowerShell.Cmdlets.ComputeFleet.Runtime.Json.JsonBoolean((bool)this._autoUpgradeMinorVersion) : null, "autoUpgradeMinorVersion" ,container.Add ); AddIf( null != this._enableAutomaticUpgrade ? (Microsoft.Azure.PowerShell.Cmdlets.ComputeFleet.Runtime.Json.JsonNode)new Microsoft.Azure.PowerShell.Cmdlets.ComputeFleet.Runtime.Json.JsonBoolean((bool)this._enableAutomaticUpgrade) : null, "enableAutomaticUpgrade" ,container.Add ); AddIf( null != this._setting ? (Microsoft.Azure.PowerShell.Cmdlets.ComputeFleet.Runtime.Json.JsonNode) this._setting.ToJson(null,serializationMode) : null, "settings" ,container.Add ); - AddIf( null != this._protectedSetting ? (Microsoft.Azure.PowerShell.Cmdlets.ComputeFleet.Runtime.Json.JsonNode) this._protectedSetting.ToJson(null,serializationMode) : null, "protectedSettings" ,container.Add ); + if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.ComputeFleet.Runtime.SerializationMode.IncludeUpdate)||serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.ComputeFleet.Runtime.SerializationMode.IncludeCreate)) + { + AddIf( null != this._protectedSetting ? (Microsoft.Azure.PowerShell.Cmdlets.ComputeFleet.Runtime.Json.JsonNode) this._protectedSetting.ToJson(null,serializationMode) : null, "protectedSettings" ,container.Add ); + } if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.ComputeFleet.Runtime.SerializationMode.IncludeRead)) { AddIf( null != (((object)this._provisioningState)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.ComputeFleet.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.ComputeFleet.Runtime.Json.JsonString(this._provisioningState.ToString()) : null, "provisioningState" ,container.Add ); @@ -131,7 +134,6 @@ internal VirtualMachineScaleSetExtensionProperties(Microsoft.Azure.PowerShell.Cm {_autoUpgradeMinorVersion = If( json?.PropertyT("autoUpgradeMinorVersion"), out var __jsonAutoUpgradeMinorVersion) ? (bool?)__jsonAutoUpgradeMinorVersion : _autoUpgradeMinorVersion;} {_enableAutomaticUpgrade = If( json?.PropertyT("enableAutomaticUpgrade"), out var __jsonEnableAutomaticUpgrade) ? (bool?)__jsonEnableAutomaticUpgrade : _enableAutomaticUpgrade;} {_setting = If( json?.PropertyT("settings"), out var __jsonSettings) ? Microsoft.Azure.PowerShell.Cmdlets.ComputeFleet.Models.Settings.FromJson(__jsonSettings) : _setting;} - {_protectedSetting = If( json?.PropertyT("protectedSettings"), out var __jsonProtectedSettings) ? Microsoft.Azure.PowerShell.Cmdlets.ComputeFleet.Models.Settings.FromJson(__jsonProtectedSettings) : _protectedSetting;} {_provisioningState = If( json?.PropertyT("provisioningState"), out var __jsonProvisioningState) ? (string)__jsonProvisioningState : (string)_provisioningState;} {_provisionAfterExtension = If( json?.PropertyT("provisionAfterExtensions"), out var __jsonProvisionAfterExtensions) ? If( __jsonProvisionAfterExtensions as Microsoft.Azure.PowerShell.Cmdlets.ComputeFleet.Runtime.Json.JsonArray, out var __v) ? new global::System.Func>(()=> global::System.Linq.Enumerable.ToList(global::System.Linq.Enumerable.Select(__v, (__u)=>(string) (__u is Microsoft.Azure.PowerShell.Cmdlets.ComputeFleet.Runtime.Json.JsonString __t ? (string)(__t.ToString()) : null)) ))() : null : _provisionAfterExtension;} {_suppressFailure = If( json?.PropertyT("suppressFailures"), out var __jsonSuppressFailures) ? (bool?)__jsonSuppressFailures : _suppressFailure;} diff --git a/tests-upgrade/tests-emitter/AzureFleet.Management/target/generated/api/Models/VirtualMachineScaleSetOSProfile.cs b/tests-upgrade/tests-emitter/AzureFleet.Management/target/generated/api/Models/VirtualMachineScaleSetOSProfile.cs index fcd2a8856d..6b53372416 100644 --- a/tests-upgrade/tests-emitter/AzureFleet.Management/target/generated/api/Models/VirtualMachineScaleSetOSProfile.cs +++ b/tests-upgrade/tests-emitter/AzureFleet.Management/target/generated/api/Models/VirtualMachineScaleSetOSProfile.cs @@ -323,7 +323,7 @@ public partial interface IVirtualMachineScaleSetOSProfile : [Microsoft.Azure.PowerShell.Cmdlets.ComputeFleet.Runtime.Info( Required = false, ReadOnly = false, - Read = true, + Read = false, Create = true, Update = true, Description = @"Specifies the password of the administrator account.

**Minimum-length @@ -412,7 +412,7 @@ scale set. This may only be set to False when no extensions are present on the [Microsoft.Azure.PowerShell.Cmdlets.ComputeFleet.Runtime.Info( Required = false, ReadOnly = false, - Read = true, + Read = false, Create = true, Update = true, Description = @"Specifies a base-64 encoded string of custom data. The base-64 encoded string diff --git a/tests-upgrade/tests-emitter/AzureFleet.Management/target/generated/api/Models/VirtualMachineScaleSetOSProfile.json.cs b/tests-upgrade/tests-emitter/AzureFleet.Management/target/generated/api/Models/VirtualMachineScaleSetOSProfile.json.cs index 4dbc3fc54c..78ab2cafa3 100644 --- a/tests-upgrade/tests-emitter/AzureFleet.Management/target/generated/api/Models/VirtualMachineScaleSetOSProfile.json.cs +++ b/tests-upgrade/tests-emitter/AzureFleet.Management/target/generated/api/Models/VirtualMachineScaleSetOSProfile.json.cs @@ -86,8 +86,14 @@ public Microsoft.Azure.PowerShell.Cmdlets.ComputeFleet.Runtime.Json.JsonNode ToJ AddIf( null != this._linuxConfiguration ? (Microsoft.Azure.PowerShell.Cmdlets.ComputeFleet.Runtime.Json.JsonNode) this._linuxConfiguration.ToJson(null,serializationMode) : null, "linuxConfiguration" ,container.Add ); AddIf( null != (((object)this._computerNamePrefix)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.ComputeFleet.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.ComputeFleet.Runtime.Json.JsonString(this._computerNamePrefix.ToString()) : null, "computerNamePrefix" ,container.Add ); AddIf( null != (((object)this._adminUsername)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.ComputeFleet.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.ComputeFleet.Runtime.Json.JsonString(this._adminUsername.ToString()) : null, "adminUsername" ,container.Add ); - AddIf( null != (((object)this._adminPassword)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.ComputeFleet.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.ComputeFleet.Runtime.Json.JsonString(System.Runtime.InteropServices.Marshal.PtrToStringBSTR(System.Runtime.InteropServices.Marshal.SecureStringToBSTR(this._adminPassword))) : null, "adminPassword" ,container.Add ); - AddIf( null != (((object)this._customData)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.ComputeFleet.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.ComputeFleet.Runtime.Json.JsonString(System.Runtime.InteropServices.Marshal.PtrToStringBSTR(System.Runtime.InteropServices.Marshal.SecureStringToBSTR(this._customData))) : null, "customData" ,container.Add ); + if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.ComputeFleet.Runtime.SerializationMode.IncludeUpdate)||serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.ComputeFleet.Runtime.SerializationMode.IncludeCreate)) + { + AddIf( null != (((object)this._adminPassword)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.ComputeFleet.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.ComputeFleet.Runtime.Json.JsonString(System.Runtime.InteropServices.Marshal.PtrToStringBSTR(System.Runtime.InteropServices.Marshal.SecureStringToBSTR(this._adminPassword))) : null, "adminPassword" ,container.Add ); + } + if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.ComputeFleet.Runtime.SerializationMode.IncludeUpdate)||serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.ComputeFleet.Runtime.SerializationMode.IncludeCreate)) + { + AddIf( null != (((object)this._customData)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.ComputeFleet.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.ComputeFleet.Runtime.Json.JsonString(System.Runtime.InteropServices.Marshal.PtrToStringBSTR(System.Runtime.InteropServices.Marshal.SecureStringToBSTR(this._customData))) : null, "customData" ,container.Add ); + } if (null != this._secret) { var __w = new Microsoft.Azure.PowerShell.Cmdlets.ComputeFleet.Runtime.Json.XNodeArray(); @@ -119,8 +125,6 @@ internal VirtualMachineScaleSetOSProfile(Microsoft.Azure.PowerShell.Cmdlets.Comp {_linuxConfiguration = If( json?.PropertyT("linuxConfiguration"), out var __jsonLinuxConfiguration) ? Microsoft.Azure.PowerShell.Cmdlets.ComputeFleet.Models.LinuxConfiguration.FromJson(__jsonLinuxConfiguration) : _linuxConfiguration;} {_computerNamePrefix = If( json?.PropertyT("computerNamePrefix"), out var __jsonComputerNamePrefix) ? (string)__jsonComputerNamePrefix : (string)_computerNamePrefix;} {_adminUsername = If( json?.PropertyT("adminUsername"), out var __jsonAdminUsername) ? (string)__jsonAdminUsername : (string)_adminUsername;} - {_adminPassword = If( json?.PropertyT("adminPassword"), out var __jsonAdminPassword) ? new System.Net.NetworkCredential("",(string)__jsonAdminPassword).SecurePassword : _adminPassword;} - {_customData = If( json?.PropertyT("customData"), out var __jsonCustomData) ? new System.Net.NetworkCredential("",(string)__jsonCustomData).SecurePassword : _customData;} {_secret = If( json?.PropertyT("secrets"), out var __jsonSecrets) ? If( __jsonSecrets as Microsoft.Azure.PowerShell.Cmdlets.ComputeFleet.Runtime.Json.JsonArray, out var __v) ? new global::System.Func>(()=> global::System.Linq.Enumerable.ToList(global::System.Linq.Enumerable.Select(__v, (__u)=>(Microsoft.Azure.PowerShell.Cmdlets.ComputeFleet.Models.IVaultSecretGroup) (Microsoft.Azure.PowerShell.Cmdlets.ComputeFleet.Models.VaultSecretGroup.FromJson(__u) )) ))() : null : _secret;} {_allowExtensionOperation = If( json?.PropertyT("allowExtensionOperations"), out var __jsonAllowExtensionOperations) ? (bool?)__jsonAllowExtensionOperations : _allowExtensionOperation;} {_requireGuestProvisionSignal = If( json?.PropertyT("requireGuestProvisionSignal"), out var __jsonRequireGuestProvisionSignal) ? (bool?)__jsonRequireGuestProvisionSignal : _requireGuestProvisionSignal;} diff --git a/tests-upgrade/tests-emitter/DocumentDB.MongoCluster.Management/target/generated/api/Models/AdministratorProperties.cs b/tests-upgrade/tests-emitter/DocumentDB.MongoCluster.Management/target/generated/api/Models/AdministratorProperties.cs index 0599314a38..01cf77e629 100644 --- a/tests-upgrade/tests-emitter/DocumentDB.MongoCluster.Management/target/generated/api/Models/AdministratorProperties.cs +++ b/tests-upgrade/tests-emitter/DocumentDB.MongoCluster.Management/target/generated/api/Models/AdministratorProperties.cs @@ -39,7 +39,7 @@ public partial interface IAdministratorProperties : [Microsoft.Azure.PowerShell.Cmdlets.MongoCluster.Runtime.Info( Required = false, ReadOnly = false, - Read = true, + Read = false, Create = true, Update = true, Description = @"The administrator password.", diff --git a/tests-upgrade/tests-emitter/DocumentDB.MongoCluster.Management/target/generated/api/Models/AdministratorProperties.json.cs b/tests-upgrade/tests-emitter/DocumentDB.MongoCluster.Management/target/generated/api/Models/AdministratorProperties.json.cs index 647523a2a4..314adfe4d9 100644 --- a/tests-upgrade/tests-emitter/DocumentDB.MongoCluster.Management/target/generated/api/Models/AdministratorProperties.json.cs +++ b/tests-upgrade/tests-emitter/DocumentDB.MongoCluster.Management/target/generated/api/Models/AdministratorProperties.json.cs @@ -64,7 +64,6 @@ internal AdministratorProperties(Microsoft.Azure.PowerShell.Cmdlets.MongoCluster return; } {_userName = If( json?.PropertyT("userName"), out var __jsonUserName) ? (string)__jsonUserName : (string)_userName;} - {_password = If( json?.PropertyT("password"), out var __jsonPassword) ? new System.Net.NetworkCredential("",(string)__jsonPassword).SecurePassword : _password;} AfterFromJson(json); } @@ -100,7 +99,10 @@ public Microsoft.Azure.PowerShell.Cmdlets.MongoCluster.Runtime.Json.JsonNode ToJ return container; } AddIf( null != (((object)this._userName)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.MongoCluster.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.MongoCluster.Runtime.Json.JsonString(this._userName.ToString()) : null, "userName" ,container.Add ); - AddIf( null != (((object)this._password)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.MongoCluster.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.MongoCluster.Runtime.Json.JsonString(System.Runtime.InteropServices.Marshal.PtrToStringBSTR(System.Runtime.InteropServices.Marshal.SecureStringToBSTR(this._password))) : null, "password" ,container.Add ); + if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.MongoCluster.Runtime.SerializationMode.IncludeUpdate)||serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.MongoCluster.Runtime.SerializationMode.IncludeCreate)) + { + AddIf( null != (((object)this._password)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.MongoCluster.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.MongoCluster.Runtime.Json.JsonString(System.Runtime.InteropServices.Marshal.PtrToStringBSTR(System.Runtime.InteropServices.Marshal.SecureStringToBSTR(this._password))) : null, "password" ,container.Add ); + } AfterToJson(ref container); return container; } diff --git a/tests-upgrade/tests-emitter/DocumentDB.MongoCluster.Management/target/generated/api/Models/MongoCluster.cs b/tests-upgrade/tests-emitter/DocumentDB.MongoCluster.Management/target/generated/api/Models/MongoCluster.cs index 2b695d7400..6b1c752ffd 100644 --- a/tests-upgrade/tests-emitter/DocumentDB.MongoCluster.Management/target/generated/api/Models/MongoCluster.cs +++ b/tests-upgrade/tests-emitter/DocumentDB.MongoCluster.Management/target/generated/api/Models/MongoCluster.cs @@ -291,7 +291,7 @@ public partial interface IMongoCluster : [Microsoft.Azure.PowerShell.Cmdlets.MongoCluster.Runtime.Info( Required = false, ReadOnly = false, - Read = true, + Read = false, Create = true, Update = true, Description = @"The administrator password.", @@ -361,9 +361,9 @@ public partial interface IMongoCluster : [Microsoft.Azure.PowerShell.Cmdlets.MongoCluster.Runtime.Info( Required = false, ReadOnly = false, - Read = true, + Read = false, Create = true, - Update = true, + Update = false, Description = @"The mode to create a mongo cluster.", SerializedName = @"createMode", PossibleTypes = new [] { typeof(string) })] @@ -443,9 +443,9 @@ public partial interface IMongoCluster : [Microsoft.Azure.PowerShell.Cmdlets.MongoCluster.Runtime.Info( Required = false, ReadOnly = false, - Read = true, + Read = false, Create = true, - Update = true, + Update = false, Description = @"The location of the source cluster", SerializedName = @"sourceLocation", PossibleTypes = new [] { typeof(string) })] @@ -454,9 +454,9 @@ public partial interface IMongoCluster : [Microsoft.Azure.PowerShell.Cmdlets.MongoCluster.Runtime.Info( Required = false, ReadOnly = false, - Read = true, + Read = false, Create = true, - Update = true, + Update = false, Description = @"The id of the replication source cluster.", SerializedName = @"sourceResourceId", PossibleTypes = new [] { typeof(string) })] @@ -500,9 +500,9 @@ public partial interface IMongoCluster : [Microsoft.Azure.PowerShell.Cmdlets.MongoCluster.Runtime.Info( Required = false, ReadOnly = false, - Read = true, + Read = false, Create = true, - Update = true, + Update = false, Description = @"UTC point in time to restore a mongo cluster", SerializedName = @"pointInTimeUTC", PossibleTypes = new [] { typeof(global::System.DateTime) })] @@ -511,9 +511,9 @@ public partial interface IMongoCluster : [Microsoft.Azure.PowerShell.Cmdlets.MongoCluster.Runtime.Info( Required = false, ReadOnly = false, - Read = true, + Read = false, Create = true, - Update = true, + Update = false, Description = @"Resource ID to locate the source cluster to restore", SerializedName = @"sourceResourceId", PossibleTypes = new [] { typeof(string) })] diff --git a/tests-upgrade/tests-emitter/DocumentDB.MongoCluster.Management/target/generated/api/Models/MongoClusterProperties.cs b/tests-upgrade/tests-emitter/DocumentDB.MongoCluster.Management/target/generated/api/Models/MongoClusterProperties.cs index c9d23c0ecc..59cd37725d 100644 --- a/tests-upgrade/tests-emitter/DocumentDB.MongoCluster.Management/target/generated/api/Models/MongoClusterProperties.cs +++ b/tests-upgrade/tests-emitter/DocumentDB.MongoCluster.Management/target/generated/api/Models/MongoClusterProperties.cs @@ -266,7 +266,7 @@ public partial interface IMongoClusterProperties : [Microsoft.Azure.PowerShell.Cmdlets.MongoCluster.Runtime.Info( Required = false, ReadOnly = false, - Read = true, + Read = false, Create = true, Update = true, Description = @"The administrator password.", @@ -336,9 +336,9 @@ public partial interface IMongoClusterProperties : [Microsoft.Azure.PowerShell.Cmdlets.MongoCluster.Runtime.Info( Required = false, ReadOnly = false, - Read = true, + Read = false, Create = true, - Update = true, + Update = false, Description = @"The mode to create a mongo cluster.", SerializedName = @"createMode", PossibleTypes = new [] { typeof(string) })] @@ -418,9 +418,9 @@ public partial interface IMongoClusterProperties : [Microsoft.Azure.PowerShell.Cmdlets.MongoCluster.Runtime.Info( Required = false, ReadOnly = false, - Read = true, + Read = false, Create = true, - Update = true, + Update = false, Description = @"The location of the source cluster", SerializedName = @"sourceLocation", PossibleTypes = new [] { typeof(string) })] @@ -429,9 +429,9 @@ public partial interface IMongoClusterProperties : [Microsoft.Azure.PowerShell.Cmdlets.MongoCluster.Runtime.Info( Required = false, ReadOnly = false, - Read = true, + Read = false, Create = true, - Update = true, + Update = false, Description = @"The id of the replication source cluster.", SerializedName = @"sourceResourceId", PossibleTypes = new [] { typeof(string) })] @@ -475,9 +475,9 @@ public partial interface IMongoClusterProperties : [Microsoft.Azure.PowerShell.Cmdlets.MongoCluster.Runtime.Info( Required = false, ReadOnly = false, - Read = true, + Read = false, Create = true, - Update = true, + Update = false, Description = @"UTC point in time to restore a mongo cluster", SerializedName = @"pointInTimeUTC", PossibleTypes = new [] { typeof(global::System.DateTime) })] @@ -486,9 +486,9 @@ public partial interface IMongoClusterProperties : [Microsoft.Azure.PowerShell.Cmdlets.MongoCluster.Runtime.Info( Required = false, ReadOnly = false, - Read = true, + Read = false, Create = true, - Update = true, + Update = false, Description = @"Resource ID to locate the source cluster to restore", SerializedName = @"sourceResourceId", PossibleTypes = new [] { typeof(string) })] diff --git a/tests-upgrade/tests-emitter/DocumentDB.MongoCluster.Management/target/generated/api/Models/MongoClusterProperties.json.cs b/tests-upgrade/tests-emitter/DocumentDB.MongoCluster.Management/target/generated/api/Models/MongoClusterProperties.json.cs index 1badedfeb1..bbb45fe1c0 100644 --- a/tests-upgrade/tests-emitter/DocumentDB.MongoCluster.Management/target/generated/api/Models/MongoClusterProperties.json.cs +++ b/tests-upgrade/tests-emitter/DocumentDB.MongoCluster.Management/target/generated/api/Models/MongoClusterProperties.json.cs @@ -75,8 +75,6 @@ internal MongoClusterProperties(Microsoft.Azure.PowerShell.Cmdlets.MongoCluster. { return; } - {_restoreParameter = If( json?.PropertyT("restoreParameters"), out var __jsonRestoreParameters) ? Microsoft.Azure.PowerShell.Cmdlets.MongoCluster.Models.MongoClusterRestoreParameters.FromJson(__jsonRestoreParameters) : _restoreParameter;} - {_replicaParameter = If( json?.PropertyT("replicaParameters"), out var __jsonReplicaParameters) ? Microsoft.Azure.PowerShell.Cmdlets.MongoCluster.Models.MongoClusterReplicaParameters.FromJson(__jsonReplicaParameters) : _replicaParameter;} {_administrator = If( json?.PropertyT("administrator"), out var __jsonAdministrator) ? Microsoft.Azure.PowerShell.Cmdlets.MongoCluster.Models.AdministratorProperties.FromJson(__jsonAdministrator) : _administrator;} {_highAvailability = If( json?.PropertyT("highAvailability"), out var __jsonHighAvailability) ? Microsoft.Azure.PowerShell.Cmdlets.MongoCluster.Models.HighAvailabilityProperties.FromJson(__jsonHighAvailability) : _highAvailability;} {_storage = If( json?.PropertyT("storage"), out var __jsonStorage) ? Microsoft.Azure.PowerShell.Cmdlets.MongoCluster.Models.StorageProperties.FromJson(__jsonStorage) : _storage;} @@ -84,7 +82,6 @@ internal MongoClusterProperties(Microsoft.Azure.PowerShell.Cmdlets.MongoCluster. {_compute = If( json?.PropertyT("compute"), out var __jsonCompute) ? Microsoft.Azure.PowerShell.Cmdlets.MongoCluster.Models.ComputeProperties.FromJson(__jsonCompute) : _compute;} {_backup = If( json?.PropertyT("backup"), out var __jsonBackup) ? Microsoft.Azure.PowerShell.Cmdlets.MongoCluster.Models.BackupProperties.FromJson(__jsonBackup) : _backup;} {_replica = If( json?.PropertyT("replica"), out var __jsonReplica) ? Microsoft.Azure.PowerShell.Cmdlets.MongoCluster.Models.ReplicationProperties.FromJson(__jsonReplica) : _replica;} - {_createMode = If( json?.PropertyT("createMode"), out var __jsonCreateMode) ? (string)__jsonCreateMode : (string)_createMode;} {_serverVersion = If( json?.PropertyT("serverVersion"), out var __jsonServerVersion) ? (string)__jsonServerVersion : (string)_serverVersion;} {_connectionString = If( json?.PropertyT("connectionString"), out var __jsonConnectionString) ? (string)__jsonConnectionString : (string)_connectionString;} {_provisioningState = If( json?.PropertyT("provisioningState"), out var __jsonProvisioningState) ? (string)__jsonProvisioningState : (string)_provisioningState;} @@ -115,8 +112,14 @@ public Microsoft.Azure.PowerShell.Cmdlets.MongoCluster.Runtime.Json.JsonNode ToJ { return container; } - AddIf( null != this._restoreParameter ? (Microsoft.Azure.PowerShell.Cmdlets.MongoCluster.Runtime.Json.JsonNode) this._restoreParameter.ToJson(null,serializationMode) : null, "restoreParameters" ,container.Add ); - AddIf( null != this._replicaParameter ? (Microsoft.Azure.PowerShell.Cmdlets.MongoCluster.Runtime.Json.JsonNode) this._replicaParameter.ToJson(null,serializationMode) : null, "replicaParameters" ,container.Add ); + if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.MongoCluster.Runtime.SerializationMode.IncludeCreate)) + { + AddIf( null != this._restoreParameter ? (Microsoft.Azure.PowerShell.Cmdlets.MongoCluster.Runtime.Json.JsonNode) this._restoreParameter.ToJson(null,serializationMode) : null, "restoreParameters" ,container.Add ); + } + if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.MongoCluster.Runtime.SerializationMode.IncludeCreate)) + { + AddIf( null != this._replicaParameter ? (Microsoft.Azure.PowerShell.Cmdlets.MongoCluster.Runtime.Json.JsonNode) this._replicaParameter.ToJson(null,serializationMode) : null, "replicaParameters" ,container.Add ); + } AddIf( null != this._administrator ? (Microsoft.Azure.PowerShell.Cmdlets.MongoCluster.Runtime.Json.JsonNode) this._administrator.ToJson(null,serializationMode) : null, "administrator" ,container.Add ); AddIf( null != this._highAvailability ? (Microsoft.Azure.PowerShell.Cmdlets.MongoCluster.Runtime.Json.JsonNode) this._highAvailability.ToJson(null,serializationMode) : null, "highAvailability" ,container.Add ); AddIf( null != this._storage ? (Microsoft.Azure.PowerShell.Cmdlets.MongoCluster.Runtime.Json.JsonNode) this._storage.ToJson(null,serializationMode) : null, "storage" ,container.Add ); @@ -127,7 +130,10 @@ public Microsoft.Azure.PowerShell.Cmdlets.MongoCluster.Runtime.Json.JsonNode ToJ { AddIf( null != this._replica ? (Microsoft.Azure.PowerShell.Cmdlets.MongoCluster.Runtime.Json.JsonNode) this._replica.ToJson(null,serializationMode) : null, "replica" ,container.Add ); } - AddIf( null != (((object)this._createMode)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.MongoCluster.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.MongoCluster.Runtime.Json.JsonString(this._createMode.ToString()) : null, "createMode" ,container.Add ); + if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.MongoCluster.Runtime.SerializationMode.IncludeCreate)) + { + AddIf( null != (((object)this._createMode)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.MongoCluster.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.MongoCluster.Runtime.Json.JsonString(this._createMode.ToString()) : null, "createMode" ,container.Add ); + } AddIf( null != (((object)this._serverVersion)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.MongoCluster.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.MongoCluster.Runtime.Json.JsonString(this._serverVersion.ToString()) : null, "serverVersion" ,container.Add ); if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.MongoCluster.Runtime.SerializationMode.IncludeRead)) { diff --git a/tests-upgrade/tests-emitter/DocumentDB.MongoCluster.Management/target/generated/api/Models/MongoClusterUpdate.cs b/tests-upgrade/tests-emitter/DocumentDB.MongoCluster.Management/target/generated/api/Models/MongoClusterUpdate.cs index ef4b35a97f..f51cb2df9f 100644 --- a/tests-upgrade/tests-emitter/DocumentDB.MongoCluster.Management/target/generated/api/Models/MongoClusterUpdate.cs +++ b/tests-upgrade/tests-emitter/DocumentDB.MongoCluster.Management/target/generated/api/Models/MongoClusterUpdate.cs @@ -108,7 +108,7 @@ public partial interface IMongoClusterUpdate : [Microsoft.Azure.PowerShell.Cmdlets.MongoCluster.Runtime.Info( Required = false, ReadOnly = false, - Read = true, + Read = false, Create = true, Update = true, Description = @"The administrator password.", diff --git a/tests-upgrade/tests-emitter/DocumentDB.MongoCluster.Management/target/generated/api/Models/MongoClusterUpdateProperties.cs b/tests-upgrade/tests-emitter/DocumentDB.MongoCluster.Management/target/generated/api/Models/MongoClusterUpdateProperties.cs index 6791c83afb..0f19cb1c65 100644 --- a/tests-upgrade/tests-emitter/DocumentDB.MongoCluster.Management/target/generated/api/Models/MongoClusterUpdateProperties.cs +++ b/tests-upgrade/tests-emitter/DocumentDB.MongoCluster.Management/target/generated/api/Models/MongoClusterUpdateProperties.cs @@ -142,7 +142,7 @@ public partial interface IMongoClusterUpdateProperties : [Microsoft.Azure.PowerShell.Cmdlets.MongoCluster.Runtime.Info( Required = false, ReadOnly = false, - Read = true, + Read = false, Create = true, Update = true, Description = @"The administrator password.", diff --git a/tests-upgrade/tests-emitter/DocumentDB.MongoCluster.Management/target/generated/api/Models/Replica.cs b/tests-upgrade/tests-emitter/DocumentDB.MongoCluster.Management/target/generated/api/Models/Replica.cs index a54d320819..ef72e318d0 100644 --- a/tests-upgrade/tests-emitter/DocumentDB.MongoCluster.Management/target/generated/api/Models/Replica.cs +++ b/tests-upgrade/tests-emitter/DocumentDB.MongoCluster.Management/target/generated/api/Models/Replica.cs @@ -262,7 +262,7 @@ public partial interface IReplica : [Microsoft.Azure.PowerShell.Cmdlets.MongoCluster.Runtime.Info( Required = false, ReadOnly = false, - Read = true, + Read = false, Create = true, Update = true, Description = @"The administrator password.", @@ -332,9 +332,9 @@ public partial interface IReplica : [Microsoft.Azure.PowerShell.Cmdlets.MongoCluster.Runtime.Info( Required = false, ReadOnly = false, - Read = true, + Read = false, Create = true, - Update = true, + Update = false, Description = @"The mode to create a mongo cluster.", SerializedName = @"createMode", PossibleTypes = new [] { typeof(string) })] @@ -367,9 +367,9 @@ public partial interface IReplica : [Microsoft.Azure.PowerShell.Cmdlets.MongoCluster.Runtime.Info( Required = false, ReadOnly = false, - Read = true, + Read = false, Create = true, - Update = true, + Update = false, Description = @"The location of the source cluster", SerializedName = @"sourceLocation", PossibleTypes = new [] { typeof(string) })] @@ -378,9 +378,9 @@ public partial interface IReplica : [Microsoft.Azure.PowerShell.Cmdlets.MongoCluster.Runtime.Info( Required = false, ReadOnly = false, - Read = true, + Read = false, Create = true, - Update = true, + Update = false, Description = @"The id of the replication source cluster.", SerializedName = @"sourceResourceId", PossibleTypes = new [] { typeof(string) })] @@ -448,9 +448,9 @@ public partial interface IReplica : [Microsoft.Azure.PowerShell.Cmdlets.MongoCluster.Runtime.Info( Required = false, ReadOnly = false, - Read = true, + Read = false, Create = true, - Update = true, + Update = false, Description = @"UTC point in time to restore a mongo cluster", SerializedName = @"pointInTimeUTC", PossibleTypes = new [] { typeof(global::System.DateTime) })] @@ -459,9 +459,9 @@ public partial interface IReplica : [Microsoft.Azure.PowerShell.Cmdlets.MongoCluster.Runtime.Info( Required = false, ReadOnly = false, - Read = true, + Read = false, Create = true, - Update = true, + Update = false, Description = @"Resource ID to locate the source cluster to restore", SerializedName = @"sourceResourceId", PossibleTypes = new [] { typeof(string) })]