fleet/server/datastore/failing/common_store.go
Jonathan Katz fc4106c688
Cloudfront signing for in-house apps (#37650)
<!-- Add the related story/sub-task/bug number, like Resolves #123, or
remove if NA -->
**Related issue:** Resolves #33756

# Checklist for submitter

If some of the following don't apply, delete the relevant line.

- [x] Changes file added for user-visible changes in `changes/`,
`orbit/changes/` or `ee/fleetd-chrome/changes`.
See [Changes
files](https://github.com/fleetdm/fleet/blob/main/docs/Contributing/guides/committing-changes.md#changes-files)
for more information.

## Testing

- [x] Added/updated automated tests
- [ ] Where appropriate, [automated tests simulate multiple hosts and
test for host
isolation](https://github.com/fleetdm/fleet/blob/main/docs/Contributing/reference/patterns-backend.md#unit-testing)
(updates to one hosts's records do not affect another)

- [x] QA'd all new/changed functionality manually
2026-01-05 16:30:31 -05:00

35 lines
1.1 KiB
Go

package failing
import (
"context"
"fmt"
"io"
"time"
)
// commonFailingStore is an implementation of CommonStore
// that fails all operations. It is used when S3 is not configured and the
// local filesystem store could not be setup.
type commonFailingStore struct {
Entity string
}
func (c commonFailingStore) Get(ctx context.Context, iconID string) (io.ReadCloser, int64, error) {
return nil, 0, fmt.Errorf("%s store not properly configured", c.Entity)
}
func (c commonFailingStore) Put(ctx context.Context, iconID string, content io.ReadSeeker) error {
return fmt.Errorf("%s store not properly configured", c.Entity)
}
func (c commonFailingStore) Exists(ctx context.Context, iconID string) (bool, error) {
return false, fmt.Errorf("%s store not properly configured", c.Entity)
}
func (c commonFailingStore) Cleanup(ctx context.Context, usedIconIDs []string, removeCreatedBefore time.Time) (int, error) {
return 0, nil
}
func (c commonFailingStore) Sign(_ context.Context, _ string, _ time.Duration) (string, error) {
return "", fmt.Errorf("%s store not properly configured", c.Entity)
}