vault/sdk/logical/pki_cert_count_system_view.go
Vault Automation a24046a0b4
Increment certificate counts in all PKI backends (#9693) (#9721)
Increment certificate counts in all PKI backends.

Ensure that the PkiCertificateCounter is invoked every time we store and
issue a certificate by any of the PKI backends.

Co-authored-by: Victor Rodriguez <vrizo@hashicorp.com>
Co-authored-by: Steven Clark <steven.clark@hashicorp.com>
2025-09-29 15:33:00 -04:00

34 lines
975 B
Go

// Copyright (c) HashiCorp, Inc.
// SPDX-License-Identifier: MPL-2.0
package logical
// PkiCertificateCounter is an interface for incrementing the count of issued and stored
// PKI certificates.
type PkiCertificateCounter interface {
// IncrementCount increments the count of issued and stored certificates.
IncrementCount(issuedCerts, storedCerts uint64)
// AddIssuedCertificate increments the issued certificate count by 1, and also the
// stored certificate count if stored is true.
AddIssuedCertificate(stored bool)
}
type PkiCertificateCountSystemView interface {
GetPkiCertificateCounter() PkiCertificateCounter
}
type nullPkiCertificateCounter struct{}
func (n *nullPkiCertificateCounter) IncrementCount(_, _ uint64) {
}
func (n *nullPkiCertificateCounter) AddIssuedCertificate(_ bool) {
}
var _ PkiCertificateCounter = (*nullPkiCertificateCounter)(nil)
func NewNullPkiCertificateCounter() PkiCertificateCounter {
return &nullPkiCertificateCounter{}
}