add Discover method to interface

Signed-off-by: Daniel Morsing <dmo@jetstack.io>
This commit is contained in:
Daniel Morsing 2019-02-05 09:27:12 +00:00
parent 7a8f5be106
commit 4db43bf04c
3 changed files with 14 additions and 0 deletions

View File

@ -41,6 +41,7 @@ type FakeACME struct {
FakeGetAccount func(ctx context.Context) (*acme.Account, error)
FakeHTTP01ChallengeResponse func(token string) (string, error)
FakeDNS01ChallengeRecord func(token string) (string, error)
FakeDiscover func(ctx context.Context) (acme.Directory, error)
}
func (f *FakeACME) CreateOrder(ctx context.Context, order *acme.Order) (*acme.Order, error) {
@ -133,3 +134,10 @@ func (f *FakeACME) DNS01ChallengeRecord(token string) (string, error) {
}
return "", fmt.Errorf("DNS01ChallengeRecord not implemented")
}
func (f *FakeACME) Discover(ctx context.Context) (acme.Directory, error) {
if f.FakeDiscover != nil {
return f.FakeDiscover(ctx)
}
return acme.Directory{}, fmt.Errorf("Discover not implemented")
}

View File

@ -36,6 +36,7 @@ type Interface interface {
GetAccount(ctx context.Context) (*acme.Account, error)
HTTP01ChallengeResponse(token string) (string, error)
DNS01ChallengeRecord(token string) (string, error)
Discover(ctx context.Context) (acme.Directory, error)
}
var _ Interface = &acme.Client{}

View File

@ -98,3 +98,8 @@ func (l *Logger) DNS01ChallengeRecord(token string) (string, error) {
glog.Infof("Calling DNS01ChallengeRecord")
return l.baseCl.DNS01ChallengeRecord(token)
}
func (l *Logger) Discover(ctx context.Context) (acme.Directory, error) {
glog.Infof("Calling Discover")
return l.baseCl.Discover(ctx)
}