Documentation ¶
Index ¶
- Constants
- Variables
- func InternalSnapctlCmdNeedsStdin(name string) bool
- func IsAssertionNotFoundError(err error) bool
- func IsInterfacesUnchangedError(err error) bool
- func IsRetryable(err error) bool
- func IsTwoFactorError(err error) bool
- func MockDoTimings(retry, timeout time.Duration) (restore func())
- type AliasStatus
- type AppActivator
- type AppInfo
- type AppOptions
- type AuthorizationError
- type AvailableForInstall
- type BuyOptions
- type BuyResult
- type Category
- type Change
- type ChangeSelector
- type ChangesOptions
- type Client
- func (client *Client) Abort(id string) (*Change, error)
- func (client *Client) Ack(b []byte) error
- func (client *Client) Alias(snapName, app, alias string) (changeID string, err error)
- func (client *Client) Aliases() (allStatuses map[string]map[string]AliasStatus, err error)
- func (client *Client) ApplyValidationSet(accountID, name string, opts *ValidateApplyOptions) (res *ValidationSetResult, err error)
- func (client *Client) Apps(names []string, opts AppOptions) ([]*AppInfo, error)
- func (client *Client) AssertionTypes() ([]string, error)
- func (client *Client) Buy(opts *BuyOptions) (*BuyResult, error)
- func (client *Client) Categories() ([]*Category, error)
- func (client *Client) Change(id string) (*Change, error)
- func (client *Client) Changes(opts *ChangesOptions) ([]*Change, error)
- func (client *Client) CheckSnapshots(setID uint64, snaps []string, users []string) (changeID string, err error)
- func (client *Client) Conf(snapName string, keys []string) (configuration map[string]interface{}, err error)
- func (client *Client) Connect(plugSnapName, plugName, slotSnapName, slotName string) (changeID string, err error)
- func (client *Client) Connections(opts *ConnectionOptions) (Connections, error)
- func (client *Client) CreateCohorts(snaps []string) (map[string]string, error)
- func (client *Client) CreateUser(options *CreateUserOptions) (*CreateUserResult, error)
- func (client *Client) CreateUsers(options []*CreateUserOptions) ([]*CreateUserResult, error)
- func (client *Client) CurrentModelAssertion() (*asserts.Model, error)
- func (client *Client) CurrentSerialAssertion() (*asserts.Serial, error)
- func (client *Client) Debug(action string, params interface{}, result interface{}) error
- func (client *Client) DebugGet(aspect string, result interface{}, params map[string]string) error
- func (client *Client) DebugRaw(ctx context.Context, method, urlpath string, query url.Values, ...) (*http.Response, error)
- func (client *Client) Disable(name string, options *SnapOptions) (changeID string, err error)
- func (client *Client) DisableAllAliases(snapName string) (changeID string, err error)
- func (client *Client) Disconnect(plugSnapName, plugName, slotSnapName, slotName string, opts *DisconnectOptions) (changeID string, err error)
- func (client *Client) DoSystemAction(systemLabel string, action *SystemAction) error
- func (client *Client) Download(name string, options *DownloadOptions) (dlInfo *DownloadInfo, r io.ReadCloser, err error)
- func (client *Client) Enable(name string, options *SnapOptions) (changeID string, err error)
- func (client *Client) EnsureQuota(groupName string, opts *EnsureQuotaOptions) (changeID string, err error)
- func (client *Client) Find(opts *FindOptions) ([]*Snap, *ResultInfo, error)
- func (client *Client) FindOne(name string) (*Snap, *ResultInfo, error)
- func (client *Client) ForgetSnapshots(setID uint64, snaps []string) (changeID string, err error)
- func (client *Client) ForgetValidationSet(accountID, name string, sequence int) error
- func (client *Client) GetQuotaGroup(groupName string) (*QuotaGroupResult, error)
- func (client *Client) Hijack(f func(*http.Request) (*http.Response, error))
- func (client *Client) HoldRefreshes(name string, options *SnapOptions) (changeID string, err error)
- func (client *Client) HoldRefreshesMany(names []string, options *SnapOptions) (changeID string, err error)
- func (c *Client) Icon(pkgID string) (*Icon, error)
- func (client *Client) Install(name string, components []string, options *SnapOptions) (changeID string, err error)
- func (client *Client) InstallMany(names []string, components map[string][]string, options *SnapOptions) (changeID string, err error)
- func (client *Client) InstallPath(path, name string, options *SnapOptions) (changeID string, err error)
- func (client *Client) InstallPathMany(paths []string, options *SnapOptions) (changeID string, err error)
- func (client *Client) InstallSystem(systemLabel string, opts *InstallSystemOptions) (changeID string, err error)
- func (client *Client) Interfaces(opts *InterfaceOptions) ([]*Interface, error)
- func (client *Client) InternalConsoleConfStart() ([]string, []string, error)
- func (client *Client) Known(assertTypeName string, headers map[string]string, opts *KnownOptions) ([]asserts.Assertion, error)
- func (client *Client) List(names []string, opts *ListOptions) ([]*Snap, error)
- func (client *Client) ListSystems() ([]System, error)
- func (client *Client) ListValidationsSets() ([]*ValidationSetResult, error)
- func (client *Client) LoggedInUser() *User
- func (client *Client) Login(email, password, otp string) (*User, error)
- func (client *Client) Logout() error
- func (client *Client) Logs(names []string, opts LogOptions) (<-chan Log, error)
- func (client *Client) Maintenance() error
- func (c *Client) MigrateSnapHome(snaps []string) (changeID string, err error)
- func (client *Client) Notify(opts *NotifyOptions) (string, error)
- func (client *Client) Okay(t time.Time) error
- func (client *Client) Prefer(snapName string) (changeID string, err error)
- func (client *Client) Quotas() ([]*QuotaGroupResult, error)
- func (client *Client) ReadyToBuy() error
- func (client *Client) RebootToSystem(systemLabel, mode string) error
- func (client *Client) Refresh(name string, options *SnapOptions) (changeID string, err error)
- func (client *Client) RefreshMany(names []string, options *SnapOptions) (changeID string, err error)
- func (c *Client) RegistryGetViaView(viewID string, requests []string) (result map[string]interface{}, err error)
- func (c *Client) RegistrySetViaView(viewID string, requestValues map[string]interface{}) (changeID string, err error)
- func (client *Client) Remodel(b []byte, opts RemodelOpts) (changeID string, err error)
- func (client *Client) RemodelWithLocalSnaps(model []byte, snapPaths, assertPaths []string) (changeID string, err error)
- func (client *Client) Remove(name string, components []string, options *SnapOptions) (changeID string, err error)
- func (client *Client) RemoveManualAlias(alias string) (changeID string, err error)
- func (client *Client) RemoveMany(names []string, components map[string][]string, options *SnapOptions) (changeID string, err error)
- func (client *Client) RemoveQuotaGroup(groupName string) (changeID string, err error)
- func (client *Client) RemoveUser(options *RemoveUserOptions) (removed []*User, err error)
- func (client *Client) Restart(names []string, scope ScopeSelector, users UserSelector, opts RestartOptions) (changeID string, err error)
- func (client *Client) RestoreSnapshots(setID uint64, snaps []string, users []string) (changeID string, err error)
- func (client *Client) Revert(name string, options *SnapOptions) (changeID string, err error)
- func (client *Client) RunSnapctl(options *SnapCtlOptions, stdin io.Reader) (stdout, stderr []byte, err error)
- func (client *Client) Sections() ([]string, error)
- func (client *Client) ServerVersion() (*ServerVersion, error)
- func (client *Client) SetConf(snapName string, patch map[string]interface{}) (changeID string, err error)
- func (client *Client) Snap(name string) (*Snap, *ResultInfo, error)
- func (client *Client) SnapshotExport(setID uint64) (stream io.ReadCloser, contentLength int64, err error)
- func (client *Client) SnapshotImport(exportStream io.Reader, size int64) (SnapshotImportSet, error)
- func (client *Client) SnapshotMany(names []string, users []string) (setID uint64, changeID string, err error)
- func (client *Client) SnapshotSets(setID uint64, snapNames []string) ([]SnapshotSet, error)
- func (client *Client) Start(names []string, scope ScopeSelector, users UserSelector, opts StartOptions) (changeID string, err error)
- func (client *Client) Stop(names []string, scope ScopeSelector, users UserSelector, opts StopOptions) (changeID string, err error)
- func (client *Client) StoreAccount(accountID string) (*snap.StoreAccount, error)
- func (client *Client) Switch(name string, options *SnapOptions) (changeID string, err error)
- func (client *Client) SysInfo() (*SysInfo, error)
- func (client *Client) SystemDetails(systemLabel string) (*SystemDetails, error)
- func (client *Client) SystemRecoveryKeys(result interface{}) error
- func (client *Client) Try(path string, options *SnapOptions) (changeID string, err error)
- func (client *Client) Unalias(aliasOrSnap string) (changeID string, err error)
- func (client *Client) UnholdRefreshes(name string, options *SnapOptions) (changeID string, err error)
- func (client *Client) UnholdRefreshesMany(names []string, options *SnapOptions) (changeID string, err error)
- func (client *Client) Users() ([]*User, error)
- func (client *Client) ValidationSet(accountID, name string, sequence int) (*ValidationSetResult, error)
- func (client *Client) Warnings(opts WarningsOptions) ([]*Warning, error)
- func (client *Client) WarningsSummary() (count int, timestamp time.Time)
- func (client *Client) WhoAmI() (string, error)
- type CohortAction
- type Component
- type Config
- type Connection
- type ConnectionError
- type ConnectionOptions
- type Connections
- type CreateSystemOptions
- type CreateUserOptions
- type CreateUserResult
- type DisconnectOptions
- type DownloadInfo
- type DownloadOptions
- type EnsureQuotaOptions
- type Error
- type ErrorKind
- type FindOptions
- type Icon
- type InstallStep
- type InstallSystemOptions
- type Interface
- type InterfaceAction
- type InterfaceOptions
- type InternalClientError
- type InternalConsoleConfStartResponse
- type KnownOptions
- type ListOptions
- type Log
- type LogOptions
- type NoticeType
- type NotifyOptions
- type OSRelease
- type OptionalInstallRequest
- type Plug
- type PlugRef
- type QuotaCPUSetValues
- type QuotaCPUValues
- type QuotaGroupResult
- type QuotaJournalRate
- type QuotaJournalValues
- type QuotaValues
- type RefreshInfo
- type RemodelOpts
- type RemoveUserOptions
- type RequestError
- type RestartOptions
- type ResultInfo
- type ScopeSelector
- type ServerVersion
- type Slot
- type SlotRef
- type Snap
- type SnapCtlOptions
- type SnapCtlPostData
- type SnapHealth
- type SnapOptions
- type SnapRefreshInhibit
- type Snapshot
- type SnapshotImportSet
- type SnapshotSet
- type StartOptions
- type StopOptions
- type StorageEncryption
- type StorageEncryptionSupport
- type SysInfo
- type System
- type SystemAction
- type SystemDetails
- type SystemModelData
- type SystemRecoveryKeysResponse
- type Task
- type TaskProgress
- type TransactionType
- type User
- type UserSelection
- type UserSelector
- type ValidateApplyOptions
- type ValidationSetResult
- type Warning
- type WarningsOptions
Constants ¶
const ( StatusAvailable = "available" StatusInstalled = "installed" StatusActive = "active" StatusRemoved = "removed" StatusPriced = "priced" TypeApp = "app" TypeKernel = "kernel" TypeGadget = "gadget" TypeOS = "os" StrictConfinement = "strict" DevModeConfinement = "devmode" ClassicConfinement = "classic" )
Statuses and types a snap may have.
const ( // forcefull disabled by the device StorageEncryptionSupportDisabled = "disabled" // encryption available and usable StorageEncryptionSupportAvailable = "available" StorageEncryptionSupportUnavailable = "unavailable" // encryption unavailable and required, this is an error StorageEncryptionSupportDefective = "defective" )
const AllowInteractionHeader = "X-Allow-Interaction"
AllowInteractionHeader is the HTTP request header used to indicate that the client is willing to allow interaction.
const SnapshotExportMediaType = "application/x.snapd.snapshot"
SnapshotExportMediaType is the media type used to identify snapshot exports in the API.
Variables ¶
var ( ErrSnapshotSetNotFound = errors.New("no snapshot set with the given ID") ErrSnapshotSnapsNotFound = errors.New("no snapshot for the requested snaps found in the set with the given ID") )
var ErrDangerousNotApplicable = fmt.Errorf("dangerous option only meaningful when installing from a local file")
var ErrNoData = fmt.Errorf("data entry not found")
var ErrNoNames = errors.New(`"names" must not be empty`)
ErrNoNames is returned by Start, Stop, or Restart, when the given list of things on which to operate is empty.
var ErrNoSnapsInstalled = errors.New("no snaps installed")
Functions ¶
func InternalSnapctlCmdNeedsStdin ¶
InternalSnapctlCmdNeedsStdin returns true if the given snapctl command needs data from stdin
func IsAssertionNotFoundError ¶
IsAssertionNotFoundError returns whether the given error means that the assertion wasn't found and thus the device isn't ready/seeded.
func IsInterfacesUnchangedError ¶
IsInterfacesUnchangedError returns whether the given error means the requested change to interfaces was not made, because there was nothing to do.
func IsRetryable ¶
IsRetryable returns true if the given error is an error that can be retried later.
func IsTwoFactorError ¶
IsTwoFactorError returns whether the given error is due to problems in two-factor authentication.
func MockDoTimings ¶
MockDoTimings mocks the delay used by the do retry loop and request timeout.
Types ¶
type AliasStatus ¶
type AliasStatus struct { Command string `json:"command"` Status string `json:"status"` Manual string `json:"manual,omitempty"` Auto string `json:"auto,omitempty"` }
AliasStatus represents the status of an alias.
type AppActivator ¶
type AppActivator struct { Name string // Type describes the type of the unit, either timer or socket Type string Active bool Enabled bool }
AppActivator is a thing that activates the app that is a service in the system.
type AppInfo ¶
type AppInfo struct { Snap string `json:"snap,omitempty"` Name string `json:"name"` DesktopFile string `json:"desktop-file,omitempty"` Daemon string `json:"daemon,omitempty"` DaemonScope snap.DaemonScope `json:"daemon-scope,omitempty"` Enabled bool `json:"enabled,omitempty"` Active bool `json:"active,omitempty"` CommonID string `json:"common-id,omitempty"` Activators []AppActivator `json:"activators,omitempty"` }
AppInfo describes a single snap application.
type AppOptions ¶
type AppOptions struct { // If Service is true, only return apps that are services // (app.IsService() is true); otherwise, return all. Service bool // Global if set, returns only the global status of the services. This // is only relevant for user services, where we either return the status // of the services for the current user, or the global enable status. // For root-users, global is always implied. Global bool }
AppOptions represent the options of the Apps call.
type AuthorizationError ¶
type AuthorizationError struct{ Err error }
func (AuthorizationError) Error ¶
func (e AuthorizationError) Error() string
func (AuthorizationError) Is ¶
func (e AuthorizationError) Is(target error) bool
type AvailableForInstall ¶
type AvailableForInstall struct { // Snaps contains the names of optional snaps that are available for installation. Snaps []string `json:"snaps,omitempty"` // Components contains a mapping of snap names to lists of the names of // optional components that are available for installation. Components map[string][]string `json:"components,omitempty"` }
AvailableForInstall contains information about snaps and components that are optional in the system's model, but are available for installation.
type BuyOptions ¶
type BuyOptions struct { SnapID string `json:"snap-id"` Price float64 `json:"price"` Currency string `json:"currency"` // ISO 4217 code as string }
BuyOptions specifies parameters to buy from the store.
type BuyResult ¶
type BuyResult struct {
State string `json:"state,omitempty"`
}
BuyResult holds the state of a buy attempt.
type Change ¶
type Change struct { ID string `json:"id"` Kind string `json:"kind"` Summary string `json:"summary"` Status string `json:"status"` Tasks []*Task `json:"tasks,omitempty"` Ready bool `json:"ready"` Err string `json:"err,omitempty"` SpawnTime time.Time `json:"spawn-time,omitempty"` ReadyTime time.Time `json:"ready-time,omitempty"` // contains filtered or unexported fields }
A Change is a modification to the system state.
type ChangeSelector ¶
type ChangeSelector uint8
const ( ChangesInProgress ChangeSelector = 1 << iota ChangesReady ChangesAll = ChangesReady | ChangesInProgress )
func (ChangeSelector) String ¶
func (c ChangeSelector) String() string
type ChangesOptions ¶
type ChangesOptions struct { SnapName string // if empty, no filtering by name is done Selector ChangeSelector }
type Client ¶
type Client struct { // SetMayLogBody controls whether a request or response's body may be logged // if the appropriate environment variable is set SetMayLogBody func(bool) // contains filtered or unexported fields }
A Client knows how to talk to the snappy daemon.
func (*Client) Ack ¶
Ack 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) Aliases ¶
func (client *Client) Aliases() (allStatuses map[string]map[string]AliasStatus, err error)
Aliases returns a map snap -> alias -> AliasStatus for all snaps and aliases in the system.
func (*Client) ApplyValidationSet ¶
func (client *Client) ApplyValidationSet(accountID, name string, opts *ValidateApplyOptions) (res *ValidationSetResult, err error)
ApplyValidationSet applies the given validation set identified by account and name and returns the new validation set tracking info. For monitoring mode the returned res may indicate invalid state.
func (*Client) Apps ¶
func (client *Client) Apps(names []string, opts AppOptions) ([]*AppInfo, error)
Apps returns information about all matching apps. Each name can be either a snap or a snap.app. If names is empty, list all (that satisfy opts).
func (*Client) AssertionTypes ¶
AssertionTypes returns a list of assertion type names.
func (*Client) Categories ¶
Categories returns the list of existing snap categories in the store
func (*Client) CheckSnapshots ¶
func (client *Client) CheckSnapshots(setID uint64, snaps []string, users []string) (changeID string, err error)
CheckSnapshots verifies the archive checksums in the given snapshot set.
If snaps or users are non-empty, limit to checking only those archives of the snapshot.
func (*Client) Conf ¶
func (client *Client) Conf(snapName string, keys []string) (configuration map[string]interface{}, err error)
Conf asks for a snap's current configuration.
Note that the configuration may include json.Numbers.
func (*Client) Connect ¶
func (client *Client) Connect(plugSnapName, plugName, slotSnapName, slotName string) (changeID string, err error)
Connect establishes a connection between a plug and a slot. The plug and the slot must have the same interface.
func (*Client) Connections ¶
func (client *Client) Connections(opts *ConnectionOptions) (Connections, error)
Connections returns matching plugs, slots and their connections. Unless specified by matching options, returns established connections.
func (*Client) CreateCohorts ¶
func (*Client) CreateUser ¶
func (client *Client) CreateUser(options *CreateUserOptions) (*CreateUserResult, error)
CreateUser creates a local system user. See CreateUserOptions for details.
func (*Client) CreateUsers ¶
func (client *Client) CreateUsers(options []*CreateUserOptions) ([]*CreateUserResult, error)
CreateUsers creates multiple local system users. See CreateUserOptions for details.
Results may be provided even if there are errors.
func (*Client) CurrentModelAssertion ¶
CurrentModelAssertion returns the current model assertion
func (*Client) CurrentSerialAssertion ¶
CurrentSerialAssertion returns the current serial assertion
func (*Client) Debug ¶
Debug is only useful when writing test code, it will trigger an internal action with the given parameters.
func (*Client) DebugRaw ¶
func (client *Client) DebugRaw(ctx context.Context, method, urlpath string, query url.Values, headers map[string]string, body io.Reader) (*http.Response, error)
DebugRaw allows to make raw queries to the API with the intention of using it from the debug code.
func (*Client) Disable ¶
func (client *Client) Disable(name string, options *SnapOptions) (changeID string, err error)
func (*Client) DisableAllAliases ¶
// DisableAllAliases disables all aliases of a snap, removing all manual ones.
func (*Client) Disconnect ¶
func (client *Client) Disconnect(plugSnapName, plugName, slotSnapName, slotName string, opts *DisconnectOptions) (changeID string, err error)
Disconnect breaks the connection between a plug and a slot.
func (*Client) DoSystemAction ¶
func (client *Client) DoSystemAction(systemLabel string, action *SystemAction) error
DoSystemAction issues a request to perform an action using the given seed system and its mode.
func (*Client) Download ¶
func (client *Client) Download(name string, options *DownloadOptions) (dlInfo *DownloadInfo, r io.ReadCloser, err error)
Download will stream the given snap to the client
func (*Client) Enable ¶
func (client *Client) Enable(name string, options *SnapOptions) (changeID string, err error)
func (*Client) EnsureQuota ¶
func (client *Client) EnsureQuota(groupName string, opts *EnsureQuotaOptions) (changeID string, err error)
EnsureQuota creates a quota group or updates an existing group with the options provided.
func (*Client) Find ¶
func (client *Client) Find(opts *FindOptions) ([]*Snap, *ResultInfo, error)
Find returns a list of snaps available for install from the store for this system and that match the query
func (*Client) ForgetSnapshots ¶
ForgetSnapshots permanently removes the snapshot set, limited to the given snaps (if non-empty).
func (*Client) ForgetValidationSet ¶
ForgetValidationSet forgets the given validation set identified by account, name and optional sequence (if non-zero).
func (*Client) GetQuotaGroup ¶
func (client *Client) GetQuotaGroup(groupName string) (*QuotaGroupResult, error)
func (*Client) HoldRefreshes ¶
func (client *Client) HoldRefreshes(name string, options *SnapOptions) (changeID string, err error)
func (*Client) HoldRefreshesMany ¶
func (client *Client) HoldRefreshesMany(names []string, options *SnapOptions) (changeID string, err error)
func (*Client) Install ¶
func (client *Client) Install(name string, components []string, options *SnapOptions) (changeID string, err error)
Install adds the snap with the given name from the given channel (or the system default channel if not).
func (*Client) InstallMany ¶
func (*Client) InstallPath ¶
func (client *Client) InstallPath(path, name string, options *SnapOptions) (changeID string, err error)
InstallPath sideloads the snap with the given path under optional provided name, returning the UUID of the background operation upon success.
func (*Client) InstallPathMany ¶
func (client *Client) InstallPathMany(paths []string, options *SnapOptions) (changeID string, err error)
InstallPathMany sideloads the snaps with the given paths, returning the UUID of the background operation upon success.
func (*Client) InstallSystem ¶
func (client *Client) InstallSystem(systemLabel string, opts *InstallSystemOptions) (changeID string, err error)
InstallSystem will perform the given install step for the given volumes
func (*Client) Interfaces ¶
func (client *Client) Interfaces(opts *InterfaceOptions) ([]*Interface, error)
func (*Client) InternalConsoleConfStart ¶
InternalConsoleConfStart invokes the dedicated console-conf start support to handle intervening auto-refreshes. Not for general use.
func (*Client) Known ¶
func (client *Client) Known(assertTypeName string, headers map[string]string, opts *KnownOptions) ([]asserts.Assertion, error)
Known queries assertions with type assertTypeName and matching assertion headers.
func (*Client) List ¶
func (client *Client) List(names []string, opts *ListOptions) ([]*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 (*Client) ListSystems ¶
ListSystems list all systems available for seeding or recovery.
func (*Client) ListValidationsSets ¶
func (client *Client) ListValidationsSets() ([]*ValidationSetResult, error)
ListValidationsSets queries all validation sets.
func (*Client) LoggedInUser ¶
LoggedInUser returns the logged in User or nil
func (*Client) Logs ¶
func (client *Client) Logs(names []string, opts LogOptions) (<-chan Log, error)
Logs asks for the logs of a series of services, by name.
func (*Client) Maintenance ¶
Maintenance returns an error reflecting the daemon maintenance status or nil.
func (*Client) MigrateSnapHome ¶
func (*Client) Notify ¶
func (client *Client) Notify(opts *NotifyOptions) (string, error)
Notify records an occurrence of a notice with the specified options, returning the notice ID.
func (*Client) Okay ¶
Okay asks snapd to chill about the warnings that would have been returned by Warnings at the given time.
func (*Client) Prefer ¶
Prefer enables all aliases of a snap in preference to conflicting aliases of other snaps whose aliases will be disabled (removed for manual ones).
func (*Client) Quotas ¶
func (client *Client) Quotas() ([]*QuotaGroupResult, error)
func (*Client) ReadyToBuy ¶
func (*Client) RebootToSystem ¶
RebootToSystem issues a request to reboot into system with the given label and the given mode.
When called without a systemLabel and without a mode it will just trigger a regular reboot.
When called without a systemLabel but with a mode it will use the current system to enter the given mode.
Note that "recover" and "run" modes are only available for the current system.
func (*Client) Refresh ¶
func (client *Client) Refresh(name string, options *SnapOptions) (changeID string, err error)
Refresh refreshes the snap with the given name (switching it to track the given channel if given).
func (*Client) RefreshMany ¶
func (client *Client) RefreshMany(names []string, options *SnapOptions) (changeID string, err error)
func (*Client) RegistryGetViaView ¶
func (*Client) RegistrySetViaView ¶
func (*Client) Remodel ¶
func (client *Client) Remodel(b []byte, opts RemodelOpts) (changeID string, err error)
Remodel tries to remodel the system with the given assertion data
func (*Client) RemodelWithLocalSnaps ¶
func (client *Client) RemodelWithLocalSnaps( model []byte, snapPaths, assertPaths []string) (changeID string, err error)
RemodelWithLocalSnaps tries to remodel the system with the given model assertion and local snaps and assertion files. Remodeling using this method will ensure that snapd does not contact the store.
func (*Client) Remove ¶
func (client *Client) Remove(name string, components []string, options *SnapOptions) (changeID string, err error)
Remove removes the snap with the given name, or only the specified components if present.
func (*Client) RemoveManualAlias ¶
RemoveManualAlias removes a manual alias.
func (*Client) RemoveMany ¶
func (client *Client) RemoveMany(names []string, components map[string][]string, options *SnapOptions) (changeID string, err error)
RemoveMany removes the snaps in names and the components as a map of snap names to a list of components.
func (*Client) RemoveQuotaGroup ¶
func (*Client) RemoveUser ¶
func (client *Client) RemoveUser(options *RemoveUserOptions) (removed []*User, err error)
RemoveUser removes a local system user.
func (*Client) Restart ¶
func (client *Client) Restart(names []string, scope ScopeSelector, users UserSelector, opts RestartOptions) (changeID string, err error)
Restart services.
It takes a list of names that can be snaps, of which all their services are restarted, or snap.service which are individual services to restart; it shouldn't be empty. If the service is not running, starts it.
func (*Client) RestoreSnapshots ¶
func (client *Client) RestoreSnapshots(setID uint64, snaps []string, users []string) (changeID string, err error)
RestoreSnapshots extracts the given snapshot set.
If snaps or users are non-empty, limit to checking only those archives of the snapshot.
func (*Client) Revert ¶
func (client *Client) Revert(name string, options *SnapOptions) (changeID string, err error)
Revert rolls the snap back to the previous on-disk state
func (*Client) RunSnapctl ¶
func (client *Client) RunSnapctl(options *SnapCtlOptions, stdin io.Reader) (stdout, stderr []byte, err error)
RunSnapctl requests a snapctl run for the given options.
func (*Client) Sections ¶
Sections returns the list of existing snap sections in the store This is deprecated, use Categories() instead.
func (*Client) ServerVersion ¶
func (client *Client) ServerVersion() (*ServerVersion, error)
func (*Client) SetConf ¶
func (client *Client) SetConf(snapName string, patch map[string]interface{}) (changeID string, err error)
SetConf requests a snap to apply the provided patch to the configuration.
func (*Client) Snap ¶
func (client *Client) Snap(name string) (*Snap, *ResultInfo, error)
Snap returns the most recently published revision of the snap with the provided name.
func (*Client) SnapshotExport ¶
func (client *Client) SnapshotExport(setID uint64) (stream io.ReadCloser, contentLength int64, err error)
SnapshotExport streams the requested snapshot set.
The return value includes the length of the returned stream.
func (*Client) SnapshotImport ¶
SnapshotImport imports an exported snapshot set.
func (*Client) SnapshotMany ¶
func (client *Client) SnapshotMany(names []string, users []string) (setID uint64, changeID string, err error)
SnapshotMany snapshots many snaps (all, if names empty) for many users (all, if users is empty).
func (*Client) SnapshotSets ¶
func (client *Client) SnapshotSets(setID uint64, snapNames []string) ([]SnapshotSet, error)
SnapshotSets lists the snapshot sets in the system that belong to the given set (if non-zero) and are for the given snaps (if non-empty).
func (*Client) Start ¶
func (client *Client) Start(names []string, scope ScopeSelector, users UserSelector, opts StartOptions) (changeID string, err error)
Start services.
It takes a list of names that can be snaps, of which all their services are started, or snap.service which are individual services to start; it shouldn't be empty.
func (*Client) Stop ¶
func (client *Client) Stop(names []string, scope ScopeSelector, users UserSelector, opts StopOptions) (changeID string, err error)
Stop services.
It takes a list of names that can be snaps, of which all their services are stopped, or snap.service which are individual services to stop; it shouldn't be empty.
func (*Client) StoreAccount ¶
func (client *Client) StoreAccount(accountID string) (*snap.StoreAccount, error)
StoreAccount returns the full store account info for the specified accountID
func (*Client) Switch ¶
func (client *Client) Switch(name string, options *SnapOptions) (changeID string, err error)
Switch moves the snap to a different channel without a refresh
func (*Client) SystemDetails ¶
func (client *Client) SystemDetails(systemLabel string) (*SystemDetails, error)
func (*Client) SystemRecoveryKeys ¶
func (*Client) Try ¶
func (client *Client) Try(path string, options *SnapOptions) (changeID string, err error)
Try
func (*Client) Unalias ¶
Unalias tears down a manual alias or disables all aliases of a snap (removing all manual ones)
func (*Client) UnholdRefreshes ¶
func (client *Client) UnholdRefreshes(name string, options *SnapOptions) (changeID string, err error)
func (*Client) UnholdRefreshesMany ¶
func (client *Client) UnholdRefreshesMany(names []string, options *SnapOptions) (changeID string, err error)
func (*Client) ValidationSet ¶
func (client *Client) ValidationSet(accountID, name string, sequence int) (*ValidationSetResult, error)
ValidationSet queries the given validation set identified by account/name.
func (*Client) Warnings ¶
func (client *Client) Warnings(opts WarningsOptions) ([]*Warning, error)
Warnings returns the list of un-okayed warnings.
func (*Client) WarningsSummary ¶
WarningsSummary returns the number of warnings that are ready to be shown to the user, and the timestamp of the most recently added warning (useful for silencing the warning alerts, and OKing the returned warnings).
type CohortAction ¶
type Component ¶
type Component struct { Name string `json:"name"` Type snap.ComponentType `json:"type"` Version string `json:"version"` Summary string `json:"summary"` Description string `json:"description"` Revision snap.Revision `json:"revision"` InstalledSize int64 `json:"installed-size,omitempty"` InstallDate *time.Time `json:"install-date,omitempty"` }
Component describes a component for API purposes TODO we will eventually add a "status" field when it becomes clear which states can a component have.
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 // DisableAuth controls whether the client should send an // Authorization header from reading the auth.json data. DisableAuth bool // Interactive controls whether the client runs in interactive mode. // At present, this only affects whether interactive polkit // authorisation is requested. Interactive bool // Socket is the path to the unix socket to use Socket string // DisableKeepAlive indicates whether the connections should not be kept // alive for later reuse DisableKeepAlive bool // User-Agent to sent to the snapd daemon UserAgent string }
Config allows to customize client behavior.
type Connection ¶
type Connection struct { Slot SlotRef `json:"slot"` Plug PlugRef `json:"plug"` Interface string `json:"interface"` // Manual is set for connections that were established manually. Manual bool `json:"manual"` // Gadget is set for connections that were enabled by the gadget snap. Gadget bool `json:"gadget"` // SlotAttrs is the list of attributes of the slot side of the connection. SlotAttrs map[string]interface{} `json:"slot-attrs,omitempty"` // PlugAttrs is the list of attributes of the plug side of the connection. PlugAttrs map[string]interface{} `json:"plug-attrs,omitempty"` }
Connection describes a connection between a plug and a slot.
type ConnectionError ¶
type ConnectionError struct{ Err error }
func (ConnectionError) Error ¶
func (e ConnectionError) Error() string
func (ConnectionError) Unwrap ¶
func (e ConnectionError) Unwrap() error
type ConnectionOptions ¶
type ConnectionOptions struct { // Snap selects connections with the snap on one of the sides, as well // as plugs and slots of a given snap. Snap string // Interface selects connections, plugs or slots using given interface. Interface string // All when true, selects established and undesired connections as well // as all disconnected plugs and slots. All bool }
ConnectionOptions contains criteria for selecting matching connections, plugs and slots.
type Connections ¶
type Connections struct { // Established is the list of connections that are currently present. Established []Connection `json:"established"` // Undersired is a list of connections that are manually denied. Undesired []Connection `json:"undesired"` Plugs []Plug `json:"plugs"` Slots []Slot `json:"slots"` }
Connections contains information about connections, as well as related plugs and slots.
type CreateSystemOptions ¶
type CreateSystemOptions struct { // Label is the label of the new system. Label string `json:"label,omitempty"` // ValidationSets is a list of validation sets that snaps in the newly // created system should be validated against. ValidationSets []string `json:"validation-sets,omitempty"` // TestSystem is true if the system should be tested by rebooting into the // new system. TestSystem bool `json:"test-system,omitempty"` // MarkDefault is true if the system should be marked as the default // recovery system. MarkDefault bool `json:"mark-default,omitempty"` // Offline is true if the system should be created without reaching out to // the store. In the JSON variant of the API, only pre-installed // snaps/assertions will be considered. Offline bool `json:"offline,omitempty"` }
CreateSystemOptions contains the options for creating a new recovery system.
type CreateUserOptions ¶
type CreateUserOptions struct { Email string `json:"email,omitempty"` Sudoer bool `json:"sudoer,omitempty"` Known bool `json:"known,omitempty"` ForceManaged bool `json:"force-managed,omitempty"` // Automatic is for internal snapd use, behavior might evolve Automatic bool `json:"automatic,omitempty"` }
CreateUserOptions holds options for creating a local system user.
If Known is false, the provided email is used to query the store for username and SSH key details.
If Known is true, the user will be created by looking through existing system-user assertions and looking for a matching email. If Email is empty then all such assertions are considered and multiple users may be created.
type CreateUserResult ¶
type CreateUserResult struct { Username string `json:"username"` SSHKeys []string `json:"ssh-keys"` }
CreateUserResult holds the result of a user creation.
type DisconnectOptions ¶
type DisconnectOptions struct {
Forget bool
}
DisconnectOptions represents extra options for disconnect op
type DownloadInfo ¶
type DownloadOptions ¶
type DownloadOptions struct { SnapOptions HeaderPeek bool ResumeToken string Resume int64 }
type EnsureQuotaOptions ¶
type EnsureQuotaOptions struct { // Parent is used to assign a Parent quota group Parent string // Snaps that should be added to the quota group Snaps []string // Services that should be added to the quota group Services []string // Constraints are the resource limits that should be applied to the quota group, // these are added or modified, not removed. Constraints *QuotaValues }
type Error ¶
type Error struct { Kind ErrorKind `json:"kind"` Value interface{} `json:"value"` Message string `json:"message"` StatusCode int }
Error is the real value of response.Result when an error occurs.
type ErrorKind ¶
type ErrorKind string
ErrorKind distinguishes kind of errors.
const ( // ErrorKindTwoFactorRequired: the client needs to retry the // `login` command including an OTP. ErrorKindTwoFactorRequired ErrorKind = "two-factor-required" // ErrorKindTwoFactorFailed: the OTP provided wasn't recognised. ErrorKindTwoFactorFailed ErrorKind = "two-factor-failed" // ErrorKindLoginRequired: the requested operation cannot be // performed without an authenticated user. This is the kind // of any other 401 Unauthorized response. ErrorKindLoginRequired ErrorKind = "login-required" // ErrorKindInvalidAuthData: the authentication data provided // failed to validate (e.g. a malformed email address). The // `value` of the error is an object with a key per failed field // and a list of the failures on each field. ErrorKindInvalidAuthData ErrorKind = "invalid-auth-data" // ErrorKindPasswordPolicy: provided password doesn't meet // system policy. ErrorKindPasswordPolicy ErrorKind = "password-policy" // ErrorKindAuthCancelled: authentication was cancelled by the user. ErrorKindAuthCancelled ErrorKind = "auth-cancelled" // ErrorKindTermsNotAccepted: deprecated, do not document. ErrorKindTermsNotAccepted ErrorKind = "terms-not-accepted" // ErrorKindNoPaymentMethods: deprecated, do not document. ErrorKindNoPaymentMethods ErrorKind = "no-payment-methods" // ErrorKindPaymentDeclined: deprecated, do not document. ErrorKindPaymentDeclined ErrorKind = "payment-declined" // ErrorKindSnapAlreadyInstalled: the requested snap is // already installed. ErrorKindSnapAlreadyInstalled ErrorKind = "snap-already-installed" // ErrorKindSnapNotInstalled: the requested snap is not installed. ErrorKindSnapNotInstalled ErrorKind = "snap-not-installed" // ErrorKindSnapNotFound: the requested snap couldn't be found. ErrorKindSnapNotFound ErrorKind = "snap-not-found" // ErrorKindAppNotFound: the requested app couldn't be found. ErrorKindAppNotFound ErrorKind = "app-not-found" // ErrorKindSnapLocal: cannot perform operation on local snap. ErrorKindSnapLocal ErrorKind = "snap-local" // ErrorKindSnapNeedsDevMode: the requested snap needs devmode // to be installed. ErrorKindSnapNeedsDevMode ErrorKind = "snap-needs-devmode" // ErrorKindSnapNeedsClassic: the requested snap needs classic // confinement to be installed. ErrorKindSnapNeedsClassic ErrorKind = "snap-needs-classic" // ErrorKindSnapNeedsClassicSystem: the requested snap can't // be installed on the current non-classic system. ErrorKindSnapNeedsClassicSystem ErrorKind = "snap-needs-classic-system" // ErrorKindSnapNotClassic: snap not compatible with classic mode. ErrorKindSnapNotClassic ErrorKind = "snap-not-classic" // ErrorKindSnapNoUpdateAvailable: the requested snap does not // have an update available. ErrorKindSnapNoUpdateAvailable ErrorKind = "snap-no-update-available" // ErrorKindSnapRevisionNotAvailable: no snap revision available // as specified. ErrorKindSnapRevisionNotAvailable ErrorKind = "snap-revision-not-available" // ErrorKindSnapChannelNotAvailable: no snap revision on specified // channel. The `value` of the error is a rich object with // requested `snap-name`, `action`, `channel`, `architecture`, and // actually available `releases` as list of // `{"architecture":... , "channel": ...}` objects. ErrorKindSnapChannelNotAvailable ErrorKind = "snap-channel-not-available" // ErrorKindSnapArchitectureNotAvailable: no snap revision on // specified architecture. Value has the same format as for // `snap-channel-not-available`. ErrorKindSnapArchitectureNotAvailable ErrorKind = "snap-architecture-not-available" // ErrorKindSnapChangeConflict: the requested operation would // conflict with currently ongoing change. This is a temporary // error. The error `value` is an object with optional fields // `snap-name`, `change-kind` of the ongoing change. ErrorKindSnapChangeConflict ErrorKind = "snap-change-conflict" // ErrorKindQuotaChangeConflict: the requested operation would // conflict with a currently ongoing change affecting the quota // group. This is a temporary error. The error `value` is an // object with optional fields `quota-name`, `change-kind` of the // ongoing change. ErrorKindQuotaChangeConflict ErrorKind = "quota-change-conflict" // ErrorKindNotSnap: the given snap or directory does not // look like a snap. ErrorKindNotSnap ErrorKind = "snap-not-a-snap" // ErrorKindInterfacesUnchanged: the requested interfaces' // operation would have no effect. ErrorKindInterfacesUnchanged ErrorKind = "interfaces-unchanged" // ErrorKindBadQuery: a bad query was provided. ErrorKindBadQuery ErrorKind = "bad-query" // ErrorKindConfigNoSuchOption: the given configuration option // does not exist. ErrorKindConfigNoSuchOption ErrorKind = "option-not-found" // ErrorKindAssertionNotFound: assertion can not be found. ErrorKindAssertionNotFound ErrorKind = "assertion-not-found" // ErrorKindUnsuccessful: snapctl command was unsuccessful. ErrorKindUnsuccessful ErrorKind = "unsuccessful" // ErrorKindNetworkTimeout: a timeout occurred during the request. ErrorKindNetworkTimeout ErrorKind = "network-timeout" // ErrorKindDNSFailure: DNS not responding. ErrorKindDNSFailure ErrorKind = "dns-failure" // ErrorKindInsufficientDiskSpace: not enough disk space to perform the request. ErrorKindInsufficientDiskSpace ErrorKind = "insufficient-disk-space" // ErrorKindValidationSetNotFound: validation set cannot be found. ErrorKindValidationSetNotFound ErrorKind = "validation-set-not-found" // ErrorKindAppArmorPromptingNotRunning: AppArmor Prompting is not running. ErrorKindAppArmorPromptingNotRunning ErrorKind = "apparmor-prompting-not-running" // ErrorKindInterfacesRequestsPromptNotFound: interfaces requests prompt not found. ErrorKindInterfacesRequestsPromptNotFound ErrorKind = "interfaces-requests-prompt-not-found" // ErrorKindInterfacesRequestsRuleNotFound: interfaces requests rule not found. ErrorKindInterfacesRequestsRuleNotFound ErrorKind = "interfaces-requests-rule-not-found" // ErrorKindInterfacesRequestsInvalidFields: POST body to prompting API contains invalid fields. ErrorKindInterfacesRequestsInvalidFields ErrorKind = "interfaces-requests-invalid-fields" // ErrorKindInterfacesRequestsReplyNotMatchRequest: the prompt reply does not match the path and/or permissions which were requested. ErrorKindInterfacesRequestsReplyNotMatchRequest ErrorKind = "interfaces-requests-reply-not-match-request" // ErrorKindInterfacesRequestsRuleConflict: a rule with conflicting path pattern and permissions already exists. ErrorKindInterfacesRequestsRuleConflict ErrorKind = "interfaces-requests-rule-conflict" )
Error kinds. Keep https://forum.snapcraft.io/t/using-the-rest-api/18603#heading--errors in sync using doc/error-kinds.go.
const ( // ErrorKindDaemonRestart: daemon is restarting. ErrorKindDaemonRestart ErrorKind = "daemon-restart" // ErrorKindSystemRestart: system is restarting. ErrorKindSystemRestart ErrorKind = "system-restart" )
Maintenance error kinds. These are used only inside the maintenance field of responses. Keep https://forum.snapcraft.io/t/using-the-rest-api/18603#heading--maint-errors in sync using doc/error-kinds.go.
type FindOptions ¶
type FindOptions struct { // Query is a term to search by or a prefix (if Prefix is true) Query string Prefix bool CommonID string Category string // Section is deprecated, use Category instead. Section string Private bool Scope string Refresh bool }
FindOptions supports exactly one of the following options: - Refresh: only return snaps that are refreshable - Private: return snaps that are private - Query: only return snaps that match the query string
type InstallStep ¶
type InstallStep string
const ( // Creates a change to setup encryption for the partitions // with system-{data,save} roles. The successful change has a // created device mapper devices ready to use. InstallStepSetupStorageEncryption InstallStep = "setup-storage-encryption" // Creates a change to finish the installation. The change // ensures all volume structure content is written to disk, it // sets up boot, kernel etc and when finished the installed // system is ready for reboot. InstallStepFinish InstallStep = "finish" )
type InstallSystemOptions ¶
type InstallSystemOptions struct { // Step is the install step, either "setup-storage-encryption" // or "finish". Step InstallStep `json:"step,omitempty"` // OnVolumes is the volume description of the volumes that the // given step should operate on. OnVolumes map[string]*gadget.Volume `json:"on-volumes,omitempty"` // OptionalInstall contains the optional snaps and components that should be // installed on the system. Omitting this field will result in all optional // snaps and components being installed. To install none of the optional // snaps and components, provide an empty OptionalInstallRequest with the // All field set to false. OptionalInstall *OptionalInstallRequest `json:"optional-install,omitempty"` }
type Interface ¶
type Interface struct { Name string `json:"name,omitempty"` Summary string `json:"summary,omitempty"` DocURL string `json:"doc-url,omitempty"` Plugs []Plug `json:"plugs,omitempty"` Slots []Slot `json:"slots,omitempty"` }
Interface holds information about a given interface and its instances.
type InterfaceAction ¶
type InterfaceAction struct { Action string `json:"action"` Forget bool `json:"forget,omitempty"` Plugs []Plug `json:"plugs,omitempty"` Slots []Slot `json:"slots,omitempty"` }
InterfaceAction represents an action performed on the interface system.
type InterfaceOptions ¶
InterfaceOptions represents opt-in elements include in responses.
type InternalClientError ¶
type InternalClientError struct{ Err error }
func (InternalClientError) Error ¶
func (e InternalClientError) Error() string
func (InternalClientError) Is ¶
func (e InternalClientError) Is(target error) bool
type InternalConsoleConfStartResponse ¶
type InternalConsoleConfStartResponse struct { ActiveAutoRefreshChanges []string `json:"active-auto-refreshes,omitempty"` ActiveAutoRefreshSnaps []string `json:"active-auto-refresh-snaps,omitempty"` }
InternalConsoleConfStartResponse is the response from console-conf start support
type KnownOptions ¶
type KnownOptions struct { // If Remote is true, the store is queried to find the assertion Remote bool }
KnownOptions represent the options of the Known call.
type ListOptions ¶
type ListOptions struct {
All bool
}
type Log ¶
type Log struct { Timestamp time.Time `json:"timestamp"` // Timestamp of the event, in RFC3339 format to µs precision. Message string `json:"message"` // The log message itself SID string `json:"sid"` // The syslog identifier PID string `json:"pid"` // The process identifier }
A Log holds the information of a single syslog entry
func (Log) StringInUTC ¶
StringInUTC will format the log entry with the timestamp in UTC
type LogOptions ¶
type LogOptions struct { N int // The maximum number of log lines to retrieve initially. If <0, no limit. Follow bool // Whether to continue returning new lines as they appear }
LogOptions represent the options of the Logs call.
type NoticeType ¶
type NoticeType string
const ( // SnapRunInhibitNotice is recorded when "snap run" is inhibited due refresh. SnapRunInhibitNotice NoticeType = "snap-run-inhibit" )
type NotifyOptions ¶
type NotifyOptions struct { // Type is the notice's type. Currently only notices of type CustomNotice // can be added. Type NoticeType // Key is the notice's key. For "custom" notices, this must be in // "domain.com/key" format. Key string }
type OptionalInstallRequest ¶
type OptionalInstallRequest struct { AvailableForInstall // All is true if all optional snaps and components should be installed. It // is invalid to set both All and the individual fields in AvailableForInstall. All bool `json:"all,omitempty"` }
type Plug ¶
type Plug struct { Snap string `json:"snap"` Name string `json:"plug"` Interface string `json:"interface,omitempty"` Attrs map[string]interface{} `json:"attrs,omitempty"` Apps []string `json:"apps,omitempty"` Label string `json:"label,omitempty"` Connections []SlotRef `json:"connections,omitempty"` }
Plug represents the potential of a given snap to connect to a slot.
type QuotaCPUSetValues ¶
type QuotaCPUSetValues struct {
CPUs []int `json:"cpus,omitempty"`
}
type QuotaCPUValues ¶
type QuotaGroupResult ¶
type QuotaGroupResult struct { GroupName string `json:"group-name"` Parent string `json:"parent,omitempty"` Subgroups []string `json:"subgroups,omitempty"` Snaps []string `json:"snaps,omitempty"` Services []string `json:"services,omitempty"` Constraints *QuotaValues `json:"constraints,omitempty"` Current *QuotaValues `json:"current,omitempty"` }
type QuotaJournalRate ¶
type QuotaJournalValues ¶
type QuotaJournalValues struct { Size quantity.Size `json:"size,omitempty"` *QuotaJournalRate }
type QuotaValues ¶
type QuotaValues struct { Memory quantity.Size `json:"memory,omitempty"` CPU *QuotaCPUValues `json:"cpu,omitempty"` CPUSet *QuotaCPUSetValues `json:"cpu-set,omitempty"` Threads int `json:"threads,omitempty"` Journal *QuotaJournalValues `json:"journal,omitempty"` }
type RefreshInfo ¶
type RefreshInfo struct { // Timer contains the refresh.timer setting. Timer string `json:"timer,omitempty"` // Schedule contains the legacy refresh.schedule setting. Schedule string `json:"schedule,omitempty"` Last string `json:"last,omitempty"` Hold string `json:"hold,omitempty"` Next string `json:"next,omitempty"` }
RefreshInfo contains information about refreshes.
type RemodelOpts ¶
type RemodelOpts struct { // Offline indicates whether the remodel should be done offline. If true, // the remodel will be attempted to be done without contacting the store. Offline bool }
RemodelOpts defines options to be used when remodeling the system.
type RemoveUserOptions ¶
type RemoveUserOptions struct { // Username indicates which user to remove. Username string `json:"username,omitempty"` }
RemoveUserOptions holds options for removing a local system user.
type RequestError ¶
type RequestError struct {
// contains filtered or unexported fields
}
func (RequestError) Error ¶
func (e RequestError) Error() string
type RestartOptions ¶
type RestartOptions struct { // Reload the services, if possible (i.e. if the App has a // ReloadCommand, invoque it), instead of restarting. Reload bool `json:"reload,omitempty"` }
RestartOptions represent the different options of the Restart call.
type ResultInfo ¶
type ResultInfo struct {
SuggestedCurrency string `json:"suggested-currency"`
}
type ScopeSelector ¶
type ScopeSelector []string
func (*ScopeSelector) UnmarshalJSON ¶
func (ss *ScopeSelector) UnmarshalJSON(b []byte) error
type ServerVersion ¶
type Slot ¶
type Slot struct { Snap string `json:"snap"` Name string `json:"slot"` Interface string `json:"interface,omitempty"` Attrs map[string]interface{} `json:"attrs,omitempty"` Apps []string `json:"apps,omitempty"` Label string `json:"label,omitempty"` Connections []PlugRef `json:"connections,omitempty"` }
Slot represents a capacity offered by a snap.
type Snap ¶
type Snap struct { ID string `json:"id"` Title string `json:"title,omitempty"` Summary string `json:"summary"` Description string `json:"description"` DownloadSize int64 `json:"download-size,omitempty"` Icon string `json:"icon,omitempty"` InstalledSize int64 `json:"installed-size,omitempty"` InstallDate *time.Time `json:"install-date,omitempty"` Name string `json:"name"` Publisher *snap.StoreAccount `json:"publisher,omitempty"` StoreURL string `json:"store-url,omitempty"` // Developer is also the publisher's username for historic reasons. Developer string `json:"developer"` Status string `json:"status"` Type string `json:"type"` Base string `json:"base,omitempty"` Version string `json:"version"` Channel string `json:"channel"` TrackingChannel string `json:"tracking-channel,omitempty"` IgnoreValidation bool `json:"ignore-validation"` Revision snap.Revision `json:"revision"` Confinement string `json:"confinement"` Private bool `json:"private"` DevMode bool `json:"devmode"` JailMode bool `json:"jailmode"` TryMode bool `json:"trymode,omitempty"` Apps []AppInfo `json:"apps,omitempty"` Broken string `json:"broken,omitempty"` License string `json:"license,omitempty"` CommonIDs []string `json:"common-ids,omitempty"` MountedFrom string `json:"mounted-from,omitempty"` CohortKey string `json:"cohort-key,omitempty"` Links map[string][]string `json:"links,omitempy"` // legacy fields before we had links Contact string `json:"contact"` Website string `json:"website,omitempty"` Prices map[string]float64 `json:"prices,omitempty"` Screenshots []snap.ScreenshotInfo `json:"screenshots,omitempty"` Media snap.MediaInfos `json:"media,omitempty"` Categories []snap.CategoryInfo `json:"categories,omitempty"` // The flattended channel map with $track/$risk Channels map[string]*snap.ChannelSnapInfo `json:"channels,omitempty"` // The ordered list of tracks that contains channels Tracks []string `json:"tracks,omitempty"` Health *SnapHealth `json:"health,omitempty"` // Hold is the time until which the snap's refreshes are held by the user. Hold *time.Time `json:"hold,omitempty"` // GatingHold is the time until which the snap's refreshes are held by a snap. GatingHold *time.Time `json:"gating-hold,omitempty"` // if RefreshInhibit is nil, then there is no pending refresh. RefreshInhibit *SnapRefreshInhibit `json:"refresh-inhibit,omitempty"` // Components is a list of the snap components Components []Component `json:"components,omitempty"` }
Snap holds the data for a snap as obtained from snapd.
type SnapCtlOptions ¶
type SnapCtlOptions struct { // ContextID is a string used to determine the context of this call (e.g. // which context and handler should be used, etc.) ContextID string `json:"context-id"` // Args contains a list of parameters to use for this invocation. Args []string `json:"args"` }
SnapCtlOptions holds the various options with which snapctl is invoked.
type SnapCtlPostData ¶
type SnapCtlPostData struct { SnapCtlOptions Stdin []byte `json:"stdin,omitempty"` }
SnapCtlPostData is the data posted to the daemon /v2/snapctl endpoint TODO: this can be removed again once we no longer need to pass stdin data but instead use a real stdin stream
type SnapHealth ¶
type SnapOptions ¶
type SnapOptions struct { Channel string `json:"channel,omitempty"` Revision string `json:"revision,omitempty"` CohortKey string `json:"cohort-key,omitempty"` LeaveCohort bool `json:"leave-cohort,omitempty"` DevMode bool `json:"devmode,omitempty"` JailMode bool `json:"jailmode,omitempty"` Classic bool `json:"classic,omitempty"` Dangerous bool `json:"dangerous,omitempty"` IgnoreValidation bool `json:"ignore-validation,omitempty"` IgnoreRunning bool `json:"ignore-running,omitempty"` Unaliased bool `json:"unaliased,omitempty"` Prefer bool `json:"prefer,omitempty"` Purge bool `json:"purge,omitempty"` Terminate bool `json:"terminate,omitempty"` Amend bool `json:"amend,omitempty"` Transaction TransactionType `json:"transaction,omitempty"` QuotaGroupName string `json:"quota-group,omitempty"` ValidationSets []string `json:"validation-sets,omitempty"` Time string `json:"time,omitempty"` HoldLevel string `json:"hold-level,omitempty"` Users []string `json:"users,omitempty"` }
type SnapRefreshInhibit ¶
type SnapRefreshInhibit struct { // ProceedTime is the time after which a pending refresh is forced for a // running snap in the next auto-refresh. // // NOTE: ProceedTime may be in the past, if a refresh is still pending and // the snap applications are being monitored. ProceedTime time.Time `json:"proceed-time"` }
type Snapshot ¶
type Snapshot struct { // SetID is the ID of the snapshot set (a snapshot set is the result of a "snap save" invocation) SetID uint64 `json:"set"` // the time this snapshot's data collection was started Time time.Time `json:"time"` // information about the snap this data is for Snap string `json:"snap"` Revision snap.Revision `json:"revision"` SnapID string `json:"snap-id,omitempty"` Epoch snap.Epoch `json:"epoch,omitempty"` Summary string `json:"summary"` Version string `json:"version"` // the snap's configuration at snapshot time Conf map[string]interface{} `json:"conf,omitempty"` // the hash of the archives' data, keyed by archive path // (either 'archive.tgz' for the system archive, or // user/<username>.tgz for each user) SHA3_384 map[string]string `json:"sha3-384"` // the sum of the archive sizes Size int64 `json:"size,omitempty"` // dynamic snapshot options Options *snap.SnapshotOptions `json:"options,omitempty"` // if the snapshot failed to open this will be the reason why Broken string `json:"broken,omitempty"` // set if the snapshot was created automatically on snap removal; // note, this is only set inside actual snapshot file for old snapshots; // newer snapd just updates this flag on the fly for snapshots // returned by List(). Auto bool `json:"auto,omitempty"` }
A Snapshot is a collection of archives with a simple metadata json file (and hashsums of everything).
func (*Snapshot) ContentHash ¶
ContentHash returns a hash that can be used to identify the snapshot by its content, leaving out metadata like "time" or "set-id".
type SnapshotImportSet ¶
SnapshotImportSet is a snapshot import created by a "snap import-snapshot".
type SnapshotSet ¶
A SnapshotSet is a set of snapshots created by a single "snap save".
func (SnapshotSet) ContentHash ¶
func (ss SnapshotSet) ContentHash() ([]byte, error)
ContentHash returns a hash that can be used to identify the SnapshotSet by its content.
func (SnapshotSet) Size ¶
func (ss SnapshotSet) Size() int64
Size returns the sum of the set's sizes.
func (SnapshotSet) Time ¶
func (ss SnapshotSet) Time() time.Time
Time returns the earliest time in the set.
type StartOptions ¶
type StartOptions struct { // Enable, as well as starting, the listed services. A // disabled service does not start on boot. Enable bool `json:"enable,omitempty"` }
StartOptions represent the different options of the Start call.
type StopOptions ¶
type StopOptions struct { // Disable, as well as stopping, the listed services. A // service that is not disabled starts on boot. Disable bool `json:"disable,omitempty"` }
StopOptions represent the different options of the Stop call.
type StorageEncryption ¶
type StorageEncryption struct { // Support describes the level of hardware support available. Support StorageEncryptionSupport `json:"support"` // StorageSafety can have values of asserts.StorageSafety StorageSafety string `json:"storage-safety,omitempty"` // Type has values of secboot.EncryptionType: "", "cryptsetup", // "cryptsetup-with-inline-crypto-engine" Type string `json:"encryption-type,omitempty"` // available in a human readable form. Depending on if // encryption is required or not this should be presented to // the user as either an error or as information. UnavailableReason string `json:"unavailable-reason,omitempty"` }
type StorageEncryptionSupport ¶
type StorageEncryptionSupport string
type SysInfo ¶
type SysInfo struct { Series string `json:"series,omitempty"` Version string `json:"version,omitempty"` BuildID string `json:"build-id"` OSRelease OSRelease `json:"os-release"` OnClassic bool `json:"on-classic"` Managed bool `json:"managed"` KernelVersion string `json:"kernel-version,omitempty"` Architecture string `json:"architecture,omitempty"` Virtualization string `json:"virtualization,omitempty"` Refresh RefreshInfo `json:"refresh,omitempty"` Confinement string `json:"confinement"` SandboxFeatures map[string][]string `json:"sandbox-features,omitempty"` Features map[string]features.FeatureInfo `json:"features,omitempty"` }
SysInfo holds system information
type System ¶
type System struct { // Current is true when the system running now was installed from that // recovery seed Current bool `json:"current,omitempty"` // Label of the recovery system Label string `json:"label,omitempty"` // Model information Model SystemModelData `json:"model,omitempty"` // Brand information Brand snap.StoreAccount `json:"brand,omitempty"` // Actions available for this system Actions []SystemAction `json:"actions,omitempty"` // DefaultRecoverySystem is true when the system is the default recovery system DefaultRecoverySystem bool `json:"default-recovery-system,omitempty"` }
type SystemAction ¶
type SystemDetails ¶
type SystemDetails struct { // First part is designed to look like `client.System` - the // only difference is how the model is represented Current bool `json:"current,omitempty"` Label string `json:"label,omitempty"` Model map[string]interface{} `json:"model,omitempty"` Brand snap.StoreAccount `json:"brand,omitempty"` Actions []SystemAction `json:"actions,omitempty"` // Volumes contains the volumes defined from the gadget snap Volumes map[string]*gadget.Volume `json:"volumes,omitempty"` StorageEncryption *StorageEncryption `json:"storage-encryption,omitempty"` // AvailableOptional contains the optional snaps and components that are // available in this system. AvailableOptional AvailableForInstall `json:"available-optional"` }
type SystemModelData ¶
type SystemModelData struct { // Model as the model assertion Model string `json:"model,omitempty"` // BrandID corresponds to brand-id in the model assertion BrandID string `json:"brand-id,omitempty"` // DisplayName is human friendly name, corresponds to display-name in // the model assertion DisplayName string `json:"display-name,omitempty"` }
SystemModelData contains information about the model
type Task ¶
type Task struct { ID string `json:"id"` Kind string `json:"kind"` Summary string `json:"summary"` Status string `json:"status"` Log []string `json:"log,omitempty"` Progress TaskProgress `json:"progress"` SpawnTime time.Time `json:"spawn-time,omitempty"` ReadyTime time.Time `json:"ready-time,omitempty"` }
A Task is an operation done to change the system's state.
type TaskProgress ¶
type TransactionType ¶
type TransactionType string
TransactionType says whether we want to treat each snap separately (the transaction is per snap) or whether to consider the call a single transaction so everything is reverted if it fails for just one snap. This applies to installs and updates, which can be done for multiple snaps in the same API call.
const ( TransactionAllSnaps TransactionType = "all-snaps" TransactionPerSnap TransactionType = "per-snap" )
type User ¶
type User struct { ID int `json:"id,omitempty"` Username string `json:"username,omitempty"` Email string `json:"email,omitempty"` Macaroon string `json:"macaroon,omitempty"` Discharges []string `json:"discharges,omitempty"` }
User holds logged in user information.
type UserSelection ¶
type UserSelection int
const ( UserSelectionList UserSelection = iota UserSelectionSelf UserSelectionAll )
type UserSelector ¶
type UserSelector struct { Names []string Selector UserSelection }
UserSelector is a support structure for correctly translating a way of representing both a list of user-names, and specific keywords like "self" and "all" for JSON marshalling.
When "Selector == UserSelectionList" then Names is used as the data source and the data is treated like a list of strings. When "Selector == UserSelectionSelf|UserSelectionAll", then the data source will be a single string that represent this in the form of "self|all".
func (UserSelector) MarshalJSON ¶
func (us UserSelector) MarshalJSON() ([]byte, error)
func (*UserSelector) UnmarshalJSON ¶
func (us *UserSelector) UnmarshalJSON(b []byte) error
type ValidateApplyOptions ¶
ValidateApplyOptions carries options for ApplyValidationSet.
type ValidationSetResult ¶
type ValidationSetResult struct { AccountID string `json:"account-id"` Name string `json:"name"` Sequence int `json:"sequence,omitempty"` PinnedAt int `json:"pinned-at,omitempty"` Mode string `json:"mode"` Valid bool `json:"valid"` }
ValidationSetResult holds information about a single validation set.
type Warning ¶
type Warning struct { Message string `json:"message"` FirstAdded time.Time `json:"first-added"` LastAdded time.Time `json:"last-added"` LastShown time.Time `json:"last-shown,omitempty"` ExpireAfter time.Duration `json:"expire-after,omitempty"` RepeatAfter time.Duration `json:"repeat-after,omitempty"` }
A Warning is a short messages that's meant to alert about system events. There'll only ever be one Warning with the same message, and it can be silenced for a while before repeating. After a (supposedly longer) while it'll go away on its own (unless it recurrs).
type WarningsOptions ¶
type WarningsOptions struct {
All bool
}
WarningsOptions contains options for querying snapd for warnings supported options: - All: return all warnings, instead of only the un-okayed ones.
Source Files ¶
Directories ¶
Path | Synopsis |
---|---|
Package clientutil offers utilities to turn snap.Info and related structs into client structs and to work with the latter.
|
Package clientutil offers utilities to turn snap.Info and related structs into client structs and to work with the latter. |