mirror of
https://github.com/ceph/ceph-csi.git
synced 2024-10-19 13:49:53 +00:00
5280b67327
Bumps [github.com/hashicorp/vault/api](https://github.com/hashicorp/vault) from 1.1.1 to 1.2.0. - [Release notes](https://github.com/hashicorp/vault/releases) - [Changelog](https://github.com/hashicorp/vault/blob/main/CHANGELOG.md) - [Commits](https://github.com/hashicorp/vault/compare/v1.1.1...v1.2.0) --- updated-dependencies: - dependency-name: github.com/hashicorp/vault/api dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] <support@github.com>
53 lines
1.1 KiB
Go
53 lines
1.1 KiB
Go
package logical
|
|
|
|
import (
|
|
"context"
|
|
|
|
"github.com/hashicorp/vault/sdk/physical"
|
|
)
|
|
|
|
type LogicalStorage struct {
|
|
underlying physical.Backend
|
|
}
|
|
|
|
func (s *LogicalStorage) Get(ctx context.Context, key string) (*StorageEntry, error) {
|
|
entry, err := s.underlying.Get(ctx, key)
|
|
if err != nil {
|
|
return nil, err
|
|
}
|
|
if entry == nil {
|
|
return nil, nil
|
|
}
|
|
return &StorageEntry{
|
|
Key: entry.Key,
|
|
Value: entry.Value,
|
|
SealWrap: entry.SealWrap,
|
|
}, nil
|
|
}
|
|
|
|
func (s *LogicalStorage) Put(ctx context.Context, entry *StorageEntry) error {
|
|
return s.underlying.Put(ctx, &physical.Entry{
|
|
Key: entry.Key,
|
|
Value: entry.Value,
|
|
SealWrap: entry.SealWrap,
|
|
})
|
|
}
|
|
|
|
func (s *LogicalStorage) Delete(ctx context.Context, key string) error {
|
|
return s.underlying.Delete(ctx, key)
|
|
}
|
|
|
|
func (s *LogicalStorage) List(ctx context.Context, prefix string) ([]string, error) {
|
|
return s.underlying.List(ctx, prefix)
|
|
}
|
|
|
|
func (s *LogicalStorage) Underlying() physical.Backend {
|
|
return s.underlying
|
|
}
|
|
|
|
func NewLogicalStorage(underlying physical.Backend) *LogicalStorage {
|
|
return &LogicalStorage{
|
|
underlying: underlying,
|
|
}
|
|
}
|