18 Commits

Author SHA1 Message Date
Zeyad Yasser
54c6a1d8c3 refactor: replace IsNotFound usages for errors.Is(err, &NotFoundError{}) 2023-02-09 16:02:40 +00:00
Samuele Pedroni
716b13b5f9 daemon: simplify SyncResponse
it doesn't take Meta anymore
2021-06-03 13:49:26 +02:00
Samuele Pedroni
53997ce72f daemon: api_asserts.go use SyncResponse as usual 2021-05-28 19:48:19 +02:00
James Henstridge
eebe1636b2 Merge remote-tracking branch 'upstream/master' into daemon-access-check 2021-04-07 17:02:42 +08:00
Samuele Pedroni
d0a7d7f357 daemon: rename getStore to storeFrom 2021-03-16 11:42:38 +01:00
Samuele Pedroni
926de177e3 daemon: change getStore(*Command) -> getStore(*Daemon)
this helps avoiding passing *Command around which complicates exposing
helpers if they actually want to be tested

with this we don't need to export ThemesCmd to the tests anymore
2021-03-16 11:42:38 +01:00
James Henstridge
6dca0bae80 daemon: reorder access checkers after method functions, to match struct layout 2020-08-27 13:48:57 +08:00
James Henstridge
ea3c3c4b6a daemon: don't export access checkers, and rename RootOnlyAccess to rootAccess 2020-08-07 08:42:36 +08:00
James Henstridge
14b9e7ec62 daemon: have each command list a ReadAccess and/or WriteAccess policy directly.
This is simpler than determining how the current set of flags
interoperate, and more closely matches how API access is documented to
work.
2020-08-07 08:32:56 +08:00
Michael Vogt
6ca1e81e2e daemon: simplify parseHeadersFormatOptionsFromURL() (thanks to Ian) 2019-09-30 08:24:08 +02:00
Michael Vogt
1d3196ccb9 daemon: allow /v2/assertions/{assertType} to query store
This adds a new option "remote=true" to the
/v2/assertions/{assertType} endpoint. This will force
the daemon to search the store instead of the local asserts
database.

This will be needed for the `snap download <foo>` feature
that does the downloading via the snapd daemon.
2019-09-26 10:39:41 +02:00
Samuele Pedroni
3616ea3558 Merge remote-tracking branch 'upstream/master' into HEAD 2019-08-30 13:40:09 +02:00
Samuele Pedroni
f9f19ec9d2 make Precheck an option to CommitTo instead of a separate method
as discussed/suggested

clarify docs
2019-08-23 09:25:58 +02:00
Samuele Pedroni
7b63540188 use asserts.Batch for assertstate.Batch and internal accumFetcher
introduce assertsstate.AddBatch

code adjustments everywhere

drop now unused assertstate code
2019-08-18 09:41:29 +02:00
Ian Johnson
11533a386b daemon/api_asserts.go: refactor query params handling
* Add a new helper to parse the json url Query parameters into a more usable
  format with the headers put into a map[string]string and whether we should
  output in JSON and whether we should output headers only as specific bools.
* Use the new helper in the assertsFindMany v2/assertions/{type} endpoint

Signed-off-by: Ian Johnson <ian.johnson@canonical.com>
2019-08-09 16:22:56 -05:00
Samuele Pedroni
dd40909941 review feedback 2019-03-12 17:52:02 +01:00
Samuele Pedroni
a20f65f725 support returning assertion information as JSON with the "json" query parameter 2019-03-12 11:13:53 +01:00
Samuele Pedroni
659064a0e9 move assertions endpoint impls to their own file 2019-03-11 17:54:36 +01:00