Documentation ¶
Index ¶
- type CurrentSnap
- type DownloadManyOptions
- type DownloadSnapOptions
- type DownloadedSnap
- type SimpleCreds
- type SnapToDownload
- type StoreImpl
- type ToolingStore
- func (tsto *ToolingStore) AssertionFetcher(db *asserts.Database, save func(asserts.Assertion) error) asserts.Fetcher
- func (tsto *ToolingStore) DownloadMany(toDownload []SnapToDownload, curSnaps []*CurrentSnap, opts DownloadManyOptions) (downloadedSnaps map[string]*DownloadedSnap, err error)
- func (tsto *ToolingStore) DownloadSnap(name string, opts DownloadSnapOptions) (downloadedSnap *DownloadedSnap, err error)
- func (tsto *ToolingStore) Find(at *asserts.AssertionType, headers map[string]string) (asserts.Assertion, error)
- type UbuntuOneCreds
- func (c *UbuntuOneCreds) Authorize(r *http.Request, _ store.DeviceAndAuthContext, _ *auth.UserState, ...) error
- func (c *UbuntuOneCreds) CanAuthorizeForUser(_ *auth.UserState) bool
- func (c *UbuntuOneCreds) RefreshAuth(_ store.AuthRefreshNeed, _ store.DeviceAndAuthContext, user *auth.UserState, ...) error
- func (c *UbuntuOneCreds) UpdateUserAuth(user *auth.UserState, discharges []string) (*auth.UserState, error)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type CurrentSnap ¶
type DownloadManyOptions ¶
type DownloadSnapOptions ¶
type DownloadSnapOptions struct { TargetDir string Revision snap.Revision Channel string CohortKey string Basename string LeavePartialOnError bool }
DownloadSnapOptions carries options for downloading snaps plus assertions.
func (*DownloadSnapOptions) String ¶
func (opts *DownloadSnapOptions) String() string
type DownloadedSnap ¶
type SimpleCreds ¶
SimpleCreds can authorize requests using simply scheme/auth value.
func (*SimpleCreds) Authorize ¶
func (c *SimpleCreds) Authorize(r *http.Request, _ store.DeviceAndAuthContext, user *auth.UserState, _ *store.AuthorizeOptions) error
func (*SimpleCreds) CanAuthorizeForUser ¶
func (c *SimpleCreds) CanAuthorizeForUser(_ *auth.UserState) bool
type SnapToDownload ¶
type StoreImpl ¶
type StoreImpl interface { // SnapAction queries the store for snap information for the given install/refresh actions. Orthogonally it can be used to fetch or update assertions. SnapAction(context.Context, []*store.CurrentSnap, []*store.SnapAction, store.AssertionQuery, *auth.UserState, *store.RefreshOptions) ([]store.SnapActionResult, []store.AssertionResult, error) // Download downloads the snap addressed by download info Download(ctx context.Context, name, targetFn string, downloadInfo *snap.DownloadInfo, pbar progress.Meter, user *auth.UserState, dlOpts *store.DownloadOptions) error // Assertion retrieves the assertion for the given type and primary key. Assertion(assertType *asserts.AssertionType, primaryKey []string, user *auth.UserState) (asserts.Assertion, error) }
A StoreImpl can find metadata on snaps, download snaps and fetch assertions. This interface is a subset of store.Store methods.
type ToolingStore ¶
type ToolingStore struct { // Stdout is for output, mainly progress bars // left unset stdout is used Stdout io.Writer // contains filtered or unexported fields }
ToolingStore wraps access to the store for tools.
func MockToolingStore ¶
func MockToolingStore(sto StoreImpl) *ToolingStore
MockToolingStore creates a ToolingStore that uses the provided StoreImpl implementation for Download, SnapAction and Assertion methods. For testing.
func NewToolingStore ¶
func NewToolingStore() (*ToolingStore, error)
NewToolingStore creates ToolingStore, with optional arch and store id read from UBUNTU_STORE_ARCH and UBUNTU_STORE_ID environment variables.
func NewToolingStoreFromModel ¶
func NewToolingStoreFromModel(model *asserts.Model, fallbackArchitecture string) (*ToolingStore, error)
NewToolingStoreFromModel creates ToolingStore for the snap store used by the given model.
func (*ToolingStore) AssertionFetcher ¶
func (tsto *ToolingStore) AssertionFetcher(db *asserts.Database, save func(asserts.Assertion) error) asserts.Fetcher
AssertionFetcher creates an asserts.Fetcher for assertions using dlOpts for authorization, the fetcher will add assertions in the given database and after that also call save for each of them.
func (*ToolingStore) DownloadMany ¶
func (tsto *ToolingStore) DownloadMany(toDownload []SnapToDownload, curSnaps []*CurrentSnap, opts DownloadManyOptions) (downloadedSnaps map[string]*DownloadedSnap, err error)
DownloadMany downloads the specified snaps. curSnaps are meant to represent already downloaded snaps that will be installed in conjunction with the snaps to download, this is needed if enforcing validations (ops.EnforceValidation set to true) to have cross-gating work.
func (*ToolingStore) DownloadSnap ¶
func (tsto *ToolingStore) DownloadSnap(name string, opts DownloadSnapOptions) (downloadedSnap *DownloadedSnap, err error)
DownloadSnap downloads the snap with the given name and options. It returns the final full path of the snap and a snap.Info for it and optionally a channel the snap got redirected to wrapped in DownloadedSnap.
func (*ToolingStore) Find ¶
func (tsto *ToolingStore) Find(at *asserts.AssertionType, headers map[string]string) (asserts.Assertion, error)
Find provides the snapsserts.Finder interface for snapasserts.DerviceSideInfo
type UbuntuOneCreds ¶
UbuntuOneCreds can authorize requests using the implicitly carried SSO/U1 user credentials.
func (*UbuntuOneCreds) Authorize ¶
func (c *UbuntuOneCreds) Authorize(r *http.Request, _ store.DeviceAndAuthContext, _ *auth.UserState, _ *store.AuthorizeOptions) error
func (*UbuntuOneCreds) CanAuthorizeForUser ¶
func (c *UbuntuOneCreds) CanAuthorizeForUser(_ *auth.UserState) bool
func (*UbuntuOneCreds) RefreshAuth ¶
func (c *UbuntuOneCreds) RefreshAuth(_ store.AuthRefreshNeed, _ store.DeviceAndAuthContext, user *auth.UserState, client *http.Client) error