Skip to content

Manipulating map keys on arrays #529

Discussion options

You must be logged in to vote

Just for reference, this is what ended up working for me 🙂
thanks for the community!

#@ load("@ytt:data", "data")
#@ load("@ytt:overlay", "overlay")
#@ load("@ytt:template", "template")

#@ def path_to_key(name, metric):
#@   return name.replace("/", "_") + "_" + metric
#@ end

config:
#@ for method in data.values.request_methods:
#@   for metric in data.values.request_methods[method]:
#@yaml/text-templated-strings
- REQUEST_RT_SLO(@= path_to_key(method, metric) @): #@ "REQUEST_RT_SLO_" + metric + ".json"
#@   end
#@ end

#@ def additions(method):
#@overlay/match expects=0
REQUEST_NAME: #@ method
#@ end

#@ for method in data.values.request_methods:
#@   for metric in data.values.request_…

Replies: 5 comments 4 replies

Comment options

You must be logged in to vote
2 replies
@mtrin-wooliesx
Comment options

@pivotaljohn
Comment options

Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
2 replies
@pivotaljohn
Comment options

@pivotaljohn
Comment options

Answer selected by mtrin-wooliesx
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