provider.go 1.7 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647
  1. /*
  2. Licensed under the Apache License, Version 2.0 (the "License");
  3. you may not use this file except in compliance with the License.
  4. You may obtain a copy of the License at
  5. http://www.apache.org/licenses/LICENSE-2.0
  6. Unless required by applicable law or agreed to in writing, software
  7. distributed under the License is distributed on an "AS IS" BASIS,
  8. WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  9. See the License for the specific language governing permissions and
  10. limitations under the License.
  11. */
  12. package provider
  13. import (
  14. "context"
  15. "sigs.k8s.io/controller-runtime/pkg/client"
  16. esv1beta1 "github.com/external-secrets/external-secrets/apis/externalsecrets/v1beta1"
  17. )
  18. // Provider is a common interface for interacting with secret backends.
  19. type Provider interface {
  20. // NewClient constructs a SecretsManager Provider
  21. NewClient(ctx context.Context, store esv1beta1.GenericStore, kube client.Client, namespace string) (SecretsClient, error)
  22. }
  23. // SecretsClient provides access to secrets.
  24. type SecretsClient interface {
  25. // GetSecret returns a single secret from the provider
  26. GetSecret(ctx context.Context, ref esv1beta1.ExternalSecretDataRemoteRef) ([]byte, error)
  27. // Validate checks if the client is configured correctly
  28. // and is able to retrieve secrets from the provider
  29. Validate() error
  30. // GetSecretMap returns multiple k/v pairs from the provider
  31. GetSecretMap(ctx context.Context, ref esv1beta1.ExternalSecretDataRemoteRef) (map[string][]byte, error)
  32. // GetAllSecrets returns multiple k/v pairs from the provider
  33. GetAllSecrets(ctx context.Context, ref esv1beta1.ExternalSecretFind) (map[string][]byte, error)
  34. Close(ctx context.Context) error
  35. }