private async readParameterHierarchy()

in src/tasks/SystemsManagerGetParameter/TaskOperations.ts [59:95]


    private async readParameterHierarchy(): Promise<void> {
        // do the path name prefixing as a convenience if the user failed to supply it
        let finalParameterPath: string
        if (this.taskParameters.parameterPath.startsWith('/')) {
            finalParameterPath = this.taskParameters.parameterPath
        } else {
            finalParameterPath = '/' + this.taskParameters.parameterPath
        }

        console.log(tl.loc('ReadingParameterHierarchy', finalParameterPath, this.taskParameters.recursive))

        let nextToken: string | undefined
        do {
            const response = await this.ssmClient
                .getParametersByPath({
                    Path: finalParameterPath,
                    Recursive: this.taskParameters.recursive,
                    WithDecryption: true,
                    NextToken: nextToken
                })
                .promise()

            if (!response.Parameters) {
                tl.error(tl.loc('ErrorParametersEmpty'))
                break
            }

            nextToken = response.NextToken
            for (const p of response.Parameters) {
                const outputVariableName = transformParameterToVariableName(this.taskParameters, p.Name)
                const isSecret = p.Type === 'SecureString'
                console.log(tl.loc('SettingVariable', outputVariableName, p.Name, isSecret))

                tl.setVariable(outputVariableName, `${p.Value}`, isSecret)
            }
        } while (nextToken)
    }