@@ -181,7 +181,7 @@ type ServerStorageDevice struct {
181181type StorageImportDetails struct {
182182 ClientContentLength int `json:"client_content_length"`
183183 ClientContentType string `json:"client_content_type"`
184- Completed string `json:"completed"`
184+ Completed time. Time `json:"completed"`
185185 Created time.Time `json:"created"`
186186 DirectUploadURL string `json:"direct_upload_url"`
187187 ErrorCode string `json:"error_code"`
@@ -190,6 +190,7 @@ type StorageImportDetails struct {
190190 ReadBytes int `json:"read_bytes"`
191191 SHA256Sum string `json:"sha256sum"`
192192 Source string `json:"source"`
193+ SourceLocation string `json:"source_location"`
193194 State string `json:"state"`
194195 UUID string `json:"uuid"`
195196 WrittenBytes int `json:"written_bytes"`
@@ -199,16 +200,25 @@ type StorageImportDetails struct {
199200// deeply embedded values.
200201func (s * StorageImportDetails ) UnmarshalJSON (b []byte ) error {
201202 type localStorageImport StorageImportDetails
202-
203203 v := struct {
204- StorageImport localStorageImport `json:"storage_import"`
204+ StorageImport struct {
205+ localStorageImport
206+ Completed string `json:"completed"`
207+ } `json:"storage_import"`
205208 }{}
206209 err := json .Unmarshal (b , & v )
207210 if err != nil {
208211 return err
209212 }
210213
211- (* s ) = StorageImportDetails (v .StorageImport )
214+ if v .StorageImport .Completed != "" {
215+ tv , err := time .Parse (time .RFC3339 , v .StorageImport .Completed )
216+ if err != nil {
217+ return err
218+ }
219+ v .StorageImport .localStorageImport .Completed = tv
220+ }
221+ * s = StorageImportDetails (v .StorageImport .localStorageImport )
212222
213223 return nil
214224}
0 commit comments