MCPcopy Index your code
hub / github.com/apache/cloudstack-go / DestroySystemVm

Method DestroySystemVm

cloudstack/SystemVMService.go:261–293  ·  view source on GitHub ↗

Destroys a system virtual machine.

(p *DestroySystemVmParams)

Source from the content-addressed store, hash-verified

259
260// Destroys a system virtual machine.
261func (s *SystemVMService) DestroySystemVm(p *DestroySystemVmParams) (*DestroySystemVmResponse, error) {
262 resp, err := s.cs.newPostRequest("destroySystemVm", p.toURLValues())
263 if err != nil {
264 return nil, err
265 }
266
267 var r DestroySystemVmResponse
268 if err := json.Unmarshal(resp, &r); err != nil {
269 return nil, err
270 }
271
272 // If we have a async client, we need to wait for the async result
273 if s.cs.async {
274 b, err := s.cs.GetAsyncJobResult(r.JobID, s.cs.timeout)
275 if err != nil {
276 if err == AsyncTimeoutErr {
277 return &r, err
278 }
279 return nil, err
280 }
281
282 b, err = getRawValue(b)
283 if err != nil {
284 return nil, err
285 }
286
287 if err := json.Unmarshal(b, &r); err != nil {
288 return nil, err
289 }
290 }
291
292 return &r, nil
293}
294
295type DestroySystemVmResponse struct {
296 Activeviewersessions int `json:"activeviewersessions"`

Callers

nothing calls this directly

Calls 4

newPostRequestMethod · 0.80
GetAsyncJobResultMethod · 0.80
getRawValueFunction · 0.70
toURLValuesMethod · 0.45

Tested by

no test coverage detected