github.com/emate/packer@v0.8.1-0.20150625195101-fe0fde195dc6/builder/googlecompute/account.go (about) 1 package googlecompute 2 3 import ( 4 "encoding/json" 5 "os" 6 ) 7 8 // accountFile represents the structure of the account file JSON file. 9 type accountFile struct { 10 PrivateKeyId string `json:"private_key_id"` 11 PrivateKey string `json:"private_key"` 12 ClientEmail string `json:"client_email"` 13 ClientId string `json:"client_id"` 14 } 15 16 func loadJSON(result interface{}, path string) error { 17 f, err := os.Open(path) 18 if err != nil { 19 return err 20 } 21 defer f.Close() 22 23 dec := json.NewDecoder(f) 24 return dec.Decode(result) 25 }