InputsToProps converts a resource's inputs to a flat string map for display.
(record resources.ResourceRecord)
| 122 | |
| 123 | // InputsToProps converts a resource's inputs to a flat string map for display. |
| 124 | func InputsToProps(record resources.ResourceRecord) map[string]string { |
| 125 | props := map[string]string{ |
| 126 | "type": record.Type, |
| 127 | } |
| 128 | for k, v := range record.Inputs { |
| 129 | key := string(k) |
| 130 | if v.IsString() { |
| 131 | props[key] = v.StringValue() |
| 132 | } else if v.IsNumber() { |
| 133 | props[key] = fmt.Sprintf("%g", v.NumberValue()) |
| 134 | } else if v.IsBool() { |
| 135 | if v.BoolValue() { |
| 136 | props[key] = "true" |
| 137 | } else { |
| 138 | props[key] = "false" |
| 139 | } |
| 140 | } |
| 141 | } |
| 142 | return props |
| 143 | } |
| 144 | |
| 145 | // DecodeFreeResource creates a no-pricing DecodedResource for free resource types. |
| 146 | func DecodeFreeResource(record resources.ResourceRecord) resources.DecodedResource { |
nothing calls this directly
no outgoing calls
no test coverage detected