Skip to content

Commit

Permalink
preserve parameter types returned from cloudtruth api, update openapi
Browse files Browse the repository at this point in the history
  • Loading branch information
wr0ngway committed Sep 22, 2021
1 parent a055741 commit 865f16f
Show file tree
Hide file tree
Showing 22 changed files with 6,664 additions and 1,893 deletions.
14 changes: 13 additions & 1 deletion lib/kubetruth/ctapi.rb
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,19 @@ def parameters(project:, environment: "default")
result&.results&.collect do |param|
# values is keyed by url, but we forced it to only have a single entry
# for the supplied environment
Kubetruth::Parameter.new(key: param.name, value: param.values.values.first&.value, secret: param.secret)
# preserve types so we can generate accurate structured data vs using typify filter
value = param.values.values.first&.value
if ! value.nil?
case param.type
when CloudtruthClient::ParameterTypeEnum::BOOL
value = (value == "true")
when CloudtruthClient::ParameterTypeEnum::INTEGER
value = value.to_i
else
value = value.to_s
end
end
Kubetruth::Parameter.new(key: param.name, value: value, secret: param.secret)
end
end

Expand Down
Loading

0 comments on commit 865f16f

Please sign in to comment.