Skip to content

Commit

Permalink
Tsp - fixed a vis related issue (#1418)
Browse files Browse the repository at this point in the history
  • Loading branch information
dolauli authored Dec 19, 2024
1 parent 50772a2 commit 213e8b4
Show file tree
Hide file tree
Showing 16 changed files with 74 additions and 58 deletions.
2 changes: 1 addition & 1 deletion packages/typespec-powershell/src/utils/modelUtils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,6 @@ internal AdditionalUnattendContent(Microsoft.Azure.PowerShell.Cmdlets.ComputeFle
{_passName = If( json?.PropertyT<Microsoft.Azure.PowerShell.Cmdlets.ComputeFleet.Runtime.Json.JsonString>("passName"), out var __jsonPassName) ? (string)__jsonPassName : (string)_passName;}
{_componentName = If( json?.PropertyT<Microsoft.Azure.PowerShell.Cmdlets.ComputeFleet.Runtime.Json.JsonString>("componentName"), out var __jsonComponentName) ? (string)__jsonComponentName : (string)_componentName;}
{_settingName = If( json?.PropertyT<Microsoft.Azure.PowerShell.Cmdlets.ComputeFleet.Runtime.Json.JsonString>("settingName"), out var __jsonSettingName) ? (string)__jsonSettingName : (string)_settingName;}
{_content = If( json?.PropertyT<Microsoft.Azure.PowerShell.Cmdlets.ComputeFleet.Runtime.Json.JsonString>("content"), out var __jsonContent) ? new System.Net.NetworkCredential("",(string)__jsonContent).SecurePassword : _content;}
AfterFromJson(json);
}

Expand Down Expand Up @@ -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;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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 );
Expand Down Expand Up @@ -131,7 +134,6 @@ internal VirtualMachineScaleSetExtensionProperties(Microsoft.Azure.PowerShell.Cm
{_autoUpgradeMinorVersion = If( json?.PropertyT<Microsoft.Azure.PowerShell.Cmdlets.ComputeFleet.Runtime.Json.JsonBoolean>("autoUpgradeMinorVersion"), out var __jsonAutoUpgradeMinorVersion) ? (bool?)__jsonAutoUpgradeMinorVersion : _autoUpgradeMinorVersion;}
{_enableAutomaticUpgrade = If( json?.PropertyT<Microsoft.Azure.PowerShell.Cmdlets.ComputeFleet.Runtime.Json.JsonBoolean>("enableAutomaticUpgrade"), out var __jsonEnableAutomaticUpgrade) ? (bool?)__jsonEnableAutomaticUpgrade : _enableAutomaticUpgrade;}
{_setting = If( json?.PropertyT<Microsoft.Azure.PowerShell.Cmdlets.ComputeFleet.Runtime.Json.JsonObject>("settings"), out var __jsonSettings) ? Microsoft.Azure.PowerShell.Cmdlets.ComputeFleet.Models.Settings.FromJson(__jsonSettings) : _setting;}
{_protectedSetting = If( json?.PropertyT<Microsoft.Azure.PowerShell.Cmdlets.ComputeFleet.Runtime.Json.JsonObject>("protectedSettings"), out var __jsonProtectedSettings) ? Microsoft.Azure.PowerShell.Cmdlets.ComputeFleet.Models.Settings.FromJson(__jsonProtectedSettings) : _protectedSetting;}
{_provisioningState = If( json?.PropertyT<Microsoft.Azure.PowerShell.Cmdlets.ComputeFleet.Runtime.Json.JsonString>("provisioningState"), out var __jsonProvisioningState) ? (string)__jsonProvisioningState : (string)_provisioningState;}
{_provisionAfterExtension = If( json?.PropertyT<Microsoft.Azure.PowerShell.Cmdlets.ComputeFleet.Runtime.Json.JsonArray>("provisionAfterExtensions"), out var __jsonProvisionAfterExtensions) ? If( __jsonProvisionAfterExtensions as Microsoft.Azure.PowerShell.Cmdlets.ComputeFleet.Runtime.Json.JsonArray, out var __v) ? new global::System.Func<System.Collections.Generic.List<string>>(()=> 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<Microsoft.Azure.PowerShell.Cmdlets.ComputeFleet.Runtime.Json.JsonBoolean>("suppressFailures"), out var __jsonSuppressFailures) ? (bool?)__jsonSuppressFailures : _suppressFailure;}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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. <br><br> **Minimum-length
Expand Down Expand Up @@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand Down Expand Up @@ -119,8 +125,6 @@ internal VirtualMachineScaleSetOSProfile(Microsoft.Azure.PowerShell.Cmdlets.Comp
{_linuxConfiguration = If( json?.PropertyT<Microsoft.Azure.PowerShell.Cmdlets.ComputeFleet.Runtime.Json.JsonObject>("linuxConfiguration"), out var __jsonLinuxConfiguration) ? Microsoft.Azure.PowerShell.Cmdlets.ComputeFleet.Models.LinuxConfiguration.FromJson(__jsonLinuxConfiguration) : _linuxConfiguration;}
{_computerNamePrefix = If( json?.PropertyT<Microsoft.Azure.PowerShell.Cmdlets.ComputeFleet.Runtime.Json.JsonString>("computerNamePrefix"), out var __jsonComputerNamePrefix) ? (string)__jsonComputerNamePrefix : (string)_computerNamePrefix;}
{_adminUsername = If( json?.PropertyT<Microsoft.Azure.PowerShell.Cmdlets.ComputeFleet.Runtime.Json.JsonString>("adminUsername"), out var __jsonAdminUsername) ? (string)__jsonAdminUsername : (string)_adminUsername;}
{_adminPassword = If( json?.PropertyT<Microsoft.Azure.PowerShell.Cmdlets.ComputeFleet.Runtime.Json.JsonString>("adminPassword"), out var __jsonAdminPassword) ? new System.Net.NetworkCredential("",(string)__jsonAdminPassword).SecurePassword : _adminPassword;}
{_customData = If( json?.PropertyT<Microsoft.Azure.PowerShell.Cmdlets.ComputeFleet.Runtime.Json.JsonString>("customData"), out var __jsonCustomData) ? new System.Net.NetworkCredential("",(string)__jsonCustomData).SecurePassword : _customData;}
{_secret = If( json?.PropertyT<Microsoft.Azure.PowerShell.Cmdlets.ComputeFleet.Runtime.Json.JsonArray>("secrets"), out var __jsonSecrets) ? If( __jsonSecrets as Microsoft.Azure.PowerShell.Cmdlets.ComputeFleet.Runtime.Json.JsonArray, out var __v) ? new global::System.Func<System.Collections.Generic.List<Microsoft.Azure.PowerShell.Cmdlets.ComputeFleet.Models.IVaultSecretGroup>>(()=> 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<Microsoft.Azure.PowerShell.Cmdlets.ComputeFleet.Runtime.Json.JsonBoolean>("allowExtensionOperations"), out var __jsonAllowExtensionOperations) ? (bool?)__jsonAllowExtensionOperations : _allowExtensionOperation;}
{_requireGuestProvisionSignal = If( json?.PropertyT<Microsoft.Azure.PowerShell.Cmdlets.ComputeFleet.Runtime.Json.JsonBoolean>("requireGuestProvisionSignal"), out var __jsonRequireGuestProvisionSignal) ? (bool?)__jsonRequireGuestProvisionSignal : _requireGuestProvisionSignal;}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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.",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,6 @@ internal AdministratorProperties(Microsoft.Azure.PowerShell.Cmdlets.MongoCluster
return;
}
{_userName = If( json?.PropertyT<Microsoft.Azure.PowerShell.Cmdlets.MongoCluster.Runtime.Json.JsonString>("userName"), out var __jsonUserName) ? (string)__jsonUserName : (string)_userName;}
{_password = If( json?.PropertyT<Microsoft.Azure.PowerShell.Cmdlets.MongoCluster.Runtime.Json.JsonString>("password"), out var __jsonPassword) ? new System.Net.NetworkCredential("",(string)__jsonPassword).SecurePassword : _password;}
AfterFromJson(json);
}

Expand Down Expand Up @@ -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;
}
Expand Down
Loading

0 comments on commit 213e8b4

Please sign in to comment.