Functions/Private/DiscoverArtifacts.ps1

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
function DiscoverArtifacts {

    <#
    .SYNOPSIS
    Performs discovery of artifacts specified by user
 
     .PARAMETER Artifact
    This specifies which artifact/s that you are looking to discover
 
    .PARAMETER OutputPath
    This specifies where you want to output discovered items to.
 
    .PARAMETER ArtifactParam
    This is used for passing parameters to the resulting Generate functions.
    #>

    [CmdletBinding()]
    param (
        [Parameter(Mandatory = $true)]
        [string[]] $Artifact,

        [Parameter(Mandatory = $true)]
        [string] $OutputPath,

        [Parameter(Mandatory = $false)]
        [string[]] $ArtifactParam
    )

    ### Perform discovery of artifacts
    
    if (!$ArtifactParam) {
        foreach ($item in $Artifact) {
        & "Discover_$item" -OutputPath $OutputPath -MountPath $Mount.Path
        }
    }
    else {
        foreach ($item in $Artifact) {
        & "Discover_$item" -OutputPath $OutputPath -MountPath $Mount.Path -ArtifactParam $ArtifactParam
        }
    }

}