Documentation ¶
Index ¶
- Constants
- type Client
- func (client *Client) ActivateSnap(name string) (string, error)
- func (client *Client) AddSkill(skill *Skill) error
- func (client *Client) AddSlot(slot *Slot) error
- func (client *Client) AddSnap(name string) (string, error)
- func (client *Client) AllSkills() (grants []SkillGrants, err error)
- func (client *Client) Assert(b []byte) error
- func (client *Client) Asserts(assertTypeName string, headers map[string]string) ([]asserts.Assertion, error)
- func (client *Client) DeactivateSnap(name string) (string, error)
- func (client *Client) FilterSnaps(filter SnapFilter) (map[string]*Snap, error)
- func (client *Client) Grant(skillSnapName, skillName, slotSnapName, slotName string) error
- func (c *Client) Icon(pkgID string) (*Icon, error)
- func (client *Client) Operation(uuid string) (Operation, error)
- func (client *Client) PurgeSnap(name string) (string, error)
- func (client *Client) RefreshSnap(name string) (string, error)
- func (client *Client) RemoveSkill(snapName, skillName string) error
- func (client *Client) RemoveSlot(snapName, slotName string) error
- func (client *Client) RemoveSnap(name string) (string, error)
- func (client *Client) Revoke(skillSnapName, skillName, slotSnapName, slotName string) error
- func (client *Client) RollbackSnap(name string) (string, error)
- func (client *Client) Services(pkg string) (map[string]*Service, error)
- func (client *Client) Snap(name string) (*Snap, error)
- func (client *Client) Snaps() (map[string]*Snap, error)
- func (client *Client) SysInfo() (*SysInfo, error)
- type Config
- type Icon
- type Operation
- type Service
- type ServicePort
- type ServicePorts
- type ServiceSpec
- type ServiceStatus
- type Skill
- type SkillAction
- type SkillGrants
- type Slot
- type Snap
- type SnapFilter
- type SysInfo
Constants ¶
const ( StatusNotInstalled = "not installed" StatusInstalled = "installed" StatusActive = "active" StatusRemoved = "removed" TypeApp = "app" TypeFramework = "framework" TypeKernel = "kernel" TypeGadget = "gadget" TypeOS = "os" )
Statuses and types a snap may have.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Client ¶
type Client struct {
// contains filtered or unexported fields
}
A Client knows how to talk to the snappy daemon.
func (*Client) ActivateSnap ¶
ActivateSnap activates the snap with the given name, returning the UUID of the background operation upon success.
func (*Client) AddSnap ¶
AddSnap adds the snap with the given name, returning the UUID of the background operation upon success.
func (*Client) AllSkills ¶
func (client *Client) AllSkills() (grants []SkillGrants, err error)
AllSkills returns information about all the skills and their grants.
func (*Client) Assert ¶
Assert tries to add an assertion to the system assertion database. To succeed the assertion must be valid, its signature verified with a known public key and the assertion consistent with and its prerequisite in the database.
func (*Client) Asserts ¶
func (client *Client) Asserts(assertTypeName string, headers map[string]string) ([]asserts.Assertion, error)
Asserts queries assertions with type assertTypeName and matching assertion headers.
func (*Client) DeactivateSnap ¶
DeactivateSnap deactivates the snap with the given name, returning the UUID of the background operation upon success.
func (*Client) FilterSnaps ¶
func (client *Client) FilterSnaps(filter SnapFilter) (map[string]*Snap, error)
FilterSnaps returns a list of snaps per Snaps() but filtered by source, name and/or type
func (*Client) Grant ¶
Grant grants the named skill to the named slot of the given snap. The skill and the slot must have the same type.
func (*Client) PurgeSnap ¶
PurgeSnap purges the snap with the given name, returning the UUID of the background operation upon success.
TODO: nuke purge, when we have snapshots/backups done
func (*Client) RefreshSnap ¶
RefreshSnap refreshes the snap with the given name, returning the UUID of the background operation upon success.
func (*Client) RemoveSkill ¶
RemoveSkill removes a skill from the system.
func (*Client) RemoveSlot ¶
RemoveSlot removes a slot from the system.
func (*Client) RemoveSnap ¶
RemoveSnap removes the snap with the given name, returning the UUID of the background operation upon success.
func (*Client) RollbackSnap ¶
RollbackSnap rolls back the snap with the given name, returning the UUID of the background operation upon success.
func (*Client) Snap ¶
Snap returns the most recently published revision of the snap with the provided name.
type Config ¶
type Config struct { // BaseURL contains the base URL where snappy daemon is expected to be. // It can be empty for a default behavior of talking over a unix socket. BaseURL string }
Config allows to customize client behavior.
type Service ¶
type Service struct { Op string `json:"op"` Spec ServiceSpec `json:"spec"` Status ServiceStatus `json:"status"` }
Service represents a service belonging to a Snap
type ServicePort ¶
ServicePort is a port a Service may listen on
type ServicePorts ¶
type ServicePorts struct { Internal map[string]ServicePort `json:"internal,omitempty"` External map[string]ServicePort `json:"external,omitempty"` }
ServicePorts are the collection of internal and external ports the Service may listen on
type ServiceSpec ¶
type ServiceSpec struct { Name string `json:"name"` Description string `json:"description,omitempty"` Start string `json:"start,omitempty"` StopTimeout string `json:"stop-timeout,omitempty"` Ports ServicePorts `json:"ports,omitempty"` }
ServiceSpec represents the Service specification
type ServiceStatus ¶
type ServiceStatus struct { ServiceFileName string `json:"service_file_name"` LoadState string `json:"load_state"` ActiveState string `json:"active_state"` SubState string `json:"sub_state"` UnitFileState string `json:"unit_file_state"` SnapName string `json:"snap_name"` ServiceName string `json:"service_name"` }
ServiceStatus represents the status of a Service
type Skill ¶
type Skill struct { Name string `json:"name"` Snap string `json:"snap"` Type string `json:"type,omitempty"` Attrs map[string]interface{} `json:"attrs,omitempty"` Apps []string `json:"apps,omitempty"` Label string `json:"label,omitempty"` }
Skill represents a capacity offered by a snap.
type SkillAction ¶
type SkillAction struct { Action string `json:"action"` Skill *Skill `json:"skill,omitempty"` Slot *Slot `json:"slot,omitempty"` }
SkillAction represents an action performed on the skill system.
type SkillGrants ¶
SkillGrants represents a single skill and slots that are using it.
type Slot ¶
type Slot struct { Name string `json:"name"` Snap string `json:"snap"` Type string `json:"type,omitempty"` Attrs map[string]interface{} `json:"attrs,omitempty"` Apps []string `json:"apps,omitempty"` Label string `json:"label,omitempty"` }
Slot represents the potential of a given snap to use a skill.
type Snap ¶
type Snap struct { Description string `json:"description"` DownloadSize int64 `json:"download_size"` Icon string `json:"icon"` InstalledSize int64 `json:"installed_size"` Name string `json:"name"` Origin string `json:"origin"` Status string `json:"status"` Type string `json:"type"` Version string `json:"version"` }
Snap holds the data for a snap as obtained from snapd.
type SnapFilter ¶
SnapFilter is used to filter snaps by source, name and/or type