|
|
@@ -41,27 +41,20 @@ var (
|
|
|
ErrKeyExists = errors.New("client: key already exists")
|
|
|
)
|
|
|
|
|
|
-func NewKeysAPI(tr *http.Transport, eps []string, to time.Duration) (KeysAPI, error) {
|
|
|
- return newHTTPKeysAPIWithPrefix(tr, eps, to, DefaultV2KeysPrefix)
|
|
|
-}
|
|
|
-
|
|
|
-func NewDiscoveryKeysAPI(tr *http.Transport, eps []string, to time.Duration) (KeysAPI, error) {
|
|
|
- return newHTTPKeysAPIWithPrefix(tr, eps, to, "")
|
|
|
-}
|
|
|
-
|
|
|
-func newHTTPKeysAPIWithPrefix(tr *http.Transport, eps []string, to time.Duration, prefix string) (*httpKeysAPI, error) {
|
|
|
- c, err := NewHTTPClient(tr, eps)
|
|
|
- if err != nil {
|
|
|
- return nil, err
|
|
|
+func NewKeysAPI(c httpActionDo, to time.Duration) KeysAPI {
|
|
|
+ return &httpKeysAPI{
|
|
|
+ client: c,
|
|
|
+ prefix: DefaultV2KeysPrefix,
|
|
|
+ timeout: to,
|
|
|
}
|
|
|
+}
|
|
|
|
|
|
- kAPI := httpKeysAPI{
|
|
|
+func NewDiscoveryKeysAPI(c httpActionDo, to time.Duration) KeysAPI {
|
|
|
+ return &httpKeysAPI{
|
|
|
client: c,
|
|
|
- prefix: prefix,
|
|
|
+ prefix: "",
|
|
|
timeout: to,
|
|
|
}
|
|
|
-
|
|
|
- return &kAPI, nil
|
|
|
}
|
|
|
|
|
|
type KeysAPI interface {
|