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

Method AddGuestOs

cloudstack/GuestOSService.go:208–240  ·  view source on GitHub ↗

Add a new guest OS type

(p *AddGuestOsParams)

Source from the content-addressed store, hash-verified

206
207// Add a new guest OS type
208func (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
242type AddGuestOsResponse struct {
243 Description string `json:"description"`

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