secretsmanager.go 1.7 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950
  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 secretsmanager
  13. import (
  14. "context"
  15. "sigs.k8s.io/controller-runtime/pkg/client"
  16. esv1alpha1 "github.com/external-secrets/external-secrets/api/v1alpha1"
  17. "github.com/external-secrets/external-secrets/pkg/provider"
  18. "github.com/external-secrets/external-secrets/pkg/provider/schema"
  19. )
  20. // SecretsManager is a provider for AWS SecretsManager.
  21. type SecretsManager struct{}
  22. // New constructs a SecretsManager Provider.
  23. func (sm *SecretsManager) New(ctx context.Context, store esv1alpha1.SecretStoreProvider, kube client.Client, namespace string) (provider.Provider, error) {
  24. return sm, nil // stub
  25. }
  26. // GetSecret returns a single secret from the provider.
  27. func (sm *SecretsManager) GetSecret(ctx context.Context, ref esv1alpha1.ExternalSecretDataRemoteRef) ([]byte, error) {
  28. return []byte("NOOP"), nil
  29. }
  30. // GetSecretMap returns multiple k/v pairs from the provider.
  31. func (sm *SecretsManager) GetSecretMap(ctx context.Context, ref esv1alpha1.ExternalSecretDataRemoteRef) (map[string][]byte, error) {
  32. return map[string][]byte{
  33. "noop": []byte("NOOP"),
  34. }, nil
  35. }
  36. func init() {
  37. schema.Register(&SecretsManager{}, &esv1alpha1.SecretStoreProvider{
  38. AWSSM: &esv1alpha1.AWSSMProvider{},
  39. })
  40. }