Add a new guest OS type
(p *AddGuestOsParams)
| 206 | |
| 207 | // Add a new guest OS type |
| 208 | func (s *GuestOSService) AddGuestOs(p *AddGuestOsParams) (*AddGuestOsResponse, error) { |
| 209 | resp, err := s.cs.newPostRequest("addGuestOs", p.toURLValues()) |
| 210 | if err != nil { |
| 211 | return nil, err |
| 212 | } |
| 213 | |
| 214 | var r AddGuestOsResponse |
| 215 | if err := json.Unmarshal(resp, &r); err != nil { |
| 216 | return nil, err |
| 217 | } |
| 218 | |
| 219 | // If we have a async client, we need to wait for the async result |
| 220 | if s.cs.async { |
| 221 | b, err := s.cs.GetAsyncJobResult(r.JobID, s.cs.timeout) |
| 222 | if err != nil { |
| 223 | if err == AsyncTimeoutErr { |
| 224 | return &r, err |
| 225 | } |
| 226 | return nil, err |
| 227 | } |
| 228 | |
| 229 | b, err = getRawValue(b) |
| 230 | if err != nil { |
| 231 | return nil, err |
| 232 | } |
| 233 | |
| 234 | if err := json.Unmarshal(b, &r); err != nil { |
| 235 | return nil, err |
| 236 | } |
| 237 | } |
| 238 | |
| 239 | return &r, nil |
| 240 | } |
| 241 | |
| 242 | type AddGuestOsResponse struct { |
| 243 | Description string `json:"description"` |
nothing calls this directly
no test coverage detected