Documentation ¶
Index ¶
- func GetCoreConfig(keys []string) (map[string]interface{}, error)
- func GetModelInfo(c SnapdClient) (map[string]interface{}, error)
- type ClientAdapter
- func (a *ClientAdapter) Abort(id string) (*client.Change, error)
- func (a *ClientAdapter) Change(id string) (*client.Change, error)
- func (a *ClientAdapter) CreateUser(request *client.CreateUserOptions) (*client.CreateUserResult, error)
- func (a *ClientAdapter) Disable(name string, options *client.SnapOptions) (string, error)
- func (a *ClientAdapter) Enable(name string, options *client.SnapOptions) (string, error)
- func (a *ClientAdapter) Find(opts *client.FindOptions) ([]*client.Snap, *client.ResultInfo, error)
- func (a *ClientAdapter) FindOne(name string) (*client.Snap, *client.ResultInfo, error)
- func (a *ClientAdapter) Icon(name string) (*client.Icon, error)
- func (a *ClientAdapter) Install(name string, options *client.SnapOptions) (string, error)
- func (a *ClientAdapter) Interfaces() (client.Interfaces, error)
- func (a *ClientAdapter) Known(assertTypeName string, headers map[string]string) ([]asserts.Assertion, error)
- func (a *ClientAdapter) List(names []string, opts *client.ListOptions) ([]*client.Snap, error)
- func (a *ClientAdapter) Remove(name string, options *client.SnapOptions) (string, error)
- func (a *ClientAdapter) Sections() ([]string, error)
- func (a *ClientAdapter) ServerVersion() (*client.ServerVersion, error)
- func (a *ClientAdapter) Snap(name string) (*client.Snap, *client.ResultInfo, error)
- type FakeSnapdClient
- func (f *FakeSnapdClient) Abort(id string) (*client.Change, error)
- func (f *FakeSnapdClient) Change(id string) (*client.Change, error)
- func (f *FakeSnapdClient) CreateUser(request *client.CreateUserOptions) (*client.CreateUserResult, error)
- func (f *FakeSnapdClient) Disable(name string, options *client.SnapOptions) (string, error)
- func (f *FakeSnapdClient) Enable(name string, options *client.SnapOptions) (string, error)
- func (f *FakeSnapdClient) Find(opts *client.FindOptions) ([]*client.Snap, *client.ResultInfo, error)
- func (f *FakeSnapdClient) FindOne(name string) (*client.Snap, *client.ResultInfo, error)
- func (f *FakeSnapdClient) GetCoreConfig(keys []string) (map[string]interface{}, error)
- func (f *FakeSnapdClient) Icon(name string) (*client.Icon, error)
- func (f *FakeSnapdClient) Install(name string, options *client.SnapOptions) (string, error)
- func (f *FakeSnapdClient) Interfaces() (client.Interfaces, error)
- func (f *FakeSnapdClient) Known(assertTypeName string, headers map[string]string) ([]asserts.Assertion, error)
- func (f *FakeSnapdClient) List(names []string, opts *client.ListOptions) ([]*client.Snap, error)
- func (f *FakeSnapdClient) Remove(name string, options *client.SnapOptions) (string, error)
- func (f *FakeSnapdClient) Sections() ([]string, error)
- func (f *FakeSnapdClient) ServerVersion() (*client.ServerVersion, error)
- func (f *FakeSnapdClient) SetCoreConfig(patch map[string]interface{}) (string, error)
- func (f *FakeSnapdClient) Snap(name string) (*client.Snap, *client.ResultInfo, error)
- type SnapdClient
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func GetCoreConfig ¶
GetCoreConfig gets some aspect of core configuration XXX: current assumption, asking for timezone info
func GetModelInfo ¶
func GetModelInfo(c SnapdClient) (map[string]interface{}, error)
GetModelInfo returns information about the device.
Types ¶
type ClientAdapter ¶
type ClientAdapter struct {
// contains filtered or unexported fields
}
ClientAdapter adapts our expectations to the snapd client API.
func NewClientAdapter ¶
func NewClientAdapter() *ClientAdapter
NewClientAdapter creates a new ClientAdapter for use in snapweb.
func (*ClientAdapter) Abort ¶
func (a *ClientAdapter) Abort(id string) (*client.Change, error)
Abort attempts to abort a change that is in not yet ready.
func (*ClientAdapter) Change ¶
func (a *ClientAdapter) Change(id string) (*client.Change, error)
Change returns the list of ongoing changes for a given snap and changeid
func (*ClientAdapter) CreateUser ¶
func (a *ClientAdapter) CreateUser(request *client.CreateUserOptions) (*client.CreateUserResult, error)
CreateUser creates a local user on the system
func (*ClientAdapter) Disable ¶
func (a *ClientAdapter) Disable(name string, options *client.SnapOptions) (string, error)
Disable disables the snap
func (*ClientAdapter) Enable ¶
func (a *ClientAdapter) Enable(name string, options *client.SnapOptions) (string, error)
Enable enables the snap
func (*ClientAdapter) Find ¶
func (a *ClientAdapter) Find(opts *client.FindOptions) ([]*client.Snap, *client.ResultInfo, error)
Find returns a list of snaps available for install from the store for this system and that match the query
func (*ClientAdapter) FindOne ¶
func (a *ClientAdapter) FindOne(name string) (*client.Snap, *client.ResultInfo, error)
FindOne returns a list of snaps available for install from the store for this system and that match the query
func (*ClientAdapter) Icon ¶
func (a *ClientAdapter) Icon(name string) (*client.Icon, error)
Icon returns the Icon belonging to an installed snap.
func (*ClientAdapter) Install ¶
func (a *ClientAdapter) Install(name string, options *client.SnapOptions) (string, error)
Install adds the snap with the given name from the given channel (or the system default channel if not).
func (*ClientAdapter) Interfaces ¶
func (a *ClientAdapter) Interfaces() (client.Interfaces, error)
Interfaces returns the list of supported interfaces on the system
func (*ClientAdapter) Known ¶
func (a *ClientAdapter) Known(assertTypeName string, headers map[string]string) ([]asserts.Assertion, error)
Known queries assertions with type assertTypeName and matching assertion headers.
func (*ClientAdapter) List ¶
func (a *ClientAdapter) List(names []string, opts *client.ListOptions) ([]*client.Snap, error)
List returns the list of all snaps installed on the system with names in the given list; if the list is empty, all snaps.
func (*ClientAdapter) Remove ¶
func (a *ClientAdapter) Remove(name string, options *client.SnapOptions) (string, error)
Remove removes the snap with the given name.
func (*ClientAdapter) Sections ¶
func (a *ClientAdapter) Sections() ([]string, error)
Sections returns the list of available sections
func (*ClientAdapter) ServerVersion ¶
func (a *ClientAdapter) ServerVersion() (*client.ServerVersion, error)
ServerVersion returns information about the snapd server.
func (*ClientAdapter) Snap ¶
func (a *ClientAdapter) Snap(name string) (*client.Snap, *client.ResultInfo, error)
Snap returns the most recently published revision of the snap with the provided name.
type FakeSnapdClient ¶
type FakeSnapdClient struct { Snaps []*client.Snap StoreSnaps []*client.Snap Err error StoreErr error CalledListSnaps bool Query string FindOptions *client.FindOptions Version client.ServerVersion Installed string Removed string CrUser client.CreateUserResult Name string SnapSections []string AbortedChangeID string ChangeID string CurrentChange *client.Change }
FakeSnapdClient is a fake SnapdClient for testing purposes
func (*FakeSnapdClient) Abort ¶
func (f *FakeSnapdClient) Abort(id string) (*client.Change, error)
Abort attempts to abort a change that is in not yet ready.
func (*FakeSnapdClient) Change ¶
func (f *FakeSnapdClient) Change(id string) (*client.Change, error)
Change returns the list of ongoing changes for a given snap and changeid
func (*FakeSnapdClient) CreateUser ¶
func (f *FakeSnapdClient) CreateUser(request *client.CreateUserOptions) (*client.CreateUserResult, error)
CreateUser creates a local user on the system
func (*FakeSnapdClient) Disable ¶
func (f *FakeSnapdClient) Disable(name string, options *client.SnapOptions) (string, error)
Disable disables the snap
func (*FakeSnapdClient) Enable ¶
func (f *FakeSnapdClient) Enable(name string, options *client.SnapOptions) (string, error)
Enable enables the snap
func (*FakeSnapdClient) Find ¶
func (f *FakeSnapdClient) Find(opts *client.FindOptions) ([]*client.Snap, *client.ResultInfo, error)
Find returns the results of searching for snaps with the given options
func (*FakeSnapdClient) FindOne ¶
func (f *FakeSnapdClient) FindOne(name string) (*client.Snap, *client.ResultInfo, error)
FindOne returns a list of snaps available for install from the store for this system and that match the query
func (*FakeSnapdClient) GetCoreConfig ¶
func (f *FakeSnapdClient) GetCoreConfig(keys []string) (map[string]interface{}, error)
GetCoreConfig gets some aspect of core configuration
func (*FakeSnapdClient) Icon ¶
func (f *FakeSnapdClient) Icon(name string) (*client.Icon, error)
Icon returns the icon of an installed snap
func (*FakeSnapdClient) Install ¶
func (f *FakeSnapdClient) Install(name string, options *client.SnapOptions) (string, error)
Install adds the named snap to the system
func (*FakeSnapdClient) Interfaces ¶
func (f *FakeSnapdClient) Interfaces() (client.Interfaces, error)
Interfaces returns the list of supported interfaces on the system
func (*FakeSnapdClient) Known ¶
func (f *FakeSnapdClient) Known(assertTypeName string, headers map[string]string) ([]asserts.Assertion, error)
Known queries assertions with type assertTypeName and matching assertion headers.
func (*FakeSnapdClient) List ¶
func (f *FakeSnapdClient) List(names []string, opts *client.ListOptions) ([]*client.Snap, error)
List lists the installed snaps
func (*FakeSnapdClient) Remove ¶
func (f *FakeSnapdClient) Remove(name string, options *client.SnapOptions) (string, error)
Remove removes the names snap from the system
func (*FakeSnapdClient) Sections ¶
func (f *FakeSnapdClient) Sections() ([]string, error)
Sections returns the list of existing sections in the store.
func (*FakeSnapdClient) ServerVersion ¶
func (f *FakeSnapdClient) ServerVersion() (*client.ServerVersion, error)
ServerVersion returns the version of the running `snapd` daemon
func (*FakeSnapdClient) SetCoreConfig ¶
func (f *FakeSnapdClient) SetCoreConfig(patch map[string]interface{}) (string, error)
SetCoreConfig sets some aspect of core configuration
func (*FakeSnapdClient) Snap ¶
func (f *FakeSnapdClient) Snap(name string) (*client.Snap, *client.ResultInfo, error)
Snap returns the named snap
type SnapdClient ¶
type SnapdClient interface { Icon(name string) (*client.Icon, error) Snap(name string) (*client.Snap, *client.ResultInfo, error) List(names []string, opts *client.ListOptions) ([]*client.Snap, error) Sections() ([]string, error) Find(opts *client.FindOptions) ([]*client.Snap, *client.ResultInfo, error) FindOne(name string) (*client.Snap, *client.ResultInfo, error) Install(name string, options *client.SnapOptions) (string, error) Remove(name string, options *client.SnapOptions) (string, error) ServerVersion() (*client.ServerVersion, error) CreateUser(request *client.CreateUserOptions) (*client.CreateUserResult, error) Interfaces() (client.Interfaces, error) Known(assertTypeName string, headers map[string]string) ([]asserts.Assertion, error) Change(id string) (*client.Change, error) Enable(id string, options *client.SnapOptions) (string, error) Disable(id string, options *client.SnapOptions) (string, error) Abort(id string) (*client.Change, error) }
SnapdClient is a client of the snapd REST API