mirror of
https://github.com/yunionio/cloudpods.git
synced 2026-09-01 15:07:17 +08:00
fix created_at & add license
This commit is contained in:
@@ -0,0 +1,57 @@
|
||||
package shell
|
||||
|
||||
import (
|
||||
"yunion.io/x/onecloud/pkg/mcclient"
|
||||
"yunion.io/x/onecloud/pkg/mcclient/modules"
|
||||
"yunion.io/x/onecloud/pkg/mcclient/options"
|
||||
)
|
||||
|
||||
func init() {
|
||||
type LicenseListOptions struct {
|
||||
options.BaseListOptions
|
||||
}
|
||||
|
||||
R(&LicenseListOptions{}, "licenses-list", "show licenses", func(s *mcclient.ClientSession, args *LicenseListOptions) error {
|
||||
params, err := options.ListStructToParams(args)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
lics, err := modules.License.List(s, params)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
printList(lics, modules.License.GetColumns(s))
|
||||
return nil
|
||||
})
|
||||
|
||||
type LicenseShowOptions struct {
|
||||
SERVICE string `help:"service name" choices:"compute|service_tree"`
|
||||
}
|
||||
|
||||
R(&LicenseShowOptions{}, "licenses-show", "show actived license", func(s *mcclient.ClientSession, args *LicenseShowOptions) error {
|
||||
lic, e := modules.License.Get(s, args.SERVICE, nil)
|
||||
if e != nil {
|
||||
return e
|
||||
}
|
||||
|
||||
printObject(lic)
|
||||
return nil
|
||||
})
|
||||
|
||||
type LicenseStatusOptions struct {
|
||||
SERVICE string `help:"service name" choices:"compute|service_tree"`
|
||||
}
|
||||
|
||||
R(&LicenseStatusOptions{}, "licenses-usage", "show license usages status", func(s *mcclient.ClientSession, args *LicenseStatusOptions) error {
|
||||
status, err := modules.License.GetSpecific(s, args.SERVICE, "status", nil)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
printObject(status)
|
||||
return nil
|
||||
})
|
||||
|
||||
}
|
||||
@@ -12,7 +12,7 @@ import (
|
||||
type SResourceBase struct {
|
||||
SModelBase
|
||||
|
||||
CreatedAt time.Time `nullable:"false" created_at:"true" get:"user"`
|
||||
CreatedAt time.Time `nullable:"false" created_at:"true" get:"user" list:"user"`
|
||||
UpdatedAt time.Time `nullable:"false" updated_at:"true" list:"user"`
|
||||
UpdateVersion int `default:"0" nullable:"false" auto_version:"true" list:"user"`
|
||||
DeletedAt time.Time ``
|
||||
|
||||
@@ -26,7 +26,6 @@ type SParameter struct {
|
||||
db.SResourceBase
|
||||
|
||||
Id int64 `primary:"true" auto_increment:"true" list:"user"` // = Column(BigInteger, primary_key=True)
|
||||
CreatedBy string `width:"128" charset:"ascii" nullable:"false" create:"required" list:"user"` // Column(VARCHAR(length=128, charset='ascii'), nullable=False)
|
||||
UpdatedBy string `width:"128" charset:"ascii" nullable:"false" create:"required" update:"user" list:"user"` // Column(VARCHAR(length=128, charset='ascii'), nullable=False) "user"/ serviceName/ "admin"
|
||||
Namespace string `width:"64" charset:"ascii" default:"user" nullable:"false" create:"required" list:"admin"` // Column(VARCHAR(length=128, charset='ascii'), nullable=False) user_id / serviceid
|
||||
NamespaceId string `width:"128" charset:"ascii" nullable:"false" index:"true" create:"required" list:"admin"` // Column(VARCHAR(length=128, charset='ascii'), nullable=False)
|
||||
|
||||
Reference in New Issue
Block a user