41 lines
711 B
Go
41 lines
711 B
Go
package certmanager
|
|
|
|
import (
|
|
"k8s.io/client-go/dynamic"
|
|
)
|
|
|
|
type Client struct {
|
|
crdClient dynamic.DynamicClient
|
|
certIssuerName string
|
|
certIssuerKind string
|
|
|
|
Certificates certificateClient
|
|
}
|
|
|
|
type ClientOption func(*Client)
|
|
|
|
func WithCertIssuerName(name string) ClientOption {
|
|
return func(c *Client) {
|
|
c.certIssuerName = name
|
|
}
|
|
}
|
|
|
|
func WithCertIssuerKind(kind string) ClientOption {
|
|
return func(c *Client) {
|
|
c.certIssuerKind = kind
|
|
}
|
|
}
|
|
|
|
func NewClient(crdClient dynamic.DynamicClient, options ...ClientOption) *Client {
|
|
client := &Client{
|
|
crdClient: crdClient,
|
|
}
|
|
|
|
for _, option := range options {
|
|
option(client)
|
|
}
|
|
|
|
client.Certificates = newCertificateClient(client)
|
|
|
|
return client
|
|
}
|