mirror of
https://github.com/external-secrets/external-secrets.git
synced 2024-12-15 17:51:01 +00:00
1cf7c3a6e3
Signed-off-by: Gustavo Carvalho <gusfcarvalho@gmail.com>
55 lines
1.6 KiB
Go
55 lines
1.6 KiB
Go
/*
|
|
Licensed under the Apache License, Version 2.0 (the "License");
|
|
you may not use this file except in compliance with the License.
|
|
You may obtain a copy of the License at
|
|
|
|
http://www.apache.org/licenses/LICENSE-2.0
|
|
|
|
Unless required by applicable law or agreed to in writing, software
|
|
distributed under the License is distributed on an "AS IS" BASIS,
|
|
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
See the License for the specific language governing permissions and
|
|
limitations under the License.
|
|
*/
|
|
package fake
|
|
|
|
import (
|
|
"fmt"
|
|
"net/url"
|
|
|
|
"github.com/google/go-cmp/cmp"
|
|
|
|
"github.com/external-secrets/external-secrets/pkg/provider/doppler/client"
|
|
)
|
|
|
|
type DopplerClient struct {
|
|
getSecret func(request client.SecretRequest) (*client.SecretResponse, error)
|
|
}
|
|
|
|
func (dc *DopplerClient) BaseURL() *url.URL {
|
|
return &url.URL{Scheme: "https", Host: "api.doppler.com"}
|
|
}
|
|
|
|
func (dc *DopplerClient) Authenticate() error {
|
|
return nil
|
|
}
|
|
|
|
func (dc *DopplerClient) GetSecret(request client.SecretRequest) (*client.SecretResponse, error) {
|
|
return dc.getSecret(request)
|
|
}
|
|
|
|
func (dc *DopplerClient) GetSecrets(_ client.SecretsRequest) (*client.SecretsResponse, error) {
|
|
// Not implemented
|
|
return &client.SecretsResponse{}, nil
|
|
}
|
|
|
|
func (dc *DopplerClient) WithValue(request client.SecretRequest, response *client.SecretResponse, err error) {
|
|
if dc != nil {
|
|
dc.getSecret = func(requestIn client.SecretRequest) (*client.SecretResponse, error) {
|
|
if !cmp.Equal(requestIn, request) {
|
|
return nil, fmt.Errorf("unexpected test argument")
|
|
}
|
|
return response, err
|
|
}
|
|
}
|
|
}
|