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

Method AttachIso

cloudstack/ISOService.go:155–187  ·  view source on GitHub ↗

Attaches an ISO to a virtual machine.

(p *AttachIsoParams)

Source from the content-addressed store, hash-verified

153
154// Attaches an ISO to a virtual machine.
155func (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
189type AttachIsoResponse struct {
190 Account string `json:"account"`

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