Detaches any ISO file (if any) currently attached to a virtual machine.
(p *DetachIsoParams)
| 787 | |
| 788 | // Detaches any ISO file (if any) currently attached to a virtual machine. |
| 789 | func (s *ISOService) DetachIso(p *DetachIsoParams) (*DetachIsoResponse, error) { |
| 790 | resp, err := s.cs.newPostRequest("detachIso", p.toURLValues()) |
| 791 | if err != nil { |
| 792 | return nil, err |
| 793 | } |
| 794 | |
| 795 | var r DetachIsoResponse |
| 796 | if err := json.Unmarshal(resp, &r); err != nil { |
| 797 | return nil, err |
| 798 | } |
| 799 | |
| 800 | // If we have a async client, we need to wait for the async result |
| 801 | if s.cs.async { |
| 802 | b, err := s.cs.GetAsyncJobResult(r.JobID, s.cs.timeout) |
| 803 | if err != nil { |
| 804 | if err == AsyncTimeoutErr { |
| 805 | return &r, err |
| 806 | } |
| 807 | return nil, err |
| 808 | } |
| 809 | |
| 810 | b, err = getRawValue(b) |
| 811 | if err != nil { |
| 812 | return nil, err |
| 813 | } |
| 814 | |
| 815 | if err := json.Unmarshal(b, &r); err != nil { |
| 816 | return nil, err |
| 817 | } |
| 818 | } |
| 819 | |
| 820 | return &r, nil |
| 821 | } |
| 822 | |
| 823 | type DetachIsoResponse struct { |
| 824 | Account string `json:"account"` |
nothing calls this directly
no test coverage detected