Attaches an ISO to a virtual machine.
(p *AttachIsoParams)
| 153 | |
| 154 | // Attaches an ISO to a virtual machine. |
| 155 | func (s *ISOService) AttachIso(p *AttachIsoParams) (*AttachIsoResponse, error) { |
| 156 | resp, err := s.cs.newPostRequest("attachIso", p.toURLValues()) |
| 157 | if err != nil { |
| 158 | return nil, err |
| 159 | } |
| 160 | |
| 161 | var r AttachIsoResponse |
| 162 | if err := json.Unmarshal(resp, &r); err != nil { |
| 163 | return nil, err |
| 164 | } |
| 165 | |
| 166 | // If we have a async client, we need to wait for the async result |
| 167 | if s.cs.async { |
| 168 | b, err := s.cs.GetAsyncJobResult(r.JobID, s.cs.timeout) |
| 169 | if err != nil { |
| 170 | if err == AsyncTimeoutErr { |
| 171 | return &r, err |
| 172 | } |
| 173 | return nil, err |
| 174 | } |
| 175 | |
| 176 | b, err = getRawValue(b) |
| 177 | if err != nil { |
| 178 | return nil, err |
| 179 | } |
| 180 | |
| 181 | if err := json.Unmarshal(b, &r); err != nil { |
| 182 | return nil, err |
| 183 | } |
| 184 | } |
| 185 | |
| 186 | return &r, nil |
| 187 | } |
| 188 | |
| 189 | type AttachIsoResponse struct { |
| 190 | Account string `json:"account"` |
nothing calls this directly
no test coverage detected