Update query complete message to a struct (#37395)

pull/37398/head
Daniel Banck 9 months ago committed by GitHub
parent ac015cb36b
commit dcb0486c44
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

@ -263,10 +263,11 @@ func (h *jsonHook) PostListQuery(id terraform.HookResourceIdentity, results plan
json.MessageListResourceFound, result,
)
}
h.view.log.Info(
fmt.Sprintf("%s: List complete", addr.String()),
"type", json.MessageListComplete,
"total", data.LengthInt(),
json.MessageListComplete, json.NewQueryComplete(addr, data.LengthInt()),
)
return terraform.HookActionContinue, nil
}

@ -28,6 +28,12 @@ type QueryResult struct {
ImportConfig string `json:"import_config,omitempty"`
}
type QueryComplete struct {
Address string `json:"address"`
ResourceType string `json:"resource_type"`
Total int `json:"total"`
}
func NewQueryStart(addr addrs.AbsResourceInstance, input_config cty.Value) QueryStart {
return QueryStart{
Address: addr.String(),
@ -54,6 +60,14 @@ func NewQueryResult(listAddr addrs.AbsResourceInstance, value cty.Value, generat
return result
}
func NewQueryComplete(addr addrs.AbsResourceInstance, total int) QueryComplete {
return QueryComplete{
Address: addr.String(),
ResourceType: addr.Resource.Resource.Type,
Total: total,
}
}
func marshalValues(value cty.Value) map[string]json.RawMessage {
if value == cty.NilVal || value.IsNull() {
return nil

Loading…
Cancel
Save