Documentation ¶
Index ¶
- Constants
- Variables
- func ActivateMaintenanceApp(c *space.Space, appSlug string, opts MaintenanceOptions) error
- func ActivateMaintenanceVirtualSpace(virtualSpaceName, appSlug string, opts MaintenanceOptions) error
- func ChannelToStr(channel Channel) string
- func CleanOldVersions(space *space.Space, appSlug, channel string, params base.CleanParameters, ...) error
- func CreatePendingVersion(c *space.Space, ver *Version, attachments []*kivik.Attachment, app *App) error
- func CreateReleaseVersion(c *space.Space, ver *Version, attachments []*kivik.Attachment, app *App, ...) (err error)
- func DeactivateMaintenanceApp(c *space.Space, appSlug string) error
- func DeactivateMaintenanceVirtualSpace(virtualSpaceName, appSlug string) error
- func DeleteOverwrittenVersion(s base.VirtualSpace, version *Version) error
- func DeletePendingVersion(c *space.Space, version *Version) error
- func FindAppOverride(virtualSpace *base.VirtualSpace, appSlug string, name string) (string, error)
- func GetSlugs(c *space.Space) ([]string, error)
- func HandleAssets(tarball *Tarball, opts *VersionOptions) ([]*kivik.Attachment, error)
- func IsValidApp(app *AppOptions) error
- func IsValidVersion(ver *VersionOptions) error
- func MoveAssetToGlobalDatabase(c *space.Space, ver *Version, content []byte, filename, contentType string) error
- func OverwriteAppIcon(virtualSpaceName, appSlug, file string) error
- func OverwriteAppName(virtualSpaceName, appSlug, newName string) error
- func RegenerateOverwrittenTarballs(virtualSpaceName string, appSlug string) (err error)
- func RemoveAppFromSpace(s *space.Space, appSlug string) error
- func RemoveSpace(s *space.Space) error
- type App
- func CreateApp(c *space.Space, opts *AppOptions, editor *auth.Editor) (*App, error)
- func FindApp(v *base.VirtualSpace, c *space.Space, appSlug string, channel Channel) (*App, error)
- func GetAppsList(v *base.VirtualSpace, c *space.Space, opts *AppsListOptions) (int, []*App, error)
- func GetMaintainanceApps(c *space.Space) ([]*App, error)
- func ModifyApp(c *space.Space, appSlug string, opts AppOptions) (*App, error)
- type AppOptions
- type AppVersions
- func FindAppVersions(c *space.Space, appSlug string, channel Channel, concat ConcatChannels) (*AppVersions, error)
- func FindAppVersionsCacheMiss(c *space.Space, appSlug string, channel Channel, concat ConcatChannels) (*AppVersions, error)
- func GetVersionsListFromCache(c *space.Space, channelStr string, apps []*App) []*AppVersions
- type AppsListOptions
- type Attachment
- func FindAppAttachment(c *space.Space, appSlug, filename string, channel Channel) (*Attachment, error)
- func FindAttachmentFromOverwrite(space *base.VirtualSpace, appSlug, filename string) (*Attachment, bool, error)
- func FindOverwrittenTarball(space *base.VirtualSpace, version *Version) (*Attachment, bool, error)
- func FindVersionAttachment(c *space.Space, version *Version, filename string) (*Attachment, error)
- type Channel
- type ConcatChannels
- type Developer
- type Label
- type Locales
- type MaintenanceMessage
- type MaintenanceOptions
- type Manifest
- type Partnership
- type Platform
- type RunType
- type Tarball
- type Version
- func ApprovePendingVersion(c *space.Space, pending *Version, app *App) (*Version, error)
- func DownloadVersion(opts *VersionOptions) (*Version, []*kivik.Attachment, error)
- func FindLastNVersions(c *space.Space, appSlug string, channelStr string, nMajor, nMinor int) ([]*Version, error)
- func FindLastsVersionsSince(c *space.Space, appSlug, channel string, date time.Time) ([]*Version, error)
- func FindLatestVersion(c *space.Space, appSlug string, channel Channel) (*Version, error)
- func FindLatestVersionCacheMiss(v *base.VirtualSpace, c *space.Space, appSlug string, channel Channel) (*Version, error)
- func FindLatestVersionWithOverride(v *base.VirtualSpace, c *space.Space, appSlug string, channel Channel) (*Version, error)
- func FindOverwrittenVersion(space *base.VirtualSpace, version *Version) (*Version, error)
- func FindPendingVersion(c *space.Space, appSlug, version string) (*Version, error)
- func FindPublishedVersion(c *space.Space, appSlug, version string) (*Version, error)
- func FindVersion(c *space.Space, appSlug, version string) (*Version, error)
- func GetAppChannelVersions(c *space.Space, appSlug string, channel Channel) ([]*Version, error)
- func GetAppPengindVersions(c *space.Space, appSlug string) ([]*Version, error)
- func GetPendingVersions(c *space.Space) ([]*Version, error)
- func GetVersionsLatestFromCache(c *space.Space, channelStr string, apps []*App) []*Version
- type VersionOptions
Constants ¶
const ( LabelA = iota LabelB LabelC LabelD LabelE LabelF )
The label scores go from A to F.
const ( DUCUserCiphered = "user_ciphered" DUCUserReserved = "user_reserved" DUCNone = "none" )
"DUC" stands for DataUserCommitment
const ( DUCByCozy = "cozy" DUCByEditor = "editor" DUCByNone = "none" )
"DUCBy" stands for DataUserCommitmentBy
Variables ¶
var ( ErrAppAlreadyExists = errshttp.NewError(http.StatusConflict, "Application already exists") ErrAppNotFound = errshttp.NewError(http.StatusNotFound, "Application was not found") ErrAppSlugMismatch = errshttp.NewError(http.StatusBadRequest, "Application slug does not match the one specified in the body") ErrAppSlugInvalid = errshttp.NewError(http.StatusBadRequest, "Invalid application slug: should contain only lowercase alphanumeric characters and dashes") ErrAppEditorMismatch = errshttp.NewError(http.StatusBadRequest, "Application can not be updated: editor can not change") ErrAppTypeMismatch = errshttp.NewError(http.StatusBadRequest, "Application can not be updated: type can not change") ErrVersionAlreadyExists = errshttp.NewError(http.StatusConflict, "Version already exists") ErrVersionSlugMismatch = errshttp.NewError(http.StatusBadRequest, "Version slug does not match the application") ErrVersionNotFound = errshttp.NewError(http.StatusNotFound, "Version was not found") ErrVersionInvalid = errshttp.NewError(http.StatusBadRequest, "Invalid version value") ErrChannelInvalid = errshttp.NewError(http.StatusBadRequest, `Invalid version channel: should be "stable", "beta" or "dev"`) )
var Channels = []Channel{Stable, Beta, Dev}
Functions ¶
func ActivateMaintenanceApp ¶
func ActivateMaintenanceApp(c *space.Space, appSlug string, opts MaintenanceOptions) error
func ActivateMaintenanceVirtualSpace ¶
func ActivateMaintenanceVirtualSpace(virtualSpaceName, appSlug string, opts MaintenanceOptions) error
ActivateMaintenanceVirtualSpace tells that an app is in maintenance in the given virtual space.
func ChannelToStr ¶
ChannelToStr returns a string that describes the channel.
func CleanOldVersions ¶
func CleanOldVersions(space *space.Space, appSlug, channel string, params base.CleanParameters, run RunType) error
CleanOldVersions removes a specific app version of a space
func CreatePendingVersion ¶
func CreateReleaseVersion ¶
func DeactivateMaintenanceVirtualSpace ¶
DeactivateMaintenanceVirtualSpace tells that an app is no longer in maintenance in the given virtual space.
func DeleteOverwrittenVersion ¶
func DeleteOverwrittenVersion(s base.VirtualSpace, version *Version) error
func FindAppOverride ¶
FindAppOverride finds if the app have overwritten value in the virtual space
func HandleAssets ¶
func HandleAssets(tarball *Tarball, opts *VersionOptions) ([]*kivik.Attachment, error)
HandleAssets handles all the assets of the app tarball (icon, partnership icon, screenshots). Appened to attachments
func IsValidApp ¶
func IsValidApp(app *AppOptions) error
func IsValidVersion ¶
func IsValidVersion(ver *VersionOptions) error
func MoveAssetToGlobalDatabase ¶
func MoveAssetToGlobalDatabase(c *space.Space, ver *Version, content []byte, filename, contentType string) error
MoveAssetToGlobalDatabase moves an asset located in the "local" container in the global database. This function is not intended to stay forever and will be removed when no more assets will be remaining in the app containers. It does the following steps: 1. Creating the new asset object in the global database 2. Adds a reference to the asset in the couch version document 3. Removes the old asset location
func OverwriteAppIcon ¶
OverwriteAppIcon tells that an app will have a different icon in the virtual space.
func OverwriteAppName ¶
OverwriteAppName tells that an app will have a different name in the virtual space.
func RemoveAppFromSpace ¶
RemoveAppFromSpace deletes an application and all its versions from a space.
func RemoveSpace ¶
RemoveSpace deletes CouchDB databases and Swift container for this space.
Types ¶
type App ¶
type App struct { ID string `json:"_id,omitempty"` Rev string `json:"_rev,omitempty"` Slug string `json:"slug"` Type string `json:"type"` Editor string `json:"editor"` CreatedAt time.Time `json:"created_at"` MaintenanceActivated bool `json:"maintenance_activated,omitempty"` MaintenanceOptions *MaintenanceOptions `json:"maintenance_options,omitempty"` DataUsageCommitment string `json:"data_usage_commitment"` DataUsageCommitmentBy string `json:"data_usage_commitment_by"` // Calculated fields, not present in the database Versions *AppVersions `json:"versions,omitempty"` Label Label `json:"label"` LatestVersion *Version `json:"latest_version,omitempty"` }
func GetAppsList ¶
func GetAppsList(v *base.VirtualSpace, c *space.Space, opts *AppsListOptions) (int, []*App, error)
type AppOptions ¶
type AppVersions ¶
type AppVersions struct { HasVersions bool `json:"has_versions"` Stable []string `json:"stable,omitempty"` Beta []string `json:"beta,omitempty"` Dev []string `json:"dev,omitempty"` }
func FindAppVersions ¶
func FindAppVersions(c *space.Space, appSlug string, channel Channel, concat ConcatChannels) (*AppVersions, error)
FindAppVersions return all the app versions. The concat params allows you to concatenate stable & beta versions in dev list, and stable versions in beta list
func FindAppVersionsCacheMiss ¶
func FindAppVersionsCacheMiss(c *space.Space, appSlug string, channel Channel, concat ConcatChannels) (*AppVersions, error)
func GetVersionsListFromCache ¶
func GetVersionsListFromCache(c *space.Space, channelStr string, apps []*App) []*AppVersions
func (*AppVersions) GetAll ¶
func (av *AppVersions) GetAll() []string
type AppsListOptions ¶
type Attachment ¶
func FindAppAttachment ¶
func FindAttachmentFromOverwrite ¶
func FindAttachmentFromOverwrite(space *base.VirtualSpace, appSlug, filename string) (*Attachment, bool, error)
FindAttachmentFromOverwrite finds if the app was overwritten in the virtual space.
func FindOverwrittenTarball ¶
func FindOverwrittenTarball(space *base.VirtualSpace, version *Version) (*Attachment, bool, error)
func FindVersionAttachment ¶
type Channel ¶
type Channel int
Channel is a way to regroup versions of an application, in function of the expected stability.
func GetVersionChannel ¶
GetVersionChannel returns the channel in which a version is published.
func StrToChannel ¶
StrToChannel returns the channel from a string.
type ConcatChannels ¶
type ConcatChannels bool
ConcatChannels type
const ( Concatenated ConcatChannels = true NotConcatenated ConcatChannels = false )
type MaintenanceMessage ¶
type MaintenanceOptions ¶
type MaintenanceOptions struct { FlagInfraMaintenance bool `json:"flag_infra_maintenance"` FlagShortMaintenance bool `json:"flag_short_maintenance"` FlagDisallowManualExec bool `json:"flag_disallow_manual_exec"` Messages map[string]MaintenanceMessage `json:"messages"` }
type Manifest ¶
type Manifest struct { Editor string `json:"editor"` Name string `json:"name"` Slug string `json:"slug"` Version string `json:"version"` Icon string `json:"icon"` Partnership Partnership `json:"partnership"` Screenshots []string `json:"screenshots"` Locales map[string]struct { Screenshots []string `json:"screenshots"` } `json:"locales"` }
Manifest type contains a subset of the attributes contained in the manifest of applications. It is only here to help us reading some informations from the manifest that are useful to us, without manipulating maps.
type Partnership ¶
type Tarball ¶
type Tarball struct { Manifest *Manifest ManifestContent []byte ManifestMap map[string]interface{} PackageVersion string HasPrefix bool TarPrefix string ContentType string AppType string Content []byte URL string Size int64 }
Tarball holds all the data from a downloaded app version
func ReadTarballVersion ¶
ReadTarballVersion reads the content of the version tarball which has been downloaded. It reads the tarball to check if an app prefix exists, ensure that the manifest and the package.json (if exists) files are correct, and eventually returns a Tarball struct that holds these informations for the next steps
func (*Tarball) CheckEditor ¶
CheckEditor validates a tarball manifest editor
type Version ¶
type Version struct { ID string `json:"_id,omitempty"` Rev string `json:"_rev,omitempty"` AttachmentReferences map[string]string `json:"attachments"` Slug string `json:"slug"` Editor string `json:"editor"` Type string `json:"type"` Version string `json:"version"` Manifest json.RawMessage `json:"manifest"` CreatedAt time.Time `json:"created_at"` URL string `json:"url"` Size int64 `json:"size,string"` Sha256 string `json:"sha256"` TarPrefix string `json:"tar_prefix"` }
func ApprovePendingVersion ¶
func DownloadVersion ¶
func DownloadVersion(opts *VersionOptions) (*Version, []*kivik.Attachment, error)
func FindLastNVersions ¶
func FindLastNVersions(c *space.Space, appSlug string, channelStr string, nMajor, nMinor int) ([]*Version, error)
FindLastNVersions returns the N lasts versions of an app If N is greater than available versions, only available are returned
func FindLastsVersionsSince ¶
func FindLastsVersionsSince(c *space.Space, appSlug, channel string, date time.Time) ([]*Version, error)
FindLastsVersionsSince returns versions of a channel up to a date
Example: FindLastsVersionSince("foo", "stable", myDate) returns all the versions created beetween myDate and now
func FindLatestVersion ¶
func FindOverwrittenVersion ¶
func FindOverwrittenVersion(space *base.VirtualSpace, version *Version) (*Version, error)
func FindPendingVersion ¶
func FindPublishedVersion ¶
func GetAppChannelVersions ¶
GetAppChannelVersions returns the versions list of an app channel
func GetAppPengindVersions ¶
type VersionOptions ¶
type VersionOptions struct { Version string `json:"version"` URL string `json:"url"` Sha256 string `json:"sha256"` Parameters json.RawMessage `json:"parameters"` Icon string `json:"icon"` Partnership Partnership `json:"partnership"` Screenshots []string `json:"screenshots"` SpacePrefix base.Prefix RegistryURL *url.URL }