Documentation ¶
Index ¶
- type ActionDevice
- type ClientAdapter
- func (a *ClientAdapter) Ack(b []byte) error
- func (a *ClientAdapter) Apps(names []string, opts *client.AppOptions) ([]*client.AppInfo, error)
- func (a *ClientAdapter) Change(id string) (*client.Change, error)
- func (a *ClientAdapter) Changes(opts *client.ChangesOptions) ([]*client.Change, error)
- func (a *ClientAdapter) Conf(name string) (map[string]interface{}, error)
- func (a *ClientAdapter) CreateUser(opts *client.CreateUserOptions) (*client.CreateUserResult, error)
- func (a *ClientAdapter) DeviceInfo() (ActionDevice, 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) GetEncodedAssertions(assertionType string) ([]byte, error)
- func (a *ClientAdapter) Install(name string, options *client.SnapOptions) (string, 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) Logs(opts client.LogOptions) (<-chan client.Log, error)
- func (a *ClientAdapter) Refresh(name string, options *client.SnapOptions) (string, error)
- func (a *ClientAdapter) Remove(name string, options *client.SnapOptions) (string, error)
- func (a *ClientAdapter) RemoveUser(opts *client.RemoveUserOptions) ([]*client.User, error)
- func (a *ClientAdapter) Restart(names []string, opts client.RestartOptions) (changeID string, err error)
- func (a *ClientAdapter) Revert(name string, options *client.SnapOptions) (string, error)
- func (a *ClientAdapter) ServerVersion() (*client.ServerVersion, error)
- func (a *ClientAdapter) SetConf(name string, patch map[string]interface{}) (string, error)
- func (a *ClientAdapter) Snap(name string) (*client.Snap, *client.ResultInfo, error)
- func (a *ClientAdapter) Snaps() ([]*client.Snap, error)
- func (a *ClientAdapter) SnapshotExport(setID uint64) (stream io.ReadCloser, contentLength int64, err error)
- func (a *ClientAdapter) SnapshotMany(names []string, users []string) (setID uint64, changeID string, err error)
- func (a *ClientAdapter) Start(names []string, opts client.StartOptions) (changeID string, err error)
- func (a *ClientAdapter) Stop(names []string, opts client.StopOptions) (changeID string, err error)
- func (a *ClientAdapter) Switch(name string, options *client.SnapOptions) (string, error)
- type HTTPClient
- type SnapdClient
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type ActionDevice ¶
type ActionDevice struct { Brand string `json:"brand"` Model string `json:"model"` SerialNumber string `json:"serial"` StoreID string `json:"store"` DeviceKey string `json:"deviceKey"` }
ActionDevice has basic information of a device
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 as a singleton
func (*ClientAdapter) Ack ¶
func (a *ClientAdapter) Ack(b []byte) error
Ack adds a new assertion to the system
func (*ClientAdapter) Apps ¶
func (a *ClientAdapter) Apps(names []string, opts *client.AppOptions) ([]*client.AppInfo, error)
func (*ClientAdapter) Changes ¶
func (a *ClientAdapter) Changes(opts *client.ChangesOptions) ([]*client.Change, error)
func (*ClientAdapter) Conf ¶
func (a *ClientAdapter) Conf(name string) (map[string]interface{}, error)
Conf gets the snap's current configuration
func (*ClientAdapter) CreateUser ¶
func (a *ClientAdapter) CreateUser(opts *client.CreateUserOptions) (*client.CreateUserResult, error)
func (*ClientAdapter) DeviceInfo ¶
func (a *ClientAdapter) DeviceInfo() (ActionDevice, error)
DeviceInfo fetches the basic details of the device
func (*ClientAdapter) Disable ¶
func (a *ClientAdapter) Disable(name string, options *client.SnapOptions) (string, error)
Disable deactivates the snap with the given name.
func (*ClientAdapter) Enable ¶
func (a *ClientAdapter) Enable(name string, options *client.SnapOptions) (string, error)
Enable activates the snap with the given name.
func (*ClientAdapter) GetEncodedAssertions ¶
func (a *ClientAdapter) GetEncodedAssertions(assertionType string) ([]byte, error)
GetEncodedAssertions fetches the encoded model and serial assertions
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) 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) Logs ¶
func (a *ClientAdapter) Logs(opts client.LogOptions) (<-chan client.Log, error)
Logs requests syslog logs from the snapd api
func (*ClientAdapter) Refresh ¶
func (a *ClientAdapter) Refresh(name string, options *client.SnapOptions) (string, error)
Refresh updates the snap with the given name from the given channel (or the system default channel if not).
func (*ClientAdapter) Remove ¶
func (a *ClientAdapter) Remove(name string, options *client.SnapOptions) (string, error)
Remove removes the snap with the given name.
func (*ClientAdapter) RemoveUser ¶
func (a *ClientAdapter) RemoveUser(opts *client.RemoveUserOptions) ([]*client.User, error)
func (*ClientAdapter) Restart ¶
func (a *ClientAdapter) Restart(names []string, opts client.RestartOptions) (changeID string, err error)
func (*ClientAdapter) Revert ¶
func (a *ClientAdapter) Revert(name string, options *client.SnapOptions) (string, error)
Revert rolls the snap back to the previous on-disk state
func (*ClientAdapter) ServerVersion ¶
func (a *ClientAdapter) ServerVersion() (*client.ServerVersion, error)
ServerVersion returns information about the snapd server.
func (*ClientAdapter) SetConf ¶
func (a *ClientAdapter) SetConf(name string, patch map[string]interface{}) (string, error)
SetConf requests a snap to apply the provided patch to the configuration
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.
func (*ClientAdapter) SnapshotExport ¶
func (a *ClientAdapter) SnapshotExport(setID uint64) (stream io.ReadCloser, contentLength int64, err error)
SnapshotExport returns an archive data stream of the Snapshot set created by the SnapshotMany function
func (*ClientAdapter) SnapshotMany ¶
func (a *ClientAdapter) SnapshotMany(names []string, users []string) (setID uint64, changeID string, err error)
SnapshotMany creates snapshots of the provided snaps under the provided users. If an array is empty, it will take a snapshot of all snaps with users (or both)
func (*ClientAdapter) Start ¶
func (a *ClientAdapter) Start(names []string, opts client.StartOptions) (changeID string, err error)
func (*ClientAdapter) Stop ¶
func (a *ClientAdapter) Stop(names []string, opts client.StopOptions) (changeID string, err error)
func (*ClientAdapter) Switch ¶
func (a *ClientAdapter) Switch(name string, options *client.SnapOptions) (string, error)
type SnapdClient ¶
type SnapdClient interface { Apps(names []string, opts *client.AppOptions) ([]*client.AppInfo, error) Start(names []string, opts client.StartOptions) (changeID string, err error) Stop(names []string, opts client.StopOptions) (changeID string, err error) Restart(names []string, opts client.RestartOptions) (changeID string, err error) Snap(name string) (*client.Snap, *client.ResultInfo, error) List(names []string, opts *client.ListOptions) ([]*client.Snap, error) Install(name string, options *client.SnapOptions) (string, error) Refresh(name string, options *client.SnapOptions) (string, error) Revert(name string, options *client.SnapOptions) (string, error) Remove(name string, options *client.SnapOptions) (string, error) Enable(name string, options *client.SnapOptions) (string, error) Disable(name string, options *client.SnapOptions) (string, error) ServerVersion() (*client.ServerVersion, error) Ack(b []byte) error Known(assertTypeName string, headers map[string]string) ([]asserts.Assertion, error) Conf(name string) (map[string]interface{}, error) SetConf(name string, patch map[string]interface{}) (string, error) GetEncodedAssertions(assertionType string) ([]byte, error) DeviceInfo() (ActionDevice, error) Snaps() ([]*client.Snap, error) Switch(name string, options *client.SnapOptions) (string, error) Logs(opts client.LogOptions) (<-chan client.Log, error) SnapshotMany(names []string, users []string) (setID uint64, changeID string, err error) SnapshotExport(setID uint64) (stream io.ReadCloser, contentLength int64, err error) CreateUser(opts *client.CreateUserOptions) (*client.CreateUserResult, error) RemoveUser(opts *client.RemoveUserOptions) ([]*client.User, error) Changes(opts *client.ChangesOptions) ([]*client.Change, error) Change(id string) (*client.Change, error) }
SnapdClient is a client of the snapd REST API