Versions in this module Expand all Collapse all v1 v1.0.0 Jun 4, 2021 Changes in this version + const TokenExpireDuration + var DB = dbs.DB + var SignedSeret = []byte("Red B") + var UrlBefore string + func Admin(c *macaron.Context) + func AllocateAddress(ctx context.Context, subnetID, ifaceID int64, ipaddr, addrType string) (address *model.Address, err error) + func AllocateFloatingIp(ctx context.Context, floatingipID, owner int64, gateway *model.Gateway, ...) (fipIface *model.Interface, err error) + func CreateInterface(ctx context.Context, subnetID, ID, owner, zoneID int64, hyper int32, ...) (iface *model.Interface, err error) + func DeallocateAddress(ctx context.Context, ifaces []*model.Interface) (err error) + func DeallocateFloatingIp(ctx context.Context, floatingipID int64) (err error) + func DeleteInterface(ctx context.Context, iface *model.Interface) (err error) + func DeleteInterfaces(ctx context.Context, masterID, subnetID int64, ifType string) (err error) + func FileExist(filename string) bool + func Index(c *macaron.Context, store session.Store) + func LinkHandler(c *macaron.Context, store session.Store) + func MakeToken(instanceID int, secret string, memberShip *MemberShip) (string, error) + func New() (m *macaron.Macaron) + func NewClaims(u, o, uid, oid string, role model.Role) (claims jwt.Claims, issuedAt, ExpiresAt int64) + func NewToken(u, o, uid, oid string, role model.Role) (signed string, issueAt, expiresAt int64, err error) + func RandomStr() string + func Run() (err error) + func SetGateway(ctx context.Context, subnetID, zoneID, owner int64, router *model.Gateway) (subnet *model.Subnet, iface *model.Interface, err error) + func UnsetGateway(ctx context.Context, subnet *model.Subnet) (err error) + type ConsoleAdmin struct + type ConsoleInfo struct + Address string + Insecure bool + Password string + TLSTunnel bool + Type string + type ConsoleView struct + func (a *ConsoleView) ConsoleResolve(c *macaron.Context, store session.Store) + func (a *ConsoleView) ConsoleURL(c *macaron.Context, store session.Store) + type Dashboard struct + func (a *Dashboard) GetData(c *macaron.Context, store session.Store) + func (a *Dashboard) Show(c *macaron.Context, store session.Store) + type FlavorAdmin struct + func (a *FlavorAdmin) Create(name string, cpu, memory, disk, swap, ephemeral int32) (flavor *model.Flavor, err error) + func (a *FlavorAdmin) Delete(id int64) (err error) + func (a *FlavorAdmin) List(offset, limit int64, order, query string) (total int64, flavors []*model.Flavor, err error) + type FlavorView struct + func (v *FlavorView) Create(c *macaron.Context, store session.Store) + func (v *FlavorView) Delete(c *macaron.Context, store session.Store) (err error) + func (v *FlavorView) List(c *macaron.Context, store session.Store) + func (v *FlavorView) New(c *macaron.Context, store session.Store) + type FloatingIpAdmin struct + func (a *FloatingIpAdmin) Create(ctx context.Context, instID, ifaceID int64, types []string, ...) (floatingips []*model.FloatingIp, err error) + func (a *FloatingIpAdmin) Delete(ctx context.Context, id int64) (err error) + func (a *FloatingIpAdmin) List(ctx context.Context, offset, limit int64, order, query string) (total int64, floatingips []*model.FloatingIp, err error) + type FloatingIpView struct + func (v *FloatingIpView) Assign(c *macaron.Context, store session.Store) + func (v *FloatingIpView) Create(c *macaron.Context, store session.Store) + func (v *FloatingIpView) Delete(c *macaron.Context, store session.Store) (err error) + func (v *FloatingIpView) List(c *macaron.Context, store session.Store) + func (v *FloatingIpView) New(c *macaron.Context, store session.Store) + type FloatingIps struct + Instance int64 + PrivateIp string + PublicIp string + type GatewayAdmin struct + func (a *GatewayAdmin) Create(ctx context.Context, name, stype string, pubID, priID int64, subnetIDs []int64, ...) (gateway *model.Gateway, err error) + func (a *GatewayAdmin) Delete(ctx context.Context, id int64) (err error) + func (a *GatewayAdmin) List(ctx context.Context, offset, limit int64, order, query string) (total int64, gateways []*model.Gateway, err error) + func (a *GatewayAdmin) Update(ctx context.Context, id int64, name string, pubID, priID int64, ...) (gateway *model.Gateway, err error) + type GatewayView struct + func (v *GatewayView) Create(c *macaron.Context, store session.Store) + func (v *GatewayView) Delete(c *macaron.Context, store session.Store) (err error) + func (v *GatewayView) Edit(c *macaron.Context, store session.Store) + func (v *GatewayView) List(c *macaron.Context, store session.Store) + func (v *GatewayView) New(c *macaron.Context, store session.Store) + func (v *GatewayView) Patch(c *macaron.Context, store session.Store) + type GlusterfsAdmin struct + func (a *GlusterfsAdmin) Create(ctx context.Context, name, cookie string, nworkers int32, ...) (glusterfs *model.Glusterfs, err error) + func (a *GlusterfsAdmin) Delete(ctx context.Context, id int64) (err error) + func (a *GlusterfsAdmin) GetState(ctx context.Context, id int64) (status string, err error) + func (a *GlusterfsAdmin) List(ctx context.Context, offset, limit int64, order, query string) (total int64, glusterfses []*model.Glusterfs, err error) + func (a *GlusterfsAdmin) State(ctx context.Context, id int64, status string, nworkers int32) (err error) + func (a *GlusterfsAdmin) Update(ctx context.Context, id, heketiKey, flavorID int64, nworkers int32) (glusterfs *model.Glusterfs, err error) + type GlusterfsView struct + func (v *GlusterfsView) Create(c *macaron.Context, store session.Store) + func (v *GlusterfsView) Delete(c *macaron.Context, store session.Store) (err error) + func (v *GlusterfsView) Edit(c *macaron.Context, store session.Store) + func (v *GlusterfsView) List(c *macaron.Context, store session.Store) + func (v *GlusterfsView) New(c *macaron.Context, store session.Store) + func (v *GlusterfsView) Patch(c *macaron.Context, store session.Store) + func (v *GlusterfsView) State(c *macaron.Context, store session.Store) + type HyperAdmin struct + func (a *HyperAdmin) List(offset, limit int64, order, query string) (total int64, hypers []*model.Hyper, err error) + type HyperView struct + func (v *HyperView) List(c *macaron.Context, store session.Store) + type HypercubeClaims struct + OID string + Role model.Role + UID string + func ParseToken(tokenString string) (tokenClaims *HypercubeClaims, err error) + type ImageAdmin struct + func (a *ImageAdmin) Create(ctx context.Context, ...) (image *model.Image, err error) + func (a *ImageAdmin) Delete(ctx context.Context, id int64) (err error) + func (a *ImageAdmin) List(offset, limit int64, order, query string) (total int64, images []*model.Image, err error) + type ImageView struct + func (v *ImageView) Create(c *macaron.Context, store session.Store) + func (v *ImageView) Delete(c *macaron.Context, store session.Store) (err error) + func (v *ImageView) List(c *macaron.Context, store session.Store) + func (v *ImageView) New(c *macaron.Context, store session.Store) + type InstanceAdmin struct + func (a *InstanceAdmin) ChangeInstanceStatus(ctx context.Context, id int64, action string) (instance *model.Instance, err error) + func (a *InstanceAdmin) Create(ctx context.Context, count int, prefix, userdata string, ...) (instance *model.Instance, err error) + func (a *InstanceAdmin) Delete(ctx context.Context, id int64) (err error) + func (a *InstanceAdmin) List(ctx context.Context, offset, limit int64, order, query string) (total int64, instances []*model.Instance, err error) + func (a *InstanceAdmin) Update(ctx context.Context, id, flavorID int64, hostname, action string, ...) (instance *model.Instance, err error) + type InstanceData struct + DNS string + Keys []string + Links []*NetworkLink + Networks []*InstanceNetwork + OCP []*OcpData + SecRules []*SecurityData + Userdata string + VirtType string + Vlans []*VlanInfo + ZVM []*ZvmData + type InstanceNetwork struct + Address string + ID string + Link string + Netmask string + Routes []*NetworkRoute + Type string + type InstanceView struct + func (v *InstanceView) Create(c *macaron.Context, store session.Store) + func (v *InstanceView) Delete(c *macaron.Context, store session.Store) (err error) + func (v *InstanceView) Edit(c *macaron.Context, store session.Store) + func (v *InstanceView) List(c *macaron.Context, store session.Store) + func (v *InstanceView) New(c *macaron.Context, store session.Store) + func (v *InstanceView) Patch(c *macaron.Context, store session.Store) + func (v *InstanceView) UpdateTable(c *macaron.Context, store session.Store) + type InstancesData struct + Instances []*model.Instance + IsAdmin bool + type InterfaceAdmin struct + func (a *InterfaceAdmin) Update(ctx context.Context, id int64, name, pairs string, sgIDs []int64) (iface *model.Interface, err error) + type InterfaceView struct + func (v *InterfaceView) Create(c *macaron.Context, store session.Store) + func (v *InterfaceView) Delete(c *macaron.Context, store session.Store) + func (v *InterfaceView) Edit(c *macaron.Context, store session.Store) + func (v *InterfaceView) Patch(c *macaron.Context, store session.Store) + type KeyAdmin struct + func (a *KeyAdmin) Create(ctx context.Context, name, pubkey, fingerprint string) (key *model.Key, err error) + func (a *KeyAdmin) Delete(id int64) (err error) + func (a *KeyAdmin) List(ctx context.Context, offset, limit int64, order, query string) (total int64, keys []*model.Key, err error) + type KeyTemp struct + func (point *KeyTemp) Create() (publicKey, fingerPrint, privateKey string, err error) + func (point *KeyTemp) CreateFingerPrint(publicKey string) (fingerPrint string, err error) + type KeyView struct + func (v *KeyView) Confirm(c *macaron.Context, store session.Store) + func (v *KeyView) Create(c *macaron.Context, store session.Store) + func (v *KeyView) Delete(c *macaron.Context, store session.Store) (err error) + func (v *KeyView) List(c *macaron.Context, store session.Store) + func (v *KeyView) New(c *macaron.Context, store session.Store) + func (v *KeyView) SearchDbFingerPrint(c *macaron.Context, store session.Store, fingerPrint, publicKey, name string) + func (v *KeyView) SolveListKeyError(c *macaron.Context, store session.Store) + func (v *KeyView) SolvePrintedPublicKeyError(c *macaron.Context, store session.Store, err error) + func (v *KeyView) SolvePublicKeyDbError(c *macaron.Context, store session.Store, name, publicKey, fingerPrint string) + type MemberShip struct + OrgID int64 + OrgName string + Role model.Role + UserID int64 + UserName string + func GetDBMemberShip(userID, orgID int64) (ms *MemberShip, err error) + func GetMemberShip(ctx context.Context) *MemberShip + func ResolveToken(tokenString string) (int, *MemberShip, error) + func (m *MemberShip) CheckAdmin(reqRole model.Role, table string, id int64) (admin bool, err error) + func (m *MemberShip) CheckCreater(table string, id int64) (isCreater bool, err error) + func (m *MemberShip) CheckOwner(reqRole model.Role, table string, id int64) (isOwner bool, err error) + func (m *MemberShip) CheckPermission(reqRole model.Role) (permit bool) + func (m *MemberShip) CheckUser(id int64) (permit bool, err error) + func (m *MemberShip) GetWhere() (where string) + func (m *MemberShip) SetContext(ctx context.Context) context.Context + type NetworkLink struct + ID string + MacAddr string + Mtu uint + Type string + type NetworkRoute struct + Gateway string + Netmask string + Network string + type OcpData struct + OcpVersion string + Service string + type OpenshiftAdmin struct + func (a *OpenshiftAdmin) Create(ctx context.Context, cluster, domain, cookie, haflag, extIP string, ...) (openshift *model.Openshift, err error) + func (a *OpenshiftAdmin) Delete(ctx context.Context, id int64) (err error) + func (a *OpenshiftAdmin) GetState(ctx context.Context, id int64) (status string, err error) + func (a *OpenshiftAdmin) Launch(ctx context.Context, id int64, hostname, ipaddr string) (instance *model.Instance, err error) + func (a *OpenshiftAdmin) List(ctx context.Context, offset, limit int64, order, query string) (total int64, openshifts []*model.Openshift, err error) + func (a *OpenshiftAdmin) State(ctx context.Context, id int64, status string) (err error) + func (a *OpenshiftAdmin) Update(ctx context.Context, id, flavorID int64, nworkers int32) (openshift *model.Openshift, err error) + type OpenshiftView struct + func (v *OpenshiftView) Create(c *macaron.Context, store session.Store) + func (v *OpenshiftView) Delete(c *macaron.Context, store session.Store) (err error) + func (v *OpenshiftView) Edit(c *macaron.Context, store session.Store) + func (v *OpenshiftView) Launch(c *macaron.Context, store session.Store) + func (v *OpenshiftView) List(c *macaron.Context, store session.Store) + func (v *OpenshiftView) New(c *macaron.Context, store session.Store) + func (v *OpenshiftView) Patch(c *macaron.Context, store session.Store) + func (v *OpenshiftView) State(c *macaron.Context, store session.Store) + type OrgAdmin struct + func (a *OrgAdmin) Create(ctx context.Context, name, owner string) (org *model.Organization, err error) + func (a *OrgAdmin) Delete(ctx context.Context, id int64) (err error) + func (a *OrgAdmin) Get(name string) (org *model.Organization, err error) + func (a *OrgAdmin) List(ctx context.Context, offset, limit int64, order, query string) (total int64, orgs []*model.Organization, err error) + func (a *OrgAdmin) Update(ctx context.Context, orgID int64, members, users []string, roles []model.Role) (org *model.Organization, err error) + type OrgView struct + func (v *OrgView) Create(c *macaron.Context, store session.Store) + func (v *OrgView) Delete(c *macaron.Context, store session.Store) (err error) + func (v *OrgView) Edit(c *macaron.Context, store session.Store) + func (v *OrgView) List(c *macaron.Context, store session.Store) + func (v *OrgView) New(c *macaron.Context, store session.Store) + func (v *OrgView) Patch(c *macaron.Context, store session.Store) + type Page struct + Number int + Offset int + func GetPages(total, limit int64) (pages []*Page) + type PortmapAdmin struct + func (a *PortmapAdmin) Create(ctx context.Context, instID int64, port int) (portmap *model.Portmap, err error) + func (a *PortmapAdmin) Delete(ctx context.Context, id int64) (err error) + func (a *PortmapAdmin) List(ctx context.Context, offset, limit int64, order, query string) (total int64, portmaps []*model.Portmap, err error) + type PortmapView struct + func (v *PortmapView) Create(c *macaron.Context, store session.Store) + func (v *PortmapView) Delete(c *macaron.Context, store session.Store) (err error) + func (v *PortmapView) List(c *macaron.Context, store session.Store) + func (v *PortmapView) New(c *macaron.Context, store session.Store) + type RegistryAdmin struct + func (a *RegistryAdmin) Create(ctx context.Context, ...) (registry *model.Registry, err error) + func (a *RegistryAdmin) Delete(id int64) (err error) + func (a *RegistryAdmin) List(offset, limit int64, order, query string) (total int64, registrys []*model.Registry, err error) + func (a *RegistryAdmin) Update(ctx context.Context, id int64, ...) (registry *model.Registry, err error) + type RegistryView struct + func (v *RegistryView) Create(c *macaron.Context, store session.Store) + func (v *RegistryView) Delete(c *macaron.Context, store session.Store) (err error) + func (v *RegistryView) Edit(c *macaron.Context, store session.Store) + func (v *RegistryView) List(c *macaron.Context, store session.Store) + func (v *RegistryView) New(c *macaron.Context, store session.Store) + func (v *RegistryView) Patch(c *macaron.Context, store session.Store) + type ResourceData struct + CpuAvail int64 + CpuUsed int64 + DiskAvail int64 + DiskUsed int64 + MemAvail int64 + MemUsed int64 + PrvipAvail int64 + PrvipUsed int64 + PubipAvail int64 + PubipUsed int64 + Title string + VolumeAvail int64 + VolumeUsed int64 + type SecgroupAdmin struct + func (a *SecgroupAdmin) Create(ctx context.Context, name string, isDefault bool, owner int64) (secgroup *model.SecurityGroup, err error) + func (a *SecgroupAdmin) Delete(id int64) (err error) + func (a *SecgroupAdmin) List(ctx context.Context, offset, limit int64, order, query string) (total int64, secgroups []*model.SecurityGroup, err error) + func (a *SecgroupAdmin) Switch(ctx context.Context, newSg *model.SecurityGroup, store session.Store) (err error) + func (a *SecgroupAdmin) Update(ctx context.Context, sgID int64, name string, isDefault bool) (secgroup *model.SecurityGroup, err error) + type SecgroupView struct + func (v *SecgroupView) Create(c *macaron.Context, store session.Store) + func (v *SecgroupView) Delete(c *macaron.Context, store session.Store) (err error) + func (v *SecgroupView) Edit(c *macaron.Context, store session.Store) + func (v *SecgroupView) List(c *macaron.Context, store session.Store) + func (v *SecgroupView) New(c *macaron.Context, store session.Store) + func (v *SecgroupView) Patch(c *macaron.Context, store session.Store) + type SecruleAdmin struct + func (a *SecruleAdmin) ApplySecgroup(ctx context.Context, secgroup *model.SecurityGroup, ruleID int64) (err error) + func (a *SecruleAdmin) Create(ctx context.Context, sgID, owner int64, remoteIp, direction, protocol string, ...) (secrule *model.SecurityRule, err error) + func (a *SecruleAdmin) Delete(ctx context.Context, sgID, id int64) (err error) + func (a *SecruleAdmin) List(ctx context.Context, offset, limit int64, order string, secgroupID int64) (total int64, secrules []*model.SecurityRule, err error) + func (a *SecruleAdmin) Update(ctx context.Context, id int64, remoteIp, direction, protocol string, ...) (secrule *model.SecurityRule, err error) + type SecruleView struct + func (v *SecruleView) Create(c *macaron.Context, store session.Store) + func (v *SecruleView) Delete(c *macaron.Context, store session.Store) (err error) + func (v *SecruleView) Edit(c *macaron.Context, store session.Store) + func (v *SecruleView) List(c *macaron.Context, store session.Store) + func (v *SecruleView) New(c *macaron.Context, store session.Store) + func (v *SecruleView) Patch(c *macaron.Context, store session.Store) + type SecurityData struct + Direction string + IpVersion string + PortMax int32 + PortMin int32 + Protocol string + RemoteGroup string + RemoteIp string + Secgroup int64 + type StaticRoute struct + Destination string + Nexthop string + type SubnetAdmin struct + func (a *SubnetAdmin) Create(ctx context.Context, ...) (subnet *model.Subnet, err error) + func (a *SubnetAdmin) Delete(ctx context.Context, id int64) (err error) + func (a *SubnetAdmin) List(ctx context.Context, offset, limit int64, order, query, sql string) (total int64, subnets []*model.Subnet, err error) + func (a *SubnetAdmin) Update(ctx context.Context, id int64, name, gateway, start, end, dns, routes string) (subnet *model.Subnet, err error) + type SubnetIface struct + Address string + MacAddr string + Routes []*StaticRoute + Vni int64 + type SubnetView struct + func (v *SubnetView) Create(c *macaron.Context, store session.Store) + func (v *SubnetView) Delete(c *macaron.Context, store session.Store) (err error) + func (v *SubnetView) Edit(c *macaron.Context, store session.Store) + func (v *SubnetView) List(c *macaron.Context, store session.Store) + func (v *SubnetView) New(c *macaron.Context, store session.Store) + func (v *SubnetView) Patch(c *macaron.Context, store session.Store) + type TokenClaim struct + InstanceID int + OrgID int64 + Role model.Role + Secret string + type UserAdmin struct + func (a *UserAdmin) AccessToken(uid int64, username, organization string) (oid int64, role model.Role, token string, issueAt, expiresAt int64, err error) + func (a *UserAdmin) CompareHashAndPassword(hash, password string) (err error) + func (a *UserAdmin) Create(ctx context.Context, username, password string) (user *model.User, err error) + func (a *UserAdmin) Delete(id int64) (err error) + func (a *UserAdmin) GenerateFromPassword(password string) (hash string, err error) + func (a *UserAdmin) List(ctx context.Context, offset, limit int64, order, query string) (total int64, users []*model.User, err error) + func (a *UserAdmin) Update(ctx context.Context, id int64, password string, members []string) (user *model.User, err error) + func (a *UserAdmin) Validate(ctx context.Context, username, password string) (user *model.User, err error) + type UserView struct + func (v *UserView) Change(c *macaron.Context, store session.Store) + func (v *UserView) Create(c *macaron.Context, store session.Store) + func (v *UserView) Delete(c *macaron.Context, store session.Store) (err error) + func (v *UserView) Edit(c *macaron.Context, store session.Store) + func (v *UserView) List(c *macaron.Context, store session.Store) + func (v *UserView) LoginGet(c *macaron.Context, store session.Store) + func (v *UserView) LoginPost(c *macaron.Context, store session.Store) + func (v *UserView) New(c *macaron.Context, store session.Store) + func (v *UserView) Patch(c *macaron.Context, store session.Store) + type VlanInfo struct + Device string + IpAddr string + MacAddr string + Vlan int64 + type VolumeAdmin struct + func (a *VolumeAdmin) Create(ctx context.Context, name string, size int) (volume *model.Volume, err error) + func (a *VolumeAdmin) Delete(ctx context.Context, id int64) (err error) + func (a *VolumeAdmin) List(ctx context.Context, offset, limit int64, order, query string) (total int64, volumes []*model.Volume, err error) + func (a *VolumeAdmin) Update(ctx context.Context, id int64, name string, instID int64) (volume *model.Volume, err error) + type VolumeView struct + func (v *VolumeView) Create(c *macaron.Context, store session.Store) + func (v *VolumeView) Delete(c *macaron.Context, store session.Store) (err error) + func (v *VolumeView) Edit(c *macaron.Context, store session.Store) + func (v *VolumeView) List(c *macaron.Context, store session.Store) + func (v *VolumeView) New(c *macaron.Context, store session.Store) + func (v *VolumeView) Patch(c *macaron.Context, store session.Store) + type ZvmData struct + DiskType string + OsVersion string + VSwitch string