mirror of
https://github.com/yunionio/cloudpods.git
synced 2026-10-24 23:41:52 +08:00
Merge pull request #331 in YUNIONIO/onecloud from ~QIUJIAN/onecloud:hotfix/qj-reformat-long-codes to release/2.3.0
* commit 'd50d363d948c7efe05345ff7981b47b759deabe0': minor fixes 增加keystone policy资源,格式化代码
This commit is contained in:
@@ -77,7 +77,11 @@ func init() {
|
||||
ID string `help:"ID or Name of cloud account"`
|
||||
Name string `help:"New name to update"`
|
||||
AccessUrl string `help:"New access url"`
|
||||
Desc string `help:"Description"`
|
||||
|
||||
BalanceKey string `help:"update cloud balance account key, such as Azure EA key"`
|
||||
RemoveBalanceKey bool `help:"remove cloud blance account key"`
|
||||
|
||||
Desc string `help:"Description"`
|
||||
}
|
||||
R(&CloudaccountUpdateOptions{}, "cloud-account-update", "Update a cloud account", func(s *mcclient.ClientSession, args *CloudaccountUpdateOptions) error {
|
||||
params := jsonutils.NewDict()
|
||||
@@ -87,6 +91,11 @@ func init() {
|
||||
if len(args.AccessUrl) > 0 {
|
||||
params.Add(jsonutils.NewString(args.AccessUrl), "access_url")
|
||||
}
|
||||
if len(args.BalanceKey) > 0 {
|
||||
params.Add(jsonutils.NewString(args.BalanceKey), "balance_key")
|
||||
} else if args.RemoveBalanceKey {
|
||||
params.Add(jsonutils.NewString(""), "balance_key")
|
||||
}
|
||||
if len(args.Desc) > 0 {
|
||||
params.Add(jsonutils.NewString(args.Desc), "description")
|
||||
}
|
||||
|
||||
@@ -0,0 +1,78 @@
|
||||
package shell
|
||||
|
||||
import (
|
||||
"io/ioutil"
|
||||
"yunion.io/x/jsonutils"
|
||||
"yunion.io/x/onecloud/pkg/mcclient"
|
||||
"yunion.io/x/onecloud/pkg/mcclient/modules"
|
||||
)
|
||||
|
||||
func init() {
|
||||
type PolicyListOptions struct {
|
||||
}
|
||||
R(&PolicyListOptions{}, "policy-list", "List all policies", func(s *mcclient.ClientSession, args *PolicyListOptions) error {
|
||||
result, err := modules.Policies.List(s, nil)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
printList(result, modules.Policies.GetColumns(s))
|
||||
return nil
|
||||
})
|
||||
|
||||
type PolicyCreateOptions struct {
|
||||
FILE string `help:"path to policy file"`
|
||||
}
|
||||
R(&PolicyCreateOptions{}, "policy-create", "Create a new policy", func(s *mcclient.ClientSession, args *PolicyCreateOptions) error {
|
||||
blob, err := ioutil.ReadFile(args.FILE)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
params := jsonutils.NewDict()
|
||||
params.Add(jsonutils.NewString("application/json"), "type")
|
||||
params.Add(jsonutils.NewString(string(blob)), "blob")
|
||||
|
||||
result, err := modules.Policies.Create(s, params)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
printObject(result)
|
||||
|
||||
return nil
|
||||
})
|
||||
|
||||
type PolicyPatchOptions struct {
|
||||
ID string `help:"ID of policy"`
|
||||
FILE string `help:"path to policy file"`
|
||||
}
|
||||
R(&PolicyPatchOptions{}, "policy-patch", "Patch policy", func(s *mcclient.ClientSession, args *PolicyPatchOptions) error {
|
||||
blob, err := ioutil.ReadFile(args.FILE)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
params := jsonutils.NewDict()
|
||||
params.Add(jsonutils.NewString("application/json"), "type")
|
||||
params.Add(jsonutils.NewString(string(blob)), "blob")
|
||||
|
||||
result, err := modules.Policies.Patch(s, args.ID, params)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
printObject(result)
|
||||
|
||||
return nil
|
||||
})
|
||||
|
||||
type PolicyDeleteOptions struct {
|
||||
ID string `help:"ID of policy"`
|
||||
}
|
||||
R(&PolicyDeleteOptions{}, "policy-delete", "Delete policy", func(s *mcclient.ClientSession, args *PolicyDeleteOptions) error {
|
||||
result, err := modules.Policies.Delete(s, args.ID, nil)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
printObject(result)
|
||||
return nil
|
||||
})
|
||||
}
|
||||
@@ -1,8 +1,6 @@
|
||||
package compute
|
||||
|
||||
import (
|
||||
"yunion.io/x/log"
|
||||
|
||||
"yunion.io/x/onecloud/pkg/appsrv"
|
||||
"yunion.io/x/onecloud/pkg/appsrv/dispatcher"
|
||||
"yunion.io/x/onecloud/pkg/cloudcommon/db"
|
||||
@@ -23,7 +21,6 @@ func InitHandlers(app *appsrv.Application) {
|
||||
capabilities.AddCapabilityHandler("", app)
|
||||
specs.AddSpecHandler("", app)
|
||||
sshkeys.AddSshKeysHandler("", app)
|
||||
|
||||
taskman.AddTaskHandler("", app)
|
||||
|
||||
for _, manager := range []db.IModelManager{
|
||||
@@ -61,10 +58,11 @@ func InitHandlers(app *appsrv.Application) {
|
||||
models.IsolatedDeviceManager,
|
||||
models.SecurityGroupManager,
|
||||
models.SecurityGroupRuleManager,
|
||||
models.VCenterManager,
|
||||
// models.VCenterManager,
|
||||
models.DnsRecordManager,
|
||||
models.ElasticipManager,
|
||||
models.SnapshotManager,
|
||||
|
||||
models.LoadbalancerManager,
|
||||
models.LoadbalancerListenerManager,
|
||||
models.LoadbalancerListenerRuleManager,
|
||||
@@ -95,7 +93,7 @@ func InitHandlers(app *appsrv.Application) {
|
||||
models.StoragecachedimageManager,
|
||||
} {
|
||||
db.RegisterModelManager(manager)
|
||||
log.Infof("Register handler %s", manager.KeywordPlural())
|
||||
// log.Infof("Register handler %s", manager.KeywordPlural())
|
||||
handler := db.NewJointModelHandler(manager)
|
||||
dispatcher.AddJointModelDispatcher("", app, handler)
|
||||
}
|
||||
|
||||
@@ -34,7 +34,14 @@ type SCachedimageManager struct {
|
||||
var CachedimageManager *SCachedimageManager
|
||||
|
||||
func init() {
|
||||
CachedimageManager = &SCachedimageManager{SStandaloneResourceBaseManager: db.NewStandaloneResourceBaseManager(SCachedimage{}, "cachedimages_tbl", "cachedimage", "cachedimages")}
|
||||
CachedimageManager = &SCachedimageManager{
|
||||
SStandaloneResourceBaseManager: db.NewStandaloneResourceBaseManager(
|
||||
SCachedimage{},
|
||||
"cachedimages_tbl",
|
||||
"cachedimage",
|
||||
"cachedimages",
|
||||
),
|
||||
}
|
||||
}
|
||||
|
||||
type SCachedimage struct {
|
||||
|
||||
@@ -29,7 +29,14 @@ type SCloudaccountManager struct {
|
||||
var CloudaccountManager *SCloudaccountManager
|
||||
|
||||
func init() {
|
||||
CloudaccountManager = &SCloudaccountManager{SEnabledStatusStandaloneResourceBaseManager: db.NewEnabledStatusStandaloneResourceBaseManager(SCloudaccount{}, "cloudaccounts_tbl", "cloudaccount", "cloudaccounts")}
|
||||
CloudaccountManager = &SCloudaccountManager{
|
||||
SEnabledStatusStandaloneResourceBaseManager: db.NewEnabledStatusStandaloneResourceBaseManager(
|
||||
SCloudaccount{},
|
||||
"cloudaccounts_tbl",
|
||||
"cloudaccount",
|
||||
"cloudaccounts",
|
||||
),
|
||||
}
|
||||
}
|
||||
|
||||
type SCloudaccount struct {
|
||||
@@ -41,7 +48,7 @@ type SCloudaccount struct {
|
||||
Account string `width:"128" charset:"ascii" nullable:"false" list:"admin" create:"admin_required"` // Column(VARCHAR(64, charset='ascii'), nullable=False)
|
||||
Secret string `width:"256" charset:"ascii" nullable:"false" list:"admin" create:"admin_required"` // Column(VARCHAR(256, charset='ascii'), nullable=False)
|
||||
|
||||
BalanceKey string `width:"256" charset:"ascii" nullable:"true" list:"admin" create:"admin_optional"`
|
||||
BalanceKey string `width:"256" charset:"ascii" nullable:"true" list:"admin" update:"admin" create:"admin_optional"`
|
||||
LastSync time.Time `get:"admin" list:"admin"` // = Column(DateTime, nullable=True)
|
||||
|
||||
Version string `width:"32" charset:"ascii" nullable:"true" list:"admin"` // Column(VARCHAR(32, charset='ascii'), nullable=True)
|
||||
|
||||
@@ -42,7 +42,14 @@ type SCloudproviderManager struct {
|
||||
var CloudproviderManager *SCloudproviderManager
|
||||
|
||||
func init() {
|
||||
CloudproviderManager = &SCloudproviderManager{SEnabledStatusStandaloneResourceBaseManager: db.NewEnabledStatusStandaloneResourceBaseManager(SCloudprovider{}, "cloudproviders_tbl", "cloudprovider", "cloudproviders")}
|
||||
CloudproviderManager = &SCloudproviderManager{
|
||||
SEnabledStatusStandaloneResourceBaseManager: db.NewEnabledStatusStandaloneResourceBaseManager(
|
||||
SCloudprovider{},
|
||||
"cloudproviders_tbl",
|
||||
"cloudprovider",
|
||||
"cloudproviders",
|
||||
),
|
||||
}
|
||||
}
|
||||
|
||||
type SCloudprovider struct {
|
||||
|
||||
@@ -29,7 +29,14 @@ type SCloudregionManager struct {
|
||||
var CloudregionManager *SCloudregionManager
|
||||
|
||||
func init() {
|
||||
CloudregionManager = &SCloudregionManager{SEnabledStatusStandaloneResourceBaseManager: db.NewEnabledStatusStandaloneResourceBaseManager(SCloudregion{}, "cloudregions_tbl", "cloudregion", "cloudregions")}
|
||||
CloudregionManager = &SCloudregionManager{
|
||||
SEnabledStatusStandaloneResourceBaseManager: db.NewEnabledStatusStandaloneResourceBaseManager(
|
||||
SCloudregion{},
|
||||
"cloudregions_tbl",
|
||||
"cloudregion",
|
||||
"cloudregions",
|
||||
),
|
||||
}
|
||||
}
|
||||
|
||||
type SCloudregion struct {
|
||||
|
||||
@@ -71,7 +71,14 @@ type SDiskManager struct {
|
||||
var DiskManager *SDiskManager
|
||||
|
||||
func init() {
|
||||
DiskManager = &SDiskManager{SSharableVirtualResourceBaseManager: db.NewSharableVirtualResourceBaseManager(SDisk{}, "disks_tbl", "disk", "disks")}
|
||||
DiskManager = &SDiskManager{
|
||||
SSharableVirtualResourceBaseManager: db.NewSharableVirtualResourceBaseManager(
|
||||
SDisk{},
|
||||
"disks_tbl",
|
||||
"disk",
|
||||
"disks",
|
||||
),
|
||||
}
|
||||
}
|
||||
|
||||
type SDisk struct {
|
||||
|
||||
@@ -23,7 +23,14 @@ type SDnsRecordManager struct {
|
||||
var DnsRecordManager *SDnsRecordManager
|
||||
|
||||
func init() {
|
||||
DnsRecordManager = &SDnsRecordManager{SAdminSharableVirtualResourceBaseManager: db.NewAdminSharableVirtualResourceBaseManager(SDnsRecord{}, "dnsrecord_tbl", "dnsrecord", "dnsrecords")}
|
||||
DnsRecordManager = &SDnsRecordManager{
|
||||
SAdminSharableVirtualResourceBaseManager: db.NewAdminSharableVirtualResourceBaseManager(
|
||||
SDnsRecord{},
|
||||
"dnsrecord_tbl",
|
||||
"dnsrecord",
|
||||
"dnsrecords",
|
||||
),
|
||||
}
|
||||
}
|
||||
|
||||
const DNS_RECORDS_SEPARATOR = ","
|
||||
|
||||
@@ -21,7 +21,14 @@ type SDynamicschedtagManager struct {
|
||||
var DynamicschedtagManager *SDynamicschedtagManager
|
||||
|
||||
func init() {
|
||||
DynamicschedtagManager = &SDynamicschedtagManager{SStandaloneResourceBaseManager: db.NewStandaloneResourceBaseManager(SDynamicschedtag{}, "dynamicschedtags_tbl", "dynamicschedtag", "dynamicschedtags")}
|
||||
DynamicschedtagManager = &SDynamicschedtagManager{
|
||||
SStandaloneResourceBaseManager: db.NewStandaloneResourceBaseManager(
|
||||
SDynamicschedtag{},
|
||||
"dynamicschedtags_tbl",
|
||||
"dynamicschedtag",
|
||||
"dynamicschedtags",
|
||||
),
|
||||
}
|
||||
}
|
||||
|
||||
// dynamic schedtag is called before scan host candidates, dynamically adding additional schedtag to hosts
|
||||
|
||||
@@ -52,7 +52,14 @@ type SElasticipManager struct {
|
||||
var ElasticipManager *SElasticipManager
|
||||
|
||||
func init() {
|
||||
ElasticipManager = &SElasticipManager{SVirtualResourceBaseManager: db.NewVirtualResourceBaseManager(SElasticip{}, "elasticips_tbl", "eip", "eips")}
|
||||
ElasticipManager = &SElasticipManager{
|
||||
SVirtualResourceBaseManager: db.NewVirtualResourceBaseManager(
|
||||
SElasticip{},
|
||||
"elasticips_tbl",
|
||||
"eip",
|
||||
"eips",
|
||||
),
|
||||
}
|
||||
}
|
||||
|
||||
type SElasticip struct {
|
||||
|
||||
@@ -17,7 +17,15 @@ var GroupguestManager *SGroupguestManager
|
||||
|
||||
func init() {
|
||||
db.InitManager(func() {
|
||||
GroupguestManager = &SGroupguestManager{SGroupJointsManager: NewGroupJointsManager(SGroupguest{}, "guestgroups_tbl", "groupguest", "groupguests", GuestManager)}
|
||||
GroupguestManager = &SGroupguestManager{
|
||||
SGroupJointsManager: NewGroupJointsManager(
|
||||
SGroupguest{},
|
||||
"guestgroups_tbl",
|
||||
"groupguest",
|
||||
"groupguests",
|
||||
GuestManager,
|
||||
),
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
|
||||
@@ -7,7 +7,16 @@ type SGroupJointsManager struct {
|
||||
}
|
||||
|
||||
func NewGroupJointsManager(dt interface{}, tableName string, keyword string, keywordPlural string, slave db.IVirtualModelManager) SGroupJointsManager {
|
||||
return SGroupJointsManager{SVirtualJointResourceBaseManager: db.NewVirtualJointResourceBaseManager(dt, tableName, keyword, keywordPlural, GroupManager, slave)}
|
||||
return SGroupJointsManager{
|
||||
SVirtualJointResourceBaseManager: db.NewVirtualJointResourceBaseManager(
|
||||
dt,
|
||||
tableName,
|
||||
keyword,
|
||||
keywordPlural,
|
||||
GroupManager,
|
||||
slave,
|
||||
),
|
||||
}
|
||||
}
|
||||
|
||||
type SGroupJointsBase struct {
|
||||
|
||||
@@ -14,7 +14,14 @@ type SGroupManager struct {
|
||||
var GroupManager *SGroupManager
|
||||
|
||||
func init() {
|
||||
GroupManager = &SGroupManager{SVirtualResourceBaseManager: db.NewVirtualResourceBaseManager(SGroup{}, "groups_tbl", "group", "groups")}
|
||||
GroupManager = &SGroupManager{
|
||||
SVirtualResourceBaseManager: db.NewVirtualResourceBaseManager(
|
||||
SGroup{},
|
||||
"groups_tbl",
|
||||
"group",
|
||||
"groups",
|
||||
),
|
||||
}
|
||||
}
|
||||
|
||||
type SGroup struct {
|
||||
|
||||
@@ -17,7 +17,14 @@ type SGuestcdromManager struct {
|
||||
var GuestcdromManager *SGuestcdromManager
|
||||
|
||||
func init() {
|
||||
GuestcdromManager = &SGuestcdromManager{SModelBaseManager: db.NewModelBaseManager(SGuestcdrom{}, "guestcdrom_tbl", "guestcdrom", "guestcdroms")}
|
||||
GuestcdromManager = &SGuestcdromManager{
|
||||
SModelBaseManager: db.NewModelBaseManager(
|
||||
SGuestcdrom{},
|
||||
"guestcdrom_tbl",
|
||||
"guestcdrom",
|
||||
"guestcdroms",
|
||||
),
|
||||
}
|
||||
}
|
||||
|
||||
type SGuestcdrom struct {
|
||||
|
||||
@@ -21,7 +21,15 @@ var GuestdiskManager *SGuestdiskManager
|
||||
|
||||
func init() {
|
||||
db.InitManager(func() {
|
||||
GuestdiskManager = &SGuestdiskManager{SGuestJointsManager: NewGuestJointsManager(SGuestdisk{}, "guestdisks_tbl", "guestdisk", "guestdisks", DiskManager)}
|
||||
GuestdiskManager = &SGuestdiskManager{
|
||||
SGuestJointsManager: NewGuestJointsManager(
|
||||
SGuestdisk{},
|
||||
"guestdisks_tbl",
|
||||
"guestdisk",
|
||||
"guestdisks",
|
||||
DiskManager,
|
||||
),
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
|
||||
@@ -7,7 +7,16 @@ type SGuestJointsManager struct {
|
||||
}
|
||||
|
||||
func NewGuestJointsManager(dt interface{}, tableName string, keyword string, keywordPlural string, slave db.IVirtualModelManager) SGuestJointsManager {
|
||||
return SGuestJointsManager{SVirtualJointResourceBaseManager: db.NewVirtualJointResourceBaseManager(dt, tableName, keyword, keywordPlural, GuestManager, slave)}
|
||||
return SGuestJointsManager{
|
||||
SVirtualJointResourceBaseManager: db.NewVirtualJointResourceBaseManager(
|
||||
dt,
|
||||
tableName,
|
||||
keyword,
|
||||
keywordPlural,
|
||||
GuestManager,
|
||||
slave,
|
||||
),
|
||||
}
|
||||
}
|
||||
|
||||
type SGuestJointsBase struct {
|
||||
|
||||
@@ -34,8 +34,15 @@ var GuestnetworkManager *SGuestnetworkManager
|
||||
|
||||
func init() {
|
||||
db.InitManager(func() {
|
||||
GuestnetworkManager = &SGuestnetworkManager{SGuestJointsManager: NewGuestJointsManager(SGuestnetwork{},
|
||||
"guestnetworks_tbl", "guestnetwork", "guestnetworks", NetworkManager)}
|
||||
GuestnetworkManager = &SGuestnetworkManager{
|
||||
SGuestJointsManager: NewGuestJointsManager(
|
||||
SGuestnetwork{},
|
||||
"guestnetworks_tbl",
|
||||
"guestnetwork",
|
||||
"guestnetworks",
|
||||
NetworkManager,
|
||||
),
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
|
||||
@@ -161,7 +161,14 @@ type SGuestManager struct {
|
||||
var GuestManager *SGuestManager
|
||||
|
||||
func init() {
|
||||
GuestManager = &SGuestManager{SVirtualResourceBaseManager: db.NewVirtualResourceBaseManager(SGuest{}, "guests_tbl", "server", "servers")}
|
||||
GuestManager = &SGuestManager{
|
||||
SVirtualResourceBaseManager: db.NewVirtualResourceBaseManager(
|
||||
SGuest{},
|
||||
"guests_tbl",
|
||||
"server",
|
||||
"servers",
|
||||
),
|
||||
}
|
||||
GuestManager.SetAlias("guest", "guests")
|
||||
}
|
||||
|
||||
|
||||
@@ -14,7 +14,16 @@ type SHostJointsManager struct {
|
||||
}
|
||||
|
||||
func NewHostJointsManager(dt interface{}, tableName string, keyword string, keywordPlural string, slave db.IStandaloneModelManager) SHostJointsManager {
|
||||
return SHostJointsManager{SJointResourceBaseManager: db.NewJointResourceBaseManager(dt, tableName, keyword, keywordPlural, HostManager, slave)}
|
||||
return SHostJointsManager{
|
||||
SJointResourceBaseManager: db.NewJointResourceBaseManager(
|
||||
dt,
|
||||
tableName,
|
||||
keyword,
|
||||
keywordPlural,
|
||||
HostManager,
|
||||
slave,
|
||||
),
|
||||
}
|
||||
}
|
||||
|
||||
type SHostJointsBase struct {
|
||||
|
||||
@@ -18,8 +18,15 @@ var HostnetworkManager *SHostnetworkManager
|
||||
|
||||
func init() {
|
||||
db.InitManager(func() {
|
||||
HostnetworkManager = &SHostnetworkManager{SHostJointsManager: NewHostJointsManager(SHostnetwork{},
|
||||
"baremetalnetworks_tbl", "baremetalnetwork", "baremetalnetworks", NetworkManager)}
|
||||
HostnetworkManager = &SHostnetworkManager{
|
||||
SHostJointsManager: NewHostJointsManager(
|
||||
SHostnetwork{},
|
||||
"baremetalnetworks_tbl",
|
||||
"baremetalnetwork",
|
||||
"baremetalnetworks",
|
||||
NetworkManager,
|
||||
),
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
|
||||
@@ -79,7 +79,14 @@ type SHostManager struct {
|
||||
var HostManager *SHostManager
|
||||
|
||||
func init() {
|
||||
HostManager = &SHostManager{SEnabledStatusStandaloneResourceBaseManager: db.NewEnabledStatusStandaloneResourceBaseManager(SHost{}, "hosts_tbl", "host", "hosts")}
|
||||
HostManager = &SHostManager{
|
||||
SEnabledStatusStandaloneResourceBaseManager: db.NewEnabledStatusStandaloneResourceBaseManager(
|
||||
SHost{},
|
||||
"hosts_tbl",
|
||||
"host",
|
||||
"hosts",
|
||||
),
|
||||
}
|
||||
HostManager.SetAlias("baremetal", "baremetals")
|
||||
}
|
||||
|
||||
|
||||
@@ -17,7 +17,15 @@ var HostschedtagManager *SHostschedtagManager
|
||||
|
||||
func init() {
|
||||
db.InitManager(func() {
|
||||
HostschedtagManager = &SHostschedtagManager{SHostJointsManager: NewHostJointsManager(SHostschedtag{}, "aggregate_hosts_tbl", "schedtaghost", "schedtaghosts", SchedtagManager)}
|
||||
HostschedtagManager = &SHostschedtagManager{
|
||||
SHostJointsManager: NewHostJointsManager(
|
||||
SHostschedtag{},
|
||||
"aggregate_hosts_tbl",
|
||||
"schedtaghost",
|
||||
"schedtaghosts",
|
||||
SchedtagManager,
|
||||
),
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
|
||||
@@ -20,8 +20,15 @@ var HoststorageManager *SHoststorageManager
|
||||
|
||||
func init() {
|
||||
db.InitManager(func() {
|
||||
HoststorageManager = &SHoststorageManager{SHostJointsManager: NewHostJointsManager(SHoststorage{},
|
||||
"hoststorages_tbl", "hoststorage", "hoststorages", StorageManager)}
|
||||
HoststorageManager = &SHoststorageManager{
|
||||
SHostJointsManager: NewHostJointsManager(
|
||||
SHoststorage{},
|
||||
"hoststorages_tbl",
|
||||
"hoststorage",
|
||||
"hoststorages",
|
||||
StorageManager,
|
||||
),
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
|
||||
@@ -47,7 +47,14 @@ type SIsolatedDeviceManager struct {
|
||||
var IsolatedDeviceManager *SIsolatedDeviceManager
|
||||
|
||||
func init() {
|
||||
IsolatedDeviceManager = &SIsolatedDeviceManager{SStandaloneResourceBaseManager: db.NewStandaloneResourceBaseManager(SIsolatedDevice{}, "isolated_devices_tbl", "isolated_device", "isolated_devices")}
|
||||
IsolatedDeviceManager = &SIsolatedDeviceManager{
|
||||
SStandaloneResourceBaseManager: db.NewStandaloneResourceBaseManager(
|
||||
SIsolatedDevice{},
|
||||
"isolated_devices_tbl",
|
||||
"isolated_device",
|
||||
"isolated_devices",
|
||||
),
|
||||
}
|
||||
}
|
||||
|
||||
type SIsolatedDevice struct {
|
||||
|
||||
@@ -22,7 +22,14 @@ type SKeypairManager struct {
|
||||
var KeypairManager *SKeypairManager
|
||||
|
||||
func init() {
|
||||
KeypairManager = &SKeypairManager{SStandaloneResourceBaseManager: db.NewStandaloneResourceBaseManager(SKeypair{}, "keypairs_tbl", "keypair", "keypairs")}
|
||||
KeypairManager = &SKeypairManager{
|
||||
SStandaloneResourceBaseManager: db.NewStandaloneResourceBaseManager(
|
||||
SKeypair{},
|
||||
"keypairs_tbl",
|
||||
"keypair",
|
||||
"keypairs",
|
||||
),
|
||||
}
|
||||
}
|
||||
|
||||
type SKeypair struct {
|
||||
|
||||
@@ -31,7 +31,14 @@ type SNetInterfaceManager struct {
|
||||
var NetInterfaceManager *SNetInterfaceManager
|
||||
|
||||
func init() {
|
||||
NetInterfaceManager = &SNetInterfaceManager{SModelBaseManager: db.NewModelBaseManager(SNetInterface{}, "netinterfaces_tbl", "netinterface", "netinterfaces")}
|
||||
NetInterfaceManager = &SNetInterfaceManager{
|
||||
SModelBaseManager: db.NewModelBaseManager(
|
||||
SNetInterface{},
|
||||
"netinterfaces_tbl",
|
||||
"netinterface",
|
||||
"netinterfaces",
|
||||
),
|
||||
}
|
||||
}
|
||||
|
||||
func (netif *SNetInterface) GetId() string {
|
||||
|
||||
@@ -67,7 +67,14 @@ type SNetworkManager struct {
|
||||
var NetworkManager *SNetworkManager
|
||||
|
||||
func init() {
|
||||
NetworkManager = &SNetworkManager{SSharableVirtualResourceBaseManager: db.NewSharableVirtualResourceBaseManager(SNetwork{}, "networks_tbl", "network", "networks")}
|
||||
NetworkManager = &SNetworkManager{
|
||||
SSharableVirtualResourceBaseManager: db.NewSharableVirtualResourceBaseManager(
|
||||
SNetwork{},
|
||||
"networks_tbl",
|
||||
"network",
|
||||
"networks",
|
||||
),
|
||||
}
|
||||
NetworkManager.NameLength = 9
|
||||
NetworkManager.NameRequireAscii = true
|
||||
}
|
||||
|
||||
@@ -19,7 +19,14 @@ type SReservedipManager struct {
|
||||
var ReservedipManager *SReservedipManager
|
||||
|
||||
func init() {
|
||||
ReservedipManager = &SReservedipManager{SResourceBaseManager: db.NewResourceBaseManager(SReservedip{}, "reservedips_tbl", "reservedip", "reservedips")}
|
||||
ReservedipManager = &SReservedipManager{
|
||||
SResourceBaseManager: db.NewResourceBaseManager(
|
||||
SReservedip{},
|
||||
"reservedips_tbl",
|
||||
"reservedip",
|
||||
"reservedips",
|
||||
),
|
||||
}
|
||||
}
|
||||
|
||||
type SReservedip struct {
|
||||
|
||||
@@ -22,7 +22,14 @@ type SSchedpolicyManager struct {
|
||||
var SchedpolicyManager *SSchedpolicyManager
|
||||
|
||||
func init() {
|
||||
SchedpolicyManager = &SSchedpolicyManager{SStandaloneResourceBaseManager: db.NewStandaloneResourceBaseManager(SSchedpolicy{}, "schedpolicies_tbl", "schedpolicy", "schedpolicies")}
|
||||
SchedpolicyManager = &SSchedpolicyManager{
|
||||
SStandaloneResourceBaseManager: db.NewStandaloneResourceBaseManager(
|
||||
SSchedpolicy{},
|
||||
"schedpolicies_tbl",
|
||||
"schedpolicy",
|
||||
"schedpolicies",
|
||||
),
|
||||
}
|
||||
}
|
||||
|
||||
// sched policy is called before calling scheduler, add additional preferences for schedtags
|
||||
|
||||
@@ -36,7 +36,14 @@ type SSchedtagManager struct {
|
||||
var SchedtagManager *SSchedtagManager
|
||||
|
||||
func init() {
|
||||
SchedtagManager = &SSchedtagManager{SStandaloneResourceBaseManager: db.NewStandaloneResourceBaseManager(SSchedtag{}, "aggregates_tbl", "schedtag", "schedtags")}
|
||||
SchedtagManager = &SSchedtagManager{
|
||||
SStandaloneResourceBaseManager: db.NewStandaloneResourceBaseManager(
|
||||
SSchedtag{},
|
||||
"aggregates_tbl",
|
||||
"schedtag",
|
||||
"schedtags",
|
||||
),
|
||||
}
|
||||
}
|
||||
|
||||
type SSchedtag struct {
|
||||
|
||||
@@ -25,7 +25,14 @@ type SSecurityGroupRuleManager struct {
|
||||
var SecurityGroupRuleManager *SSecurityGroupRuleManager
|
||||
|
||||
func init() {
|
||||
SecurityGroupRuleManager = &SSecurityGroupRuleManager{SResourceBaseManager: db.NewResourceBaseManager(SSecurityGroupRule{}, "secgrouprules_tbl", "secgrouprule", "secgrouprules")}
|
||||
SecurityGroupRuleManager = &SSecurityGroupRuleManager{
|
||||
SResourceBaseManager: db.NewResourceBaseManager(
|
||||
SSecurityGroupRule{},
|
||||
"secgrouprules_tbl",
|
||||
"secgrouprule",
|
||||
"secgrouprules",
|
||||
),
|
||||
}
|
||||
}
|
||||
|
||||
type SSecurityGroupRule struct {
|
||||
|
||||
@@ -28,7 +28,14 @@ type SSecurityGroupManager struct {
|
||||
var SecurityGroupManager *SSecurityGroupManager
|
||||
|
||||
func init() {
|
||||
SecurityGroupManager = &SSecurityGroupManager{SSharableVirtualResourceBaseManager: db.NewSharableVirtualResourceBaseManager(SSecurityGroup{}, "secgroups_tbl", "secgroup", "secgroups")}
|
||||
SecurityGroupManager = &SSecurityGroupManager{
|
||||
SSharableVirtualResourceBaseManager: db.NewSharableVirtualResourceBaseManager(
|
||||
SSecurityGroup{},
|
||||
"secgroups_tbl",
|
||||
"secgroup",
|
||||
"secgroups",
|
||||
),
|
||||
}
|
||||
SecurityGroupManager.NameRequireAscii = false
|
||||
}
|
||||
|
||||
|
||||
@@ -54,7 +54,14 @@ type SSnapshot struct {
|
||||
var SnapshotManager *SSnapshotManager
|
||||
|
||||
func init() {
|
||||
SnapshotManager = &SSnapshotManager{SVirtualResourceBaseManager: db.NewVirtualResourceBaseManager(SSnapshot{}, "snapshots_tbl", "snapshot", "snapshots")}
|
||||
SnapshotManager = &SSnapshotManager{
|
||||
SVirtualResourceBaseManager: db.NewVirtualResourceBaseManager(
|
||||
SSnapshot{},
|
||||
"snapshots_tbl",
|
||||
"snapshot",
|
||||
"snapshots",
|
||||
),
|
||||
}
|
||||
}
|
||||
|
||||
func ValidateSnapshotName(hypervisor, name string) error {
|
||||
|
||||
@@ -26,10 +26,13 @@ var StoragecacheManager *SStoragecacheManager
|
||||
|
||||
func init() {
|
||||
StoragecacheManager = &SStoragecacheManager{
|
||||
SStandaloneResourceBaseManager: db.NewStandaloneResourceBaseManager(SStoragecache{},
|
||||
SStandaloneResourceBaseManager: db.NewStandaloneResourceBaseManager(
|
||||
SStoragecache{},
|
||||
"storagecaches_tbl",
|
||||
"storagecache",
|
||||
"storagecaches")}
|
||||
"storagecaches",
|
||||
),
|
||||
}
|
||||
}
|
||||
|
||||
type SStoragecache struct {
|
||||
|
||||
@@ -57,8 +57,14 @@ type SStorageManager struct {
|
||||
var StorageManager *SStorageManager
|
||||
|
||||
func init() {
|
||||
StorageManager = &SStorageManager{SEnabledStatusStandaloneResourceBaseManager: db.NewEnabledStatusStandaloneResourceBaseManager(SStorage{},
|
||||
"storages_tbl", "storage", "storages")}
|
||||
StorageManager = &SStorageManager{
|
||||
SEnabledStatusStandaloneResourceBaseManager: db.NewEnabledStatusStandaloneResourceBaseManager(
|
||||
SStorage{},
|
||||
"storages_tbl",
|
||||
"storage",
|
||||
"storages",
|
||||
),
|
||||
}
|
||||
}
|
||||
|
||||
type SStorage struct {
|
||||
|
||||
@@ -17,7 +17,14 @@ type SVCenterManager struct {
|
||||
var VCenterManager *SVCenterManager
|
||||
|
||||
func init() {
|
||||
VCenterManager = &SVCenterManager{SEnabledStatusStandaloneResourceBaseManager: db.NewEnabledStatusStandaloneResourceBaseManager(SVCenter{}, "vcenters_tbl", "vcenter", "vcenters")}
|
||||
VCenterManager = &SVCenterManager{
|
||||
SEnabledStatusStandaloneResourceBaseManager: db.NewEnabledStatusStandaloneResourceBaseManager(
|
||||
SVCenter{},
|
||||
"vcenters_tbl",
|
||||
"vcenter",
|
||||
"vcenters",
|
||||
),
|
||||
}
|
||||
}
|
||||
|
||||
type SVCenter struct {
|
||||
|
||||
@@ -39,7 +39,14 @@ type SVpcManager struct {
|
||||
var VpcManager *SVpcManager
|
||||
|
||||
func init() {
|
||||
VpcManager = &SVpcManager{SEnabledStatusStandaloneResourceBaseManager: db.NewEnabledStatusStandaloneResourceBaseManager(SVpc{}, "vpcs_tbl", "vpc", "vpcs")}
|
||||
VpcManager = &SVpcManager{
|
||||
SEnabledStatusStandaloneResourceBaseManager: db.NewEnabledStatusStandaloneResourceBaseManager(
|
||||
SVpc{},
|
||||
"vpcs_tbl",
|
||||
"vpc",
|
||||
"vpcs",
|
||||
),
|
||||
}
|
||||
}
|
||||
|
||||
type SVpc struct {
|
||||
|
||||
@@ -23,7 +23,14 @@ type SWireManager struct {
|
||||
var WireManager *SWireManager
|
||||
|
||||
func init() {
|
||||
WireManager = &SWireManager{SStandaloneResourceBaseManager: db.NewStandaloneResourceBaseManager(SWire{}, "wires_tbl", "wire", "wires")}
|
||||
WireManager = &SWireManager{
|
||||
SStandaloneResourceBaseManager: db.NewStandaloneResourceBaseManager(
|
||||
SWire{},
|
||||
"wires_tbl",
|
||||
"wire",
|
||||
"wires",
|
||||
),
|
||||
}
|
||||
WireManager.NameLength = 9
|
||||
WireManager.NameRequireAscii = true
|
||||
}
|
||||
|
||||
@@ -29,7 +29,14 @@ type SZoneManager struct {
|
||||
var ZoneManager *SZoneManager
|
||||
|
||||
func init() {
|
||||
ZoneManager = &SZoneManager{SStatusStandaloneResourceBaseManager: db.NewStatusStandaloneResourceBaseManager(SZone{}, "zones_tbl", "zone", "zones")}
|
||||
ZoneManager = &SZoneManager{
|
||||
SStatusStandaloneResourceBaseManager: db.NewStatusStandaloneResourceBaseManager(
|
||||
SZone{},
|
||||
"zones_tbl",
|
||||
"zone",
|
||||
"zones",
|
||||
),
|
||||
}
|
||||
ZoneManager.NameRequireAscii = false
|
||||
}
|
||||
|
||||
|
||||
@@ -108,7 +108,7 @@ func AddUsageHandler(prefix string, app *appsrv.Application) {
|
||||
"vcenter": rangeObjHandler(models.VCenterManager, ReportVCenterUsage),
|
||||
"cloudregion": rangeObjHandler(models.CloudregionManager, ReportCloudRegionUsage),
|
||||
} {
|
||||
addHandler(prefix, key, auth.Authenticate(f), app)
|
||||
addHandler(prefix, key, f, app)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -0,0 +1,11 @@
|
||||
package modules
|
||||
|
||||
var Policies ResourceManager
|
||||
|
||||
func init() {
|
||||
Policies = NewIdentityV3Manager("policy", "policies",
|
||||
[]string{},
|
||||
[]string{})
|
||||
|
||||
register(&Policies)
|
||||
}
|
||||
Reference in New Issue
Block a user