dsapid

package module
v0.7.2 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Dec 29, 2016 License: MIT Imports: 1 Imported by: 18

README

A public dsapi / imgapi server

to publish datasets and images for SmartOS

The primary goal here is it to use the server with imgadm on SmartOS. The API is functional for that purpose and every aspect of the official API that is not needed for imgadm has second priority.

Version 0.6.2 is tested with imgadm on platform 20140111T020931Z.

Differences from the official dsapi

  • all images on the server are public and can be downloaded by everyone
  • maybe not all API methods are implemented
  • definitely the upload machanism is different

Why did we build this?

there is already the official repository for datasets so this one is useless

NO - ever tried to publish own images onto the official server? The community builds datasets from time to time and it's a bummer that those are not usable by a larger group of the community

TODO

  • Cleaner / easier upload mechanism
  • ACL for images
  • Stats

Version history

0.6.4: changes to the syncer to accept a provider tag from dsapi sources 0.6.2: make code repository public

Changes from earlier versions (0.1.x)

  • rewritten in Go
  • no database server anymore: all action saved in plain files
  • added export possibility: download a tarball of an image to imgadm install somewhere

Documentation

Index

Constants

View Source
const (
	DefaultUserGuestName string = "guest"

	UserTypeUser   UserType = "user"
	UserTypeSystem UserType = "system"

	UserRoleAdmin UserRoleName = "admin"
	UserRoleGuest UserRoleName = "guest"

	UserRoleDatasetUpload UserRoleName = "s_dataset.upload"
	UserRoleDatasetManage UserRoleName = "s_dataset.manage"
	UserRoleDatasetAdmin  UserRoleName = "s_dataset.admin"

	DefaultUserUuid string = "a979f956-12cb-4216-bf4c-ae73e6f14dde"
	DefaultUserName string = "sdc"

	DefaultSyncDelay string = "8h"

	SyncTypeDsapi  SyncType = "dsapi"
	SyncTypeImgapi SyncType = "imgapi"

	SyncProviderJoyent    SyncProvider = "joyent"
	SyncProviderEc        SyncProvider = "ec"
	SyncProviderElys      SyncProvider = "elys"
	SyncProviderCommunity SyncProvider = "community"
	SyncProviderTesting   SyncProvider = "testing"
	SyncProviderUnknown   SyncProvider = "unknown"

	ManifestStatePending    ManifestState = "pending"
	ManifestStateActive     ManifestState = "active"
	ManifestStateInactive   ManifestState = "unactivated"
	ManifestStateDisabled   ManifestState = "disabled"
	ManifestStateDeprecated ManifestState = "deprecated"
	ManifestStateNuked      ManifestState = "nuked"

	ManifestTypeZone ManifestType = "zone-dataset"
	ManifestTypeLx   ManifestType = "lx-dataset"
	ManifestTypeZvol ManifestType = "zvol"

	CompressionTypeGzip  CompressionType = "gzip"
	CompressionTypeBzip2 CompressionType = "bzip2"
	CompressionTypeXz    CompressionType = "xz"
	CompressionTypeNone  CompressionType = "none"
)
View Source
const (
	AppName    string = "Dataset Image Server"
	AppVersion string = "0.7.2"
)

Variables

View Source
var (
	UserTypeDescription = map[UserType]string{
		UserTypeUser:   "Real user account",
		UserTypeSystem: "System account",
	}

	SyncTypeDescription = map[SyncType]string{
		SyncTypeDsapi:  "DSAPI sync source",
		SyncTypeImgapi: "IMGAPI sync source",
	}

	SyncProviderDescription = map[SyncProvider]string{
		SyncProviderJoyent:    "Joyent",
		SyncProviderEc:        "EveryCity",
		SyncProviderCommunity: "Community",
		SyncProviderTesting:   "Testing",
	}

	ManifestStateDescription = map[ManifestState]string{
		ManifestStatePending:    "Pending",
		ManifestStateActive:     "Active",
		ManifestStateInactive:   "Not activated",
		ManifestStateDisabled:   "Disabled",
		ManifestStateDeprecated: "Deprecated",
		ManifestStateNuked:      "Nuked",
	}

	ManifestTypeDescription = map[ManifestType]string{
		ManifestTypeZone: "zone dataset",
		ManifestTypeZvol: "KVM volume",
	}

	CompressionExtensionMap = map[string]CompressionType{
		"gz":   CompressionTypeGzip,
		"bz":   CompressionTypeBzip2,
		"bz2":  CompressionTypeBzip2,
		"xz":   CompressionTypeXz,
		"none": CompressionTypeNone,
	}

	CompressionTypeExtensionMap = map[CompressionType]string{
		CompressionTypeGzip:  ".gz",
		CompressionTypeBzip2: ".bz2",
		CompressionTypeXz:    ".xz",
		CompressionTypeNone:  "",
	}
)

Functions

This section is empty.

Types

type CompressionType

type CompressionType string

type ManifestFileResource

type ManifestFileResource struct {
	Path        string          `json:"path"`
	Size        int64           `json:"size"`
	Sha1        string          `json:"sha1"`
	Md5         string          `json:"md5"`
	Compression CompressionType `json:"compression"`
}

type ManifestFilter

type ManifestFilter func(*ManifestResource) bool

type ManifestResource

type ManifestResource struct {
	Uuid     string       `json:"uuid"`
	Provider SyncProvider `json:"provider,omitempty"`
	Owner    string       `json:"owner,omitempty"`

	Name        string `json:"name"`
	Version     string `json:"version"`
	Description string `json:"description"`

	Homepage string `json:"homepage,omitempty"`
	Urn      string `json:"urn,omitempty"`

	State    ManifestState `json:"state"`
	Public   bool          `json:"public"`
	Disabled bool          `json:"disabled"`

	Type ManifestType `json:"type"`
	Os   string       `json:"os"`

	// TODO: acl
	PublishedAt time.Time `json:"published_at"`
	CreatedAt   time.Time `json:"created_at"`

	Requirements Table   `json:"requirements"`
	Users        []Table `json:"users,omitempty"`
	Tags         Table   `json:"tags,omitempty"`
	Options      Table   `json:"options,omitempty"`

	MetadataInfo []Table `json:"metadata_info"`
	BuilderInfo  Table   `json:"builder_info"`
	SyncInfo     Table   `json:"sync_info"`

	Files []ManifestFileResource `json:"files"`
}

type ManifestState

type ManifestState string

type ManifestType

type ManifestType string

type SyncProvider

type SyncProvider string

type SyncSourceResource

type SyncSourceResource struct {
	Name       string       `json:"name"`
	Active     bool         `json:"active"`
	Type       SyncType     `json:"type"`
	Provider   SyncProvider `json:"provider"`
	Source     string       `json:"source,omitempty"`
	FileSource string       `json:"file_source,omitempty"`
	Delay      string       `json:"delay"`
	Opts       Table        `json:"opts,omitempty"`
}

type SyncType

type SyncType string

type Table

type Table map[string]interface{}

type UserResource

type UserResource struct {
	Uuid     string         `json:"uuid"`
	Name     string         `json:"name"`
	Password string         `json:"password,omitempty"`
	Email    string         `json:"email,omitempty"`
	Token    string         `json:"token,omitempty"`
	Type     UserType       `json:"type,omitempty"`
	Provider SyncProvider   `json:"provider,omitempty"`
	Roles    []UserRoleName `json:"roles,omitempty"`
}

func (*UserResource) GetAuthInfo

func (me *UserResource) GetAuthInfo() interface{}

func (*UserResource) GetId

func (me *UserResource) GetId() string

func (*UserResource) GetName

func (me *UserResource) GetName() string

func (*UserResource) HasRoles

func (me *UserResource) HasRoles(roles ...UserRoleName) bool

func (*UserResource) IsGuest

func (me *UserResource) IsGuest() bool

type UserRoleName

type UserRoleName string

type UserType

type UserType string

Directories

Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL