@@ -229,20 +229,20 @@ func (c *Client) EnrollCSR(ea *EnrollCSRFctArgs) (*EnrollResponse, error) {
229229// Required fields to revoke a list of certificates in Keyfactor are:
230230// - CertificateIds : []int
231231// - Comment : string
232- func (c * Client ) RevokeCert (ra * RevokeCertArgs ) error {
232+ func (c * Client ) RevokeCert (rvargs * RevokeCertArgs ) error {
233233 log .Println ("[INFO] Revoking certificates" )
234- for _ , certs := range ra .CertificateIds {
234+ for _ , certs := range rvargs .CertificateIds {
235235 log .Printf ("[TRACE] Revoking ID %d" , certs )
236236 }
237237
238238 // Fields required by revoke cert API request are cert ID & comment
239239 // Go initializes integers to 0, check for zero input
240- if (ra .CertificateIds [0 ] == 0 ) && (ra .Comment == "" ) {
240+ if (rvargs .CertificateIds [0 ] == 0 ) && (rvargs .Comment == "" ) {
241241 return errors .New ("invalid or nonexistent values required for certificate revocation" )
242242 }
243243
244- if ra .EffectiveDate ! = "" {
245- ra .EffectiveDate = getTimestamp ()
244+ if rvargs .EffectiveDate = = "" {
245+ rvargs .EffectiveDate = getTimestamp ()
246246 }
247247
248248 // Set Keyfactor-specific headers
@@ -257,15 +257,15 @@ func (c *Client) RevokeCert(ra *RevokeCertArgs) error {
257257 Method : "POST" ,
258258 Endpoint : "Certificates/Revoke" ,
259259 Headers : headers ,
260- Payload : & ra ,
260+ Payload : & rvargs ,
261261 }
262262
263263 resp , err := c .sendRequest (keyfactorAPIStruct )
264264 if err != nil {
265265 return err
266266 }
267267
268- if resp .StatusCode != http .StatusNoContent {
268+ if resp .StatusCode != http .StatusNoContent && resp . StatusCode != http . StatusOK {
269269 return fmt .Errorf ("[ERROR] Something unexpected happened, %s call to %s returned status %d" , keyfactorAPIStruct .Method , keyfactorAPIStruct .Endpoint , resp .StatusCode )
270270 }
271271 return nil
0 commit comments