func WithRetryDelay(d string) Option {
	return func(pol *policyd) error {
		if d == "" {
			return nil
		}
		rd, err := time.ParseDuration(d)
		if err != nil {
			return errors.Wrap(err, "invalid retry delay")
		}
		pol.retryDelay = rd
		return nil
	}
}
WithRetryDelay returns an RetryDelay functional option
package policy
import (
	"net/http"
	"time"
	"github.com/pkg/errors"
	urlutil "github.com/yahoojapan/athenz-authorizer/v5/internal/url"
	"github.com/yahoojapan/athenz-authorizer/v5/pubkey"
)
var (
	defaultOptions = []Option{
		WithExpiryMargin("3h"),
		WithRefreshPeriod("30m"),
		WithPurgePeriod("1h"),
		WithRetryDelay("1m"),
		WithRetryAttempts(2),
		WithHTTPClient(http.DefaultClient),
	}
)
type Option func(*policyd) error
func WithPubKeyProvider(pkp pubkey.Provider) Option {
	return func(pol *policyd) error {
		if pkp != nil {
			pol.pkp = pkp
		}
		return nil
	}
}
func WithAthenzURL(url string) Option {
	return func(pol *policyd) error {
		u := urlutil.TrimHTTPScheme(url)
		if urlutil.HasScheme(u) {
			return urlutil.ErrUnsupportedScheme
		}
		pol.athenzURL = u
		return nil
	}
}
func WithAthenzDomains(doms ...string) Option {
	return func(pol *policyd) error {
		if doms == nil {
			return nil
		}
		pol.athenzDomains = doms
		return nil
	}
}
func WithExpiryMargin(d string) Option {
	return func(pol *policyd) error {
		if d == "" {
			return nil
		}
		em, err := time.ParseDuration(d)
		if err != nil {
			return errors.Wrap(err, "invalid expiry margin")
		}
		pol.expiryMargin = em
		return nil
	}
}
func WithRefreshPeriod(d string) Option {
	return func(pol *policyd) error {
		if d == "" {
			return nil
		}
		rp, err := time.ParseDuration(d)
		if err != nil {
			return errors.Wrap(err, "invalid refresh period")
		}
		pol.refreshPeriod = rp
		return nil
	}
}
func WithPurgePeriod(d string) Option {
	return func(pol *policyd) error {
		if d == "" {
			return nil
		}
		pp, err := time.ParseDuration(d)
		if err != nil {
			return errors.Wrap(err, "invalid purge period")
		}
		pol.purgePeriod = pp
		return nil
	}
}