Issues a client certificate using configured or provided CA plugin
(p *IssueCertificateParams)
| 194 | |
| 195 | // Issues a client certificate using configured or provided CA plugin |
| 196 | func (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 | |
| 230 | type IssueCertificateResponse struct { |
| 231 | Cacertificates string `json:"cacertificates"` |
nothing calls this directly
no test coverage detected