Skip to content

Commit

Permalink
code customization
Browse files Browse the repository at this point in the history
  • Loading branch information
v-amolpatil committed Jan 13, 2025
1 parent c34fe96 commit 4325973
Showing 1 changed file with 1 addition and 31 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -288,29 +288,9 @@ function CreateRestApiPollerResourceProperties() {
# ApiKey
ProcessPropertyPlaceholders -armResource $armResource -templateContentConnections $templateContentConnections -isOnlyObjectCheck $false -propertyObject $armResource.properties.auth -propertyName 'apikey' -isInnerObject $true -innerObjectName 'auth' -kindType $kindType -isSecret $true -isRequired $true -minLength 4
}
elseif($armResource.properties.auth.type.ToLower() -eq 'JwtToken')
{
# userName object check
ProcessPropertyPlaceholders -armResource $armResource -templateContentConnections $templateContentConnections -isOnlyObjectCheck $true -propertyObject $armResource.properties.auth -propertyName 'userName' -isInnerObject $true -innerObjectName 'auth' -kindType $kindType -isSecret $false -isRequired $true -minLength 4

# userName object should have key
ProcessPropertyPlaceholders -armResource $armResource -templateContentConnections $templateContentConnections -isOnlyObjectCheck $true -propertyObject $armResource.properties.auth.userName -propertyName 'key' -isInnerObject $true -innerObjectName 'userName' -kindType $kindType -isSecret $false -isRequired $true -minLength 4

# userName object should have value
ProcessPropertyPlaceholders -armResource $armResource -templateContentConnections $templateContentConnections -isOnlyObjectCheck $true -propertyObject $armResource.properties.auth.userName -propertyName 'value' -isInnerObject $true -innerObjectName 'userName' -kindType $kindType -isSecret $false -isRequired $true -minLength 4

# password object check
ProcessPropertyPlaceholders -armResource $armResource -templateContentConnections $templateContentConnections -isOnlyObjectCheck $true -propertyObject $armResource.properties.auth -propertyName 'password' -isInnerObject $true -innerObjectName 'auth' -kindType $kindType -isSecret $true -isRequired $true -minLength 4

# password object should have key
ProcessPropertyPlaceholders -armResource $armResource -templateContentConnections $templateContentConnections -isOnlyObjectCheck $true -propertyObject $armResource.properties.auth.password -propertyName 'key' -isInnerObject $true -innerObjectName 'password' -kindType $kindType -isSecret $false -isRequired $true -minLength 4

# password object should have value
ProcessPropertyPlaceholders -armResource $armResource -templateContentConnections $templateContentConnections -isOnlyObjectCheck $true -propertyObject $armResource.properties.auth.password -propertyName 'value' -isInnerObject $true -innerObjectName 'password' -kindType $kindType -isSecret $true -isRequired $true -minLength 4
}
else
{
Write-Host "Error: For kind RestApiPoller, Data Connector Poller file should have 'auth' object with 'type' attribute having value either 'Basic', 'OAuth2', 'APIKey' or 'JwtToken'" -BackgroundColor Red
Write-Host "Error: For kind RestApiPoller, Data Connector Poller file should have 'auth' object with 'type' attribute having value either 'Basic', 'OAuth2' or 'APIKey'." -BackgroundColor Red
exit 1;
}

Expand Down Expand Up @@ -496,16 +476,6 @@ function ProcessPropertyPlaceholders($armResource, $templateContentConnections,
}
}

function ProcessPropertyPlaceholders1($armResource, $templateContentConnections, $propertyName, $isSecret, $minLength = 1)
{
$placeHoldersMatched = $armResource.properties.$($propertyName) | Select-String $placeHolderPatternMatches -AllMatches
if ($placeHoldersMatched.Matches.Value.Count -gt 0) {
$placeHolderName = $placeHoldersMatched.Matches.Value.replace("{{", "").replace("}}", "")
$armResource.properties.dcrConfig.streamName = "[[parameters('$($placeHolderName)')]"
$templateContentConnections.properties.mainTemplate = addNewParameter -templateResourceObj $templateContentConnections.properties.mainTemplate -parameterName $placeHolderName -isSecret $isSecret -minLength $minLength
}
}

# THIS IS THE STARTUP FUNCTION FOR CCP RESOURCE CREATOR
function createCCPConnectorResources($contentResourceDetails, $dataFileMetadata, $solutionFileMetadata, $dcFolderName, $ccpDict, $solutionBasePath, $solutionName, $ccpTables, $ccpTablesCounter) {
Write-Host "Inside of CCP Connector Code!"
Expand Down

0 comments on commit 4325973

Please sign in to comment.