From 5847f263eb8c19a419917dea710b690d06931640 Mon Sep 17 00:00:00 2001 From: Erika Gressi Date: Sat, 5 Aug 2023 21:35:58 +0200 Subject: [PATCH] synopsis --- .../tools/helper/ConvertTo-ModuleResourceType.ps1 | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/utilities/tools/helper/ConvertTo-ModuleResourceType.ps1 b/utilities/tools/helper/ConvertTo-ModuleResourceType.ps1 index 848a77b7ff..a7d9a247cc 100644 --- a/utilities/tools/helper/ConvertTo-ModuleResourceType.ps1 +++ b/utilities/tools/helper/ConvertTo-ModuleResourceType.ps1 @@ -1,16 +1,17 @@ <# .SYNOPSIS -Try to find the actual provider namespace and resource type for a given resource identifier. +Converts the module folder path to the actual resource type. .DESCRIPTION -Try to find the actual provider namespace and resource type for a given resource identifier. -For example, for 'virtual-machine-images/image-template' it we want to find 'Microsoft.VirtualMachineImages/imageTemplates'. +Converts the module folder path to the actual resource type. .PARAMETER ResourceIdentifier -Mandatory. The resource identifier to search for. +Mandatory. The resource identifier to search for, i.e. the relative module file path starting from the resource provider folder. -.PARAMETER SpecsFilePath -Optional. The path to the specs file that contains all available provider namespaces & resource types. Defaults to 'utilities/src/apiSpecsList.json'. +.EXAMPLE +ConvertTo-ModuleResourceType -ResourceIdentifier 'storage/storage-account'. + +Returns 'Microsoft.Storage/storageAccounts'. .EXAMPLE ConvertTo-ModuleResourceType -ResourceIdentifier 'storage/storage-account/blob-service/container/immutability-policy'. @@ -39,7 +40,7 @@ function ConvertTo-ModuleResourceType { $innerResourceType = $fullParentResourceType foreach ($childType in $childTypeArray) { - # additonal check for non existing child types (e.g. sites/hybridConnectionNamespaces does not exist, only sites/hybridConnectionNamespaces/relays does) + # Additonal check for child types non existing on their own (e.g. sites/hybridConnectionNamespaces does not exist, sites/hybridConnectionNamespaces/relays does) $innerResourceTypeLeafReduced = Get-ReducedWordString -StringToReduce ($innerResourceType -Split '[\/|\\]')[-1] $childTypeReduced = Get-ReducedWordString -StringToReduce $childType if ($innerResourceTypeLeafReduced -eq $childTypeReduced) {