Fix Alot of typos in xml and psm generation

This commit is contained in:
Esa Kataja
2025-03-14 14:15:57 +02:00
parent 472b7d9df7
commit 71c78fc7fe
2 changed files with 12 additions and 11 deletions
+7 -6
View File
@@ -99,7 +99,7 @@ function Get-CodeServerObject!NAME! {
$params.Add("CacheKeyProperty", $CacheKeyProperty) $params.Add("CacheKeyProperty", $CacheKeyProperty)
} }
[void](Get-AllCodeServerPagesRoles @params) [void](Get-AllCodeServerPages!NAME! @params)
} }
$cacheKey = $Resource.GetHashCode() $cacheKey = $Resource.GetHashCode()
@@ -119,6 +119,7 @@ function Get-CodeServerObject!NAME! {
convert_from = """ convert_from = """
Function ConvertFrom-CodeServerObject!NAME!([PSCustomObject[]]$codeServerObject!NAME!) { Function ConvertFrom-CodeServerObject!NAME!([PSCustomObject[]]$codeServerObject!NAME!) {
$map = @{ $map = @{
"conceptCodeId" = "conceptCodeId";
!MAPS! !MAPS!
} }
@@ -145,21 +146,21 @@ class CodeServer!NAME! {
!VARIABLES! !VARIABLES!
} }
[string]${conceptCodeId}
!STRINGS! !STRINGS!
} }
Export-ModuleMember ConvertFrom-CodeServerObject!NAME! Export-ModuleMember ConvertFrom-CodeServerObject!NAME!
Export-AllCodeServerPages!NAME! Export-ModuleMember Get-AllCodeServerPages!NAME!
Export-CodeServerObject!NAME! Export-ModuleMember Get-CodeServerObject!NAME!
""" """
def define_maps(items: list[str]) -> str: def define_maps(items: list[str]) -> str:
return "\n".join([f"\t'{sanitize_name(item)}' = '{item}'" for item in items]) return "\n".join([f"\t\"{sanitize_name(item)}\" = \"{item}\";" for item in items])
def define_variables(items: list[str]) -> str: def define_variables(items: list[str]) -> str:
return "\n".join([f"\t$this.{{{sanitize_name(item)}}} = $dic['{item}']" for item in items]) return "\n".join([f"\t$this.{{{sanitize_name(item)}}} = $dic[\"{item}\"]" for item in items])
def define_strings(items: list[str]) -> str: def define_strings(items: list[str]) -> str:
return "\n".join(["\t" + "[string]$" + "{" + sanitize_name(item) + "}" for item in items]) return "\n".join(["\t" + "[string]$" + "{" + sanitize_name(item) + "}" for item in items])
+5 -5
View File
@@ -47,7 +47,7 @@ def add_connection(root: ET.Element, name: str, attr_list: list[str], descriptio
if predefined_commands is None: if predefined_commands is None:
predefined_commands = ET.SubElement(initialization, "PredefinedCommands") predefined_commands = ET.SubElement(initialization, "PredefinedCommands")
ET.SubElement(predefined_commands, "Command", Name=f"Get-AllCodeServerPages{name}") ET.SubElement(predefined_commands, "Command", Name=f"Get-AllCodeServerPages{name}")
ET.SubElement(predefined_commands, "Command", Name=f"Get-CodeServerPage{name}") ET.SubElement(predefined_commands, "Command", Name=f"Get-CodeServerObject{name}")
schema = root.find("Schema") schema = root.find("Schema")
if schema is not None: if schema is not None:
@@ -57,22 +57,22 @@ def add_connection(root: ET.Element, name: str, attr_list: list[str], descriptio
property = ET.SubElement(properties, "Property", Name="conceptCodeId", DataType="String", IsMultivalue="false", IsAutoFill="false", IsUniqueKey="true") property = ET.SubElement(properties, "Property", Name="conceptCodeId", DataType="String", IsMultivalue="false", IsAutoFill="false", IsUniqueKey="true")
return_binding = ET.SubElement(property, "ReturnBindings") return_binding = ET.SubElement(property, "ReturnBindings")
ET.SubElement(return_binding, "Bind", CommandResultOf=f"Get-AllCodeServerPages{name}", Path="conceptCodeId") ET.SubElement(return_binding, "Bind", CommandResultOf=f"Get-AllCodeServerPages{name}", Path="conceptCodeId")
ET.SubElement(return_binding, "Bind", CommandResultOf=f"Get-CodeServerPage{name}", Path="conceptCodeId") ET.SubElement(return_binding, "Bind", CommandResultOf=f"Get-CodeServerObject{name}", Path="conceptCodeId")
mapping = ET.SubElement(property, "CommandMappings") mapping = ET.SubElement(property, "CommandMappings")
ET.SubElement(mapping, "Map", ToCommand=f"Get-CodeServerPages{name}", Parameter="conceptCodeId") ET.SubElement(mapping, "Map", ToCommand=f"Get-AllCodeServerPages{name}", Parameter="conceptCodeId")
for attr in attr_list: for attr in attr_list:
property = ET.SubElement(properties, "Property", Name=sanitize_name(attr), DataType="String", IsMultivalue="false", IsAutoFill="false") property = ET.SubElement(properties, "Property", Name=sanitize_name(attr), DataType="String", IsMultivalue="false", IsAutoFill="false")
return_binding = ET.SubElement(property, "ReturnBindings") return_binding = ET.SubElement(property, "ReturnBindings")
ET.SubElement(return_binding, "Bind", CommandResultOf=f"Get-AllCodeServerPages{name}", Path=sanitize_name(attr)) ET.SubElement(return_binding, "Bind", CommandResultOf=f"Get-AllCodeServerPages{name}", Path=sanitize_name(attr))
ET.SubElement(return_binding, "Bind", CommandResultOf=f"Get-CodeServerPage{name}", Path=sanitize_name(attr)) ET.SubElement(return_binding, "Bind", CommandResultOf=f"Get-CodeServerObject{name}", Path=sanitize_name(attr))
read_configuration = ET.SubElement(new_class, "ReadConfiguration") read_configuration = ET.SubElement(new_class, "ReadConfiguration")
listing_command = ET.SubElement(read_configuration, "ListingCommand", Command=f"Get-AllCodeServerPages{name}") listing_command = ET.SubElement(read_configuration, "ListingCommand", Command=f"Get-AllCodeServerPages{name}")
ET.SubElement(listing_command, "SetParameter", Param="Resource", Source="ConnectionParameter", Value=f"VarhaUrl{name}") ET.SubElement(listing_command, "SetParameter", Param="Resource", Source="ConnectionParameter", Value=f"VarhaUrl{name}")
ET.SubElement(listing_command, "SetParameter", Param="RootProperty", Source="FixedValue", Value="conceptCodes") ET.SubElement(listing_command, "SetParameter", Param="RootProperty", Source="FixedValue", Value="conceptCodes")
cmd_squence = ET.SubElement(read_configuration, "CommandSequence") cmd_squence = ET.SubElement(read_configuration, "CommandSequence")
item = ET.SubElement(cmd_squence, "Item", Command=f"Get-CodeServerPage{name}", Order="1") item = ET.SubElement(cmd_squence, "Item", Command=f"Get-CodeServerObject{name}", Order="1")
ET.SubElement(item, "SetParameter", Param="Resource", Source="ConnectionParameter", Value=f"VarhaUrl{name}") ET.SubElement(item, "SetParameter", Param="Resource", Source="ConnectionParameter", Value=f"VarhaUrl{name}")
ET.SubElement(item, "SetParameter", Param="RootProperty", Source="FixedValue", Value="conceptCodes") ET.SubElement(item, "SetParameter", Param="RootProperty", Source="FixedValue", Value="conceptCodes")
return root return root