@@ -394,18 +394,24 @@ func (certCache *Cache) AllMatchingCertificates(name string) []Certificate {
394
394
return certs
395
395
}
396
396
397
+ // SubjectIssuer pairs a subject name with an issuer ID/key.
398
+ type SubjectIssuer struct {
399
+ Subject , IssuerKey string
400
+ }
401
+
397
402
// RemoveManaged removes managed certificates for the given subjects from the cache.
398
- // This effectively stops maintenance of those certificates. Optionally pass an issuer
399
- // key to remove only certs managed with a certain issuer.
400
- func (certCache * Cache ) RemoveManaged (subjects []string , issuerKey string ) {
403
+ // This effectively stops maintenance of those certificates. If an IssuerKey is
404
+ // specified alongside the subject, only certificates for that subject from the
405
+ // specified issuer will be removed.
406
+ func (certCache * Cache ) RemoveManaged (subjects []SubjectIssuer ) {
401
407
deleteQueue := make ([]string , 0 , len (subjects ))
402
- for _ , subject := range subjects {
403
- certs := certCache .getAllMatchingCerts (subject ) // does NOT expand wildcards; exact matches only
408
+ for _ , subj := range subjects {
409
+ certs := certCache .getAllMatchingCerts (subj . Subject ) // does NOT expand wildcards; exact matches only
404
410
for _ , cert := range certs {
405
411
if ! cert .managed {
406
412
continue
407
413
}
408
- if issuerKey == "" || cert .issuerKey == issuerKey {
414
+ if subj . IssuerKey == "" || cert .issuerKey == subj . IssuerKey {
409
415
deleteQueue = append (deleteQueue , cert .hash )
410
416
}
411
417
}
0 commit comments