MCPcopy Create free account
hub / github.com/apache/cloudstack-go / AddIpToNic

Method AddIpToNic

cloudstack/NicService.go:109–141  ·  view source on GitHub ↗

Assigns secondary IP to NIC

(p *AddIpToNicParams)

Source from the content-addressed store, hash-verified

107
108// Assigns secondary IP to NIC
109func (s *NicService) AddIpToNic(p *AddIpToNicParams) (*AddIpToNicResponse, error) {
110 resp, err := s.cs.newPostRequest("addIpToNic", p.toURLValues())
111 if err != nil {
112 return nil, err
113 }
114
115 var r AddIpToNicResponse
116 if err := json.Unmarshal(resp, &r); err != nil {
117 return nil, err
118 }
119
120 // If we have a async client, we need to wait for the async result
121 if s.cs.async {
122 b, err := s.cs.GetAsyncJobResult(r.JobID, s.cs.timeout)
123 if err != nil {
124 if err == AsyncTimeoutErr {
125 return &r, err
126 }
127 return nil, err
128 }
129
130 b, err = getRawValue(b)
131 if err != nil {
132 return nil, err
133 }
134
135 if err := json.Unmarshal(b, &r); err != nil {
136 return nil, err
137 }
138 }
139
140 return &r, nil
141}
142
143type AddIpToNicResponse struct {
144 Id string `json:"id"`

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