Skip to content

Generating multiple files with custom values #1037

Answered by HT154
jlaberge-league asked this question in Q&A
Discussion options

You must be logged in to vote

Gotcha, iterating on this a little more:

// this should be a Mapping<String, SLO>, so you have keys instead of properties
// this is preferable to a Dynamic or even some Typed class as you can enforce Mapping values are SLO instances
slos {
    ["slo1"]  {
        objective = targets.availability
    }
}

output {
    files {
        default {
            renderer = new YamlRenderer {}
        }
        for (sloName, sloSpec in slos) {
            ["base/slos/\(appName)-\(sloName).yaml"] {
                value = new Dynamic { // push the "presentation logic" of how the file gets rendered down into the output config and out of the module schema
                    service = sloName
      …

Replies: 1 comment 10 replies

Comment options

You must be logged in to vote
10 replies
@HT154
Comment options

HT154 Apr 7, 2025
Collaborator

@jlaberge-league
Comment options

@jlaberge-league
Comment options

@HT154
Comment options

HT154 Apr 7, 2025
Collaborator

Answer selected by jlaberge-league
@jlaberge-league
Comment options

@HT154
Comment options

HT154 Apr 8, 2025
Collaborator

@jlaberge-league
Comment options

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants