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

Method DetachIso

cloudstack/ISOService.go:789–821  ·  view source on GitHub ↗

Detaches any ISO file (if any) currently attached to a virtual machine.

(p *DetachIsoParams)

Source from the content-addressed store, hash-verified

787
788// Detaches any ISO file (if any) currently attached to a virtual machine.
789func (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
823type DetachIsoResponse struct {
824 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