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

Method IssueCertificate

cloudstack/CertificateService.go:196–228  ·  view source on GitHub ↗

Issues a client certificate using configured or provided CA plugin

(p *IssueCertificateParams)

Source from the content-addressed store, hash-verified

194
195// Issues a client certificate using configured or provided CA plugin
196func (s *CertificateService) IssueCertificate(p *IssueCertificateParams) (*IssueCertificateResponse, error) {
197 resp, err := s.cs.newPostRequest("issueCertificate", p.toURLValues())
198 if err != nil {
199 return nil, err
200 }
201
202 var r IssueCertificateResponse
203 if err := json.Unmarshal(resp, &r); err != nil {
204 return nil, err
205 }
206
207 // If we have a async client, we need to wait for the async result
208 if s.cs.async {
209 b, err := s.cs.GetAsyncJobResult(r.JobID, s.cs.timeout)
210 if err != nil {
211 if err == AsyncTimeoutErr {
212 return &r, err
213 }
214 return nil, err
215 }
216
217 b, err = getRawValue(b)
218 if err != nil {
219 return nil, err
220 }
221
222 if err := json.Unmarshal(b, &r); err != nil {
223 return nil, err
224 }
225 }
226
227 return &r, nil
228}
229
230type IssueCertificateResponse struct {
231 Cacertificates string `json:"cacertificates"`

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