routes

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Jun 4, 2021 License: Apache-2.0, Apache-2.0 Imports: 36 Imported by: 1

Documentation

Index

Constants

View Source
const (
	TokenExpireDuration = time.Hour * 2
)

Variables

View Source
var (
	DB = dbs.DB
)
View Source
var SignedSeret = []byte("Red B")
View Source
var UrlBefore string

Functions

func Admin

func Admin(c *macaron.Context)

func AllocateAddress

func AllocateAddress(ctx context.Context, subnetID, ifaceID int64, ipaddr, addrType string) (address *model.Address, err error)

func AllocateFloatingIp

func AllocateFloatingIp(ctx context.Context, floatingipID, owner int64, gateway *model.Gateway, ftype, address string) (fipIface *model.Interface, err error)

func CreateInterface

func CreateInterface(ctx context.Context, subnetID, ID, owner, zoneID int64, hyper int32, address, mac, ifaceName, ifType string, secGroups []*model.SecurityGroup) (iface *model.Interface, err error)

func DeallocateAddress

func DeallocateAddress(ctx context.Context, ifaces []*model.Interface) (err error)

func DeallocateFloatingIp

func DeallocateFloatingIp(ctx context.Context, floatingipID int64) (err error)

func DeleteInterface

func DeleteInterface(ctx context.Context, iface *model.Interface) (err error)

func DeleteInterfaces

func DeleteInterfaces(ctx context.Context, masterID, subnetID int64, ifType string) (err error)

func FileExist

func FileExist(filename string) bool

func Index

func Index(c *macaron.Context, store session.Store)

func LinkHandler

func LinkHandler(c *macaron.Context, store session.Store)

func MakeToken

func MakeToken(instanceID int, secret string, memberShip *MemberShip) (string, error)

func New

func New() (m *macaron.Macaron)

func NewClaims

func NewClaims(u, o, uid, oid string, role model.Role) (claims jwt.Claims, issuedAt, ExpiresAt int64)

func NewToken

func NewToken(u, o, uid, oid string, role model.Role) (signed string, issueAt, expiresAt int64, err error)

func RandomStr

func RandomStr() string

Randomly generate a string of length 10

func Run

func Run() (err error)

func SetGateway

func SetGateway(ctx context.Context, subnetID, zoneID, owner int64, router *model.Gateway) (subnet *model.Subnet, iface *model.Interface, err error)

func UnsetGateway

func UnsetGateway(ctx context.Context, subnet *model.Subnet) (err error)

Types

type ConsoleAdmin

type ConsoleAdmin struct{}

type ConsoleInfo

type ConsoleInfo struct {
	Type      string `json:"type"`
	Address   string `json:"address"`
	Insecure  bool   `json:"insecure"`
	TLSTunnel bool   `json:"tlsTunnel"`
	Password  string `json:"password"`
}

type ConsoleView

type ConsoleView struct{}

func (*ConsoleView) ConsoleResolve

func (a *ConsoleView) ConsoleResolve(c *macaron.Context, store session.Store)

func (*ConsoleView) ConsoleURL

func (a *ConsoleView) ConsoleURL(c *macaron.Context, store session.Store)

type Dashboard

type Dashboard struct{}

func (*Dashboard) GetData

func (a *Dashboard) GetData(c *macaron.Context, store session.Store)

func (*Dashboard) Show

func (a *Dashboard) Show(c *macaron.Context, store session.Store)

type FlavorAdmin

type FlavorAdmin struct{}

func (*FlavorAdmin) Create

func (a *FlavorAdmin) Create(name string, cpu, memory, disk, swap, ephemeral int32) (flavor *model.Flavor, err error)

func (*FlavorAdmin) Delete

func (a *FlavorAdmin) Delete(id int64) (err error)

func (*FlavorAdmin) List

func (a *FlavorAdmin) List(offset, limit int64, order, query string) (total int64, flavors []*model.Flavor, err error)

type FlavorView

type FlavorView struct{}

func (*FlavorView) Create

func (v *FlavorView) Create(c *macaron.Context, store session.Store)

func (*FlavorView) Delete

func (v *FlavorView) Delete(c *macaron.Context, store session.Store) (err error)

func (*FlavorView) List

func (v *FlavorView) List(c *macaron.Context, store session.Store)

func (*FlavorView) New

func (v *FlavorView) New(c *macaron.Context, store session.Store)

type FloatingIpAdmin

type FloatingIpAdmin struct{}

func (*FloatingIpAdmin) Create

func (a *FloatingIpAdmin) Create(ctx context.Context, instID, ifaceID int64, types []string, publicIp, privateIp string) (floatingips []*model.FloatingIp, err error)

func (*FloatingIpAdmin) Delete

func (a *FloatingIpAdmin) Delete(ctx context.Context, id int64) (err error)

func (*FloatingIpAdmin) List

func (a *FloatingIpAdmin) List(ctx context.Context, offset, limit int64, order, query string) (total int64, floatingips []*model.FloatingIp, err error)

type FloatingIpView

type FloatingIpView struct{}

func (*FloatingIpView) Assign

func (v *FloatingIpView) Assign(c *macaron.Context, store session.Store)

func (*FloatingIpView) Create

func (v *FloatingIpView) Create(c *macaron.Context, store session.Store)

func (*FloatingIpView) Delete

func (v *FloatingIpView) Delete(c *macaron.Context, store session.Store) (err error)

func (*FloatingIpView) List

func (v *FloatingIpView) List(c *macaron.Context, store session.Store)

func (*FloatingIpView) New

func (v *FloatingIpView) New(c *macaron.Context, store session.Store)

type FloatingIps

type FloatingIps struct {
	Instance  int64  `json:"instance"`
	PublicIp  string `json:"public_ip"`
	PrivateIp string `json:"private_ip"`
}

type GatewayAdmin

type GatewayAdmin struct{}

func (*GatewayAdmin) Create

func (a *GatewayAdmin) Create(ctx context.Context, name, stype string, pubID, priID int64, subnetIDs []int64, owner, zoneID int64) (gateway *model.Gateway, err error)

func (*GatewayAdmin) Delete

func (a *GatewayAdmin) Delete(ctx context.Context, id int64) (err error)

func (*GatewayAdmin) List

func (a *GatewayAdmin) List(ctx context.Context, offset, limit int64, order, query string) (total int64, gateways []*model.Gateway, err error)

func (*GatewayAdmin) Update

func (a *GatewayAdmin) Update(ctx context.Context, id int64, name string, pubID, priID int64, subnetIDs []int64) (gateway *model.Gateway, err error)

type GatewayView

type GatewayView struct{}

func (*GatewayView) Create

func (v *GatewayView) Create(c *macaron.Context, store session.Store)

func (*GatewayView) Delete

func (v *GatewayView) Delete(c *macaron.Context, store session.Store) (err error)

func (*GatewayView) Edit

func (v *GatewayView) Edit(c *macaron.Context, store session.Store)

func (*GatewayView) List

func (v *GatewayView) List(c *macaron.Context, store session.Store)

func (*GatewayView) New

func (v *GatewayView) New(c *macaron.Context, store session.Store)

func (*GatewayView) Patch

func (v *GatewayView) Patch(c *macaron.Context, store session.Store)

type GlusterfsAdmin

type GlusterfsAdmin struct{}

func (*GlusterfsAdmin) Create

func (a *GlusterfsAdmin) Create(ctx context.Context, name, cookie string, nworkers int32, cluster, flavor, key, zoneID int64) (glusterfs *model.Glusterfs, err error)

func (*GlusterfsAdmin) Delete

func (a *GlusterfsAdmin) Delete(ctx context.Context, id int64) (err error)

func (*GlusterfsAdmin) GetState

func (a *GlusterfsAdmin) GetState(ctx context.Context, id int64) (status string, err error)

func (*GlusterfsAdmin) List

func (a *GlusterfsAdmin) List(ctx context.Context, offset, limit int64, order, query string) (total int64, glusterfses []*model.Glusterfs, err error)

func (*GlusterfsAdmin) State

func (a *GlusterfsAdmin) State(ctx context.Context, id int64, status string, nworkers int32) (err error)

func (*GlusterfsAdmin) Update

func (a *GlusterfsAdmin) Update(ctx context.Context, id, heketiKey, flavorID int64, nworkers int32) (glusterfs *model.Glusterfs, err error)

type GlusterfsView

type GlusterfsView struct{}

func (*GlusterfsView) Create

func (v *GlusterfsView) Create(c *macaron.Context, store session.Store)

func (*GlusterfsView) Delete

func (v *GlusterfsView) Delete(c *macaron.Context, store session.Store) (err error)

func (*GlusterfsView) Edit

func (v *GlusterfsView) Edit(c *macaron.Context, store session.Store)

func (*GlusterfsView) List

func (v *GlusterfsView) List(c *macaron.Context, store session.Store)

func (*GlusterfsView) New

func (v *GlusterfsView) New(c *macaron.Context, store session.Store)

func (*GlusterfsView) Patch

func (v *GlusterfsView) Patch(c *macaron.Context, store session.Store)

func (*GlusterfsView) State

func (v *GlusterfsView) State(c *macaron.Context, store session.Store)

type HyperAdmin

type HyperAdmin struct{}

func (*HyperAdmin) List

func (a *HyperAdmin) List(offset, limit int64, order, query string) (total int64, hypers []*model.Hyper, err error)

type HyperView

type HyperView struct{}

func (*HyperView) List

func (v *HyperView) List(c *macaron.Context, store session.Store)

type HypercubeClaims

type HypercubeClaims struct {
	jwt.StandardClaims
	UID  string     `json:"uid,omitempty"`
	OID  string     `json:"oid,omitempty"`
	Role model.Role `json:"r,omitempty"`
}

func ParseToken

func ParseToken(tokenString string) (tokenClaims *HypercubeClaims, err error)

type ImageAdmin

type ImageAdmin struct{}

func (*ImageAdmin) Create

func (a *ImageAdmin) Create(ctx context.Context, osVersion, diskType, virtType, userName, name, url, format, architecture string, instID int64, isLB bool) (image *model.Image, err error)

func (*ImageAdmin) Delete

func (a *ImageAdmin) Delete(ctx context.Context, id int64) (err error)

func (*ImageAdmin) List

func (a *ImageAdmin) List(offset, limit int64, order, query string) (total int64, images []*model.Image, err error)

type ImageView

type ImageView struct{}

func (*ImageView) Create

func (v *ImageView) Create(c *macaron.Context, store session.Store)

func (*ImageView) Delete

func (v *ImageView) Delete(c *macaron.Context, store session.Store) (err error)

func (*ImageView) List

func (v *ImageView) List(c *macaron.Context, store session.Store)

func (*ImageView) New

func (v *ImageView) New(c *macaron.Context, store session.Store)

type InstanceAdmin

type InstanceAdmin struct{}

func (*InstanceAdmin) ChangeInstanceStatus

func (a *InstanceAdmin) ChangeInstanceStatus(ctx context.Context, id int64, action string) (instance *model.Instance, err error)

func (*InstanceAdmin) Create

func (a *InstanceAdmin) Create(ctx context.Context, count int, prefix, userdata string, imageID, flavorID, primaryID, clusterID, zoneID int64, primaryIP, primaryMac string, subnetIDs, keyIDs []int64, sgIDs []int64, hyperID int) (instance *model.Instance, err error)

func (*InstanceAdmin) Delete

func (a *InstanceAdmin) Delete(ctx context.Context, id int64) (err error)

func (*InstanceAdmin) List

func (a *InstanceAdmin) List(ctx context.Context, offset, limit int64, order, query string) (total int64, instances []*model.Instance, err error)

func (*InstanceAdmin) Update

func (a *InstanceAdmin) Update(ctx context.Context, id, flavorID int64, hostname, action string, subnetIDs, sgIDs []int64, hyper int) (instance *model.Instance, err error)

type InstanceData

type InstanceData struct {
	Userdata string             `json:"userdata"`
	VirtType string             `json:"virt_type"`
	DNS      string             `json:"dns"`
	ZVM      []*ZvmData         `json:"zvm"`
	OCP      []*OcpData         `json:"ocp"`
	Vlans    []*VlanInfo        `json:"vlans"`
	Networks []*InstanceNetwork `json:"networks"`
	Links    []*NetworkLink     `json:"links"`
	Keys     []string           `json:"keys"`
	SecRules []*SecurityData    `json:"security"`
}

type InstanceNetwork

type InstanceNetwork struct {
	Type    string          `json:"type,omitempty"`
	Address string          `json:"ip_address"`
	Netmask string          `json:"netmask"`
	Link    string          `json:"link"`
	ID      string          `json:"id"`
	Routes  []*NetworkRoute `json:"routes,omitempty"`
}

type InstanceView

type InstanceView struct{}

func (*InstanceView) Create

func (v *InstanceView) Create(c *macaron.Context, store session.Store)

func (*InstanceView) Delete

func (v *InstanceView) Delete(c *macaron.Context, store session.Store) (err error)

func (*InstanceView) Edit

func (v *InstanceView) Edit(c *macaron.Context, store session.Store)

func (*InstanceView) List

func (v *InstanceView) List(c *macaron.Context, store session.Store)

func (*InstanceView) New

func (v *InstanceView) New(c *macaron.Context, store session.Store)

func (*InstanceView) Patch

func (v *InstanceView) Patch(c *macaron.Context, store session.Store)

func (*InstanceView) UpdateTable

func (v *InstanceView) UpdateTable(c *macaron.Context, store session.Store)

type InstancesData

type InstancesData struct {
	Instances []*model.Instance `json:"instancedata"`
	IsAdmin   bool              `json:"is_admin"`
}

type InterfaceAdmin

type InterfaceAdmin struct{}

func (*InterfaceAdmin) Update

func (a *InterfaceAdmin) Update(ctx context.Context, id int64, name, pairs string, sgIDs []int64) (iface *model.Interface, err error)

type InterfaceView

type InterfaceView struct{}

func (*InterfaceView) Create

func (v *InterfaceView) Create(c *macaron.Context, store session.Store)

func (*InterfaceView) Delete

func (v *InterfaceView) Delete(c *macaron.Context, store session.Store)

func (*InterfaceView) Edit

func (v *InterfaceView) Edit(c *macaron.Context, store session.Store)

func (*InterfaceView) Patch

func (v *InterfaceView) Patch(c *macaron.Context, store session.Store)

type KeyAdmin

type KeyAdmin struct{}

func (*KeyAdmin) Create

func (a *KeyAdmin) Create(ctx context.Context, name, pubkey, fingerprint string) (key *model.Key, err error)

func (*KeyAdmin) Delete

func (a *KeyAdmin) Delete(id int64) (err error)

func (*KeyAdmin) List

func (a *KeyAdmin) List(ctx context.Context, offset, limit int64, order, query string) (total int64, keys []*model.Key, err error)

type KeyTemp

type KeyTemp struct{}

func (*KeyTemp) Create

func (point *KeyTemp) Create() (publicKey, fingerPrint, privateKey string, err error)

func (*KeyTemp) CreateFingerPrint

func (point *KeyTemp) CreateFingerPrint(publicKey string) (fingerPrint string, err error)

type KeyView

type KeyView struct{}

func (*KeyView) Confirm

func (v *KeyView) Confirm(c *macaron.Context, store session.Store)

func (*KeyView) Create

func (v *KeyView) Create(c *macaron.Context, store session.Store)

func (*KeyView) Delete

func (v *KeyView) Delete(c *macaron.Context, store session.Store) (err error)

func (*KeyView) List

func (v *KeyView) List(c *macaron.Context, store session.Store)

func (*KeyView) New

func (v *KeyView) New(c *macaron.Context, store session.Store)

func (*KeyView) SearchDbFingerPrint

func (v *KeyView) SearchDbFingerPrint(c *macaron.Context, store session.Store, fingerPrint, publicKey, name string)

func (*KeyView) SolveListKeyError

func (v *KeyView) SolveListKeyError(c *macaron.Context, store session.Store)

func (*KeyView) SolvePrintedPublicKeyError

func (v *KeyView) SolvePrintedPublicKeyError(c *macaron.Context, store session.Store, err error)

func (*KeyView) SolvePublicKeyDbError

func (v *KeyView) SolvePublicKeyDbError(c *macaron.Context, store session.Store, name, publicKey, fingerPrint string)

type MemberShip

type MemberShip struct {
	UserID   int64
	UserName string
	OrgID    int64
	OrgName  string
	Role     model.Role
}

func GetDBMemberShip

func GetDBMemberShip(userID, orgID int64) (ms *MemberShip, err error)

func GetMemberShip

func GetMemberShip(ctx context.Context) *MemberShip

func ResolveToken

func ResolveToken(tokenString string) (int, *MemberShip, error)

func (*MemberShip) CheckAdmin

func (m *MemberShip) CheckAdmin(reqRole model.Role, table string, id int64) (admin bool, err error)

func (*MemberShip) CheckCreater

func (m *MemberShip) CheckCreater(table string, id int64) (isCreater bool, err error)

func (*MemberShip) CheckOwner

func (m *MemberShip) CheckOwner(reqRole model.Role, table string, id int64) (isOwner bool, err error)

func (*MemberShip) CheckPermission

func (m *MemberShip) CheckPermission(reqRole model.Role) (permit bool)

func (*MemberShip) CheckUser

func (m *MemberShip) CheckUser(id int64) (permit bool, err error)

func (*MemberShip) GetWhere

func (m *MemberShip) GetWhere() (where string)

func (*MemberShip) SetContext

func (m *MemberShip) SetContext(ctx context.Context) context.Context
type NetworkLink struct {
	MacAddr string `json:"ethernet_mac_address"`
	Mtu     uint   `json:"mtu"`
	ID      string `json:"id"`
	Type    string `json:"type,omitempty"`
}

type NetworkRoute

type NetworkRoute struct {
	Network string `json:"network"`
	Netmask string `json:"netmask"`
	Gateway string `json:"gateway"`
}

type OcpData

type OcpData struct {
	OcpVersion string `json:"ocpVersion"`
	Service    string `json:"service"`
}

type OpenshiftAdmin

type OpenshiftAdmin struct{}

func (*OpenshiftAdmin) Create

func (a *OpenshiftAdmin) Create(ctx context.Context, cluster, domain, cookie, haflag, extIP string, nworkers int32, lflavor, mflavor, wflavor, key, zoneID, subnetID, registryID int64, hostrec, infrtype string) (openshift *model.Openshift, err error)

func (*OpenshiftAdmin) Delete

func (a *OpenshiftAdmin) Delete(ctx context.Context, id int64) (err error)

func (*OpenshiftAdmin) GetState

func (a *OpenshiftAdmin) GetState(ctx context.Context, id int64) (status string, err error)

func (*OpenshiftAdmin) Launch

func (a *OpenshiftAdmin) Launch(ctx context.Context, id int64, hostname, ipaddr string) (instance *model.Instance, err error)

func (*OpenshiftAdmin) List

func (a *OpenshiftAdmin) List(ctx context.Context, offset, limit int64, order, query string) (total int64, openshifts []*model.Openshift, err error)

func (*OpenshiftAdmin) State

func (a *OpenshiftAdmin) State(ctx context.Context, id int64, status string) (err error)

func (*OpenshiftAdmin) Update

func (a *OpenshiftAdmin) Update(ctx context.Context, id, flavorID int64, nworkers int32) (openshift *model.Openshift, err error)

type OpenshiftView

type OpenshiftView struct{}

func (*OpenshiftView) Create

func (v *OpenshiftView) Create(c *macaron.Context, store session.Store)

func (*OpenshiftView) Delete

func (v *OpenshiftView) Delete(c *macaron.Context, store session.Store) (err error)

func (*OpenshiftView) Edit

func (v *OpenshiftView) Edit(c *macaron.Context, store session.Store)

func (*OpenshiftView) Launch

func (v *OpenshiftView) Launch(c *macaron.Context, store session.Store)

func (*OpenshiftView) List

func (v *OpenshiftView) List(c *macaron.Context, store session.Store)

func (*OpenshiftView) New

func (v *OpenshiftView) New(c *macaron.Context, store session.Store)

func (*OpenshiftView) Patch

func (v *OpenshiftView) Patch(c *macaron.Context, store session.Store)

func (*OpenshiftView) State

func (v *OpenshiftView) State(c *macaron.Context, store session.Store)

type OrgAdmin

type OrgAdmin struct {
}

func (*OrgAdmin) Create

func (a *OrgAdmin) Create(ctx context.Context, name, owner string) (org *model.Organization, err error)

func (*OrgAdmin) Delete

func (a *OrgAdmin) Delete(ctx context.Context, id int64) (err error)

func (*OrgAdmin) Get

func (a *OrgAdmin) Get(name string) (org *model.Organization, err error)

func (*OrgAdmin) List

func (a *OrgAdmin) List(ctx context.Context, offset, limit int64, order, query string) (total int64, orgs []*model.Organization, err error)

func (*OrgAdmin) Update

func (a *OrgAdmin) Update(ctx context.Context, orgID int64, members, users []string, roles []model.Role) (org *model.Organization, err error)

type OrgView

type OrgView struct{}

func (*OrgView) Create

func (v *OrgView) Create(c *macaron.Context, store session.Store)

func (*OrgView) Delete

func (v *OrgView) Delete(c *macaron.Context, store session.Store) (err error)

func (*OrgView) Edit

func (v *OrgView) Edit(c *macaron.Context, store session.Store)

func (*OrgView) List

func (v *OrgView) List(c *macaron.Context, store session.Store)

func (*OrgView) New

func (v *OrgView) New(c *macaron.Context, store session.Store)

func (*OrgView) Patch

func (v *OrgView) Patch(c *macaron.Context, store session.Store)

type Page

type Page struct {
	Number int
	Offset int
}

func GetPages

func GetPages(total, limit int64) (pages []*Page)

type PortmapAdmin

type PortmapAdmin struct{}

func (*PortmapAdmin) Create

func (a *PortmapAdmin) Create(ctx context.Context, instID int64, port int) (portmap *model.Portmap, err error)

func (*PortmapAdmin) Delete

func (a *PortmapAdmin) Delete(ctx context.Context, id int64) (err error)

func (*PortmapAdmin) List

func (a *PortmapAdmin) List(ctx context.Context, offset, limit int64, order, query string) (total int64, portmaps []*model.Portmap, err error)

type PortmapView

type PortmapView struct{}

func (*PortmapView) Create

func (v *PortmapView) Create(c *macaron.Context, store session.Store)

func (*PortmapView) Delete

func (v *PortmapView) Delete(c *macaron.Context, store session.Store) (err error)

func (*PortmapView) List

func (v *PortmapView) List(c *macaron.Context, store session.Store)

func (*PortmapView) New

func (v *PortmapView) New(c *macaron.Context, store session.Store)

type RegistryAdmin

type RegistryAdmin struct{}

func (*RegistryAdmin) Create

func (a *RegistryAdmin) Create(ctx context.Context, label, virtType, ocpVersion, registryContent, initramfs, kernel, image, installer, cli string) (registry *model.Registry, err error)

func (*RegistryAdmin) Delete

func (a *RegistryAdmin) Delete(id int64) (err error)

func (*RegistryAdmin) List

func (a *RegistryAdmin) List(offset, limit int64, order, query string) (total int64, registrys []*model.Registry, err error)

func (*RegistryAdmin) Update

func (a *RegistryAdmin) Update(ctx context.Context, id int64, label, virtType, ocpVersion, registryContent, initramfs, kernel, image, installer, cli string) (registry *model.Registry, err error)

type RegistryView

type RegistryView struct{}

func (*RegistryView) Create

func (v *RegistryView) Create(c *macaron.Context, store session.Store)

func (*RegistryView) Delete

func (v *RegistryView) Delete(c *macaron.Context, store session.Store) (err error)

func (*RegistryView) Edit

func (v *RegistryView) Edit(c *macaron.Context, store session.Store)

func (*RegistryView) List

func (v *RegistryView) List(c *macaron.Context, store session.Store)

func (*RegistryView) New

func (v *RegistryView) New(c *macaron.Context, store session.Store)

func (*RegistryView) Patch

func (v *RegistryView) Patch(c *macaron.Context, store session.Store)

type ResourceData

type ResourceData struct {
	Title       string `json:"title"`
	CpuUsed     int64  `json:"cpu_used"`
	CpuAvail    int64  `json:"cpu_avail"`
	MemUsed     int64  `json:"mem_used"`
	MemAvail    int64  `json:"mem_avail"`
	DiskUsed    int64  `json:"disk_used"`
	DiskAvail   int64  `json:"disk_avail"`
	VolumeUsed  int64  `json:"volume_used"`
	VolumeAvail int64  `json:"volume_avail"`
	PubipUsed   int64  `json:"pubip_used"`
	PubipAvail  int64  `json:"pubip_avail"`
	PrvipUsed   int64  `json:"prvip_used"`
	PrvipAvail  int64  `json:"prvip_avail"`
}

type SecgroupAdmin

type SecgroupAdmin struct{}

func (*SecgroupAdmin) Create

func (a *SecgroupAdmin) Create(ctx context.Context, name string, isDefault bool, owner int64) (secgroup *model.SecurityGroup, err error)

func (*SecgroupAdmin) Delete

func (a *SecgroupAdmin) Delete(id int64) (err error)

func (*SecgroupAdmin) List

func (a *SecgroupAdmin) List(ctx context.Context, offset, limit int64, order, query string) (total int64, secgroups []*model.SecurityGroup, err error)

func (*SecgroupAdmin) Switch

func (a *SecgroupAdmin) Switch(ctx context.Context, newSg *model.SecurityGroup, store session.Store) (err error)

func (*SecgroupAdmin) Update

func (a *SecgroupAdmin) Update(ctx context.Context, sgID int64, name string, isDefault bool) (secgroup *model.SecurityGroup, err error)

type SecgroupView

type SecgroupView struct{}

func (*SecgroupView) Create

func (v *SecgroupView) Create(c *macaron.Context, store session.Store)

func (*SecgroupView) Delete

func (v *SecgroupView) Delete(c *macaron.Context, store session.Store) (err error)

func (*SecgroupView) Edit

func (v *SecgroupView) Edit(c *macaron.Context, store session.Store)

func (*SecgroupView) List

func (v *SecgroupView) List(c *macaron.Context, store session.Store)

func (*SecgroupView) New

func (v *SecgroupView) New(c *macaron.Context, store session.Store)

func (*SecgroupView) Patch

func (v *SecgroupView) Patch(c *macaron.Context, store session.Store)

type SecruleAdmin

type SecruleAdmin struct{}

func (*SecruleAdmin) ApplySecgroup

func (a *SecruleAdmin) ApplySecgroup(ctx context.Context, secgroup *model.SecurityGroup, ruleID int64) (err error)

func (*SecruleAdmin) Create

func (a *SecruleAdmin) Create(ctx context.Context, sgID, owner int64, remoteIp, direction, protocol string, portMin, portMax int) (secrule *model.SecurityRule, err error)

func (*SecruleAdmin) Delete

func (a *SecruleAdmin) Delete(ctx context.Context, sgID, id int64) (err error)

func (*SecruleAdmin) List

func (a *SecruleAdmin) List(ctx context.Context, offset, limit int64, order string, secgroupID int64) (total int64, secrules []*model.SecurityRule, err error)

func (*SecruleAdmin) Update

func (a *SecruleAdmin) Update(ctx context.Context, id int64, remoteIp, direction, protocol string, portMin, portMax int) (secrule *model.SecurityRule, err error)

type SecruleView

type SecruleView struct{}

func (*SecruleView) Create

func (v *SecruleView) Create(c *macaron.Context, store session.Store)

func (*SecruleView) Delete

func (v *SecruleView) Delete(c *macaron.Context, store session.Store) (err error)

func (*SecruleView) Edit

func (v *SecruleView) Edit(c *macaron.Context, store session.Store)

func (*SecruleView) List

func (v *SecruleView) List(c *macaron.Context, store session.Store)

func (*SecruleView) New

func (v *SecruleView) New(c *macaron.Context, store session.Store)

func (*SecruleView) Patch

func (v *SecruleView) Patch(c *macaron.Context, store session.Store)

type SecurityData

type SecurityData struct {
	Secgroup    int64
	RemoteIp    string `json:"remote_ip"`
	RemoteGroup string `json:"remote_group"`
	Direction   string `json:"direction"`
	IpVersion   string `json:"ip_version"`
	Protocol    string `json:"protocol"`
	PortMin     int32  `json:"port_min"`
	PortMax     int32  `json:"port_max"`
}

type StaticRoute

type StaticRoute struct {
	Destination string `json:"destination"`
	Nexthop     string `json:"nexthop"`
}

type SubnetAdmin

type SubnetAdmin struct{}

func (*SubnetAdmin) Create

func (a *SubnetAdmin) Create(ctx context.Context, name, vlan, network, netmask, zones, gateway, start, end, rtype, dns, domain, dhcp, vSwitch string, routes string, owner int64) (subnet *model.Subnet, err error)

func (*SubnetAdmin) Delete

func (a *SubnetAdmin) Delete(ctx context.Context, id int64) (err error)

func (*SubnetAdmin) List

func (a *SubnetAdmin) List(ctx context.Context, offset, limit int64, order, query, sql string) (total int64, subnets []*model.Subnet, err error)

func (*SubnetAdmin) Update

func (a *SubnetAdmin) Update(ctx context.Context, id int64, name, gateway, start, end, dns, routes string) (subnet *model.Subnet, err error)

type SubnetIface

type SubnetIface struct {
	Address string         `json:"ip_address"`
	MacAddr string         `json:"mac_address"`
	Vni     int64          `json:"vni"`
	Routes  []*StaticRoute `json:"routes,omitempty"`
}

type SubnetView

type SubnetView struct{}

func (*SubnetView) Create

func (v *SubnetView) Create(c *macaron.Context, store session.Store)

func (*SubnetView) Delete

func (v *SubnetView) Delete(c *macaron.Context, store session.Store) (err error)

func (*SubnetView) Edit

func (v *SubnetView) Edit(c *macaron.Context, store session.Store)

func (*SubnetView) List

func (v *SubnetView) List(c *macaron.Context, store session.Store)

func (*SubnetView) New

func (v *SubnetView) New(c *macaron.Context, store session.Store)

func (*SubnetView) Patch

func (v *SubnetView) Patch(c *macaron.Context, store session.Store)

type TokenClaim

type TokenClaim struct {
	OrgID      int64
	Role       model.Role
	InstanceID int    `json:"instanceID"`
	Secret     string `json:"secret"`
	jwt.StandardClaims
}

type UserAdmin

type UserAdmin struct{}

func (*UserAdmin) AccessToken

func (a *UserAdmin) AccessToken(uid int64, username, organization string) (oid int64, role model.Role, token string, issueAt, expiresAt int64, err error)

func (*UserAdmin) CompareHashAndPassword

func (a *UserAdmin) CompareHashAndPassword(hash, password string) (err error)

CompareHashAndPassword is slow by design, do not call it too offen.

func (*UserAdmin) Create

func (a *UserAdmin) Create(ctx context.Context, username, password string) (user *model.User, err error)

func (*UserAdmin) Delete

func (a *UserAdmin) Delete(id int64) (err error)

func (*UserAdmin) GenerateFromPassword

func (a *UserAdmin) GenerateFromPassword(password string) (hash string, err error)

GenerateFromPassword is slow by design, do not call it too offen.

func (*UserAdmin) List

func (a *UserAdmin) List(ctx context.Context, offset, limit int64, order, query string) (total int64, users []*model.User, err error)

func (*UserAdmin) Update

func (a *UserAdmin) Update(ctx context.Context, id int64, password string, members []string) (user *model.User, err error)

func (*UserAdmin) Validate

func (a *UserAdmin) Validate(ctx context.Context, username, password string) (user *model.User, err error)

type UserView

type UserView struct{}

func (*UserView) Change

func (v *UserView) Change(c *macaron.Context, store session.Store)

func (*UserView) Create

func (v *UserView) Create(c *macaron.Context, store session.Store)

func (*UserView) Delete

func (v *UserView) Delete(c *macaron.Context, store session.Store) (err error)

func (*UserView) Edit

func (v *UserView) Edit(c *macaron.Context, store session.Store)

func (*UserView) List

func (v *UserView) List(c *macaron.Context, store session.Store)

func (*UserView) LoginGet

func (v *UserView) LoginGet(c *macaron.Context, store session.Store)

func (*UserView) LoginPost

func (v *UserView) LoginPost(c *macaron.Context, store session.Store)

func (*UserView) New

func (v *UserView) New(c *macaron.Context, store session.Store)

func (*UserView) Patch

func (v *UserView) Patch(c *macaron.Context, store session.Store)

type VlanInfo

type VlanInfo struct {
	Device  string `json:"device"`
	Vlan    int64  `json:"vlan"`
	IpAddr  string `json:"ip_address"`
	MacAddr string `json:"mac_address"`
}

type VolumeAdmin

type VolumeAdmin struct{}

func (*VolumeAdmin) Create

func (a *VolumeAdmin) Create(ctx context.Context, name string, size int) (volume *model.Volume, err error)

func (*VolumeAdmin) Delete

func (a *VolumeAdmin) Delete(ctx context.Context, id int64) (err error)

func (*VolumeAdmin) List

func (a *VolumeAdmin) List(ctx context.Context, offset, limit int64, order, query string) (total int64, volumes []*model.Volume, err error)

func (*VolumeAdmin) Update

func (a *VolumeAdmin) Update(ctx context.Context, id int64, name string, instID int64) (volume *model.Volume, err error)

type VolumeView

type VolumeView struct{}

func (*VolumeView) Create

func (v *VolumeView) Create(c *macaron.Context, store session.Store)

func (*VolumeView) Delete

func (v *VolumeView) Delete(c *macaron.Context, store session.Store) (err error)

func (*VolumeView) Edit

func (v *VolumeView) Edit(c *macaron.Context, store session.Store)

func (*VolumeView) List

func (v *VolumeView) List(c *macaron.Context, store session.Store)

func (*VolumeView) New

func (v *VolumeView) New(c *macaron.Context, store session.Store)

func (*VolumeView) Patch

func (v *VolumeView) Patch(c *macaron.Context, store session.Store)

type ZvmData

type ZvmData struct {
	OsVersion string `json:"osVersion"`
	DiskType  string `json:"diskType"`
	VSwitch   string `json:"vswitch"`
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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