github.com/graywolf-at-work-2/terraform-vendor@v1.4.5/internal/command/jsonchecks/status.go (about) 1 package jsonchecks 2 3 import ( 4 "fmt" 5 6 "github.com/hashicorp/terraform/internal/checks" 7 ) 8 9 type checkStatus []byte 10 11 func checkStatusForJSON(s checks.Status) checkStatus { 12 if ret, ok := checkStatuses[s]; ok { 13 return ret 14 } 15 panic(fmt.Sprintf("unsupported check status %#v", s)) 16 } 17 18 func (s checkStatus) MarshalJSON() ([]byte, error) { 19 return []byte(s), nil 20 } 21 22 var checkStatuses = map[checks.Status]checkStatus{ 23 checks.StatusPass: checkStatus(`"pass"`), 24 checks.StatusFail: checkStatus(`"fail"`), 25 checks.StatusError: checkStatus(`"error"`), 26 checks.StatusUnknown: checkStatus(`"unknown"`), 27 }